use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class PubSubAdapterFactory method getDirectory.
protected IPublishedServiceDirectory getDirectory(ISharedObjectContainer container) {
ID directoryID;
try {
directoryID = IDFactory.getDefault().createStringID(PublishedServiceDirectory.SHARED_OBJECT_ID);
} catch (IDCreateException e) {
throw new RuntimeException(e);
}
final ISharedObjectManager mgr = container.getSharedObjectManager();
IPublishedServiceDirectory directory = (IPublishedServiceDirectory) mgr.getSharedObject(directoryID);
if (directory != null)
return directory;
try {
SharedObjectDescription desc = createDirectoryDescription(directoryID);
mgr.createSharedObject(desc);
return (IPublishedServiceDirectory) mgr.getSharedObject(directoryID);
} catch (SharedObjectCreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class PublishedServiceDirectory method disconnected.
protected void disconnected(IContainerDisconnectedEvent event) {
ID containerID = event.getTargetID();
if (!containerID.equals(event.getLocalContainerID())) {
synchronized (this) {
Collection values = (Collection) services.remove(event.getTargetID());
if (values != null) {
PublishedServiceDescriptor[] buf = new PublishedServiceDescriptor[values.size()];
values.toArray(buf);
fireServiceChangedEvent(new PublishedServiceDirectoryChangeEvent(this, PublishedServiceDirectoryChangeEvent.REMOVED, buf));
}
}
}
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class SharedObjectContainerUI method createAndAddSharedObject.
protected void createAndAddSharedObject(final ISharedObjectContainer soContainer, final ClientEntry client, final IResource proj, IUser user, String fileDir) throws Exception {
final EclipseCollabSharedObject sharedObject = new EclipseCollabSharedObject(soContainer, proj, user, fileDir);
sharedObject.setListener(new SharedObjectEventListener() {
public void memberRemoved(ID member) {
final ID groupID = client.getContainer().getConnectedID();
if (member.equals(groupID)) {
if (!client.isDisposed()) {
collabclient.disposeClient(proj, client);
}
}
}
public void memberAdded(ID member) {
}
public void otherActivated(ID other) {
}
public void otherDeactivated(ID other) {
}
public void windowClosing() {
final ID groupID = client.getContainer().getConnectedID();
CollabClient.removeClientForResource(proj, groupID);
}
});
final ID newID = IDFactory.getDefault().createStringID(COLLAB_SHARED_OBJECT_ID);
soContainer.getSharedObjectManager().addSharedObject(newID, sharedObject, new HashMap());
client.setSharedObject(sharedObject);
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class CollabClient method getClientEntry.
protected static ClientEntry getClientEntry(IResource proj, String containerType) {
synchronized (clients) {
Vector v = getClientEntries(proj);
if (v == null)
return null;
for (Iterator i = v.iterator(); i.hasNext(); ) {
ClientEntry e = (ClientEntry) i.next();
ID connectedID = e.getContainer().getConnectedID();
if (connectedID == null)
continue;
else {
String contType = e.getContainerType();
if (contType.equals(containerType)) {
return e;
}
}
}
}
return null;
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class CollabClient method getClientEntry.
protected static ClientEntry getClientEntry(IResource proj, ID targetID) {
synchronized (clients) {
Vector v = getClientEntries(proj);
if (v == null)
return null;
for (Iterator i = v.iterator(); i.hasNext(); ) {
ClientEntry e = (ClientEntry) i.next();
ID connectedID = e.getContainer().getConnectedID();
if (connectedID == null)
continue;
else if (connectedID.equals(targetID)) {
return e;
}
}
}
return null;
}
Aggregations