Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2012-06-08 08:41:29 +0000
committerMarkus Tiede2012-06-08 08:41:29 +0000
commita3abc4aa045ce88dcb6859c05f048b7099bdcc47 (patch)
tree7f26aa7c1bb450b95975300d2ad0ad4d0144d7cb
parentb7426380c3ef486972d6e8118756a00fbe78b34e (diff)
downloadorg.eclipse.jubula.core-a3abc4aa045ce88dcb6859c05f048b7099bdcc47.tar.gz
org.eclipse.jubula.core-a3abc4aa045ce88dcb6859c05f048b7099bdcc47.tar.xz
org.eclipse.jubula.core-a3abc4aa045ce88dcb6859c05f048b7099bdcc47.zip
Fix for issue http://bugzilla.bredex.de/356
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/MultipleTCBTracker.java46
1 files changed, 27 insertions, 19 deletions
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
index 0534bff92..87d4781b8 100644
--- 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
@@ -81,18 +81,7 @@ public class MultipleTCBTracker implements IPartListener2 {
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);
- }
+ setMainTCB(getOpenTCBs().size() > 0 ? getOpenTCBs().get(0) : null);
fireStateChanged();
}
}
@@ -106,7 +95,7 @@ public class MultipleTCBTracker implements IPartListener2 {
public void partOpened(IWorkbenchPartReference partRef) {
if (Constants.TC_BROWSER_ID.equals(partRef.getId())) {
m_tcb.add(partRef);
- if (m_tcb.size() > 1) {
+ if (getOpenTCBs().size() > 0) {
setMainTCB(getOpenTCBs().get(0));
}
fireStateChanged();
@@ -156,15 +145,34 @@ public class MultipleTCBTracker implements IPartListener2 {
/**
* @param mainTCB
- * the mainTCB to set
+ * the mainTCB to set; may be <code>null</code>.
*/
public void setMainTCB(TestCaseBrowser mainTCB) {
- if (m_mainTCB != null) {
- m_mainTCB.setViewTitle(Messages.TestCaseBrowser);
- }
- mainTCB.setViewTitle(Messages.TestCaseBrowserMainPrefix
- + Messages.TestCaseBrowser);
+ TestCaseBrowser oldMainTCB = m_mainTCB;
+ TestCaseBrowser newMainTCB = mainTCB;
+
m_mainTCB = mainTCB;
+
+ if (newMainTCB == null) {
+ return;
+ }
+
+ final String tcbTitle = Messages.TestCaseBrowser;
+ final String mainTcbTitle = Messages.TestCaseBrowserMainPrefix
+ + tcbTitle;
+
+ // reset old name
+ if (oldMainTCB != null) {
+ oldMainTCB.setViewTitle(tcbTitle);
+ }
+
+ // set new TCB name
+ final int tcbCount = getOpenTCBs().size();
+ if (tcbCount == 1) {
+ newMainTCB.setViewTitle(tcbTitle);
+ } else if (tcbCount > 1) {
+ newMainTCB.setViewTitle(mainTcbTitle);
+ }
}
/**

Back to the top