Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2012-05-16 08:10:25 +0000
committerMarkus Tiede2012-05-16 08:10:25 +0000
commit81c53a0e0a8bed64dceb4df4ab20e2c912a18154 (patch)
treeb376f20b8e5f8e317d07f0c82033b25382cc0412
parent3d4a9329df2f824f0f7aa5f775e906bc43198c90 (diff)
downloadorg.eclipse.jubula.core-81c53a0e0a8bed64dceb4df4ab20e2c912a18154.tar.gz
org.eclipse.jubula.core-81c53a0e0a8bed64dceb4df4ab20e2c912a18154.tar.xz
org.eclipse.jubula.core-81c53a0e0a8bed64dceb4df4ab20e2c912a18154.zip
Revert "Revert "Sprint task - implement multiple instance support for TCB + main view UI support.""
-rw-r--r--org.eclipse.jubula.client.teststyle/src/org/eclipse/jubula/client/teststyle/quickfix/QuickfixFactory.java23
-rw-r--r--org.eclipse.jubula.client.ui.rcp/icons/mainView.gifbin0 -> 215 bytes
-rw-r--r--org.eclipse.jubula.client.ui.rcp/icons/newView.gifbin0 -> 338 bytes
-rw-r--r--org.eclipse.jubula.client.ui.rcp/plugin.properties3
-rw-r--r--org.eclipse.jubula.client.ui.rcp/plugin.xml46
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/MultipleTCBTracker.java203
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCBrowserDndSupport.java19
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCEditorDndSupport.java33
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TSEditorDndSupport.java20
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractShowSpecificationHandler.java14
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/MoveTestCaseHandler.java17
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewTestCaseHandlerTCBrowser.java11
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewViewInstanceHandler.java47
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/SetAsMainViewInstanceHandler.java34
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/ShowSpecificationHandler.java15
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenTestCaseEditorHandler.java29
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java2
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties2
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/result/BasicSearchResult.java23
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/ActiveProjectSourceProvider.java16
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/utils/Utils.java7
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/TestCaseBrowser.java14
22 files changed, 447 insertions, 131 deletions
diff --git a/org.eclipse.jubula.client.teststyle/src/org/eclipse/jubula/client/teststyle/quickfix/QuickfixFactory.java b/org.eclipse.jubula.client.teststyle/src/org/eclipse/jubula/client/teststyle/quickfix/QuickfixFactory.java
index dbc4253a3..dbe677578 100644
--- a/org.eclipse.jubula.client.teststyle/src/org/eclipse/jubula/client/teststyle/quickfix/QuickfixFactory.java
+++ b/org.eclipse.jubula.client.teststyle/src/org/eclipse/jubula/client/teststyle/quickfix/QuickfixFactory.java
@@ -25,7 +25,7 @@ import org.eclipse.jubula.client.core.model.ITestSuitePO;
import org.eclipse.jubula.client.core.persistence.GeneralStorage;
import org.eclipse.jubula.client.teststyle.i18n.Messages;
import org.eclipse.jubula.client.ui.constants.Constants;
-import org.eclipse.jubula.client.ui.rcp.Plugin;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.client.ui.rcp.handlers.open.AbstractOpenHandler;
import org.eclipse.jubula.client.ui.rcp.utils.Utils;
import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil;
@@ -33,7 +33,6 @@ import org.eclipse.jubula.client.ui.views.ITreeViewerContainer;
import org.eclipse.jubula.tools.messagehandling.MessageIDs;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
@@ -181,19 +180,21 @@ public class QuickfixFactory {
MessageIDs.I_NO_PERSPECTIVE_CHANGE);
return;
}
- IViewPart view = Plugin.showView(Constants.TC_BROWSER_ID, null,
- IWorkbenchPage.VIEW_ACTIVATE);
+ IViewPart view = MultipleTCBTracker.getInstance()
+ .getMainTCB();
ITreeViewerContainer specView = (ITreeViewerContainer)view;
InteractionEventDispatcher.getDefault().
fireProgammableSelectionEvent(
new StructuredSelection(node));
- specView.getTreeViewer().refresh();
- specView.getTreeViewer().reveal(node);
- specView.getTreeViewer().getTree().update();
- view.setFocus();
- specView.getTreeViewer().expandToLevel(node, 0);
- specView.getTreeViewer().setSelection(
- new StructuredSelection(node), true);
+ if (specView != null) {
+ specView.getTreeViewer().refresh();
+ specView.getTreeViewer().reveal(node);
+ specView.getTreeViewer().getTree().update();
+ view.setFocus();
+ specView.getTreeViewer().expandToLevel(node, 0);
+ specView.getTreeViewer().setSelection(
+ new StructuredSelection(node), true);
+ }
}
}
diff --git a/org.eclipse.jubula.client.ui.rcp/icons/mainView.gif b/org.eclipse.jubula.client.ui.rcp/icons/mainView.gif
new file mode 100644
index 000000000..d0b5c1599
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/icons/mainView.gif
Binary files differ
diff --git a/org.eclipse.jubula.client.ui.rcp/icons/newView.gif b/org.eclipse.jubula.client.ui.rcp/icons/newView.gif
new file mode 100644
index 000000000..0f282ca3d
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/icons/newView.gif
Binary files differ
diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.properties b/org.eclipse.jubula.client.ui.rcp/plugin.properties
index 50820d6de..c1e5f66a9 100644
--- a/org.eclipse.jubula.client.ui.rcp/plugin.properties
+++ b/org.eclipse.jubula.client.ui.rcp/plugin.properties
@@ -31,6 +31,7 @@ Create=&Create
CreateCategory=&Create Category
CreateNewVersion=&Create new version...
CreateNewVersionTooltip=Create a new version of the current Project
+CreateNewViewInstance=New View Instance
databaseConnectionsTransferName=Database Connections
databaseConnectionsTransferDescription=Database connection definitions for functional testing.
Delete=&Delete
@@ -88,6 +89,7 @@ NewTestJob=New Test &Job
NewTestSuiteToolTip=Create a new Test Suite.
NewTestJobToolTip=Create a new Test Job.
NewTestCaseReference=Reference Existing Test Case
+NewTestCaseBrowserViewInstance=New Test Case Browser
ObjectMappingEditor=Object Mapping Editor
ObjectMappingPreferences=Object Mapping
ObservationPreferences=Observation Mode
@@ -119,6 +121,7 @@ SaveProject=Save all
Find=&Find
SearchToolTip=Search the mapping for a certain item.
ServerConfigEditor=Test Suite Editor
+SetAsMainViewInstance=Set this view as main view.
MapIntoOMCategory=Map Components into this Category
MapIntoOMCategoryToolTip=Sets the Category for Mapping Mode
Show=&Show
diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.xml b/org.eclipse.jubula.client.ui.rcp/plugin.xml
index b7f043a59..bfbb5ada9 100644
--- a/org.eclipse.jubula.client.ui.rcp/plugin.xml
+++ b/org.eclipse.jubula.client.ui.rcp/plugin.xml
@@ -237,6 +237,7 @@
icon="icons/specTcBrowser.gif"
category="org.eclipse.jubula.client.views"
name="%TestSpec"
+ allowMultiple="true"
id="org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser" />
<view
class="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"
@@ -951,10 +952,18 @@
id="org.eclipse.jubula.client.ui.rcp.commands.MapIntoOMCategory"
name="%MapIntoOMCategory" />
<command
- categoryId="org.eclipse.jubula.client.ui.rcp.commands"
- id="org.eclipse.jubula.client.ui.rcp.commands.MoveTestCase"
- name="%MoveTestCaseCommandName">
+ categoryId="org.eclipse.jubula.client.ui.rcp.commands"
+ id="org.eclipse.jubula.client.ui.rcp.commands.MoveTestCase"
+ name="%MoveTestCaseCommandName">
</command>
+ <command
+ categoryId="org.eclipse.jubula.client.ui.rcp.commands"
+ id="org.eclipse.jubula.client.ui.rcp.commands.CreateNewViewInstance"
+ name="%CreateNewViewInstance" />
+ <command
+ categoryId="org.eclipse.jubula.client.ui.rcp.commands"
+ id="org.eclipse.jubula.client.ui.rcp.commands.SetAsMainViewInstance"
+ name="%SetAsMainViewInstance" />
</extension>
<extension point="org.eclipse.ui.bindings">
<key
@@ -1155,6 +1164,10 @@
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser?after=additions">
+ <command
+ commandId="org.eclipse.jubula.client.ui.rcp.commands.CreateNewViewInstance"
+ label="%NewTestCaseBrowserViewInstance"
+ style="push" />
<menu label="%Show">
<command
commandId="org.eclipse.jubula.client.ui.rcp.commands.filterUsedTestCases"
@@ -1388,6 +1401,16 @@
<menuContribution
locationURI="toolbar:org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser?after=additions">
<command
+ commandId="org.eclipse.jubula.client.ui.rcp.commands.SetAsMainViewInstance"
+ style="push" >
+ <visibleWhen
+ checkEnabled="false">
+ <with variable="org.eclipse.jubula.client.ui.rcp.variable.areMultipleTCBOpen">
+ <equals value="true" />
+ </with>
+ </visibleWhen>
+ </command>
+ <command
commandId="org.eclipse.jubula.client.ui.rcp.commands.CollapseAll"
style="push" />
</menuContribution>
@@ -1813,6 +1836,14 @@
</activeWhen>
</handler>
<handler
+ commandId="org.eclipse.jubula.client.ui.rcp.commands.CreateNewViewInstance"
+ class="org.eclipse.jubula.client.ui.rcp.handlers.NewViewInstanceHandler">
+ </handler>
+ <handler
+ commandId="org.eclipse.jubula.client.ui.rcp.commands.SetAsMainViewInstance"
+ class="org.eclipse.jubula.client.ui.rcp.handlers.SetAsMainViewInstanceHandler">
+ </handler>
+ <handler
class="org.eclipse.jubula.client.ui.rcp.handlers.FindHandler"
commandId="org.eclipse.ui.edit.findReplace">
<activeWhen>
@@ -2537,6 +2568,12 @@
commandId="org.eclipse.jubula.client.ui.rcp.commands.sort.name"
icon="icons/sort.gif" />
<image
+ commandId="org.eclipse.jubula.client.ui.rcp.commands.CreateNewViewInstance"
+ icon="icons/newView.gif" />
+ <image
+ commandId="org.eclipse.jubula.client.ui.rcp.commands.SetAsMainViewInstance"
+ icon="icons/mainView.gif" />
+ <image
commandId="org.eclipse.jubula.client.ui.rcp.commands.MergeLogicalNameCommand"
icon="icons/mergeLogicalName.gif" />
<image
@@ -3398,6 +3435,9 @@
<variable
name="org.eclipse.jubula.client.ui.rcp.variable.isConnectionToDatabaseEstablished"
priorityLevel="workbench" />
+ <variable
+ name="org.eclipse.jubula.client.ui.rcp.variable.areMultipleTCBOpen"
+ priorityLevel="workbench" />
</sourceProvider>
<sourceProvider
provider="org.eclipse.jubula.client.ui.rcp.sourceprovider.TestExecutionSourceProvider">
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/MultipleTCBTracker.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/MultipleTCBTracker.java
new file mode 100644
index 000000000..0534bff92
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/MultipleTCBTracker.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 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.controllers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jubula.client.ui.constants.Constants;
+import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
+import org.eclipse.jubula.client.ui.rcp.sourceprovider.ActiveProjectSourceProvider;
+import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author BREDEX GmbH
+ */
+public class MultipleTCBTracker implements IPartListener2 {
+ /**
+ * singleton instance
+ */
+ private static MultipleTCBTracker instance = null;
+
+ /**
+ * the list of open test case browsers
+ */
+ private List<IWorkbenchPartReference> m_tcb =
+ new ArrayList<IWorkbenchPartReference>();
+
+ /**
+ * the main test case browser
+ */
+ private TestCaseBrowser m_mainTCB = null;
+
+ /**
+ * the source provider
+ */
+ private ActiveProjectSourceProvider m_provider = null;
+
+ /**
+ * private Constructor
+ */
+ private MultipleTCBTracker() {
+ // empty
+ }
+
+ /**
+ * get single instance
+ *
+ * @return single instance of ImportFileBP
+ */
+ public static MultipleTCBTracker getInstance() {
+ if (instance == null) {
+ instance = new MultipleTCBTracker();
+ }
+ return instance;
+ }
+
+ /** {@inheritDoc} */
+ public void partActivated(IWorkbenchPartReference partRef) {
+ // nothing to be done in here
+ }
+
+ /** {@inheritDoc} */
+ public void partBroughtToTop(IWorkbenchPartReference partRef) {
+ // nothing to be done in here
+ }
+
+ /** {@inheritDoc} */
+ public void partClosed(IWorkbenchPartReference partRef) {
+ if (Constants.TC_BROWSER_ID.equals(partRef.getId())) {
+ m_tcb.remove(partRef);
+ int count = m_tcb.size();
+ if (partRef.getPartName().startsWith(
+ Messages.TestCaseBrowserMainPrefix)) {
+ if (count > 0) {
+ setMainTCB(getOpenTCBs().get(0));
+ } else {
+ m_mainTCB = null;
+ }
+ }
+ if (count == 1) {
+ getMainTCB().setViewTitle(Messages.TestCaseBrowser);
+ }
+ fireStateChanged();
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void partDeactivated(IWorkbenchPartReference partRef) {
+ // nothing to be done in here
+ }
+
+ /** {@inheritDoc} */
+ public void partOpened(IWorkbenchPartReference partRef) {
+ if (Constants.TC_BROWSER_ID.equals(partRef.getId())) {
+ m_tcb.add(partRef);
+ if (m_tcb.size() > 1) {
+ setMainTCB(getOpenTCBs().get(0));
+ }
+ fireStateChanged();
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void partHidden(IWorkbenchPartReference partRef) {
+ // nothing to be done in here
+ }
+
+ /** {@inheritDoc} */
+ public void partVisible(IWorkbenchPartReference partRef) {
+ // nothing to be done in here
+ }
+
+ /** {@inheritDoc} */
+ public void partInputChanged(IWorkbenchPartReference partRef) {
+ // nothing to be done in here
+ }
+
+ /**
+ * @return the currently open instances of the TCB view
+ */
+ public List<TestCaseBrowser> getOpenTCBs() {
+ List<TestCaseBrowser> tcbs = new ArrayList<TestCaseBrowser>();
+
+ for (IWorkbenchPartReference ref : m_tcb) {
+ IWorkbenchPart part = ref.getPart(false);
+ if (part != null) {
+ tcbs.add((TestCaseBrowser) part);
+ }
+ }
+
+ return tcbs;
+ }
+
+ /**
+ * @return the currently main TCB or <code>null</code> if there is none
+ */
+ public TestCaseBrowser getMainTCB() {
+ if (m_mainTCB == null) {
+ m_mainTCB = getOpenTCBs().size() > 0 ? getOpenTCBs().get(0) : null;
+ }
+ return m_mainTCB;
+ }
+
+ /**
+ * @param mainTCB
+ * the mainTCB to set
+ */
+ public void setMainTCB(TestCaseBrowser mainTCB) {
+ if (m_mainTCB != null) {
+ m_mainTCB.setViewTitle(Messages.TestCaseBrowser);
+ }
+ mainTCB.setViewTitle(Messages.TestCaseBrowserMainPrefix
+ + Messages.TestCaseBrowser);
+ m_mainTCB = mainTCB;
+ }
+
+ /**
+ * fire data changed events
+ */
+ private void fireStateChanged() {
+ if (getProvider() != null) {
+ getProvider().handleProjectLoaded();
+ }
+ }
+
+ /**
+ * register listener
+ */
+ public void registerListener() {
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ if (activeWorkbenchWindow != null) {
+ activeWorkbenchWindow.getPartService().addPartListener(this);
+ }
+ }
+
+ /**
+ * @return the provider
+ */
+ public ActiveProjectSourceProvider getProvider() {
+ return m_provider;
+ }
+
+ /**
+ * @param provider the provider to set
+ */
+ public void setProvider(ActiveProjectSourceProvider provider) {
+ m_provider = provider;
+ }
+}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCBrowserDndSupport.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCBrowserDndSupport.java
index 42be8c164..4b354e37f 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCBrowserDndSupport.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCBrowserDndSupport.java
@@ -21,11 +21,8 @@ import org.eclipse.jubula.client.core.model.IPersistentObject;
import org.eclipse.jubula.client.core.model.ISpecObjContPO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.persistence.PMException;
-import org.eclipse.jubula.client.ui.constants.Constants;
-import org.eclipse.jubula.client.ui.rcp.Plugin;
-import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.tools.exception.ProjectDeletedException;
-import org.eclipse.ui.IViewPart;
/**
@@ -93,20 +90,8 @@ public class TCBrowserDndSupport extends AbstractBrowserDndSupport {
public static void moveNodes(List<INodePO> nodesToBeMoved,
IPersistentObject target) throws PMException,
ProjectDeletedException {
- if (getSpecView() != null) {
+ if (MultipleTCBTracker.getInstance().getMainTCB() != null) {
doMove(nodesToBeMoved, target);
}
}
-
- /**
- * @return instance of TestCaseBrowser, or null.
- */
- private static TestCaseBrowser getSpecView() {
- IViewPart viewPart = Plugin.getView(Constants.TC_BROWSER_ID);
- if (viewPart != null) {
- return (TestCaseBrowser)viewPart;
- }
- return null;
- }
-
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCEditorDndSupport.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCEditorDndSupport.java
index 2cb1b97b3..c2367babf 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCEditorDndSupport.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TCEditorDndSupport.java
@@ -30,14 +30,12 @@ import org.eclipse.jubula.client.core.persistence.EditSupport;
import org.eclipse.jubula.client.core.persistence.PMAlreadyLockedException;
import org.eclipse.jubula.client.core.persistence.PMDirtyVersionException;
import org.eclipse.jubula.client.core.persistence.PMException;
-import org.eclipse.jubula.client.ui.constants.Constants;
-import org.eclipse.jubula.client.ui.rcp.Plugin;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.client.ui.rcp.controllers.PMExceptionHandler;
import org.eclipse.jubula.client.ui.rcp.editors.AbstractTestCaseEditor;
import org.eclipse.jubula.client.ui.rcp.editors.JBEditorHelper;
import org.eclipse.jubula.client.ui.rcp.editors.NodeEditorInput;
import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
-import org.eclipse.ui.IViewPart;
/**
@@ -180,21 +178,19 @@ public class TCEditorDndSupport {
public static boolean validateDrop(Viewer sourceViewer, Viewer targetViewer,
IStructuredSelection toDrop, INodePO dropTarget,
boolean allowFromBrowser) {
-
if (toDrop == null || toDrop.isEmpty() || dropTarget == null) {
return false;
}
- if (sourceViewer != null
- && !sourceViewer.equals(targetViewer)) {
-
- if (getTCBrowser() != null) {
- if (!(allowFromBrowser
- && sourceViewer.equals(getTCBrowser().getTreeViewer()))) {
-
- return false;
+ if (sourceViewer != null && !sourceViewer.equals(targetViewer)) {
+ boolean foundOne = false;
+ for (TestCaseBrowser tcb : MultipleTCBTracker.getInstance()
+ .getOpenTCBs()) {
+ if (sourceViewer.equals(tcb.getTreeViewer())) {
+ foundOne = true;
}
- } else {
+ }
+ if (!(allowFromBrowser && foundOne)) {
return false;
}
}
@@ -237,17 +233,6 @@ public class TCEditorDndSupport {
}
/**
- * @return instance of TestCaseBrowser, or null.
- */
- static TestCaseBrowser getTCBrowser() {
- IViewPart viewPart = Plugin.getView(Constants.TC_BROWSER_ID);
- if (viewPart != null) {
- return (TestCaseBrowser)viewPart;
- }
- return null;
- }
-
- /**
* @param editSupport The EditSupport in which to perform the action.
* @param node the node to be dropped.
* @param target the target node.
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TSEditorDndSupport.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TSEditorDndSupport.java
index bcab4d943..8207b1421 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TSEditorDndSupport.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/dnd/TSEditorDndSupport.java
@@ -17,7 +17,9 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jubula.client.core.model.IExecTestCasePO;
import org.eclipse.jubula.client.core.model.INodePO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.client.ui.rcp.editors.AbstractTestCaseEditor;
+import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
/**
@@ -75,17 +77,15 @@ public class TSEditorDndSupport {
return false;
}
- if (sourceViewer != null
- && !sourceViewer.equals(targetViewer)) {
-
- if (TCEditorDndSupport.getTCBrowser() != null) {
- if (!(allowFromBrowser
- && sourceViewer.equals(TCEditorDndSupport
- .getTCBrowser().getTreeViewer()))) {
-
- return false;
+ if (sourceViewer != null && !sourceViewer.equals(targetViewer)) {
+ boolean foundOne = false;
+ for (TestCaseBrowser tcb : MultipleTCBTracker.getInstance()
+ .getOpenTCBs()) {
+ if (sourceViewer.equals(tcb.getTreeViewer())) {
+ foundOne = true;
}
- } else {
+ }
+ if (!(allowFromBrowser && foundOne)) {
return false;
}
}
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 f79f7be12..3cc3e2d5c 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
@@ -13,14 +13,12 @@ package org.eclipse.jubula.client.ui.rcp.handlers;
import org.eclipse.jubula.client.core.model.INodePO;
import org.eclipse.jubula.client.ui.constants.Constants;
import org.eclipse.jubula.client.ui.handlers.AbstractSelectionBasedHandler;
-import org.eclipse.jubula.client.ui.rcp.Plugin;
import org.eclipse.jubula.client.ui.rcp.businessprocess.UINodeBP;
import org.eclipse.jubula.client.ui.rcp.utils.Utils;
import org.eclipse.jubula.client.ui.rcp.views.AbstractJBTreeView;
import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil;
import org.eclipse.jubula.tools.messagehandling.MessageIDs;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
@@ -35,10 +33,10 @@ public abstract class AbstractShowSpecificationHandler
*
* @param node
* the node to show
- * @param viewId
- * the viewId to show the specification in
+ * @param viewPart
+ * the view part to show the specification in
*/
- protected void showSpecUINode(INodePO node, String viewId) {
+ protected void showSpecUINode(INodePO node, IViewPart viewPart) {
if (!Utils.openPerspective(Constants.SPEC_PERSPECTIVE)) {
return;
}
@@ -50,10 +48,8 @@ public abstract class AbstractShowSpecificationHandler
MessageIDs.I_NO_PERSPECTIVE_CHANGE);
return;
}
- IViewPart view = Plugin.showView(viewId, null,
- IWorkbenchPage.VIEW_ACTIVATE);
- if (view instanceof AbstractJBTreeView) {
- AbstractJBTreeView jbtv = (AbstractJBTreeView)view;
+ if (viewPart instanceof AbstractJBTreeView) {
+ AbstractJBTreeView jbtv = (AbstractJBTreeView)viewPart;
UINodeBP.selectNodeInTree(node.getId(), jbtv.getTreeViewer(),
jbtv.getEntityManager());
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/MoveTestCaseHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/MoveTestCaseHandler.java
index c236568c2..96258bedf 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/MoveTestCaseHandler.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/MoveTestCaseHandler.java
@@ -40,10 +40,10 @@ import org.eclipse.jubula.client.core.persistence.NodePM;
import org.eclipse.jubula.client.core.persistence.Persistor;
import org.eclipse.jubula.client.core.persistence.ProjectPM;
import org.eclipse.jubula.client.core.utils.TreeTraverser;
-import org.eclipse.jubula.client.ui.constants.Constants;
import org.eclipse.jubula.client.ui.constants.ContextHelpIds;
import org.eclipse.jubula.client.ui.constants.IconConstants;
import org.eclipse.jubula.client.ui.rcp.Plugin;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.client.ui.rcp.dialogs.ReusedProjectSelectionDialog;
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
import org.eclipse.jubula.client.ui.rcp.utils.Utils;
@@ -60,7 +60,6 @@ import org.eclipse.jubula.tools.messagehandling.MessageInfo;
import org.eclipse.jubula.tools.xml.businessmodell.Component;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IViewPart;
/**
@@ -158,8 +157,7 @@ public class MoveTestCaseHandler extends AbstractHandler {
@SuppressWarnings("unchecked")
public Object execute(ExecutionEvent event) {
// Gather selected nodes
- TestCaseBrowser tcb = getSpecView();
-
+ TestCaseBrowser tcb = MultipleTCBTracker.getInstance().getMainTCB();
if (!(tcb.getSelection() instanceof IStructuredSelection)) {
return null;
}
@@ -476,17 +474,6 @@ public class MoveTestCaseHandler extends AbstractHandler {
}
/**
- * @return instance of TestCaseBrowser, or null.
- */
- private TestCaseBrowser getSpecView() {
- IViewPart viewPart = Plugin.getView(Constants.TC_BROWSER_ID);
- if (viewPart != null) {
- return (TestCaseBrowser)viewPart;
- }
- return null;
- }
-
- /**
* Adds all spec testcase descendants of the given node to the given
* list.
*
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewTestCaseHandlerTCBrowser.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewTestCaseHandlerTCBrowser.java
index 23be243ec..96de77353 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewTestCaseHandlerTCBrowser.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewTestCaseHandlerTCBrowser.java
@@ -11,6 +11,7 @@
package org.eclipse.jubula.client.ui.rcp.handlers;
import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jubula.client.core.businessprocess.db.TestCaseBP;
import org.eclipse.jubula.client.core.constants.InitialValueConstants;
@@ -26,8 +27,11 @@ import org.eclipse.jubula.client.ui.rcp.Plugin;
import org.eclipse.jubula.client.ui.rcp.controllers.PMExceptionHandler;
import org.eclipse.jubula.client.ui.rcp.dialogs.InputDialog;
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
+import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
import org.eclipse.jubula.client.ui.utils.DialogUtils;
import org.eclipse.jubula.tools.exception.ProjectDeletedException;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
/**
* @author BREDEX GmbH
@@ -37,6 +41,7 @@ public class NewTestCaseHandlerTCBrowser extends AbstractNewHandler {
/** {@inheritDoc} */
public Object executeImpl(ExecutionEvent event) {
INodePO parent = getParentNode(event);
+ IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
InputDialog dialog = new InputDialog(getActiveShell(),
Messages.NewTestCaseActionTCTitle,
InitialValueConstants.DEFAULT_TEST_CASE_NAME,
@@ -60,6 +65,11 @@ public class NewTestCaseHandlerTCBrowser extends AbstractNewHandler {
tcName, parent, null);
DataEventDispatcher.getInstance().fireDataChangedListener(
newSpecTC, DataState.Added, UpdateState.all);
+ if (activePart instanceof TestCaseBrowser) {
+ TestCaseBrowser tcb = (TestCaseBrowser) activePart;
+ tcb.getTreeViewer().setSelection(
+ new StructuredSelection(newSpecTC), true);
+ }
} catch (PMException e) {
PMExceptionHandler.handlePMExceptionForMasterSession(e);
} catch (ProjectDeletedException e) {
@@ -68,5 +78,4 @@ public class NewTestCaseHandlerTCBrowser extends AbstractNewHandler {
}
return null;
}
-
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewViewInstanceHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewViewInstanceHandler.java
new file mode 100644
index 000000000..7eb8970a4
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/NewViewInstanceHandler.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 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;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jubula.client.ui.constants.Constants;
+import org.eclipse.jubula.tools.constants.DebugConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @author BREDEX GmbH
+ */
+public class NewViewInstanceHandler extends AbstractHandler {
+ /**
+ * the prefix for the secondary id
+ */
+ private static final String SECONDARY_ID_PREFIX = "instance_"; //$NON-NLS-1$
+
+ /** {@inheritDoc} */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
+ .getActiveWorkbenchWindow(event);
+
+ try {
+ activeWorkbenchWindow.getActivePage().showView(
+ Constants.TC_BROWSER_ID,
+ SECONDARY_ID_PREFIX + System.currentTimeMillis(),
+ IWorkbenchPage.VIEW_ACTIVATE);
+ } catch (PartInitException e) {
+ new ExecutionException(DebugConstants.ERROR, e);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/SetAsMainViewInstanceHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/SetAsMainViewInstanceHandler.java
new file mode 100644
index 000000000..93f0c46ad
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/SetAsMainViewInstanceHandler.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 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;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
+import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @author BREDEX GmbH
+ */
+public class SetAsMainViewInstanceHandler extends AbstractHandler {
+ /** {@inheritDoc} */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
+ if (activePart instanceof TestCaseBrowser) {
+ TestCaseBrowser tcb = (TestCaseBrowser) activePart;
+ MultipleTCBTracker.getInstance().setMainTCB(tcb);
+ }
+ return null;
+ }
+}
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 015863316..fe9aa56ef 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
@@ -12,8 +12,8 @@ package org.eclipse.jubula.client.ui.rcp.handlers;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
-import org.eclipse.jubula.client.ui.constants.Constants;
import org.eclipse.jubula.client.ui.rcp.businessprocess.UINodeBP;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
/**
@@ -22,13 +22,12 @@ import org.eclipse.jubula.client.ui.rcp.businessprocess.UINodeBP;
*
*/
public class ShowSpecificationHandler extends AbstractShowSpecificationHandler {
- /**
- * {@inheritDoc}
- */
- public Object executeImpl(ExecutionEvent event) {
- ISpecTestCasePO specTc = UINodeBP.getSpecTC(getSelection());
- if (specTc != null) {
- showSpecUINode(specTc, Constants.TC_BROWSER_ID);
+ /** {@inheritDoc} */
+ public Object executeImpl(ExecutionEvent event) {
+ ISpecTestCasePO specTc = UINodeBP.getSpecTC(getSelection());
+ if (specTc != null) {
+ showSpecUINode(specTc, MultipleTCBTracker.getInstance()
+ .getMainTCB());
}
return null;
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenTestCaseEditorHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenTestCaseEditorHandler.java
index 3baaa0acd..2522403b0 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenTestCaseEditorHandler.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/open/OpenTestCaseEditorHandler.java
@@ -13,18 +13,16 @@ package org.eclipse.jubula.client.ui.rcp.handlers.open;
import java.util.Iterator;
import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jubula.client.core.businessprocess.db.NodeBP;
import org.eclipse.jubula.client.core.model.INodePO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
-import org.eclipse.jubula.client.ui.constants.Constants;
-import org.eclipse.jubula.client.ui.rcp.Plugin;
-import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
-
+import org.eclipse.ui.handlers.HandlerUtil;
/**
* Handler to open the SpecTestCaseEditor.
- *
+ *
* @author BREDEX GmbH
* @created 05.09.2005
*/
@@ -33,22 +31,15 @@ public class OpenTestCaseEditorHandler extends AbstractOpenHandler {
* {@inheritDoc}
*/
public Object executeImpl(ExecutionEvent event) {
- TestCaseBrowser testSpecTreeView = (TestCaseBrowser)Plugin
- .getView(Constants.TC_BROWSER_ID);
- if (testSpecTreeView == null) {
+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+ if (!(currentSelection instanceof IStructuredSelection)) {
return null;
}
- if (!(testSpecTreeView.getTreeViewer()
- .getSelection() instanceof IStructuredSelection)) {
- return null;
- }
- IStructuredSelection selection = (IStructuredSelection)testSpecTreeView
- .getTreeViewer().getSelection();
- Iterator iter = selection.iterator();
+ Iterator iter = ((IStructuredSelection) currentSelection).iterator();
while (iter.hasNext()) {
Object obj = iter.next();
if (obj instanceof INodePO) {
- INodePO selectedNode = (INodePO)obj;
+ INodePO selectedNode = (INodePO) obj;
INodePO editableNode = findEditableNode(selectedNode);
if (editableNode == null) {
return null;
@@ -58,12 +49,12 @@ public class OpenTestCaseEditorHandler extends AbstractOpenHandler {
}
return null;
}
-
+
/**
* {@inheritDoc}
*/
protected boolean isEditableImpl(INodePO selected) {
- return selected instanceof ISpecTestCasePO
- && NodeBP.isEditable(selected);
+ return selected instanceof ISpecTestCasePO
+ && NodeBP.isEditable(selected);
}
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java
index 7521a6d4e..16fc4c5a8 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java
@@ -812,6 +812,8 @@ public class Messages extends NLS {
public static String StopAUTActionQuestionTextIfcollecting;
public static String StopAUTActionShellTitle;
public static String Suite;
+ public static String TestCaseBrowser;
+ public static String TestCaseBrowserMainPrefix;
public static String TestCaseBrowserLinkWithEditor;
public static String TestCaseBrowser_NoActiveProject;
public static String TestCaseEditorCantDelete;
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties
index ae34e7c93..e7fad9605 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties
@@ -798,6 +798,8 @@ StopAUTActionQuestionText=Are you sure you want to stop the AUT?
StopAUTActionQuestionTextIfcollecting=The client is still collecting monitoring data.\nExiting the AUT now might corrupt the collected data\!\nAre you sure you want to stop the AUT?
StopAUTActionShellTitle=Stop running AUT?
Suite=SUITE
+TestCaseBrowser=Test Case Browser
+TestCaseBrowserMainPrefix=Main
TestCaseBrowserLinkWithEditor=Link with Editor
TestCaseBrowser_NoActiveProject=No Project is currently active. No Reused Projects will be displayed.
TestCaseEditorCantDelete=You cannot delete the Test Case here\!
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/result/BasicSearchResult.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/result/BasicSearchResult.java
index 2781b692f..8cd96f204 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/result/BasicSearchResult.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/search/result/BasicSearchResult.java
@@ -37,6 +37,7 @@ 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.constants.RCPCommandIDs;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.client.ui.rcp.editors.CentralTestDataEditor;
import org.eclipse.jubula.client.ui.rcp.editors.ObjectMappingMultiPageEditor;
import org.eclipse.jubula.client.ui.rcp.handlers.open.AbstractOpenHandler;
@@ -416,22 +417,24 @@ public class BasicSearchResult implements ISearchResult {
Plugin.showView(viewId);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void jumpTo(Long id) {
- AbstractJBTreeView gdtv = (AbstractJBTreeView)Plugin
- .showView(Constants.TC_BROWSER_ID);
- TreeViewer tv = gdtv.getTreeViewer();
- EntityManager em = gdtv.getEntityManager();
+ AbstractJBTreeView jbtv = MultipleTCBTracker.getInstance()
+ .getMainTCB();
+ if (jbtv == null) {
+ jbtv = (AbstractJBTreeView) Plugin
+ .showView(Constants.TC_BROWSER_ID);
+ }
+ TreeViewer tv = jbtv.getTreeViewer();
+ EntityManager em = jbtv.getEntityManager();
INodePO node = UINodeBP.selectNodeInTree(id, tv, em);
if (node == null) {
- gdtv = (AbstractJBTreeView)Plugin
+ jbtv = (AbstractJBTreeView) Plugin
.showView(Constants.TS_BROWSER_ID);
- tv = gdtv.getTreeViewer();
+ tv = jbtv.getTreeViewer();
node = UINodeBP.selectNodeInTree(id, tv, em);
}
- BasicSearchResult.openEditorForNode(node, gdtv);
+ BasicSearchResult.openEditorForNode(node, jbtv);
}
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/ActiveProjectSourceProvider.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/ActiveProjectSourceProvider.java
index 035d006d9..e01217afe 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/ActiveProjectSourceProvider.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/ActiveProjectSourceProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.jubula.client.core.persistence.Persistor;
import org.eclipse.jubula.client.core.utils.DatabaseStateDispatcher;
import org.eclipse.jubula.client.core.utils.DatabaseStateEvent;
import org.eclipse.jubula.client.core.utils.IDatabaseStateListener;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.ui.ISources;
@@ -53,6 +54,12 @@ public class ActiveProjectSourceProvider extends AbstractJBSourceProvider
public static final String IS_DB_CONNECTION_ESTABLISHED =
"org.eclipse.jubula.client.ui.rcp.variable.isConnectionToDatabaseEstablished"; //$NON-NLS-1$
+ /**
+ * ID of variable that indicates whether multiple test case browser instances are open.
+ */
+ public static final String ARE_MULTIPLE_TCB_OPEN =
+ "org.eclipse.jubula.client.ui.rcp.variable.areMultipleTCBOpen"; //$NON-NLS-1$
+
/**
* Constructor.
*/
@@ -60,6 +67,7 @@ public class ActiveProjectSourceProvider extends AbstractJBSourceProvider
DataEventDispatcher.getInstance().addProjectLoadedListener(this, true);
DataEventDispatcher.getInstance().addDataChangedListener(this, true);
DatabaseStateDispatcher.addDatabaseStateListener(this);
+ MultipleTCBTracker.getInstance().setProvider(this);
}
/**
@@ -70,6 +78,7 @@ public class ActiveProjectSourceProvider extends AbstractJBSourceProvider
DataEventDispatcher.getInstance().removeProjectLoadedListener(this);
DataEventDispatcher.getInstance().removeDataChangedListener(this);
DatabaseStateDispatcher.removeDatabaseStateListener(this);
+ MultipleTCBTracker.getInstance().setProvider(null);
}
/**
@@ -87,6 +96,8 @@ public class ActiveProjectSourceProvider extends AbstractJBSourceProvider
currentState.put(IS_PROJECT_PROTECTED, isProjectProtected);
currentState.put(IS_DB_CONNECTION_ESTABLISHED,
Persistor.instance() != null ? true : false);
+ currentState.put(ARE_MULTIPLE_TCB_OPEN,
+ MultipleTCBTracker.getInstance().getOpenTCBs().size() > 1);
return currentState;
}
@@ -97,7 +108,8 @@ public class ActiveProjectSourceProvider extends AbstractJBSourceProvider
public String[] getProvidedSourceNames() {
return new String[] { IS_PROJECT_ACTIVE,
IS_PROJECT_PROTECTED,
- IS_DB_CONNECTION_ESTABLISHED };
+ IS_DB_CONNECTION_ESTABLISHED,
+ ARE_MULTIPLE_TCB_OPEN };
}
/**
@@ -129,6 +141,8 @@ public class ActiveProjectSourceProvider extends AbstractJBSourceProvider
isProjectProtected);
gdFireSourceChanged(ISources.WORKBENCH, IS_DB_CONNECTION_ESTABLISHED,
Persistor.instance() != null ? true : false);
+ gdFireSourceChanged(ISources.WORKBENCH, ARE_MULTIPLE_TCB_OPEN,
+ MultipleTCBTracker.getInstance().getOpenTCBs().size() > 1);
}
/**
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/utils/Utils.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/utils/Utils.java
index c21b8a57c..b5309736a 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/utils/Utils.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/utils/Utils.java
@@ -37,9 +37,11 @@ import org.eclipse.jubula.client.core.persistence.Persistor;
import org.eclipse.jubula.client.core.utils.Languages;
import org.eclipse.jubula.client.ui.constants.Constants;
import org.eclipse.jubula.client.ui.rcp.Plugin;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.client.ui.rcp.controllers.TestExecutionContributor;
import org.eclipse.jubula.client.ui.rcp.editors.PersistableEditorInput;
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
+import org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser;
import org.eclipse.jubula.client.ui.utils.DialogUtils;
import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil;
import org.eclipse.jubula.client.ui.views.ITreeViewerContainer;
@@ -260,7 +262,10 @@ public class Utils {
Plugin.closeAllOpenedJubulaEditors(alsoProjectIndependent);
ded.fireTestresultChanged(TestresultState.Refresh);
setTreeViewerInputNull(Constants.TESTRE_ID);
- setTreeViewerInputNull(Constants.TC_BROWSER_ID);
+ for (TestCaseBrowser tcb : MultipleTCBTracker.getInstance()
+ .getOpenTCBs()) {
+ tcb.getTreeViewer().setInput(null);
+ }
setTreeViewerInputNull(Constants.TS_BROWSER_ID);
setTreeViewerInputNull(Constants.COMPNAMEBROWSER_ID);
clearAnalyzeResultPage();
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/TestCaseBrowser.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/TestCaseBrowser.java
index cc85794eb..2f20ebf79 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/TestCaseBrowser.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/TestCaseBrowser.java
@@ -42,6 +42,7 @@ import org.eclipse.jubula.client.ui.rcp.Plugin;
import org.eclipse.jubula.client.ui.rcp.actions.CutTreeItemActionTCBrowser;
import org.eclipse.jubula.client.ui.rcp.actions.PasteTreeItemActionTCBrowser;
import org.eclipse.jubula.client.ui.rcp.constants.RCPCommandIDs;
+import org.eclipse.jubula.client.ui.rcp.controllers.MultipleTCBTracker;
import org.eclipse.jubula.client.ui.rcp.controllers.dnd.LocalSelectionClipboardTransfer;
import org.eclipse.jubula.client.ui.rcp.controllers.dnd.LocalSelectionTransfer;
import org.eclipse.jubula.client.ui.rcp.controllers.dnd.TCBrowserDndSupport;
@@ -121,6 +122,9 @@ public class TestCaseBrowser extends AbstractJBTreeView
if (GeneralStorage.getInstance().getProject() != null) {
handleProjectLoaded();
}
+
+ // register active view tracker
+ MultipleTCBTracker.getInstance().registerListener();
}
/**
@@ -455,10 +459,16 @@ public class TestCaseBrowser extends AbstractJBTreeView
if (po instanceof ISpecTestCasePO
|| po instanceof ICategoryPO) {
getTreeViewer().refresh();
- getTreeViewer().setSelection(
- new StructuredSelection(po), true);
} else if (po instanceof IProjectPO) {
handleProjectLoaded();
}
}
+
+ /**
+ * @param title
+ * the title
+ */
+ public void setViewTitle(String title) {
+ super.setPartName(title);
+ }
} \ No newline at end of file

Back to the top