diff options
| author | slewis | 2005-02-23 21:55:27 +0000 |
|---|---|---|
| committer | slewis | 2005-02-23 21:55:27 +0000 |
| commit | e385a13a7dd12c7093076eb62f41de9054e45042 (patch) | |
| tree | 82137210d6462ed9782b15add659dc57d8359f29 | |
| parent | aa1490c355cd905667e59499f6a94e290e8b1f7d (diff) | |
| download | org.eclipse.ecf-e385a13a7dd12c7093076eb62f41de9054e45042.tar.gz org.eclipse.ecf-e385a13a7dd12c7093076eb62f41de9054e45042.tar.xz org.eclipse.ecf-e385a13a7dd12c7093076eb62f41de9054e45042.zip | |
Added WorkbenchAction class to provide a top-level menu and icon
3 files changed, 88 insertions, 5 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml b/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml index 793bbf169..4e6987e0d 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml +++ b/examples/bundles/org.eclipse.ecf.example.collab/plugin.xml @@ -14,9 +14,23 @@ <extension point="org.eclipse.ui.actionSets"> <actionSet - label="Test Actions" + label="ECF" visible="true" id="org.eclipse.ecf.example.collab.actionSet"> + <action + toolbarPath="org.eclipse.ecf.example.collab.topseparator" + label="Connect..." + class="org.eclipse.ecf.example.collab.actions.WorkbenchAction" + tooltip="Join ECF Group" + icon="icons/person.gif" + style="push" + menubarPath="org.eclipse.ecf.example.collab.topmenu/org.eclipse.ecf.example.collab.topseparator" + id="org.eclipse.ecf.example.collab.joingroupaction"/> + <menu + label="ECF" + id="org.eclipse.ecf.example.collab.topmenu"> + <separator name="org.eclipse.ecf.example.collab.topseparator"/> + </menu> </actionSet> </extension> <extension diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/actions/WorkbenchAction.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/actions/WorkbenchAction.java new file mode 100644 index 000000000..c90d959f3 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/actions/WorkbenchAction.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Composent, Inc. - initial API and implementation + ******************************************************************************/ +package org.eclipse.ecf.example.collab.actions; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.ecf.example.collab.ui.JoinGroupWizard; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionDelegate; + +/** + * @author slewis + * + */ +public class WorkbenchAction extends ActionDelegate implements IWorkbenchWindowActionDelegate { + + public void run() { + IResource resource = ResourcesPlugin.getWorkspace().getRoot(); + ClientConnectAction action = new ClientConnectAction(); + action.setProject(resource); + } + + protected IWorkbench getWorkbench() { + return PlatformUI.getWorkbench(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() + */ + public void dispose() { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) + */ + public void init(IWorkbenchWindow window) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + public void run(IAction action) { + IResource resource = ResourcesPlugin.getWorkspace().getRoot(); + JoinGroupWizard wizard = new JoinGroupWizard(resource,getWorkbench()); + // Create the wizard dialog + WizardDialog dialog = new WizardDialog + (getWorkbench().getActiveWorkbenchWindow().getShell(),wizard); + // Open the wizard dialog + dialog.open(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } +} diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java index a58fd9cc3..5e72f9d4d 100644 --- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java +++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java @@ -50,7 +50,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject implements public static final String ECLIPSEOBJECTNAME = "chat"; - public static final String INIT_TEXT = "Collaboration for '"; + public static final String INIT_TEXT = "Collaboration for "; Date creationTime = new Date(); @@ -206,17 +206,17 @@ public class EclipseCollabSharedObject extends GenericSharedObject implements } protected LineChatClientView getOutputWindow() { - final String pn = (localProject == null) ? "<workspace>" : localProject + final String pn = (localProject == null || localProject.getName().trim().equals("")) ? "<workspace>" : localProject .getName(); final String projectName = pn; - final String init = INIT_TEXT + pn + "' project\n\n"; + final String init = INIT_TEXT + pn + "\n\n"; Display.getDefault().syncExec(new Runnable() { public void run() { try { if (LineChatView.isDisposed()) showView(); localGUI = LineChatView.makeClientView( - EclipseCollabSharedObject.this, projectName, init, + EclipseCollabSharedObject.this, pn, init, getLocalFullDownloadPath()); } catch (Exception e) { debugdump(e, |
