/* * (non-Javadoc) * * @see * org.eclipse.ecf.core.IContainerListener#handleEvent(org.eclipse.ecf * .core.events.IContainerEvent) */ public void handleEvent(IContainerEvent event) { final IContainerManager containerManager = (IContainerManager) ContainerFactory.getDefault(); if (containerManager == null) return; IContainer container = containerManager.getContainer(event.getLocalContainerID()); if (container == null) return; if (event instanceof IContainerConnectedEvent || event instanceof IContainerDisconnectedEvent) { // connected IChannelContainerAdapter cca = (IChannelContainerAdapter) container.getAdapter(IChannelContainerAdapter.class); if (cca == null) return; ID containerID = container.getID(); if (event instanceof IContainerConnectedEvent) { try { if (!TeamSynchronization.contains(containerID)) { TeamSynchronization.put(containerID, new WorkbenchAwareRemoteShare(cca)); } } catch (ECFException e) { TeamSynchronization.log( "RemoteShare could not be added or created", e); // $NON-NLS-1$ } } else if (event instanceof IContainerDisconnectedEvent) { // disconnected TeamSynchronization.removeShare(containerID); } } else if (event instanceof IContainerDisposeEvent) { containerManager.removeListener(containerManagerListener); container.removeListener(containerListener); } }
public void testClearContainers() throws Exception { IContainer[] c = createContainers(10); assertNotNull(c); containerManager.removeAllContainers(); IContainer[] cs = containerManager.getAllContainers(); assertTrue(cs != null); assertTrue(cs.length == 0); }
public void testHasContainerN() throws Exception { IContainer[] c = createContainers(10); assertNotNull(c); for (int i = 0; i < 10; i++) { assertTrue(containerManager.hasContainer(c[i].getID())); } }
public void testGetContainerOne() throws Exception { IContainer[] c = createContainers(1); assertNotNull(c); IContainer container = containerManager.getContainer(c[0].getID()); assertNotNull(container); assertTrue(container.getID().equals(c[0].getID())); }
public void testGetContainersOne() throws Exception { IContainer[] c = createContainers(1); assertNotNull(c); IContainer[] containers = containerManager.getAllContainers(); assertNotNull(containers); // assertTrue(containers.length == 1); }
public void testGetContainerDescriptionN() throws Exception { IContainer[] c = createContainers(10); assertNotNull(c); for (int i = 0; i < 10; i++) { ContainerTypeDescription description = containerManager.getContainerTypeDescription(c[i].getID()); assertNotNull(description); } }
public void testGetContainerN() throws Exception { IContainer[] c = createContainers(10); assertNotNull(c); for (int i = 0; i < 10; i++) { IContainer container = containerManager.getContainer(c[i].getID()); assertNotNull(container); assertTrue(container.getID().equals(c[i].getID())); } }
/* (non-Javadoc) * @see org.eclipse.ecf.tests.core.ContainerFactoryAbstractTestCase#tearDown() */ protected void tearDown() throws Exception { getFixture().removeDescription(createContainerTypeDescription()); containerManager.removeListener(containerManagerListener); containerManager = null; super.tearDown(); }
/* (non-Javadoc) * @see org.eclipse.ecf.tests.core.ContainerFactoryAbstractTestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); getFixture().addDescription(createContainerTypeDescription()); containerManager = Activator.getDefault().getContainerManager(); containerManager.addListener(containerManagerListener); }
/* * (non-Javadoc) * * @seeorg.eclipse.ecf.core.start.IECFStart#run(org.eclipse.core.runtime. * IProgressMonitor) */ public IStatus run(IProgressMonitor monitor) { final IContainerManager containerManager = (IContainerManager) ContainerFactory.getDefault(); containerManager.addListener(containerManagerListener); return Status.OK_STATUS; }