Loading tools/NewTestCasePlugin/plugin/plugin.xml +28 −0 Original line number Diff line number Diff line Loading @@ -19,11 +19,13 @@ label="Positive" class="org.etsi.mts.ttcn3.part9.popup.actions.NewPositiveTestCase" menubarPath="NewTestCase.menu1/group1" definitionId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase" enablesFor="1" id="NewTestCase.newAction1"> </action> <action label="Negative" definitionId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase" class="org.etsi.mts.ttcn3.part9.popup.actions.NewNegativeTestCase" menubarPath="NewTestCase.menu1/group1" enablesFor="1" Loading @@ -42,6 +44,16 @@ id="org.etsi.mts.ttcn3.part9.newTestCase.commands.sampleCommand" name="Sample Command"> </command> <command name="New Positive Testcase" categoryId="org.eclipse.ui.category.navigate" id="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase"> </command> <command name="New Negative Testcase" categoryId="org.eclipse.ui.category.navigate" id="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase"> </command> </extension> <extension point="org.eclipse.ui.handlers"> Loading @@ -49,6 +61,14 @@ class="org.etsi.mts.ttcn3.part9.newtestcase.handlers.CommandHandler" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.sampleCommand"> </handler> <handler class="org.etsi.mts.ttcn3.part9.newtestcase.handlers.NewPositiveTestCaseHandler" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase"> </handler> <handler class="org.etsi.mts.ttcn3.part9.newtestcase.handlers.NewNegativeTestCaseHandler" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase"> </handler> </extension> <extension point="org.eclipse.ui.bindings"> Loading @@ -58,6 +78,14 @@ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="M1+6"> </key> <key sequence="M1+O" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> <key sequence="M1+L" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> </extension> <extension point="org.eclipse.ui.menus"> Loading tools/NewTestCasePlugin/plugin/src/org/etsi/mts/ttcn3/part9/newtestcase/handlers/NewNegativeTestCaseHandler.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package org.etsi.mts.ttcn3.part9.newtestcase.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.etsi.mts.ttcn3.part9.popup.actions.NewNegativeTestCase; import org.etsi.mts.ttcn3.part9.popup.actions.NewTestCase; /** * Our sample handler extends AbstractHandler, an IHandler base class. * @see org.eclipse.core.commands.IHandler * @see org.eclipse.core.commands.AbstractHandler */ public class NewNegativeTestCaseHandler extends AbstractHandler { /** * the command has been executed, so extract extract the needed information * from the application context. */ public Object execute(ExecutionEvent event) throws ExecutionException { NewTestCase tc = new NewNegativeTestCase(); tc.runAsCommand(); return null; } } tools/NewTestCasePlugin/plugin/src/org/etsi/mts/ttcn3/part9/newtestcase/handlers/NewPositiveTestCaseHandler.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package org.etsi.mts.ttcn3.part9.newtestcase.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.etsi.mts.ttcn3.part9.popup.actions.NewPositiveTestCase; import org.etsi.mts.ttcn3.part9.popup.actions.NewTestCase; /** * Our sample handler extends AbstractHandler, an IHandler base class. * @see org.eclipse.core.commands.IHandler * @see org.eclipse.core.commands.AbstractHandler */ public class NewPositiveTestCaseHandler extends AbstractHandler { /** * the command has been executed, so extract extract the needed information * from the application context. */ public Object execute(ExecutionEvent event) throws ExecutionException { NewTestCase tc = new NewPositiveTestCase(); tc.runAsCommand(); return null; } } tools/NewTestCasePlugin/plugin/src/org/etsi/mts/ttcn3/part9/popup/actions/NewTestCase.java +19 −1 Original line number Diff line number Diff line Loading @@ -14,8 +14,11 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IActionDelegate; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; public class NewTestCase implements IObjectActionDelegate { Loading Loading @@ -68,10 +71,25 @@ public class NewTestCase implements IObjectActionDelegate { shell = targetPart.getSite().getShell(); } public void run(IAction action) { createTestCase(); } //this has to be called if this is executed as command because only as action the selection and //the shell are updated automatically public void runAsCommand() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { shell = window.getShell(); selection = window.getSelectionService().getSelection(); } createTestCase(); } /** * @see IActionDelegate#run(IAction) */ public void run(IAction action) { private void createTestCase() { if (selection == null) { MessageDialog.openError(shell, "New test case", "Unsupported explorer view or no selection"); return; Loading Loading
tools/NewTestCasePlugin/plugin/plugin.xml +28 −0 Original line number Diff line number Diff line Loading @@ -19,11 +19,13 @@ label="Positive" class="org.etsi.mts.ttcn3.part9.popup.actions.NewPositiveTestCase" menubarPath="NewTestCase.menu1/group1" definitionId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase" enablesFor="1" id="NewTestCase.newAction1"> </action> <action label="Negative" definitionId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase" class="org.etsi.mts.ttcn3.part9.popup.actions.NewNegativeTestCase" menubarPath="NewTestCase.menu1/group1" enablesFor="1" Loading @@ -42,6 +44,16 @@ id="org.etsi.mts.ttcn3.part9.newTestCase.commands.sampleCommand" name="Sample Command"> </command> <command name="New Positive Testcase" categoryId="org.eclipse.ui.category.navigate" id="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase"> </command> <command name="New Negative Testcase" categoryId="org.eclipse.ui.category.navigate" id="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase"> </command> </extension> <extension point="org.eclipse.ui.handlers"> Loading @@ -49,6 +61,14 @@ class="org.etsi.mts.ttcn3.part9.newtestcase.handlers.CommandHandler" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.sampleCommand"> </handler> <handler class="org.etsi.mts.ttcn3.part9.newtestcase.handlers.NewPositiveTestCaseHandler" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase"> </handler> <handler class="org.etsi.mts.ttcn3.part9.newtestcase.handlers.NewNegativeTestCaseHandler" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase"> </handler> </extension> <extension point="org.eclipse.ui.bindings"> Loading @@ -58,6 +78,14 @@ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="M1+6"> </key> <key sequence="M1+O" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newPositiveTestcase" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> <key sequence="M1+L" commandId="org.etsi.mts.ttcn3.part9.newTestCase.commands.newNegativeTestcase" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> </extension> <extension point="org.eclipse.ui.menus"> Loading
tools/NewTestCasePlugin/plugin/src/org/etsi/mts/ttcn3/part9/newtestcase/handlers/NewNegativeTestCaseHandler.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package org.etsi.mts.ttcn3.part9.newtestcase.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.etsi.mts.ttcn3.part9.popup.actions.NewNegativeTestCase; import org.etsi.mts.ttcn3.part9.popup.actions.NewTestCase; /** * Our sample handler extends AbstractHandler, an IHandler base class. * @see org.eclipse.core.commands.IHandler * @see org.eclipse.core.commands.AbstractHandler */ public class NewNegativeTestCaseHandler extends AbstractHandler { /** * the command has been executed, so extract extract the needed information * from the application context. */ public Object execute(ExecutionEvent event) throws ExecutionException { NewTestCase tc = new NewNegativeTestCase(); tc.runAsCommand(); return null; } }
tools/NewTestCasePlugin/plugin/src/org/etsi/mts/ttcn3/part9/newtestcase/handlers/NewPositiveTestCaseHandler.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package org.etsi.mts.ttcn3.part9.newtestcase.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.etsi.mts.ttcn3.part9.popup.actions.NewPositiveTestCase; import org.etsi.mts.ttcn3.part9.popup.actions.NewTestCase; /** * Our sample handler extends AbstractHandler, an IHandler base class. * @see org.eclipse.core.commands.IHandler * @see org.eclipse.core.commands.AbstractHandler */ public class NewPositiveTestCaseHandler extends AbstractHandler { /** * the command has been executed, so extract extract the needed information * from the application context. */ public Object execute(ExecutionEvent event) throws ExecutionException { NewTestCase tc = new NewPositiveTestCase(); tc.runAsCommand(); return null; } }
tools/NewTestCasePlugin/plugin/src/org/etsi/mts/ttcn3/part9/popup/actions/NewTestCase.java +19 −1 Original line number Diff line number Diff line Loading @@ -14,8 +14,11 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IActionDelegate; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; public class NewTestCase implements IObjectActionDelegate { Loading Loading @@ -68,10 +71,25 @@ public class NewTestCase implements IObjectActionDelegate { shell = targetPart.getSite().getShell(); } public void run(IAction action) { createTestCase(); } //this has to be called if this is executed as command because only as action the selection and //the shell are updated automatically public void runAsCommand() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { shell = window.getShell(); selection = window.getSelectionService().getSelection(); } createTestCase(); } /** * @see IActionDelegate#run(IAction) */ public void run(IAction action) { private void createTestCase() { if (selection == null) { MessageDialog.openError(shell, "New test case", "Unsupported explorer view or no selection"); return; Loading