diff options
author | Sami Wagiaalla | 2013-03-04 15:03:56 +0000 |
---|---|---|
committer | Camilo Bernal | 2013-03-04 16:32:04 +0000 |
commit | efbafd25b23f6cda23656e98a92d575f19914099 (patch) | |
tree | 27e1b1a2e619efd3896483ba87cf7cc4b748d8d1 /systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension | |
parent | 538e4d21ebaed11221b36ef96531181597a1eee1 (diff) | |
download | org.eclipse.linuxtools-efbafd25b23f6cda23656e98a92d575f19914099.tar.gz org.eclipse.linuxtools-efbafd25b23f6cda23656e98a92d575f19914099.tar.xz org.eclipse.linuxtools-efbafd25b23f6cda23656e98a92d575f19914099.zip |
Change Export Script and Create module from Actions to Commands
Change-Id: Ie03e34213b0bbfcb8cd8c63d713d2b29849468ce
Reviewed-on: https://git.eclipse.org/r/10821
Tested-by: Hudson CI
Reviewed-by: Camilo Bernal <cabernal@redhat.com>
IP-Clean: Camilo Bernal <cabernal@redhat.com>
Tested-by: Camilo Bernal <cabernal@redhat.com>
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension')
-rw-r--r-- | systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/plugin.xml | 78 | ||||
-rw-r--r-- | systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/CreateModuleHandler.java (renamed from systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/CreateModuleAction.java) | 41 | ||||
-rw-r--r-- | systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/ExportScriptHandler.java | 8 |
3 files changed, 53 insertions, 74 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/plugin.xml b/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/plugin.xml index a15012733f..eafb5fe011 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/plugin.xml +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/plugin.xml @@ -4,15 +4,17 @@ <extension point="org.eclipse.ui.commands"> <command - name="%command.exportScript.name" - description="%command.exportScript.desc" - categoryId="org.eclipse.linuxtools.systemtap.ui.ide.category.file" - id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.ExportScript"/> + categoryId="org.eclipse.linuxtools.systemtap.ui.ide.category.file" + defaultHandler="org.eclipse.linuxtools.internal.systemtap.ui.dashboardextension.actions.ExportScriptHandler" + description="%command.exportScript.desc" + id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.ExportScript" + name="%command.exportScript.name"/> <command - name="%command.createModule.name" - description="%command.createModule.desc" - categoryId="org.eclipse.linuxtools.systemtap.ui.dashboard.category.file" - id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.CreateModuleAction"/> + categoryId="org.eclipse.linuxtools.systemtap.ui.dashboard.category.file" + defaultHandler="org.eclipse.linuxtools.internal.systemtap.ui.dashboardextension.actions.CreateModuleHandler" + description="%command.createModule.desc" + id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.CreateModuleCommand" + name="%command.createModule.name"/> </extension> <extension point="org.eclipse.ui.bindings"> @@ -29,37 +31,6 @@ </extension> <extension point="org.eclipse.ui.actionSets"> - <actionSet - label="%actionset.export.name" - id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.ExportScriptActionSet"> - <action - label="%action.exportScript.name" - tooltip="%action.exportScript.desc" - id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.actions.ExportScript" - icon="icons/actions/export_wiz.gif" - toolbarPath="org.eclipse.ui.workbench.file/export.ext" - class="org.eclipse.linuxtools.internal.systemtap.ui.dashboardextension.actions.ExportScriptAction" - definitionId="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.ExportScript" - style="push" - state="false"/> - </actionSet> - </extension> - <extension - point="org.eclipse.ui.actionSets"> - <actionSet - label="%actionset.createModule.name" - id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.CreateModuleActionSet"> - <action - label="%action.createModule.name" - tooltip="%action.createModule.desc" - id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.actions.CreateModuleAction" - icon="icons/actions/mod_obj.gif" - toolbarPath="org.eclipse.ui.workbench.file/export.ext" - class="org.eclipse.linuxtools.internal.systemtap.ui.dashboardextension.actions.CreateModuleAction" - definitionId="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.CreateModuleAction" - style="push" - state="true"/> - </actionSet> </extension> @@ -106,4 +77,33 @@ <actionSet id="org.eclipse.linuxtools.systemtap.ui.dashboardextension.CreateModuleActionSet"/> </perspectiveExtension> </extension> + <extension + point="org.eclipse.ui.menus"> + <menuContribution + allPopups="true" + locationURI="toolbar:org.eclipse.ui.workbench.file"> + <separator + name="exportGroup" + visible="true"> + </separator> + </menuContribution> + <menuContribution + allPopups="true" + locationURI="toolbar:org.eclipse.ui.workbench.file?after=exportGroup"> + <command + commandId="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.CreateModuleCommand" + icon="icons/actions/mod_obj.gif" + label="%action.createModule.name" + style="push" + tooltip="%action.createModule.desc"> + </command> + <command + commandId="org.eclipse.linuxtools.systemtap.ui.dashboardextension.commands.ExportScript" + icon="icons/actions/export_wiz.gif" + label="%action.exportScript.name" + style="push" + tooltip="%action.exportScript.desc"> + </command> + </menuContribution> + </extension> </plugin> diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/CreateModuleAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/CreateModuleHandler.java index 2cb7a612f6..04f5c1c770 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/CreateModuleAction.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/CreateModuleHandler.java @@ -16,9 +16,8 @@ import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.linuxtools.internal.systemtap.ui.dashboardextension.dialogs.ExportScriptDialog; @@ -43,8 +42,6 @@ import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.XMLMemento; @@ -56,8 +53,7 @@ import org.eclipse.ui.XMLMemento; * * @author Ryan Morse */ -public class CreateModuleAction extends Action implements - IWorkbenchWindowActionDelegate { +public class CreateModuleHandler extends AbstractHandler { /** * This method will bring up the export script dialog window for the user to * select what they want to new module to contain. If the user enters module @@ -65,19 +61,11 @@ public class CreateModuleAction extends Action implements * dashboard. */ - // private static String scriptFileName = "/script.stp"; public String script = null; @Override - public void init(IWorkbenchWindow window) { - fWindow = window; - } - - protected IWorkbenchWindow fWindow = null; - - @Override - public void run(IAction action) { - ScriptDetails sd = new ScriptDetails(fWindow.getShell()); + public Object execute(ExecutionEvent event) { + ScriptDetails sd = new ScriptDetails(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); sd.create(); if (sd.open() == Window.OK) { @@ -98,9 +86,9 @@ public class CreateModuleAction extends Action implements wizard.dispose(); if (null == parser || null == dataSet) - return; + return null; - ExportScriptDialog exportDialog = new ExportScriptDialog(fWindow.getShell(), dataSet); + ExportScriptDialog exportDialog = new ExportScriptDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), dataSet); exportDialog.create(); if(exportDialog.open() == Window.OK) { @@ -133,11 +121,12 @@ public class CreateModuleAction extends Action implements // } } } + return null; } /** * This method will check to make sure the exported module directory is - * valid. If it isn't then the foleders will be created in order to make the + * valid. If it isn't then the folders will be created in order to make the * directory valid. */ private void validateDirectory() { @@ -302,16 +291,4 @@ public class CreateModuleAction extends Action implements } catch (WorkbenchException we) { } } - - @Override - public void selectionChanged(IAction action, ISelection selection) { - // TODO Auto-generated method stub - - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - - } } diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/ExportScriptHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/ExportScriptHandler.java index d1a7a98152..b055dba980 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/ExportScriptHandler.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.dashboardextension/src/org/eclipse/linuxtools/internal/systemtap/ui/dashboardextension/actions/ExportScriptHandler.java @@ -17,7 +17,7 @@ import java.io.FileWriter; import java.io.IOException; import java.text.MessageFormat; -import org.eclipse.jface.action.IAction; +import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; @@ -63,7 +63,8 @@ public class ExportScriptHandler extends RunScriptHandler { private static String scriptFileName = "/script.stp"; //$NON-NLS-1$ - public void run(IAction action) { + @Override + public Object execute(ExecutionEvent event) { String script = getFilePath(); if(null == script || script.length() <= 0) { String msg = MessageFormat.format(Localization.getString("ExportScriptAction.NoFileToExport"), (Object[])null); //$NON-NLS-1$ @@ -82,7 +83,7 @@ public class ExportScriptHandler extends RunScriptHandler { wizard.dispose(); if(null == parser || null == dataSet) - return; + return null; ExportScriptDialog exportDialog = new ExportScriptDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), dataSet); exportDialog.create(); @@ -102,6 +103,7 @@ public class ExportScriptHandler extends RunScriptHandler { updateDashboard(); } } + return null; } /** |