Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2015-08-18 12:41:46 +0000
committerMarvin Mueller2015-08-18 12:48:54 +0000
commit93966b4ee8d642b5d5aac507cbb3422126bb6d68 (patch)
treef6567cfba5819f291c844290983e028667657017 /org.eclipse.jubula.client.ui.rcp
parentf5b47d185899163c2d13bab1375942ff37683cbd (diff)
downloadorg.eclipse.jubula.core-93966b4ee8d642b5d5aac507cbb3422126bb6d68.tar.gz
org.eclipse.jubula.core-93966b4ee8d642b5d5aac507cbb3422126bb6d68.tar.xz
org.eclipse.jubula.core-93966b4ee8d642b5d5aac507cbb3422126bb6d68.zip
Non-sprint task - fixing problem with show specification
Show specification did open the test suite browser in the test perspective. This is no more the case.
Diffstat (limited to 'org.eclipse.jubula.client.ui.rcp')
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractShowSpecificationHandler.java42
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/ShowSpecificationHandler.java5
2 files changed, 40 insertions, 7 deletions
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractShowSpecificationHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractShowSpecificationHandler.java
index 6a6c9633f..f110fd426 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractShowSpecificationHandler.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractShowSpecificationHandler.java
@@ -30,7 +30,7 @@ import org.eclipse.ui.PlatformUI;
public abstract class AbstractShowSpecificationHandler
extends AbstractSelectionBasedHandler {
/**
- * Shows the SpecTS in the Test Suite Browser
+ * Shows the node in the specific viewPart if possible
*
* @param node
* the node to show
@@ -38,17 +38,53 @@ public abstract class AbstractShowSpecificationHandler
* the view part to show the specification in
*/
protected void showSpecUINode(INodePO node, IViewPart viewPart) {
- if (!Utils.openPerspective(Constants.SPEC_PERSPECTIVE)) {
+ if (!openSpecPerspectiveAndShowError()) {
+ return;
+ }
+ activatViewAndSelect(node, viewPart);
+ }
+
+ /**
+ * Shows the node in the specific viewPart if possible
+ *
+ * @param node
+ * the node to show
+ * @param viewPartID
+ * the view part ID to show the specification in
+ */
+ protected void showSpecUINode(INodePO node, String viewPartID) {
+ if (!openSpecPerspectiveAndShowError()) {
return;
}
+ IViewPart viewPart = Plugin.showView(viewPartID);
+ activatViewAndSelect(node, viewPart);
+ }
+
+ /**
+ *
+ * @return <code>true</code> if the {@link Constants#SPEC_PERSPECTIVE}
+ * has been opened or is open
+ */
+ private boolean openSpecPerspectiveAndShowError() {
+ if (!Utils.openPerspective(Constants.SPEC_PERSPECTIVE)) {
+ return false;
+ }
if (!PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getPerspective().getId()
.equals(Constants.SPEC_PERSPECTIVE)) {
// show error must be in SpecPers
ErrorHandlingUtil.createMessageDialog(
MessageIDs.I_NO_PERSPECTIVE_CHANGE);
- return;
+ return false;
}
+ return true;
+ }
+ /**
+ *
+ * @param node the node to select
+ * @param viewPart the view part to activate
+ */
+ private void activatViewAndSelect(INodePO node, IViewPart viewPart) {
if (viewPart instanceof AbstractJBTreeView) {
AbstractJBTreeView jbtv = (AbstractJBTreeView)viewPart;
Plugin.activate(jbtv);
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/ShowSpecificationHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/ShowSpecificationHandler.java
index 698a6d665..970e76267 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/ShowSpecificationHandler.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/ShowSpecificationHandler.java
@@ -14,10 +14,8 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.model.ITestSuitePO;
import org.eclipse.jubula.client.ui.constants.Constants;
-import org.eclipse.jubula.client.ui.rcp.Plugin;
import org.eclipse.jubula.client.ui.rcp.businessprocess.UINodeBP;
import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
-import org.eclipse.ui.IViewPart;
/**
@@ -36,8 +34,7 @@ public class ShowSpecificationHandler extends AbstractShowSpecificationHandler {
}
ITestSuitePO testSuite = UINodeBP.getSpecTS(getSelection());
if (testSuite != null) {
- IViewPart view = Plugin.showView(Constants.TS_BROWSER_ID);
- showSpecUINode(testSuite, view);
+ showSpecUINode(testSuite, Constants.TS_BROWSER_ID);
}
return null;

Back to the top