diff options
| author | Markus Tiede | 2014-03-19 12:02:41 +0000 |
|---|---|---|
| committer | Markus Tiede | 2014-03-19 12:02:41 +0000 |
| commit | c1421394699bcca8e77b43730dd01788e9ccb60a (patch) | |
| tree | eeacf430db2574d582b6866ddca8af63f4a0cfbc | |
| parent | 18693515a151ae4f160ddd24ba2d213ffbea93dd (diff) | |
| download | org.eclipse.jubula.core-c1421394699bcca8e77b43730dd01788e9ccb60a.tar.gz org.eclipse.jubula.core-c1421394699bcca8e77b43730dd01788e9ccb60a.tar.xz org.eclipse.jubula.core-c1421394699bcca8e77b43730dd01788e9ccb60a.zip | |
Sprint task - fix for issue http://eclip.se/429846
3 files changed, 21 insertions, 10 deletions
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractStartTestHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractStartTestHandler.java index 9a9bd76c1..92e1bedef 100644 --- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractStartTestHandler.java +++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractStartTestHandler.java @@ -13,6 +13,7 @@ package org.eclipse.jubula.client.ui.rcp.handlers; import java.net.URL; import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.State; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialogWithToggle; @@ -32,6 +33,7 @@ import org.eclipse.jubula.tools.exception.JBException; import org.eclipse.jubula.tools.messagehandling.MessageIDs; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.handlers.RegistryToggleState; @@ -73,18 +75,25 @@ public abstract class AbstractStartTestHandler extends AbstractHandler { /** * init the GUI test execution part * - * @return whether initialisation has been successful + * @param event + * the execution event + * + * @return whether initialization has been successful */ - protected boolean initTestExecution() { - return initTestExecutionRelevantFlag() && initPauseTestExecutionState(); + protected boolean initTestExecution(ExecutionEvent event) { + return initTestExecutionRelevantFlag() + && initPauseTestExecutionState(event); } /** + * @param event + * the execution event * @return true if init has been successful */ - private boolean initPauseTestExecutionState() { - ICommandService cmdService = (ICommandService)Plugin.getActivePart() - .getSite().getService(ICommandService.class); + private boolean initPauseTestExecutionState(ExecutionEvent event) { + ICommandService cmdService = (ICommandService) HandlerUtil + .getActiveWorkbenchWindow(event).getService( + ICommandService.class); if (cmdService != null) { final Command command = cmdService .getCommand(RCPCommandIDs.PAUSE_TEST_SUITE); diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestJobHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestJobHandler.java index 034d86786..f7c8a1523 100644 --- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestJobHandler.java +++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestJobHandler.java @@ -40,7 +40,8 @@ public class StartTestJobHandler extends AbstractStartTestHandler { /** * {@inheritDoc} */ - public Object executeImpl(ExecutionEvent event) throws ExecutionException { + public Object executeImpl(final ExecutionEvent event) + throws ExecutionException { Object testJobToStartObj = null; ITestJobPO testJobToStart = null; testJobToStartObj = @@ -59,7 +60,8 @@ public class StartTestJobHandler extends AbstractStartTestHandler { final AtomicBoolean prepareOk = new AtomicBoolean(false); Plugin.getDisplay().syncExec(new Runnable() { public void run() { - if (prepareTestExecution() && initTestExecution()) { + if (prepareTestExecution() + && initTestExecution(event)) { prepareOk.set(true); } } diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestSuiteHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestSuiteHandler.java index a23b1b774..c33c19edd 100644 --- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestSuiteHandler.java +++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/StartTestSuiteHandler.java @@ -52,7 +52,7 @@ public class StartTestSuiteHandler extends AbstractStartTestHandler /** * {@inheritDoc} */ - public Object executeImpl(ExecutionEvent event) { + public Object executeImpl(final ExecutionEvent event) { Object testSuiteToStartObj = null; Object runningAutObj = null; ITestSuitePO testSuiteToStart = null; @@ -103,7 +103,7 @@ public class StartTestSuiteHandler extends AbstractStartTestHandler } if (testSuiteToStart != null && runningAut != null - && initTestExecution()) { + && initTestExecution(event)) { final boolean autoScreenshots = Plugin.getDefault() .getPreferenceStore().getBoolean( Constants.AUTO_SCREENSHOT_KEY); |
