Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime PORHEL2014-02-19 14:08:24 +0000
committerGerrit Code Review @ Eclipse.org2014-03-04 08:45:04 +0000
commit34da73f4221495bd4d06e2435c71d589e4d10895 (patch)
treeb3caf87e81a11c81582ef11995ec5880173f0319
parent7fa6a557434a4183d7c9b290df6bf46fab1016e7 (diff)
downloadorg.eclipse.sirius-34da73f4221495bd4d06e2435c71d589e4d10895.tar.gz
org.eclipse.sirius-34da73f4221495bd4d06e2435c71d589e4d10895.tar.xz
org.eclipse.sirius-34da73f4221495bd4d06e2435c71d589e4d10895.zip
[428322] Enable the dynamic tabbar on Luna
Enable the dynamic tabbar (with visibility conditions and extensions) on Luna and keep the simple fixed tabbar without contibutions for previous eclipse 4.x versions (juno and kepler). Change-Id: I70c7d30b6771f836d6b42e196fab6d044e94903a Signed-off-by: Maxime PORHEL <maxime.porhel@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/tabbar/Tabbar.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/tabbar/Tabbar.java b/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/tabbar/Tabbar.java
index 007f732f91..e6489e7e59 100644
--- a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/tabbar/Tabbar.java
+++ b/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/tabbar/Tabbar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES.
* 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
@@ -37,6 +37,8 @@ import org.eclipse.ui.PlatformUI;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
+import com.google.common.collect.Ranges;
+
/**
* A beautiful tab bar.
*
@@ -113,20 +115,34 @@ public class Tabbar extends Composite implements ISelectionListener, IAuthorityL
}
private void fillForDiagram() {
- Bundle uiWorkbenchBundle = Platform.getBundle("org.eclipse.ui.workbench"); //$NON-NLS-1$
- Version junoStart = Version.parseVersion("3.103");
- //Version keplerStart = Version.parseVersion("3.105");
-
- if (uiWorkbenchBundle != null && uiWorkbenchBundle.getVersion().compareTo(junoStart) >= 0) {
- diagramFiller = new TabbarFillerWithoutContributions(manager, page);
- } else {
+ if (canBeDynamic()) {
diagramFiller = new TabbarFillerWithContributions(manager, page);
+ } else {
+ diagramFiller = new TabbarFillerWithoutContributions(manager, page);
}
diagramFiller.setPart(part);
diagramFiller.fill();
}
/**
+ * Indicates if the tabbar can be dynamic (if the workbench version supports it).
+ * Issues exist with visibleWhen and contributions in Juno and Kepler.
+ *
+ * @return true if the tabbar can be dynamic.
+ */
+ public static boolean canBeDynamic() {
+ Bundle uiWorkbenchBundle = Platform.getBundle("org.eclipse.ui.workbench"); //$NON-NLS-1$
+ Version junoStart = Version.parseVersion("3.103");
+ Version lunaStart = Version.parseVersion("3.106");
+
+ // The check is done on org.eclipse.ui.workbench and not on
+ // org.eclipse.core.runtime to be able to differentiate juno3 and juno
+ // (both have 3.8 as version on the org.eclipse.core.runtime plugin).
+ // Range must not be in [3.103..3.106)
+ return uiWorkbenchBundle != null && !Ranges.closedOpen(junoStart, lunaStart).contains(uiWorkbenchBundle.getVersion());
+ }
+
+ /**
* {@inheritDoc}
*
* @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,

Back to the top