aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Rolka2013-09-17 02:30:17 (EDT)
committerGerrit Code Review @ Eclipse.org2013-09-20 09:38:24 (EDT)
commitd2dcde53acc822bd07066824862836e568378896 (patch)
tree9c087a6f9d541ba8c505081cd82d7e5de61835d5
parent79745c875720d31db238b8de10a1572c1300d8bf (diff)
downloadeclipse.platform.ui-d2dcde53acc822bd07066824862836e568378896.zip
eclipse.platform.ui-d2dcde53acc822bd07066824862836e568378896.tar.gz
eclipse.platform.ui-d2dcde53acc822bd07066824862836e568378896.tar.bz2
Bug 402429 - hiddenToolBarItem perspective extension does not react torefs/changes/19/12819/5
perspective changes Change-Id: Idacaf4ad01eff26cca72b5c0ca3b59aa7e73e8b8 Change-Id: Idacaf4ad01eff26cca72b5c0ca3b59aa7e73e8b8 Signed-off-by: Daniel Rolka <daniel.rolka@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java
index 9fb812c..70828e6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java
@@ -57,6 +57,7 @@ public class CoolBarToTrimManager extends ContributionManager implements ICoolBa
private static final String TOOLBAR_SEPARATOR = "toolbarSeparator"; //$NON-NLS-1$
private static final String MAIN_TOOLBAR_ID = "org.eclipse.ui.main.toolbar"; //$NON-NLS-1$
private static final String OBJECT = "coolbar.object"; //$NON-NLS-1$
+ private static final String PREV_CHILD_VISIBLE = "prevChildVisible"; //$NON-NLS-1$
private MTrimBar topTrim;
private List<MTrimElement> workbenchTrimElements;
private IRendererFactory rendererFactory;
@@ -707,7 +708,11 @@ public class CoolBarToTrimManager extends ContributionManager implements ICoolBa
if (item == null) {
continue;
}
- if (renderer.getToolElement(item) != null) {
+ MToolBarElement toolBarElem = renderer.getToolElement(item);
+ if (toolBarElem != null) {
+ if (container.isVisible()) {
+ setChildVisible(toolBarElem, item, manager);
+ }
continue;
}
if (item instanceof IToolBarContributionItem) {
@@ -738,4 +743,35 @@ public class CoolBarToTrimManager extends ContributionManager implements ICoolBa
}
}
}
+
+ private void setChildVisible(MToolBarElement modelItem, IContributionItem item,
+ IContributionManager manager) {
+ Boolean currentChildVisible = isChildVisible(item, manager);
+ Boolean prevChildVisible = (Boolean) modelItem.getTransientData().get(PREV_CHILD_VISIBLE);
+
+ if (currentChildVisible != null) {
+ if (prevChildVisible == null) {
+ modelItem.getTransientData().put(PREV_CHILD_VISIBLE, modelItem.isVisible());
+ modelItem.setVisible(currentChildVisible);
+ }
+ } else if (prevChildVisible != null) {
+ modelItem.setVisible(prevChildVisible);
+ modelItem.getTransientData().remove(PREV_CHILD_VISIBLE);
+ }
+ }
+
+ private Boolean isChildVisible(IContributionItem item, IContributionManager manager) {
+ Boolean v;
+ IContributionManagerOverrides overrides = manager.getOverrides();
+ if (overrides == null) {
+ v = null;
+ } else {
+ v = overrides.getVisible(item);
+ }
+
+ if (v != null) {
+ return v.booleanValue();
+ }
+ return null;
+ }
}