Skip to content

Commit 62f9b98

Browse files
committed
Allow to hide the context menu in the perspective switcher
Eclipse RCP applications running in the compatibility mode have currently no way of hiding the menu in the perspective switcher. This introduces a model tag in PerspectiveSwitcher which can be set at startup or runtime and will prevent the display of a menu in the perspective switcher.
1 parent ebfb7ec commit 62f9b98

File tree

1 file changed

+4
-0
lines changed
  • bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher

1 file changed

+4
-0
lines changed

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public class PerspectiveSwitcher {
102102
* The ID of the perspective switcher
103103
*/
104104
public static final String PERSPECTIVE_SWITCHER_ID = "org.eclipse.e4.ui.PerspectiveSwitcher"; //$NON-NLS-1$
105+
public static final String NO_MENU = "NoMenu"; //$NON-NLS-1$
105106

106107
/**
107108
* The event {@link IEventBroker}.
@@ -277,6 +278,9 @@ void createWidget(Composite parent, MToolControl toolControl) {
277278
comp.addDisposeListener(e -> dispose());
278279

279280
perspSwitcherToolbar.addMenuDetectListener(e -> {
281+
if (perspSwitcherToolControl.getTags().contains(NO_MENU)) {
282+
return;
283+
}
280284
ToolBar tb = (ToolBar) e.widget;
281285
Point p = new Point(e.x, e.y);
282286
p = perspSwitcherToolbar.getDisplay().map(null, perspSwitcherToolbar, p);

0 commit comments

Comments
 (0)