use of org.eclipse.ecf.presence.roster.IRoster in project ecf by eclipse.
the class MSNRosterEntry method setParent.
void setParent(IRosterItem parent) {
this.parent = parent;
if (parent instanceof IRoster) {
groups = Collections.EMPTY_LIST;
} else {
ArrayList list = new ArrayList(1);
list.add(parent);
groups = Collections.unmodifiableCollection(list);
}
}
use of org.eclipse.ecf.presence.roster.IRoster in project ecf by eclipse.
the class DocShareRosterMenuContributionItem method createContributionItemsForPresenceContainer.
/* (non-Javadoc)
* @see org.eclipse.ecf.presence.ui.menu.AbstractRosterMenuContributionItem#createContributionItemsForPresenceContainer(org.eclipse.ecf.presence.IPresenceContainerAdapter)
*/
protected IContributionItem[] createContributionItemsForPresenceContainer(IPresenceContainerAdapter presenceContainerAdapter) {
final IContainer container = (IContainer) presenceContainerAdapter.getAdapter(IContainer.class);
if (container == null)
return NO_CONTRIBUTIONS;
final DocShare docShare = Activator.getDefault().getDocShare(container.getID());
if (docShare == null)
return NO_CONTRIBUTIONS;
final IRoster roster = presenceContainerAdapter.getRosterManager().getRoster();
final IContributionItem[] contributions = createContributionItemsForRoster(roster);
if (contributions == null || contributions.length == 0)
return NO_CONTRIBUTIONS;
final MenuManager menuManager = createMenuManagerForRoster(roster);
for (int i = 0; i < contributions.length; i++) {
menuManager.add(contributions[i]);
}
return new IContributionItem[] { menuManager };
}
use of org.eclipse.ecf.presence.roster.IRoster in project ecf by eclipse.
the class CompareWithHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IRosterEntry selectedEntry = getRosterEntry();
IRoster roster = selectedEntry.getRoster();
final IUser remoteUser = roster.getUser();
ID localId = remoteUser.getID();
ID remoteId = selectedEntry.getUser().getID();
IContainer container = (IContainer) roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
final IResource resource = getResource(event);
if (resource == null) {
MessageDialog.openInformation(HandlerUtil.getActiveShell(event), null, Messages.CompareWithHandler_FileNotSelectedError);
return null;
}
RemoteShare share = TeamSynchronization.getShare(container.getID());
final RemoteResourceVariantTreeSubscriber subscriber = new RemoteResourceVariantTreeSubscriber(share, localId, remoteId);
Job job = new Job(Messages.CompareWithHandler_ResourceComparisonJobTitle) {
protected IStatus run(IProgressMonitor monitor) {
try {
openCompareEditor(subscriber.getSyncInfo(resource, monitor), remoteUser);
return Status.OK_STATUS;
} catch (TeamException e) {
return e.getStatus();
}
}
};
job.setUser(true);
job.schedule();
return null;
}
use of org.eclipse.ecf.presence.roster.IRoster in project ecf by eclipse.
the class BrowseHandler method execute.
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IContainerManager containerManager = Activator.getDefault().getContainerManager();
IContainer[] containers = containerManager.getAllContainers();
BrowseDialog dialog = new BrowseDialog(window.getShell(), containers);
int status = dialog.open();
if (status == Window.OK) {
Object[] object = dialog.getResult();
IRosterEntry entry = (IRosterEntry) object[0];
IRoster roster = entry.getRoster();
if (roster != null) {
IChatManager manager = roster.getPresenceContainerAdapter().getChatManager();
IChatMessageSender icms = manager.getChatMessageSender();
ITypingMessageSender itms = manager.getTypingMessageSender();
try {
MessagesView view = (MessagesView) window.getActivePage().showView(MessagesView.VIEW_ID);
view.selectTab(icms, itms, roster.getUser().getID(), entry.getUser().getID(), entry.getUser().getName());
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
return null;
}
use of org.eclipse.ecf.presence.roster.IRoster in project ecf by eclipse.
the class ScreenCaptureShareRosterContributionItem method makeActions.
protected IAction[] makeActions() {
final IRoster roster = getSelectedRoster();
if (roster != null) {
// Roster is selected
final IContainer c = getContainerForRoster(roster);
if (c != null) {
// Get existing ScreenCaptureShare for this container (if it exists)
final ScreenCaptureShare screenCaptureShare = ScreenCaptureShare.getScreenCaptureShare(c.getID());
// If it does exist already, then create action to remove
if (screenCaptureShare != null)
return createActionRemove(c.getID(), screenCaptureShare);
final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
return (channelAdapter == null) ? null : createActionAdd(c.getID(), channelAdapter);
}
}
return null;
}
Aggregations