Search in sources :

Example 1 with ClientEntry

use of org.eclipse.ecf.internal.example.collab.ClientEntry in project ecf by eclipse.

the class JoinGroupWizardAction method isConnected.

private ClientEntry isConnected(IResource res) {
    if (res == null)
        return null;
    CollabClient client = CollabClient.getDefault();
    ClientEntry entry = client.isConnected(res, CollabClient.GENERIC_CONTAINER_CLIENT_NAME);
    return entry;
}
Also used : CollabClient(org.eclipse.ecf.internal.example.collab.CollabClient) ClientEntry(org.eclipse.ecf.internal.example.collab.ClientEntry)

Example 2 with ClientEntry

use of org.eclipse.ecf.internal.example.collab.ClientEntry 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 3 with ClientEntry

use of org.eclipse.ecf.internal.example.collab.ClientEntry in project ecf by eclipse.

the class OpenSharedEditorAction method isConnected.

protected ClientEntry isConnected(IResource res) {
    if (res == null)
        return null;
    final CollabClient client = CollabClient.getDefault();
    final ClientEntry entry = client.isConnected(res, CollabClient.GENERIC_CONTAINER_CLIENT_NAME);
    return entry;
}
Also used : CollabClient(org.eclipse.ecf.internal.example.collab.CollabClient) ClientEntry(org.eclipse.ecf.internal.example.collab.ClientEntry)

Example 4 with ClientEntry

use of org.eclipse.ecf.internal.example.collab.ClientEntry 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 5 with ClientEntry

use of org.eclipse.ecf.internal.example.collab.ClientEntry in project ecf by eclipse.

the class JoinGroupWizardAction method run.

public void run(IAction action) {
    if (!connected) {
        JoinGroupWizard wizard = new JoinGroupWizard(resource, PlatformUI.getWorkbench(), connectID);
        Shell shell = null;
        if (targetPart == null) {
            shell = (window == null) ? null : window.getShell();
        } else {
            shell = targetPart.getSite().getShell();
        }
        // Create the wizard dialog
        WizardDialog dialog = new WizardDialog(shell, wizard);
        // Open the wizard dialog
        dialog.open();
    } else {
        ClientEntry client = isConnected(resource);
        if (client == null) {
            connected = false;
            action.setText(CONNECT_PROJECT_MENU_TEXT);
        } else {
            EclipseCollabSharedObject collab = client.getSharedObject();
            if (collab != null) {
                collab.chatGUIDestroy();
            }
        }
    }
}
Also used : EclipseCollabSharedObject(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject) JoinGroupWizard(org.eclipse.ecf.internal.example.collab.ui.JoinGroupWizard) Shell(org.eclipse.swt.widgets.Shell) ClientEntry(org.eclipse.ecf.internal.example.collab.ClientEntry) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

ClientEntry (org.eclipse.ecf.internal.example.collab.ClientEntry)6 EclipseCollabSharedObject (org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject)3 CollabClient (org.eclipse.ecf.internal.example.collab.CollabClient)3 IProject (org.eclipse.core.resources.IProject)2 IFile (org.eclipse.core.resources.IFile)1 JoinGroupWizard (org.eclipse.ecf.internal.example.collab.ui.JoinGroupWizard)1 ITextSelection (org.eclipse.jface.text.ITextSelection)1 ISelection (org.eclipse.jface.viewers.ISelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Shell (org.eclipse.swt.widgets.Shell)1