From 67e3c21c1fe1f33cd64cb62127aa20bfe14294d3 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Thu, 9 Feb 2012 15:43:05 +0000 Subject: Fixes a problem where a group can be shown twice in the contactlist. --- .../impl/gui/main/contactlist/PresenceFilter.java | 14 ++++++++++++-- .../impl/gui/main/contactlist/TreeContactList.java | 15 ++++++++++----- .../contactlist/contactsource/MetaContactListSource.java | 13 ++++++++----- 3 files changed, 30 insertions(+), 12 deletions(-) (limited to 'src/net/java/sip') diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java index 45118de..76abdc9 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java @@ -245,8 +245,18 @@ public class PresenceFilter if (isMatching(subgroup)) { - GuiActivator.getContactList().addGroup( - MetaContactListSource.createUIGroup(subgroup), true); + UIGroup uiGroup; + synchronized(subgroup) + { + uiGroup = MetaContactListSource + .getUIGroup(subgroup); + + if (uiGroup == null) + uiGroup = MetaContactListSource + .createUIGroup(subgroup); + } + + GuiActivator.getContactList().addGroup(uiGroup, true); addMatching(subgroup, query, resultCount); } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java index e238658..bc8ad23 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java @@ -567,12 +567,17 @@ public class TreeContactList return; } - GroupNode parentNode = treeModel.getRoot(); + GroupNode groupNode = group.getGroupNode(); + + if(groupNode == null) + { + GroupNode parentNode = treeModel.getRoot(); - if (isSorted) - parentNode.sortedAddContactGroup(group); - else - parentNode.addContactGroup(group); + if (isSorted) + parentNode.sortedAddContactGroup(group); + else + parentNode.addContactGroup(group); + } expandGroup(treeModel.getRoot()); } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java index c631573..fd7cd84 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java @@ -762,12 +762,15 @@ public class MetaContactListSource if (!MetaContactListSource .isRootGroup(parentGroup)) { - uiGroup = MetaContactListSource - .getUIGroup(parentGroup); - - if (uiGroup == null) + synchronized(parentGroup) + { uiGroup = MetaContactListSource - .createUIGroup(parentGroup); + .getUIGroup(parentGroup); + + if (uiGroup == null) + uiGroup = MetaContactListSource + .createUIGroup(parentGroup); + } } GuiActivator.getContactList() -- cgit v1.1