Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-11-29 03:09:53 -0500
committerTobias Schwarz2013-11-29 03:09:53 -0500
commit445c1e04d99cf869534fd199373c0e00a35e08fe (patch)
tree918870cd839e77ddb8a45c10ae001ccca04a0055 /target_explorer
parent7ef4dcb8312d36c57f1462b56b157e52e0aa992e (diff)
downloadorg.eclipse.tcf-445c1e04d99cf869534fd199373c0e00a35e08fe.tar.gz
org.eclipse.tcf-445c1e04d99cf869534fd199373c0e00a35e08fe.tar.xz
org.eclipse.tcf-445c1e04d99cf869534fd199373c0e00a35e08fe.zip
Target Explorer: move editor page menu to end of toolbar
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/etool16/menu.gifbin0 -> 851 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java88
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java5
4 files changed, 54 insertions, 42 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/etool16/menu.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/etool16/menu.gif
new file mode 100644
index 000000000..7d7eba6e3
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/etool16/menu.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java
index fecdd412f..8a8445687 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java
@@ -152,6 +152,9 @@ public class UIPlugin extends AbstractUIPlugin {
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_EVIEW + "targets_view.gif"); //$NON-NLS-1$
registry.put(ImageConsts.VIEW, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ETOOL + "menu.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.MENU, ImageDescriptor.createFromURL(url));
+
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ETOOL + "help.gif"); //$NON-NLS-1$
registry.put(ImageConsts.HELP, ImageDescriptor.createFromURL(url));
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java
index 07506c927..b045054aa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java
@@ -14,13 +14,21 @@ import org.eclipse.help.HelpSystem;
import org.eclipse.help.IContext;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ContributionManager;
+import org.eclipse.jface.action.ControlContribution;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.tcf.te.ui.forms.CustomFormToolkit;
import org.eclipse.tcf.te.ui.forms.FormLayoutFactory;
import org.eclipse.tcf.te.ui.views.activator.UIPlugin;
@@ -43,7 +51,7 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor
// Reference to the toolbar toolBarManager to release menu contributions for
private IToolBarManager toolBarManager = null;
// Reference to the toolbar MenuManager to release menu contributions for
- private IMenuManager menuManager = null;
+// private IMenuManager menuManager = null;
// The default help action class definition
static protected class HelpAction extends Action {
@@ -113,9 +121,9 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor
if (toolBarManager instanceof ContributionManager) {
service.releaseContributions((ContributionManager)toolBarManager);
}
- if (menuManager instanceof ContributionManager) {
- service.releaseContributions((ContributionManager)menuManager);
- }
+// if (menuManager instanceof ContributionManager) {
+// service.releaseContributions((ContributionManager)menuManager);
+// }
}
// Dispose the custom form toolkit
if (toolkit != null) { toolkit.dispose(); toolkit = null; }
@@ -180,14 +188,14 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor
service.populateContributionManager((ContributionManager)toolBarManager, "toolbar:" + getId()); //$NON-NLS-1$
}
- // Add the menu items which will appear in the form header
- menuManager = managedForm.getForm().getForm().getMenuManager();
- // Get the menu service and populate contributed menu actions
- if (service != null && menuManager instanceof ContributionManager) {
- service.populateContributionManager((ContributionManager)menuManager, "menu:" + getId()); //$NON-NLS-1$
- }
- // Trigger an update of the menu widget
- menuManager.update(true);
+// // Add the menu items which will appear in the form header
+// menuManager = managedForm.getForm().getForm().getMenuManager();
+// // Get the menu service and populate contributed menu actions
+// if (service != null && menuManager instanceof ContributionManager) {
+// service.populateContributionManager((ContributionManager)menuManager, "menu:" + getId()); //$NON-NLS-1$
+// }
+// // Trigger an update of the menu widget
+// menuManager.update(true);
// Trigger an update of the toolbar widget
toolBarManager.update(true);
}
@@ -260,35 +268,31 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor
manager.add(new GroupMarker("group.additions")); //$NON-NLS-1$
-// MenuManager mgr = new MenuManager();
-// IMenuService service = (IMenuService) getSite().getService(IMenuService.class);
-// if (service != null) {
-// service.populateContributionManager(mgr, "menu:" + AbstractCustomFormToolkitEditorPage.this.getId()); //$NON-NLS-1$
-// }
-// if (mgr.getSize() > 0) {
-// toolBarManager.add(new ControlContribution("toolbarmenu") { //$NON-NLS-1$
-// @Override
-// protected Control createControl(Composite parent) {
-// final ToolBar tb = new ToolBar(parent, SWT.FLAT);
-// final ToolItem item = new ToolItem(tb, SWT.PUSH);
-// item.addSelectionListener(new SelectionAdapter() {
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// MenuManager mgr = new MenuManager();
-// IMenuService service = (IMenuService) getSite().getService(IMenuService.class);
-// if (service != null) {
-// service.populateContributionManager(mgr, "menu:" + AbstractCustomFormToolkitEditorPage.this.getId()); //$NON-NLS-1$
-// }
-//
-// Menu menu = mgr.createContextMenu(tb);
-//
-// menu.setVisible(true);
-// }
-// });
-// return tb;
-// }
-// });
-// }
+ final MenuManager mgr = new MenuManager();
+ final IMenuService service = (IMenuService) getSite().getService(IMenuService.class);
+ if (service != null) {
+ service.populateContributionManager(mgr, "menu:" + AbstractCustomFormToolkitEditorPage.this.getId()); //$NON-NLS-1$
+ }
+ if (mgr.getSize() > 0) {
+ toolBarManager.add(new ControlContribution("toolbarmenu") { //$NON-NLS-1$
+ @Override
+ protected Control createControl(Composite parent) {
+ final ToolBar tb = new ToolBar(parent, SWT.FLAT);
+ final ToolItem item = new ToolItem(tb, SWT.PUSH);
+ item.setImage(UIPlugin.getImage(ImageConsts.MENU));
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ MenuManager mgr = new MenuManager();
+ service.populateContributionManager(mgr, "menu:" + AbstractCustomFormToolkitEditorPage.this.getId()); //$NON-NLS-1$
+ Menu menu = mgr.createContextMenu(tb);
+ menu.setVisible(true);
+ }
+ });
+ return tb;
+ }
+ });
+ }
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java
index 3e8aa4fa5..d24b6785b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java
@@ -75,6 +75,11 @@ public interface ImageConsts {
public static final String HELP = "HelpAction"; //$NON-NLS-1$
/**
+ * The key to access the menu action image.
+ */
+ public static final String MENU = "MenuAction"; //$NON-NLS-1$
+
+ /**
* The key to access the favorites category image.
*/
public static final String FAVORITES = "Favorites"; //$NON-NLS-1$

Back to the top