Search in sources :

Example 11 with IRoster

use of org.eclipse.ecf.presence.roster.IRoster in project ecf by eclipse.

the class DocShareRosterMenuHandler method execute.

/**
 * @throws ExecutionException
 */
public Object execute(ExecutionEvent arg0) throws ExecutionException {
    IRosterEntry rosterEntry = getRosterEntry();
    if (rosterEntry != null) {
        IRoster roster = rosterEntry.getRoster();
        final IContainer container = (IContainer) roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
        if (container.getConnectedID() == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NOT_CONNECTED);
        final DocShare sender = Activator.getDefault().getDocShare(container.getID());
        if (sender == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NO_SENDER);
        if (sender.isSharing())
            showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_EDITOR_ALREADY_SHARING);
        final ITextEditor textEditor = getTextEditor();
        if (textEditor == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_EXCEPTION_EDITOR_NOT_TEXT);
        final String inputName = getInputName(textEditor);
        if (inputName == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_NO_FILENAME_WITH_CONTENT);
        final IUser user = roster.getUser();
        sender.startShare(user.getID(), user.getName(), rosterEntry.getUser().getID(), inputName, textEditor);
    }
    return null;
}
Also used : IRoster(org.eclipse.ecf.presence.roster.IRoster) DocShare(org.eclipse.ecf.docshare.DocShare) ITextEditor(org.eclipse.ui.texteditor.ITextEditor) IUser(org.eclipse.ecf.core.user.IUser) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) 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