Search in sources :

Example 1 with IRoster

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);
    }
}
Also used : IRoster(org.eclipse.ecf.presence.roster.IRoster) ArrayList(java.util.ArrayList)

Example 2 with IRoster

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 };
}
Also used : DocShare(org.eclipse.ecf.docshare.DocShare) IRoster(org.eclipse.ecf.presence.roster.IRoster) IContainer(org.eclipse.ecf.core.IContainer)

Example 3 with IRoster

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;
}
Also used : TeamException(org.eclipse.team.core.TeamException) IRoster(org.eclipse.ecf.presence.roster.IRoster) RemoteShare(org.eclipse.team.internal.ecf.core.RemoteShare) RemoteResourceVariantTreeSubscriber(org.eclipse.team.internal.ecf.core.variants.RemoteResourceVariantTreeSubscriber) IUser(org.eclipse.ecf.core.user.IUser) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer) WorkbenchJob(org.eclipse.ui.progress.WorkbenchJob) Job(org.eclipse.core.runtime.jobs.Job) IResource(org.eclipse.core.resources.IResource)

Example 4 with IRoster

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;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IContainerManager(org.eclipse.ecf.core.IContainerManager) IRoster(org.eclipse.ecf.presence.roster.IRoster) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) PartInitException(org.eclipse.ui.PartInitException) IContainer(org.eclipse.ecf.core.IContainer) MessagesView(org.eclipse.ecf.presence.ui.MessagesView)

Example 5 with IRoster

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;
}
Also used : IRoster(org.eclipse.ecf.presence.roster.IRoster) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter) IContainer(org.eclipse.ecf.core.IContainer)

Aggregations

IRoster (org.eclipse.ecf.presence.roster.IRoster)11 IContainer (org.eclipse.ecf.core.IContainer)8 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)5 IUser (org.eclipse.ecf.core.user.IUser)3 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)3 IResource (org.eclipse.core.resources.IResource)2 ID (org.eclipse.ecf.core.identity.ID)2 DocShare (org.eclipse.ecf.docshare.DocShare)2 RemoteShare (org.eclipse.team.internal.ecf.core.RemoteShare)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 Job (org.eclipse.core.runtime.jobs.Job)1 IContainerManager (org.eclipse.ecf.core.IContainerManager)1 ECFException (org.eclipse.ecf.core.util.ECFException)1 RosterWriterHelper (org.eclipse.ecf.internal.examples.webinar.util.RosterWriterHelper)1 IRosterGroup (org.eclipse.ecf.presence.roster.IRosterGroup)1 IRosterItem (org.eclipse.ecf.presence.roster.IRosterItem)1 MessagesView (org.eclipse.ecf.presence.ui.MessagesView)1