Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2019-02-04 05:20:59 -0500
committerMarvin Mueller2019-02-04 05:20:59 -0500
commit7e8ea46122f80f58521f268d912777546aa4fce1 (patch)
treec7bb2193c9f63c32f3a52c514efc06068023e2c3
parente098048e2130a2ef8d95518c27e9fd7908c0d930 (diff)
downloadorg.eclipse.jubula.core-7e8ea46122f80f58521f268d912777546aa4fce1.tar.gz
org.eclipse.jubula.core-7e8ea46122f80f58521f268d912777546aa4fce1.tar.xz
org.eclipse.jubula.core-7e8ea46122f80f58521f268d912777546aa4fce1.zip
implement Open reference handler
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/CompNamesBP.java5
-rw-r--r--org.eclipse.jubula.client.ui.rcp/plugin.properties3
-rw-r--r--org.eclipse.jubula.client.ui.rcp/plugin.xml39
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/UINodeBP.java2
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenReferencedTCHandler.java65
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java2
6 files changed, 111 insertions, 5 deletions
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/CompNamesBP.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/CompNamesBP.java
index bafbe8407..8fa8f0207 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/CompNamesBP.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/CompNamesBP.java
@@ -115,8 +115,9 @@ public class CompNamesBP {
ISpecTestCasePO specNode = execNode.getSpecTestCase();
if (specNode != null) {
- for (Iterator it = specNode.getAllNodeIter(); it.hasNext();) {
- INodePO child = (INodePO) it.next();
+ for (Iterator<INodePO> it = specNode.getAllNodeIter(); it
+ .hasNext();) {
+ INodePO child = it.next();
if (child instanceof IExecTestCasePO) {
addPropagatedPairs(pairs, (IExecTestCasePO) child);
} else if (child instanceof ICapPO) {
diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.properties b/org.eclipse.jubula.client.ui.rcp/plugin.properties
index bb2622301..cbdc22809 100644
--- a/org.eclipse.jubula.client.ui.rcp/plugin.properties
+++ b/org.eclipse.jubula.client.ui.rcp/plugin.properties
@@ -159,6 +159,7 @@ ShowResponsibleNode=Show corresponding specification
ShowWhereUsedCTDS=Show where used CTDS
ShowWhereUsedCTDSDesc=Shows all places where this CTDS data cell is referenced through a function call.
ObjectMappingEditorCleanupMenu=Cleanup...
+OpenReferencedLocation=Open reference location
OMEDeleteUnusedComponentNames=unused component names
Sort.ByDefault=&Default
Sort.ByName=&Name
@@ -199,4 +200,4 @@ TestStepToolTip=Add a new Test Step.
TestSuite=Test Suite Browser
TestSuiteEditor=Test Suite Editor
ToggleActiveState=Set as active / inactive
-TopLevelCategory=&Top-Level Category \ No newline at end of file
+TopLevelCategory=&Top-Level Category
diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.xml b/org.eclipse.jubula.client.ui.rcp/plugin.xml
index ac38c758a..bd55ffff0 100644
--- a/org.eclipse.jubula.client.ui.rcp/plugin.xml
+++ b/org.eclipse.jubula.client.ui.rcp/plugin.xml
@@ -581,6 +581,10 @@
</commandParameter>
</command>
<command
+ categoryId="org.eclipse.jubula.client.ui.commands"
+ id="org.eclipse.jubula.client.ui.commands.OpenReferencedPlace"
+ name="%OpenReferencedLocation"/>
+ <command
categoryId="org.eclipse.jubula.client.ui.rcp.commands"
id="org.eclipse.jubula.client.ui.rcp.commands.CreateNewCategoryCommand"
name="%Category" />
@@ -1286,6 +1290,11 @@
schemeId="org.eclipse.jubula.client.ui.rcp.defaultKeyScheme"
sequence="F3" />
<key
+ commandId="org.eclipse.jubula.client.ui.commands.OpenReferencedPlace"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.jubula.client.ui.rcp.defaultKeyScheme"
+ sequence="M1+F3" />
+ <key
commandId="org.eclipse.jubula.client.ui.rcp.commands.AddEventHandler"
contextId="org.eclipse.ui.contexts.window"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
@@ -1438,6 +1447,9 @@
commandId="org.eclipse.jubula.client.ui.commands.OpenSpecification"
style="push" />
<command
+ commandId="org.eclipse.jubula.client.ui.commands.OpenReferencedPlace"
+ style="push" />
+ <command
commandId="org.eclipse.jubula.client.ui.commands.ShowSpecification"
style="push" />
</menuContribution>
@@ -2344,6 +2356,25 @@
</enabledWhen>
</handler>
<handler
+ class="org.eclipse.jubula.client.ui.rcp.handlers.open.OpenReferencedTCHandler"
+ commandId="org.eclipse.jubula.client.ui.commands.OpenReferencedPlace">
+ <activeWhen>
+ <and>
+ <with variable="org.eclipse.jubula.client.ui.rcp.variable.isProjectActive">
+ <equals value="true" />
+ </with>
+ <count value="1" />
+ <iterate operator="and">
+ <or>
+ <instanceof value="org.eclipse.jubula.client.core.model.IExecTestCasePO" />
+ <instanceof value="org.eclipse.jubula.client.core.model.IEventExecTestCasePO" />
+ <instanceof value="org.eclipse.jubula.client.core.model.TestResultNode" />
+ </or>
+ </iterate>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
class="org.eclipse.jubula.client.ui.rcp.handlers.SaveLogAsHandler"
commandId="org.eclipse.jubula.client.ui.commands.SaveLogAs">
<enabledWhen>
@@ -2353,6 +2384,14 @@
</iterate>
</with>
</enabledWhen>
+ <activeWhen>
+ <and>
+ <count value="+" />
+ <with variable="activePartId">
+ <equals value="org.eclipse.jubula.client.ui.views.TestresultSummaryView" />
+ </with>
+ </and>
+ </activeWhen>
</handler>
<handler
class="org.eclipse.jubula.client.ui.rcp.handlers.JumpToCTDSHandler"
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/UINodeBP.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/UINodeBP.java
index 9025cbec6..6ecd5a7b7 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/UINodeBP.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/UINodeBP.java
@@ -197,7 +197,7 @@ public class UINodeBP {
* @param trNode the testResult node
* @return an {@link INodePO} which can be of any kind and from any project
*/
- private static INodePO getExecFromTestResultNode(TestResultNode trNode) {
+ public static INodePO getExecFromTestResultNode(TestResultNode trNode) {
INodePO nodePO = trNode.getNode();
String guid = nodePO.getGuid();
if (nodePO instanceof ITestCasePO
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenReferencedTCHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenReferencedTCHandler.java
new file mode 100644
index 000000000..058ae08d7
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenReferencedTCHandler.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 BREDEX GmbH.
+ * 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:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.ui.rcp.handlers.open;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jubula.client.core.model.INodePO;
+import org.eclipse.jubula.client.core.model.TestResultNode;
+import org.eclipse.jubula.client.ui.rcp.businessprocess.UINodeBP;
+import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil;
+import org.eclipse.jubula.tools.internal.messagehandling.MessageIDs;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+/**
+ * @author BREDEX GmbH
+ * @created Jul 29, 2010
+ */
+public class OpenReferencedTCHandler extends AbstractOpenHandler {
+ /** {@inheritDoc} */
+ public Object executeImpl(ExecutionEvent event) {
+ ISelection sel = HandlerUtil.getCurrentSelection(event);
+ if (!(sel instanceof IStructuredSelection)) {
+ return null;
+ }
+ openReferencedPlace((IStructuredSelection)sel);
+ return null;
+ }
+
+ /**
+ * Search for the SpecTC of an ExecTC and opens the corresponding editor if
+ * possible.
+ *
+ * @param structuredSel
+ * the current selection
+ */
+ private void openReferencedPlace(IStructuredSelection structuredSel) {
+ Object firstElement = structuredSel.getFirstElement();
+ if (firstElement instanceof TestResultNode) {
+ TestResultNode trnode = (TestResultNode) firstElement;
+ INodePO node = UINodeBP.getExecFromTestResultNode(trnode);
+ if (node == null) {
+ ErrorHandlingUtil
+ .createMessageDialog(MessageIDs.I_NON_EDITABLE_NODE);
+ }
+ INodePO parentNode = node.getParentNode();
+ IEditorPart openEditorAndSelectNode =
+ openEditorAndSelectNode(parentNode, node);
+ if (openEditorAndSelectNode == null) {
+ ErrorHandlingUtil
+ .createMessageDialog(MessageIDs.I_NON_EDITABLE_NODE);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java
index c5c6d5194..afc0fa700 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java
@@ -387,7 +387,7 @@ public class ComponentNamesTableComposite extends Composite implements
* {@inheritDoc}
*/
public Object[] getElements(Object inputElement) {
- return ((List)inputElement).toArray();
+ return ((List<?>)inputElement).toArray();
}
/**

Back to the top