Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-09-09 03:45:39 -0400
committerTobias Schwarz2014-09-09 03:45:39 -0400
commit72466f4a5400a3631efd0570510fab4dc197d0ca (patch)
treef7cd28d0166f7d69f31caeb34bc3f85c4da4211f
parented954c0deaa36ae38983b0a6f4a0671c8a6422d5 (diff)
downloadorg.eclipse.tcf-72466f4a5400a3631efd0570510fab4dc197d0ca.tar.gz
org.eclipse.tcf-72466f4a5400a3631efd0570510fab4dc197d0ca.tar.xz
org.eclipse.tcf-72466f4a5400a3631efd0570510fab4dc197d0ca.zip
Target Explorer: add default context to the toolbar dropdown as well
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java32
1 files changed, 20 insertions, 12 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
index 1adff32ec..c60f9a086 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
@@ -307,22 +307,14 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
menuMgr = new MenuManager();
menuMgr.add(new GroupMarker("group.configurations")); //$NON-NLS-1$
IPeerNode defaultContext = ServiceManager.getInstance().getService(IDefaultContextService.class).getDefaultContext(null);
+ if (defaultContext != null && defaultContext.isVisible()) {
+ menuMgr.add(getAction(defaultContext));
+ }
for (final IPeerNode peerNode : getPeerNodesSorted()) {
if (peerNode == defaultContext || !peerNode.isVisible()) {
continue;
}
- IAction action = new Action() {
- private IPeerNode node = peerNode;
- @Override
- public void run() {
- ServiceManager.getInstance().getService(IDefaultContextService.class).setDefaultContext(node);
- }
- };
- DelegatingLabelProvider labelProvider = new DelegatingLabelProvider();
- action.setText(labelProvider.getText(peerNode));
- Image image = labelProvider.decorateImage(labelProvider.getImage(peerNode), peerNode);
- action.setImageDescriptor(ImageDescriptor.createFromImage(image));
- menuMgr.add(action);
+ menuMgr.add(getAction(peerNode));
}
menuMgr.add(new Separator("group.open")); //$NON-NLS-1$
menuMgr.add(new GroupMarker("group.delete")); //$NON-NLS-1$
@@ -344,6 +336,22 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
}
}
+ protected IAction getAction(final IPeerNode peerNode) {
+ IAction action = new Action() {
+ private IPeerNode node = peerNode;
+ @Override
+ public void run() {
+ ServiceManager.getInstance().getService(IDefaultContextService.class).setDefaultContext(node);
+ }
+ };
+ DelegatingLabelProvider labelProvider = new DelegatingLabelProvider();
+ action.setText(labelProvider.getText(peerNode));
+ Image image = labelProvider.decorateImage(labelProvider.getImage(peerNode), peerNode);
+ action.setImageDescriptor(ImageDescriptor.createFromImage(image));
+
+ return action;
+ }
+
/**
* Get the label provider for a peer model node.
*

Back to the top