use of org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject in project ecf by eclipse.
the class OpenSharedEditorAction method run.
public void run(IAction action) {
if (file == null) {
return;
}
final IProject project = file.getProject();
final ClientEntry entry = isConnected(project);
if (entry == null) {
MessageDialog.openInformation(targetPart.getSite().getWorkbenchWindow().getShell(), Messages.OpenSharedEditorAction_DIALOG_NOT_CONNECTED_TITLE, NLS.bind(Messages.OpenSharedEditorAction_DIALOG_NOT_CONNECTED_TEXT, project.getName()));
return;
}
final EclipseCollabSharedObject collabsharedobject = entry.getSharedObject();
if (collabsharedobject != null) {
collabsharedobject.sendLaunchEditorForFile(null, file.getProjectRelativePath().toString());
}
}
use of org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject in project ecf by eclipse.
the class SetSharedEditorSelectionAction method run.
public void run(IAction action) {
if (editor == null)
return;
final ISelection s = editor.getSelectionProvider().getSelection();
ITextSelection textSelection = null;
if (s instanceof ITextSelection) {
textSelection = (ITextSelection) s;
}
if (textSelection == null)
return;
final IFile file = getFileForPart(editor);
if (file == null)
return;
final IProject project = file.getProject();
final ClientEntry entry = isConnected(project.getWorkspace().getRoot());
if (entry == null) {
MessageDialog.openInformation(getWorkbench().getDisplay().getActiveShell(), Messages.SetSharedEditorSelectionAction_DIALOG_NOT_CONNECTED_TITLE, Messages.SetSharedEditorSelectionAction_DIALOG_NOT_CONNECTED_TEXT);
return;
}
final EclipseCollabSharedObject collabsharedobject = entry.getSharedObject();
if (collabsharedobject != null) {
// $NON-NLS-1$
collabsharedobject.sendOpenAndSelectForFile(null, project.getName() + "/" + file.getProjectRelativePath().toString(), textSelection.getOffset(), textSelection.getLength());
}
}
use of org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject in project ecf by eclipse.
the class PresenceContainerAdapterFactory method getAdapter.
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adapterType.equals(IPresenceContainerAdapter.class)) {
TCPClientSOContainer container = (TCPClientSOContainer) adaptableObject;
ISharedObjectManager manager = container.getSharedObjectManager();
ID[] ids = manager.getSharedObjectIDs();
for (int i = 0; i < ids.length; i++) {
ISharedObject object = manager.getSharedObject(ids[i]);
if (object instanceof EclipseCollabSharedObject) {
EclipseCollabSharedObject ecso = (EclipseCollabSharedObject) object;
return ecso.getPresenceContainer();
}
}
}
return null;
}
use of org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject 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.example.collab.share.EclipseCollabSharedObject in project ecf by eclipse.
the class EclipseFileTransferAndLaunch method sendDone.
public void sendDone(FileTransferSharedObject obj, Exception e) {
if (senderUI != null)
senderUI.sendDone(transferParams.getRemoteFile(), e);
// Now launch file locally, if it's sucessful
if (e == null) {
String senderPath = ((EclipseCollabSharedObject) getContext().getSharedObjectManager().getSharedObject(sharedObjectID)).getLocalFullDownloadPath();
launchFile(new File(new File(senderPath), transferParams.getRemoteFile().getName()).getAbsolutePath());
}
}
Aggregations