Fixes contact list issue with duplicated contacts.

cusax-fix
hristoterezov 12 years ago
parent 79214016b4
commit dfac8a056e

@ -310,23 +310,39 @@ private void addMatching( MetaContactGroup metaGroup,
UIContact newUIContact;
synchronized (metaContact)
{
newUIContact
= MetaContactListSource.getUIContact(metaContact);
if (newUIContact == null)
{
newUIContact = MetaContactListSource
.createUIContact(metaContact);
}
GuiActivator.getContactList().addContact(
newUIContact,
uiGroup,
true,
true);
}
}
query.setInitialResultCount(resultCount);
}
else
{
synchronized (metaContact)
{
if (MetaContactListSource.getUIContact(metaContact)
== null)
{
query.fireQueryEvent(metaContact);
}
}
}
}
}
// If in the meantime the filtering has been stopped we return here.
if (query.isCanceled())

@ -569,7 +569,10 @@ private void createMetaUIRootGroup()
{
MetaContactGroup rootGroup
= GuiActivator.getContactListService().getRoot();
UIGroup uiGroup = MetaContactListSource
UIGroup uiGroup;
synchronized (rootGroup)
{
uiGroup = MetaContactListSource
.getUIGroup(rootGroup);
if (uiGroup != null)
@ -577,16 +580,23 @@ private void createMetaUIRootGroup()
uiGroup = MetaContactListSource
.createUIGroup(rootGroup);
}
treeModel.getRoot().sortedAddContactGroup((UIGroupImpl)uiGroup);
Iterator<MetaContact> i = rootGroup.getChildContacts();
while (i.hasNext())
{
MetaContact contact = i.next();
UIContact uiContact = MetaContactListSource.getUIContact(contact);
UIContact uiContact;
synchronized (contact)
{
uiContact
= MetaContactListSource.getUIContact(contact);
if(uiContact == null)
continue;
removeContact(uiContact);
uiContact = MetaContactListSource.createUIContact(contact);
}
if (currentFilter.isMatching(uiContact))
addContact(uiContact, uiGroup, true, true);
else
@ -602,11 +612,15 @@ private void removeMetaUIRootGroup()
MetaContactGroup rootGroup
= GuiActivator.getContactListService().getRoot();
UIGroup uiGroup = MetaContactListSource
UIGroup uiGroup;
synchronized (rootGroup)
{
uiGroup = MetaContactListSource
.getUIGroup(rootGroup);
if (uiGroup == null)
return;
}
GroupNode parentNode = treeModel.getRoot();
@ -614,10 +628,16 @@ private void removeMetaUIRootGroup()
while (i.hasNext())
{
MetaContact contact = i.next();
UIContact uiContact
UIContact uiContact;
synchronized (contact)
{
uiContact
= MetaContactListSource.getUIContact(contact);
if(uiContact == null)
continue;
removeContact(uiContact);
uiContact = MetaContactListSource.createUIContact(contact);
}
if (currentFilter.isMatching(uiContact))
addContact(uiContact, treeModel.getRoot().getGroupDescriptor(),
true, true);

@ -258,24 +258,42 @@ public void queryMetaContactSource(Pattern filterPattern,
}
UIContact newUIContact;
boolean uiContactCreated = false;
synchronized (metaContact)
{
newUIContact
= MetaContactListSource.createUIContact(metaContact);
}
= MetaContactListSource.getUIContact(metaContact);
if (newUIContact == null)
{
newUIContact
= MetaContactListSource
.createUIContact(metaContact);
GuiActivator.getContactList().addContact(
newUIContact,
uiGroup,
true,
true);
}
}
query.setInitialResultCount(resultCount);
}
else
{
synchronized (metaContact)
{
if (MetaContactListSource.getUIContact(metaContact)
== null)
{
query.fireQueryEvent(metaContact);
}
}
}
}
}
// If in the meantime the query is canceled we return here.
if(query.isCanceled())

Loading…
Cancel
Save