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 };
}
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;
}
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;
}
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);
}
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());
}
}
Aggregations