diff options
author | Lars Vogel | 2014-04-22 16:22:10 +0000 |
---|---|---|
committer | Lars Vogel | 2014-04-23 09:16:13 +0000 |
commit | c39657e9283a347923dd161606620410ebbb6b5e (patch) | |
tree | 899b93219fbd406984eeb16bf0b114c0c6045cf3 | |
parent | 58d30a2dbfdb8ebcfa7f99cf336de223ce8fd5c3 (diff) | |
download | eclipse.platform.ui-c39657e9283a347923dd161606620410ebbb6b5e.tar.gz eclipse.platform.ui-c39657e9283a347923dd161606620410ebbb6b5e.tar.xz eclipse.platform.ui-c39657e9283a347923dd161606620410ebbb6b5e.zip |
Bug 433234 - Use IPresentationEngine.HIDDEN_EXPLICITLY is
ToolbarManagerRenderer
Change-Id: I6297fc8a66b4a97fb8c1c152221c9c0699accf32
Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com>
2 files changed, 15 insertions, 25 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarManagerRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarManagerRenderer.java index 51129a75056..77ef82b0123 100644 --- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarManagerRenderer.java +++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarManagerRenderer.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Maxime Porhel <maxime.porhel@obeo.fr> Obeo - Bug 410426 - * Lars Vogel <Lars.Vogel@gmail.com> - Bug 426535 + * Lars Vogel <Lars.Vogel@gmail.com> - Bug 426535, 433234 * Maxime Porhel <maxime.porhel@obeo.fr> Obeo - Bug 431778 *******************************************************************************/ package org.eclipse.e4.ui.workbench.renderers.swt; @@ -99,15 +99,6 @@ public class ToolBarManagerRenderer extends SWTPartRenderer { public static final String UPDATE_VARS = "ToolBarManagerRenderer.updateVars"; //$NON-NLS-1$ private static final String DISPOSE_ADDED = "ToolBarManagerRenderer.disposeAdded"; //$NON-NLS-1$ - /** - * This is a persistedState 'key' which can be used by the renderer - * implementation to decide that a user interface element has been hidden by - * the user - * - */ - // TODO migrate to IPresentationEngine after the Luna release - public static final String HIDDEN_BY_USER = "HIDDEN_BY_USER"; //$NON-NLS-1$ - private Map<MToolBar, ToolBarManager> modelToManager = new HashMap<MToolBar, ToolBarManager>(); private Map<ToolBarManager, MToolBar> managerToModel = new HashMap<ToolBarManager, MToolBar>(); @@ -327,13 +318,13 @@ public class ToolBarManagerRenderer extends SWTPartRenderer { if (UIEvents.isADD(event)) { if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, - HIDDEN_BY_USER)) { + IPresentationEngine.HIDDEN_EXPLICITLY)) { changedElement.setVisible(false); changedElement.setToBeRendered(false); } } else if (UIEvents.isREMOVE(event)) { if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, - HIDDEN_BY_USER)) { + IPresentationEngine.HIDDEN_EXPLICITLY)) { changedElement.setVisible(true); changedElement.setToBeRendered(true); } @@ -347,7 +338,8 @@ public class ToolBarManagerRenderer extends SWTPartRenderer { List<MToolBar> toolBars = modelService.findElements(application, null, MToolBar.class, null); for (MToolBar mToolBar : toolBars) { - if (mToolBar.getTags().contains(HIDDEN_BY_USER)) { + if (mToolBar.getTags().contains( + IPresentationEngine.HIDDEN_EXPLICITLY)) { mToolBar.setVisible(false); mToolBar.setToBeRendered(false); } @@ -439,7 +431,8 @@ public class ToolBarManagerRenderer extends SWTPartRenderer { hideItem.setText(Messages.ToolBarManagerRenderer_MenuCloseText); hideItem.addListener(SWT.Selection, new Listener() { public void handleEvent(org.eclipse.swt.widgets.Event event) { - toolbarModel.getTags().add(HIDDEN_BY_USER); + toolbarModel.getTags().add( + IPresentationEngine.HIDDEN_EXPLICITLY); } }); @@ -450,7 +443,7 @@ public class ToolBarManagerRenderer extends SWTPartRenderer { .setText(Messages.ToolBarManagerRenderer_MenuRestoreText); restoreHiddenItems.addListener(SWT.Selection, new Listener() { public void handleEvent(org.eclipse.swt.widgets.Event event) { - removeHiddenByUserTags(toolbarModel); + removeHiddenTags(toolbarModel); } }); renderedCtrl.setMenu(toolbarMenu); @@ -1060,16 +1053,16 @@ public class ToolBarManagerRenderer extends SWTPartRenderer { } /** - * Removes the IPresentationEngine.HIDDEN_BY_USER from the toolbars - * + * Removes the IPresentationEngine.HIDDEN_EXPLICITLY from the toolbar entres + * * @param toolbarModel */ - private void removeHiddenByUserTags(MToolBar toolbarModel) { + private void removeHiddenTags(MToolBar toolbarModel) { MWindow mWindow = modelService.getTopLevelWindowFor(toolbarModel); List<MToolBar> toolBars = modelService.findElements(mWindow, null, MToolBar.class, null); for (MToolBar mToolBar : toolBars) { - mToolBar.getTags().remove(HIDDEN_BY_USER); + mToolBar.getTags().remove(IPresentationEngine.HIDDEN_EXPLICITLY); } } diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java index e3c912ceec2..656c7f66c17 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java @@ -9,7 +9,7 @@ * IBM Corporation - initial API and implementation * Christian Janz - <christian.janz@gmail.com> Fix for Bug 385592 * Marc-Andre Laperle (Ericsson) - Fix for Bug 413590 - * Lars Vogel <Lars.Vogel@gmail.com> - Bug 431340, 431348, Bug 426535 + * Lars Vogel <Lars.Vogel@gmail.com> - Bug 431340, 431348, 426535, 433234 *******************************************************************************/ package org.eclipse.ui.internal; @@ -3375,13 +3375,10 @@ public class WorkbenchPage extends CompatibleWorkbenchPage implements tags.clear(); tags.addAll(dummyPerspective.getTags()); - // remove HIDDEN_BY_USER tags from toolbar - // need to reset all window / perspective relevant elements if - // HIDDEN_BY_USER - // get implemented by more renderer + // remove HIDDEN_EXPLICITLY tag from toolbar List<MToolBar> toolBars = modelService.findElements(window, null, MToolBar.class, null); for (MToolBar mToolBar : toolBars) { - mToolBar.getTags().remove("HIDDEN_BY_USER"); //$NON-NLS-1$ + mToolBar.getTags().remove(IPresentationEngine.HIDDEN_EXPLICITLY); } partService.requestActivation(); |