use of org.eclipse.ecf.core.IContainerManager in project ecf by eclipse.
the class Activator method getContainerManager.
/**
* @return IContainerManager instance
*/
public IContainerManager getContainerManager() {
if (containerManagerTracker == null) {
containerManagerTracker = new ServiceTracker(this.context, IContainerManager.class.getName(), null);
containerManagerTracker.open();
}
return (IContainerManager) containerManagerTracker.getService();
}
use of org.eclipse.ecf.core.IContainerManager in project ecf by eclipse.
the class ConnectedTester method getContainerByConnectID.
/**
* @param connectID
* The conected ID for which an IContainer is to be returned
* @return a IContainer instance of null
*/
// TODO push this functionality down into the ContainerManager
private IContainer getContainerByConnectID(ID connectID) {
final IContainerManager containerManager = Activator.getDefault().getContainerManager();
final IContainer[] containers = containerManager.getAllContainers();
if (containers == null) {
return null;
}
for (int i = 0; i < containers.length; i++) {
ID connectedId = containers[i].getConnectedID();
if (connectedId != null && connectedId.equals(connectID)) {
return containers[i];
}
}
return null;
}
use of org.eclipse.ecf.core.IContainerManager in project ecf by eclipse.
the class Activator method getContainerManager.
public IContainerManager getContainerManager() {
if (containerManagerTracker == null) {
containerManagerTracker = new ServiceTracker(context, IContainerManager.class.getName(), null);
containerManagerTracker.open();
}
return (IContainerManager) containerManagerTracker.getService();
}
use of org.eclipse.ecf.core.IContainerManager 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;
}
use of org.eclipse.ecf.core.IContainerManager in project ecf by eclipse.
the class Activator method createAndConfigureHostContainer.
private void createAndConfigureHostContainer(BundleContext context) throws Exception {
// Get IContainerManager singleton
ServiceTracker<IContainerManager, IContainerManager> containerManagerTracker = new ServiceTracker<IContainerManager, IContainerManager>(context, IContainerManager.class.getName(), null);
containerManagerTracker.open();
IContainerManager containerManager = containerManagerTracker.getService();
if (containerManager == null)
throw new NullPointerException("Cannot get IContainerManager service");
containerManagerTracker.close();
// Now create a hostContainer instance
hostContainer = containerManager.getContainerFactory().createContainer("ecf.generic.server");
// Get the ISharedObjectContainerGroupManager adapter interface
ISharedObjectContainerGroupManager hostManager = (ISharedObjectContainerGroupManager) hostContainer.getAdapter(ISharedObjectContainerGroupManager.class);
// Set connect policy
hostManager.setConnectPolicy(new IConnectHandlerPolicy() {
public void refresh() {
}
public PermissionCollection checkConnect(Object address, ID fromID, ID targetID, String targetGroup, Object connectData) throws Exception {
// What we will do when we receive a check connect call is to call
// verifyClientConnect
verifyClientConnect(fromID, connectData);
return null;
}
});
}
Aggregations