Search in sources :

Example 21 with IContainer

use of org.eclipse.ecf.core.IContainer 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 22 with IContainer

use of org.eclipse.ecf.core.IContainer 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 23 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class AbstractRemoteServiceRegisterTest method getServerContainerAdapter.

private IRemoteServiceContainerAdapter getServerContainerAdapter() {
    if (this.server != null)
        return (IRemoteServiceContainerAdapter) this.server.getAdapter(IRemoteServiceContainerAdapter.class);
    IContainer[] containers = getContainerManager().getAllContainers();
    String containerType = getServerContainerTypeName();
    for (int i = 0; i < containers.length; i++) {
        ContainerTypeDescription ctd = getContainerManager().getContainerTypeDescription(containers[i].getID());
        if (ctd != null && ctd.getName().equals(containerType))
            return (IRemoteServiceContainerAdapter) containers[i].getAdapter(IRemoteServiceContainerAdapter.class);
    }
    return null;
}
Also used : ContainerTypeDescription(org.eclipse.ecf.core.ContainerTypeDescription) IContainer(org.eclipse.ecf.core.IContainer)

Example 24 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class AbstractBrowseTestCase method setUp.

/* (non-Javadoc)
	 * @see junit.framework.TestCase#setUp()
	 */
protected void setUp() throws Exception {
    super.setUp();
    final IContainer container = ContainerFactory.getDefault().createContainer();
    adapter = (IRemoteFileSystemBrowserContainerAdapter) container.getAdapter(IRemoteFileSystemBrowserContainerAdapter.class);
}
Also used : IContainer(org.eclipse.ecf.core.IContainer)

Example 25 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class AbstractConnectTest method testConnectTwoClients.

public void testConnectTwoClients() throws Exception {
    for (int i = 0; i < 2; i++) {
        final IContainer client = getClient(i);
        assertNull(client.getConnectedID());
        final ID serverConnectID = getServerConnectID(i);
        assertNotNull(serverConnectID);
        connectClient(client, serverConnectID, getConnectContext(i));
        assertEquals(serverConnectID, client.getConnectedID());
    }
    sleep(3000);
    for (int i = 0; i < 2; i++) {
        final IContainer client = getClient(i);
        client.disconnect();
        assertNull(client.getConnectedID());
    }
}
Also used : ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Aggregations

IContainer (org.eclipse.ecf.core.IContainer)121 ID (org.eclipse.ecf.core.identity.ID)29 ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)20 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)9 IRoster (org.eclipse.ecf.presence.roster.IRoster)8 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)7 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)7 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)7 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)5 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)5 RemoteServiceContainer (org.eclipse.ecf.remoteservice.RemoteServiceContainer)5 Action (org.eclipse.jface.action.Action)5 IAction (org.eclipse.jface.action.IAction)5 URL (java.net.URL)4 Job (org.eclipse.core.runtime.jobs.Job)4 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)4 IContainerManager (org.eclipse.ecf.core.IContainerManager)4 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)4 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)4 RestClientContainer (org.eclipse.ecf.remoteservice.rest.client.RestClientContainer)4