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 418300 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java (-4 / +4 lines)
Lines 548-554 public class NodePM extends PersistenceManager { Link Here
548
     * doesn't know the parent.
548
     * doesn't know the parent.
549
     * 
549
     * 
550
     * @param tsGuid
550
     * @param tsGuid
551
     *            GUID of the test case being reused.
551
     *            GUID of the test suite being reused.
552
     * @param parentProjectId
552
     * @param parentProjectId
553
     *            ID of the parent project of the test case being reused.
553
     *            ID of the parent project of the test case being reused.
554
     * @return all ref test suites that reference the test suite with the given
554
     * @return all ref test suites that reference the test suite with the given
Lines 572-578 public class NodePM extends PersistenceManager { Link Here
572
    /**
572
    /**
573
     * 
573
     * 
574
     * @param tsGuid The GUID of the reused test suite.
574
     * @param tsGuid The GUID of the reused test suite.
575
     * @param parentProjectIds All returned test cases will have one of these as
575
     * @param parentProjectIds All returned test suites will have one of these as
576
     *                         their project parent ID.
576
     *                         their project parent ID.
577
     * @param s The session into which the test cases will be loaded.
577
     * @param s The session into which the test cases will be loaded.
578
     * @return list of test suites.
578
     * @return list of test suites.
Lines 592-599 public class NodePM extends PersistenceManager { Link Here
592
        queryBuffer.append(")"); //$NON-NLS-1$
592
        queryBuffer.append(")"); //$NON-NLS-1$
593
        Query q = s.createQuery(queryBuffer.toString());
593
        Query q = s.createQuery(queryBuffer.toString());
594
        q.setParameter("tsGuid", tsGuid); //$NON-NLS-1$
594
        q.setParameter("tsGuid", tsGuid); //$NON-NLS-1$
595
        List<IRefTestSuitePO> execTcList = q.getResultList();
595
        List<IRefTestSuitePO> refTestSuiteList = q.getResultList();
596
        return execTcList;
596
        return refTestSuiteList;
597
    }
597
    }
598
598
599
    /**
599
    /**
(-)a/org.eclipse.jubula.client.ui.rcp/plugin.xml (+18 lines)
Lines 1751-1756 Link Here
1751
             style="push">
1751
             style="push">
1752
       </command>
1752
       </command>
1753
       <command
1753
       <command
1754
             commandId="org.eclipse.jubula.client.ui.rcp.commands.ShowWhereUsed"
1755
             style="push">
1756
       </command>
1757
       <command
1754
             commandId="org.eclipse.jubula.client.ui.commands.ExpandTreeItem"
1758
             commandId="org.eclipse.jubula.client.ui.commands.ExpandTreeItem"
1755
             style="push">
1759
             style="push">
1756
       </command>
1760
       </command>
Lines 2342-2347 Link Here
2342
      </activeWhen>
2346
      </activeWhen>
2343
    </handler>
2347
    </handler>
2344
    <handler
2348
    <handler
2349
      class="org.eclipse.jubula.client.ui.rcp.handlers.showwhereused.TestSuiteShowWhereUsedHandler"
2350
      commandId="org.eclipse.jubula.client.ui.rcp.commands.ShowWhereUsed">
2351
      <activeWhen>
2352
        <and>
2353
          <count value="1" />
2354
          <iterate
2355
            ifEmpty="false"
2356
            operator="and">
2357
            <instanceof value="org.eclipse.jubula.client.core.model.ITestSuitePO" />
2358
          </iterate>
2359
        </and>
2360
      </activeWhen>
2361
    </handler>
2362
    <handler
2345
      class="org.eclipse.jubula.client.ui.rcp.handlers.showwhereused.ComponentNameShowWhereUsedHandler"
2363
      class="org.eclipse.jubula.client.ui.rcp.handlers.showwhereused.ComponentNameShowWhereUsedHandler"
2346
      commandId="org.eclipse.jubula.client.ui.rcp.commands.ShowWhereUsed">
2364
      commandId="org.eclipse.jubula.client.ui.rcp.commands.ShowWhereUsed">
2347
      <activeWhen>
2365
      <activeWhen>
(-)a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/showwhereused/TestSuiteShowWhereUsedHandler.java (+37 lines)
Added Link Here
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.handlers.showwhereused;
12
13
import org.eclipse.core.commands.ExecutionEvent;
14
import org.eclipse.jubula.client.core.model.ITestSuitePO;
15
import org.eclipse.jubula.client.ui.rcp.search.query.ShowWhereUsedTestSuiteQuery;
16
import org.eclipse.search.ui.NewSearchUI;
17
18
19
/**
20
 * Class for test suite "Show where used" handler
21
 * 
22
 * @author BREDEX GmbH
23
 * @created 17.10.2013
24
 */
25
public class TestSuiteShowWhereUsedHandler extends
26
        AbstractShowWhereUsedHandler {
27
28
    /** {@inheritDoc} */
29
    public Object execute(ExecutionEvent event) {
30
        init(event);
31
        final Object first = getCurrentSelection().getFirstElement();
32
        ITestSuitePO testSuite = (ITestSuitePO)first;
33
        NewSearchUI.runQueryInBackground(
34
                new ShowWhereUsedTestSuiteQuery(testSuite));
35
        return null;
36
    }
37
}
(-)a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java (+1 lines)
Lines 844-849 public class Messages extends NLS { Link Here
844
    public static String UIJobSearchingResponsibleCompNames;
844
    public static String UIJobSearchingResponsibleCompNames;
845
    public static String UIJobSearchingTestCases;
845
    public static String UIJobSearchingTestCases;
846
    public static String UIJobSearchingTestDataCube;
846
    public static String UIJobSearchingTestDataCube;
847
    public static String UIJobSearchingTestSuites;
847
    public static String UIJobStartTestJob;
848
    public static String UIJobStartTestJob;
848
    public static String UnexpectedDialogReturnCode;
849
    public static String UnexpectedDialogReturnCode;
849
    public static String UnexpectedError;
850
    public static String UnexpectedError;
(-)a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties (+1 lines)
Lines 830-835 UIJobSearchingCompNames=Search for usage of Component Names Link Here
830
UIJobSearchingResponsibleCompNames=Search for responsible specification of Component Name
830
UIJobSearchingResponsibleCompNames=Search for responsible specification of Component Name
831
UIJobSearchingTestCases=Search for usage of Test Case
831
UIJobSearchingTestCases=Search for usage of Test Case
832
UIJobSearchingTestDataCube=Search for usage of Test Data Sets
832
UIJobSearchingTestDataCube=Search for usage of Test Data Sets
833
UIJobSearchingTestSuites=Search for usage of Test Suite
833
UIJobStartTestJob=Start Test Job
834
UIJobStartTestJob=Start Test Job
834
UnexpectedDialogReturnCode=Unexpected dialog return code
835
UnexpectedDialogReturnCode=Unexpected dialog return code
835
UnexpectedError=Unexpected error
836
UnexpectedError=Unexpected error
(-)a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/query/ShowWhereUsedTestSuiteQuery.java (-1 / +117 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.search.query;
12
13
import java.util.ArrayList;
14
import java.util.List;
15
16
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Status;
19
import org.eclipse.jubula.client.core.model.INodePO;
20
import org.eclipse.jubula.client.core.model.IProjectPO;
21
import org.eclipse.jubula.client.core.model.IRefTestSuitePO;
22
import org.eclipse.jubula.client.core.model.ITestSuitePO;
23
import org.eclipse.jubula.client.core.persistence.GeneralStorage;
24
import org.eclipse.jubula.client.core.persistence.NodePM;
25
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
26
import org.eclipse.jubula.client.ui.rcp.provider.labelprovider.GeneralLabelProvider;
27
import org.eclipse.jubula.client.ui.rcp.search.result.BasicSearchResult.NodeSearchResultElementAction;
28
import org.eclipse.jubula.client.ui.rcp.search.result.BasicSearchResult.SearchResultElement;
29
import org.eclipse.jubula.tools.constants.StringConstants;
30
import org.eclipse.osgi.util.NLS;
31
32
33
/**
34
 * @author BREDEX GmbH
35
 * @created 18.10.2013
36
 */
37
public class ShowWhereUsedTestSuiteQuery 
38
    extends AbstractShowWhereUsedQuery {
39
    /**
40
     * <code>m_specTC</code>
41
     */
42
    private ITestSuitePO m_testSuite;
43
    
44
    /**
45
     * @param testSuite
46
     *            the test suite to search the reuse for
47
     */
48
    public ShowWhereUsedTestSuiteQuery(ITestSuitePO testSuite) {
49
        super(null);
50
        m_testSuite = testSuite;
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public IStatus run(IProgressMonitor monitor) {
57
        calculateReuseOfTestSuite(m_testSuite, monitor);
58
        return Status.OK_STATUS;
59
    }
60
    
61
    /**
62
     * calculates and show the places of reuse for a test suite
63
     * 
64
     * @param testSuite
65
     *            the test suite
66
     * @param monitor
67
     *            the progress monitor
68
     */
69
    private void calculateReuseOfTestSuite(ITestSuitePO testSuite,
70
            IProgressMonitor monitor) {
71
        IProjectPO currentProject = GeneralStorage.getInstance().getProject();
72
        List<IRefTestSuitePO> reuse = NodePM.getInternalRefTestSuites(
73
                testSuite.getGuid(), currentProject.getId());
74
        final List<SearchResultElement> reuseLoc = 
75
            new ArrayList<SearchResultElement>(
76
                reuse.size());
77
        List<INodePO> parentList = new ArrayList<INodePO>();
78
        
79
        monitor.beginTask("Searching for reusage of Test Suite", reuse.size()); //$NON-NLS-1$
80
        for (IRefTestSuitePO refTestSuite : reuse) {
81
            INodePO parent = refTestSuite.getParentNode();
82
            if (parent != null) {
83
                Long id = refTestSuite.getId();
84
                String nodeName = GeneralLabelProvider.getTextImpl(
85
                        refTestSuite);
86
                parentList.add(parent);
87
                reuseLoc.add(new SearchResultElement<Long>(NLS.bind(
88
                        Messages.SearchResultPageElementLabel, new Object[] {
89
                                parent.getName(), nodeName }), id,
90
                                GeneralLabelProvider.getImageImpl(refTestSuite),
91
                        new NodeSearchResultElementAction(), refTestSuite
92
                                .getComment()));
93
            }
94
            monitor.worked(1);
95
        }
96
        
97
        setSearchResult(reuseLoc);
98
        monitor.done();
99
    }
100
101
    /**
102
     * {@inheritDoc}
103
     */
104
    @SuppressWarnings("nls")
105
    public String getLabel() {
106
        StringBuilder sb = new StringBuilder();
107
        sb.append(getTimestamp());
108
        sb.append(StringConstants.COLON);
109
        sb.append(StringConstants.SPACE);
110
        sb.append(Messages.UIJobSearchingTestSuites);
111
        sb.append(" \"");
112
        sb.append(m_testSuite.getName());
113
        sb.append("\"");
114
        return sb.toString();
115
    }
116
    
117
}

Return to bug 418300