Search in sources :

Example 1 with EclipseCollabSharedObject

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());
    }
}
Also used : EclipseCollabSharedObject(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject) ClientEntry(org.eclipse.ecf.internal.example.collab.ClientEntry) IProject(org.eclipse.core.resources.IProject)

Example 2 with EclipseCollabSharedObject

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());
    }
}
Also used : EclipseCollabSharedObject(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject) IFile(org.eclipse.core.resources.IFile) ISelection(org.eclipse.jface.viewers.ISelection) ClientEntry(org.eclipse.ecf.internal.example.collab.ClientEntry) ITextSelection(org.eclipse.jface.text.ITextSelection) IProject(org.eclipse.core.resources.IProject)

Example 3 with EclipseCollabSharedObject

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;
}
Also used : EclipseCollabSharedObject(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject) ISharedObjectManager(org.eclipse.ecf.core.sharedobject.ISharedObjectManager) ID(org.eclipse.ecf.core.identity.ID) ISharedObject(org.eclipse.ecf.core.sharedobject.ISharedObject) TCPClientSOContainer(org.eclipse.ecf.provider.generic.TCPClientSOContainer)

Example 4 with EclipseCollabSharedObject

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);
}
Also used : EclipseCollabSharedObject(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject) SharedObjectEventListener(org.eclipse.ecf.example.collab.share.SharedObjectEventListener) ID(org.eclipse.ecf.core.identity.ID)

Example 5 with EclipseCollabSharedObject

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());
    }
}
Also used : EclipseCollabSharedObject(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject) File(java.io.File)

Aggregations

EclipseCollabSharedObject (org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject)8 IProject (org.eclipse.core.resources.IProject)3 ID (org.eclipse.ecf.core.identity.ID)3 ClientEntry (org.eclipse.ecf.internal.example.collab.ClientEntry)3 IFile (org.eclipse.core.resources.IFile)2 ITextSelection (org.eclipse.jface.text.ITextSelection)2 File (java.io.File)1 IContainer (org.eclipse.ecf.core.IContainer)1 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)1 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)1 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)1 SharedObjectEventListener (org.eclipse.ecf.example.collab.share.SharedObjectEventListener)1 JoinGroupWizard (org.eclipse.ecf.internal.example.collab.ui.JoinGroupWizard)1 SharedObjectContainerUI (org.eclipse.ecf.internal.example.collab.ui.SharedObjectContainerUI)1 TCPClientSOContainer (org.eclipse.ecf.provider.generic.TCPClientSOContainer)1 Action (org.eclipse.jface.action.Action)1 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 IAction (org.eclipse.jface.action.IAction)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 Separator (org.eclipse.jface.action.Separator)1