Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRolf Theunissen2020-08-25 19:50:50 +0000
committerRolf Theunissen2020-08-27 11:58:21 +0000
commit95971633200aadb08d626086d444f6778cc4656a (patch)
tree41b71b2549e3262e917f5c323692e8ace319f67d
parentedd57c680fa2a7077f921652418737eb42d78c0e (diff)
downloadeclipse.platform.ui-I20200828-0150.tar.gz
eclipse.platform.ui-I20200828-0150.tar.xz
eclipse.platform.ui-I20200828-0150.zip
Bug 566375 - Disappearing 'View Menu' toolbar button in History viewI20200828-0150
When the view menu became available in the model, the topright was not adjusted in StackRenderer. Fix to properly call the adjustTopRigth in case children are added. Furthermore, the view menu is not synchronized to the E4 model when updateActionBars is called. Enabling this synchronization is too risky now (RC1), therefor bypassing the model and renderers and forcing an UI update of the topright. Change-Id: If5fcf7f90d9257e3a48bae684746a23717b4b152 Signed-off-by: Rolf Theunissen <rolf.theunissen@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java32
2 files changed, 35 insertions, 25 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index a3ee4836249..f2e67f406c1 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
@@ -280,28 +280,7 @@ public class StackRenderer extends LazyStackRenderer {
@Inject
@Optional
void subscribeTopicChildrenChanged(@UIEventTopic(UIEvents.ElementContainer.TOPIC_CHILDREN) Event event) {
-
- Object changedObj = event.getProperty(UIEvents.EventTags.ELEMENT);
- // only interested in changes to toolbars and view menu (not popup menus)
- if (!(changedObj instanceof MToolBar)
- && !(changedObj instanceof MMenu && !(changedObj instanceof MPopupMenu))) {
- return;
- }
-
- MUIElement container = modelService.getContainer((MUIElement) changedObj);
- // check if this is a part's toolbar
- if (container instanceof MPart) {
- MElementContainer<?> parent = ((MPart) container).getParent();
- // only relayout if this part is the selected element and we
- // actually rendered this element
- if (parent instanceof MPartStack && parent.getSelectedElement() == container
- && parent.getRenderer() == StackRenderer.this) {
- Object widget = parent.getWidget();
- if (widget instanceof CTabFolder) {
- adjustTopRight((CTabFolder) widget);
- }
- }
- }
+ shouldTopRightAdjusted(event);
}
@Inject
@@ -449,7 +428,8 @@ public class StackRenderer extends LazyStackRenderer {
Object objElement = event.getProperty(UIEvents.EventTags.ELEMENT);
// Ensure that this event is for a MMenuItem or MToolBar
- if (!(objElement instanceof MMenuElement) && !(objElement instanceof MToolBar)) {
+ if (!(objElement instanceof MMenuElement && !(objElement instanceof MPopupMenu))
+ && !(objElement instanceof MToolBar)) {
return;
}
@@ -715,7 +695,7 @@ public class StackRenderer extends LazyStackRenderer {
}
- protected void adjustTopRight(final CTabFolder tabFolder) {
+ public void adjustTopRight(final CTabFolder tabFolder) {
if (tabFolder.isDisposed()) {
return;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java
index 01cea885f5c..3381f6b4c06 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java
@@ -14,14 +14,19 @@
package org.eclipse.ui.internal.e4.compatibility;
+import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
+import org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer;
import org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.SubActionBars;
import org.eclipse.ui.services.IServiceLocator;
@@ -59,7 +64,14 @@ public class ActionBars extends SubActionBars {
public void updateActionBars() {
// FIXME compat: updateActionBars : should do something useful
getStatusLineManager().update(false);
- getMenuManager().update(false);
+ if (menuManager != null) {
+ menuManager.update(false);
+
+ // Changes in the menuManager are not propagated to the E4 model, forcing UI
+ // update to properly show the view menu, see Bug 566375
+ forceUpdateTopRight();
+ }
+
if (toolbarManager != null) {
toolbarManager.update(true);
@@ -76,6 +88,24 @@ public class ActionBars extends SubActionBars {
super.updateActionBars();
}
+ private void forceUpdateTopRight() {
+ // Get the partstack and the element in the partstack
+ MStackElement element = part;
+ if (element.getCurSharedRef() != null) {
+ element = element.getCurSharedRef();
+ }
+ MUIElement parentElement = element.getParent();
+
+ if (!(parentElement instanceof MPartStack)) {
+ return;
+ }
+
+ Object widget = parentElement.getWidget();
+ if (widget instanceof CTabFolder) {
+ ((StackRenderer) parentElement.getRenderer()).adjustTopRight((CTabFolder) widget);
+ }
+ }
+
@Override
public void dispose() {
menuManager.dispose();

Back to the top