use of org.eclipse.ecf.presence.roster.IRosterItem in project ecf by eclipse.
the class BrowseDialog method fillContentProvider.
/* (non-Javadoc)
* @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#fillContentProvider(org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter, org.eclipse.core.runtime.IProgressMonitor)
*/
protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) {
progressMonitor.beginTask(Messages.BrowseDialog_scanning, containers.length);
// cycle through all the containers and grab entries
for (int i = 0; i < containers.length; i++) {
IContainer container = containers[i];
IPresenceContainerAdapter presenceContainer = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
if (presenceContainer != null) {
IRosterManager manager = presenceContainer.getRosterManager();
if (manager != null) {
Collection items = manager.getRoster().getItems();
for (Iterator it = items.iterator(); it.hasNext(); ) {
IRosterItem item = (IRosterItem) it.next();
addRosterItem(item, contentProvider, itemsFilter);
}
}
}
progressMonitor.worked(1);
}
progressMonitor.done();
}
use of org.eclipse.ecf.presence.roster.IRosterItem in project ecf by eclipse.
the class XMPPContainerPresenceHelper method countClientsInRoster.
private int countClientsInRoster(XMPPID oldID) {
Collection rosterItems = roster.getItems();
int count = 0;
synchronized (rosterItems) {
for (final Iterator i = rosterItems.iterator(); i.hasNext(); ) {
final IRosterItem item = (IRosterItem) i.next();
if (item instanceof org.eclipse.ecf.presence.roster.RosterGroup) {
final org.eclipse.ecf.presence.roster.RosterGroup group = (org.eclipse.ecf.presence.roster.RosterGroup) item;
count += countClientsInRosterGroup(group, oldID);
} else if (item instanceof org.eclipse.ecf.presence.roster.RosterEntry) {
org.eclipse.ecf.presence.roster.RosterEntry entry = (org.eclipse.ecf.presence.roster.RosterEntry) item;
XMPPID entryID = (XMPPID) entry.getUser().getID();
if (entryID.getUsernameAtHost().equals(oldID.getUsernameAtHost())) {
count++;
}
}
}
}
return count;
}
Aggregations