Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 418298 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jubula.client.ui.rcp/plugin.xml (-3 / +17 lines)
Lines 151-156 Link Here
151
          properties="hasImage"
151
          properties="hasImage"
152
          type="org.eclipse.jubula.client.core.model.TestResultNode">
152
          type="org.eclipse.jubula.client.core.model.TestResultNode">
153
    </propertyTester>
153
    </propertyTester>
154
    <propertyTester
155
          class="org.eclipse.jubula.client.ui.rcp.propertytester.SelectionPropertyTester"
156
          id="org.eclipse.jubula.client.ui.rcp.propertytester.SelectionPropertyTester"
157
          namespace="org.eclipse.jubula.client.ui.rcp.Selection"
158
          properties="isNotRootInEditor"
159
          type="org.eclipse.jubula.client.core.model.INodePO">
160
    </propertyTester>
154
  </extension>
161
  </extension>
155
  <extension
162
  <extension
156
    id="jbMarker"
163
    id="jbMarker"
Lines 3507-3521 Link Here
3507
      commandId="org.eclipse.jubula.client.ui.commands.OpenSpecification">
3514
      commandId="org.eclipse.jubula.client.ui.commands.OpenSpecification">
3508
      <activeWhen>
3515
      <activeWhen>
3509
        <and>
3516
        <and>
3517
          <not>
3518
            <instanceof value="org.eclipse.jubula.client.core.model.IRefTestSuitePO" />
3519
          </not>
3510
          <with variable="org.eclipse.jubula.client.ui.rcp.variable.isProjectActive">
3520
          <with variable="org.eclipse.jubula.client.ui.rcp.variable.isProjectActive">
3511
            <equals value="true" />
3521
            <equals value="true" />
3512
          </with>
3522
          </with>
3513
          <count value="1" />
3523
          <count value="1" />
3514
          <iterate operator="and">
3524
          <iterate operator="or" ifEmpty="false">
3515
            <or>
3525
            <or>
3516
              <instanceof value="org.eclipse.jubula.client.core.model.IExecTestCasePO" />
3517
              <instanceof value="org.eclipse.jubula.client.core.model.IEventExecTestCasePO" />
3518
              <instanceof value="org.eclipse.jubula.client.core.model.TestResultNode" />
3526
              <instanceof value="org.eclipse.jubula.client.core.model.TestResultNode" />
3527
              <and>
3528
                <instanceof value="org.eclipse.jubula.client.core.model.INodePO" />
3529
                <test
3530
                    property="org.eclipse.jubula.client.ui.rcp.Selection.isNotRootInEditor">
3531
                </test>
3532
              </and>
3519
            </or>
3533
            </or>
3520
          </iterate>
3534
          </iterate>
3521
        </and>
3535
        </and>
(-)a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenSpecificationHandler.java (-2 / +20 lines)
Lines 14-19 import org.eclipse.core.commands.ExecutionEvent; Link Here
14
import org.eclipse.jface.viewers.ISelection;
14
import org.eclipse.jface.viewers.ISelection;
15
import org.eclipse.jface.viewers.IStructuredSelection;
15
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
16
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
17
import org.eclipse.jubula.client.core.model.ITestJobPO;
18
import org.eclipse.jubula.client.core.model.ITestSuitePO;
17
import org.eclipse.jubula.client.ui.rcp.businessprocess.UINodeBP;
19
import org.eclipse.jubula.client.ui.rcp.businessprocess.UINodeBP;
18
import org.eclipse.ui.handlers.HandlerUtil;
20
import org.eclipse.ui.handlers.HandlerUtil;
19
21
Lines 29-35 public class OpenSpecificationHandler extends AbstractOpenHandler { Link Here
29
        if (!(sel instanceof IStructuredSelection)) {
31
        if (!(sel instanceof IStructuredSelection)) {
30
            return null;
32
            return null;
31
        }
33
        }
32
        openSpecNode((IStructuredSelection)sel);
34
        IStructuredSelection structuredSel = (IStructuredSelection)sel;
35
        if (structuredSel.getFirstElement() instanceof ITestSuitePO) {
36
            ITestSuitePO testSuite = (ITestSuitePO) structuredSel
37
                    .getFirstElement();
38
            openEditor(testSuite);
39
        } else if (structuredSel.getFirstElement() instanceof ITestJobPO) {
40
            ITestJobPO testJob = (ITestJobPO) structuredSel
41
                    .getFirstElement();
42
            openEditor(testJob);
43
        } else {
44
            openSpecNode((IStructuredSelection)sel);
45
        }
33
        return null;
46
        return null;
34
    }
