Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurtis Windatt2012-10-18 20:19:58 +0000
committerCurtis Windatt2012-10-18 20:19:58 +0000
commit68e0e94fffb2d7ce9739bba81e67cfe4a51c1a43 (patch)
treeb142dbb0a22150f9660eb253b340575c0fa9e578
parente9b68830bd95c74a0821e544efca4d943ec6b79e (diff)
downloadeclipse.platform.ui-68e0e94fffb2d7ce9739bba81e67cfe4a51c1a43.tar.gz
eclipse.platform.ui-68e0e94fffb2d7ce9739bba81e67cfe4a51c1a43.tar.xz
eclipse.platform.ui-68e0e94fffb2d7ce9739bba81e67cfe4a51c1a43.zip
Bug 317207 - View tabs have no context menu - can't make it a fast view
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/Messages.java4
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java65
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/messages.properties10
3 files changed, 59 insertions, 20 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/Messages.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/Messages.java
index af5c3b183a4..49501fa9205 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/Messages.java
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
* 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
@@ -20,8 +20,10 @@ public class Messages extends NLS {
public static String TrimStack_SharedAreaTooltip;
public static String TrimStack_CloseText;
+ public static String TrimStack_DefaultOrientationItem;
public static String TrimStack_RestoreText;
public static String TrimStack_Horizontal;
+ public static String TrimStack_OrientationMenu;
public static String TrimStack_Vertical;
private static final String BUNDLE_NAME = "org.eclipse.e4.ui.workbench.addons.minmax.messages";//$NON-NLS-1$
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
index 0e0a42d2eaa..f8de15850c3 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
@@ -50,6 +50,7 @@ import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
@@ -516,18 +517,25 @@ public class TrimStack {
if (menuPart == null)
return;
- MenuItem closeItem = new MenuItem(trimStackMenu, SWT.NONE);
- closeItem.setText(Messages.TrimStack_CloseText);
- closeItem.addListener(SWT.Selection, new Listener() {
+ MenuItem orientationItem = new MenuItem(trimStackMenu, SWT.CASCADE);
+ orientationItem.setText(Messages.TrimStack_OrientationMenu);
+ Menu orientationMenu = new Menu(orientationItem);
+ orientationItem.setMenu(orientationMenu);
+
+ MenuItem defaultItem = new MenuItem(orientationMenu, SWT.RADIO);
+ defaultItem.setText(Messages.TrimStack_DefaultOrientationItem);
+ defaultItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
- partService.hidePart(menuPart);
+ menuPart.getTags().remove(IPresentationEngine.ORIENTATION_HORIZONTAL);
+ menuPart.getTags().remove(IPresentationEngine.ORIENTATION_VERTICAL);
+ if (isShowing) {
+ setPaneLocation(hostPane);
+ }
}
});
- MenuItem horizontalItem = new MenuItem(trimStackMenu, SWT.CHECK);
+ MenuItem horizontalItem = new MenuItem(orientationMenu, SWT.RADIO);
horizontalItem.setText(Messages.TrimStack_Horizontal);
- horizontalItem.setSelection(menuPart.getTags().contains(
- IPresentationEngine.ORIENTATION_HORIZONTAL));
horizontalItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (menuPart.getTags().contains(IPresentationEngine.ORIENTATION_HORIZONTAL)) {
@@ -542,10 +550,9 @@ public class TrimStack {
}
});
- MenuItem verticalItem = new MenuItem(trimStackMenu, SWT.CHECK);
+ MenuItem verticalItem = new MenuItem(orientationMenu, SWT.RADIO);
verticalItem.setText(Messages.TrimStack_Vertical);
- verticalItem.setSelection(menuPart.getTags().contains(
- IPresentationEngine.ORIENTATION_VERTICAL));
+
verticalItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (menuPart.getTags().contains(IPresentationEngine.ORIENTATION_VERTICAL)) {
@@ -559,6 +566,32 @@ public class TrimStack {
}
}
});
+
+ // Set initial orientation selection
+ if (menuPart.getTags().contains(IPresentationEngine.ORIENTATION_HORIZONTAL)) {
+ horizontalItem.setSelection(true);
+ } else if (menuPart.getTags().contains(IPresentationEngine.ORIENTATION_VERTICAL)) {
+ verticalItem.setSelection(true);
+ } else {
+ defaultItem.setSelection(true);
+ }
+
+ MenuItem restoreItem = new MenuItem(trimStackMenu, SWT.NONE);
+ restoreItem.setText(Messages.TrimStack_RestoreText);
+ restoreItem.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ minimizedElement.getTags().remove(IPresentationEngine.MINIMIZED);
+ }
+ });
+
+ MenuItem closeItem = new MenuItem(trimStackMenu, SWT.NONE);
+ closeItem.setText(Messages.TrimStack_CloseText);
+ closeItem.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ partService.hidePart(menuPart);
+ }
+ });
+
}
});
@@ -570,14 +603,10 @@ public class TrimStack {
ToolItem restoreBtn = new ToolItem(trimStackTB, SWT.PUSH);
restoreBtn.setToolTipText(Messages.TrimStack_RestoreText);
restoreBtn.setImage(getRestoreImage());
- restoreBtn.addSelectionListener(new SelectionListener() {
+ restoreBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
minimizedElement.getTags().remove(IPresentationEngine.MINIMIZED);
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
- minimizedElement.getTags().remove(IPresentationEngine.MINIMIZED);
- }
});
updateTrimStackItems();
@@ -729,6 +758,12 @@ public class TrimStack {
hostPane = null;
}
+ /**
+ * Sets whether this stack should be visible or hidden
+ *
+ * @param show
+ * whether the stack should be visible
+ */
public void showStack(boolean show) {
Control ctf = (Control) minimizedElement.getWidget();
Composite clientArea = getShellClientComposite();
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/messages.properties b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/messages.properties
index 2a270b499b8..1a8b3b5be59 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/messages.properties
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/messages.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2011 IBM Corporation and others.
+# Copyright (c) 2011, 2012 IBM Corporation and others.
# 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
@@ -11,6 +11,8 @@
TrimStack_SharedAreaTooltip = Shared Area
TrimStack_CloseText = &Close
-TrimStack_RestoreText = Restore
-TrimStack_Horizontal = Horizontal
-TrimStack_Vertical = Vertical
+TrimStack_DefaultOrientationItem=&Default
+TrimStack_RestoreText = &Restore
+TrimStack_Horizontal = &Horizontal
+TrimStack_OrientationMenu=&Orientation
+TrimStack_Vertical = &Vertical

Back to the top