47
    }
35
48
Lines 41-47 public class OpenSpecificationHandler extends AbstractOpenHandler { Link Here
41
     *            the current selection
54
     *            the current selection
42
     */
55
     */
43
    private void openSpecNode(IStructuredSelection structuredSel) {
56
    private void openSpecNode(IStructuredSelection structuredSel) {
44
        ISpecTestCasePO specTc = UINodeBP.getSpecTC(structuredSel);
57
        ISpecTestCasePO specTc;
58
        if (structuredSel.getFirstElement() instanceof ISpecTestCasePO) {
59
            specTc = (ISpecTestCasePO) structuredSel.getFirstElement();
60
        } else {
61
            specTc = UINodeBP.getSpecTC(structuredSel);
62
        }
45
        openEditorForSpecTC(specTc);
63
        openEditorForSpecTC(specTc);
46
    }
64
    }
47
}
65
}
(-)a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/propertytester/SelectionPropertyTester.java (-1 / +75 lines)
Added Link Here
0
- 
1
/*******************************************************************************
2
 * Copyright (c) 2013 BREDEX GmbH.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BREDEX GmbH - initial API and implementation and/or initial documentation
10
 *******************************************************************************/
11
package org.eclipse.jubula.client.ui.rcp.propertytester;
12
13
import org.eclipse.jubula.client.core.model.IEventExecTestCasePO;
14
import org.eclipse.jubula.client.core.model.IExecTestCasePO;
15
import org.eclipse.jubula.client.core.model.INodePO;
16
import org.eclipse.jubula.client.core.model.IProjectPO;
17
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
18
import org.eclipse.jubula.client.core.model.ITestJobPO;
19
import org.eclipse.jubula.client.core.model.ITestSuitePO;
20
import org.eclipse.jubula.client.core.propertytester.AbstractBooleanPropertyTester;
21
22
23
/**
24
 * Property tester for Selections.
25
 *
26
 * @author BREDEX GmbH
27
 * @created Sep 27, 2013
28
 */
29
public class SelectionPropertyTester extends AbstractBooleanPropertyTester {
30
    /** the id of the "isRoot" property */
31
    public static final String IS_NOT_ROOT_IN_EDITOR = "isNotRootInEditor"; //$NON-NLS-1$
32
    /**
33
     * <code>PROPERTIES</code>
34
     */
35
    private static final String[] PROPERTIES = 
36
            new String[] { IS_NOT_ROOT_IN_EDITOR };
37
38
    /** {@inheritDoc} */
39
    public boolean testImpl(Object receiver, String property, Object[] args) {
40
        INodePO node = (INodePO)receiver;
41
        if (property.equals(IS_NOT_ROOT_IN_EDITOR)) {
42
            if (node instanceof IExecTestCasePO 
43
                    || node instanceof IEventExecTestCasePO) {
44
                // an ExecTestCase or an EventExecTestCase is never a root
45
                return true;
46
            } else if (node instanceof ISpecTestCasePO) {
47
                ISpecTestCasePO specTc = (ISpecTestCasePO) node;
48
                if (!(specTc.getParentNode() instanceof IProjectPO)) {
49
                    return true;
50
                }
51
            } else if (node instanceof ITestSuitePO) {
52
                ITestSuitePO testSuite = (ITestSuitePO) node;
53
                if (!(testSuite.getParentNode() == null)) {
54
                    return true;
55
                }
56
            } else if (node instanceof ITestJobPO) {
57
                ITestJobPO testJob = (ITestJobPO) node;
58
                if (!(testJob.getParentNode() == null)) {
59
                    return true;
60
                }
61
            }
62
        }
63
        return false;
64
    }
65
66
    /** {@inheritDoc} */
67
    public Class<? extends Object> getType() {
68
        return INodePO.class;
69
    }
70
71
    /** {@inheritDoc} */
72
    public String[] getProperties() {
73
        return PROPERTIES;
74
    }
75
}

Return to bug 418298