Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-02-20 08:16:53 -0500
committerTobias Schwarz2014-02-20 08:16:53 -0500
commit2f7c740ae43d4c393dc15d7ddcb1c9f4b1c63f08 (patch)
tree9625be2d21d2da83bd5530dc47ab51479230b867
parent0441e464796d4985490be686a5a896659cf1e5f1 (diff)
downloadorg.eclipse.tcf-2f7c740ae43d4c393dc15d7ddcb1c9f4b1c63f08.tar.gz
org.eclipse.tcf-2f7c740ae43d4c393dc15d7ddcb1c9f4b1c63f08.tar.xz
org.eclipse.tcf-2f7c740ae43d4c393dc15d7ddcb1c9f4b1c63f08.zip
Target Explorer: added connection name to toolbar connect/disconnect
action
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ConnectableToolbarCommandHandler.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties3
4 files changed, 42 insertions, 3 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ConnectableToolbarCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ConnectableToolbarCommandHandler.java
index dd4c8e0f0..4123abee6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ConnectableToolbarCommandHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ConnectableToolbarCommandHandler.java
@@ -10,18 +10,25 @@
package org.eclipse.tcf.te.tcf.ui.handler;
+import java.util.Map;
+
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.handler.ConnectableCommandHandler;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.menus.UIElement;
/**
* ConnectableToolbarCommandHandler
*/
-public class ConnectableToolbarCommandHandler extends ConnectableCommandHandler {
+public class ConnectableToolbarCommandHandler extends ConnectableCommandHandler implements IElementUpdater {
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.handler.AbstractCommandHandler#getSelection(org.eclipse.core.commands.ExecutionEvent)
@@ -31,4 +38,24 @@ public class ConnectableToolbarCommandHandler extends ConnectableCommandHandler
IPeerNode defaultContext = ServiceManager.getInstance().getService(IDefaultContextService.class).getDefaultContext(null);
return defaultContext != null ? new StructuredSelection(defaultContext) : new StructuredSelection();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.commands.IElementUpdater#updateElement(org.eclipse.ui.menus.UIElement, java.util.Map)
+ */
+ @Override
+ public void updateElement(UIElement element, Map parameters) {
+ IPeerNode defaultContext = ServiceManager.getInstance().getService(IDefaultContextService.class).getDefaultContext(null);
+ if (defaultContext != null) {
+ if (action == IConnectable.ACTION_CONNECT) {
+ element.setTooltip(NLS.bind(Messages.ConnectableToolbarCommandHandler_tooltip_connect, defaultContext.getName()));
+ }
+ else if (action == IConnectable.ACTION_DISCONNECT) {
+ element.setTooltip(NLS.bind(Messages.ConnectableToolbarCommandHandler_tooltip_disconnect, defaultContext.getName()));
+ }
+ else {
+ element.setTooltip(null);
+ }
+
+ }
+ }
}
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 500dbc1cf..10e9164d3 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
@@ -59,6 +59,7 @@ import org.eclipse.tcf.te.ui.views.ViewsUtil;
import org.eclipse.tcf.te.ui.views.handler.OpenEditorHandler;
import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.menus.IMenuService;
import org.eclipse.ui.menus.IWorkbenchContribution;
import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
@@ -361,8 +362,13 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
ChangeEvent changeEvent = (ChangeEvent)event;
IPeerNode peerNode = ServiceManager.getInstance().getService(IDefaultContextService.class).getDefaultContext(null);
boolean openEditorOnChange = UIPlugin.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_OPEN_EDITOR_ON_DEFAULT_CONTEXT_CHANGE);
- if (openEditorOnChange && peerNode != null && changeEvent.getSource() instanceof IDefaultContextService) {
- ViewsUtil.openEditor(new StructuredSelection(peerNode));
+ if (peerNode != null && changeEvent.getSource() instanceof IDefaultContextService) {
+ ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ service.refreshElements("org.eclipse.tcf.te.ui.toolbar.command.connect", null); //$NON-NLS-1$
+ service.refreshElements("org.eclipse.tcf.te.ui.toolbar.command.disconnect", null); //$NON-NLS-1$
+ if (openEditorOnChange) {
+ ViewsUtil.openEditor(new StructuredSelection(peerNode));
+ }
}
if (changeEvent.getSource() instanceof IDefaultContextService ||
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
index c20c74d75..5ac8c992c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
@@ -165,6 +165,9 @@ public class Messages extends NLS {
public static String CategoryManager_dnd_failed;
+ public static String ConnectableToolbarCommandHandler_tooltip_connect;
+ public static String ConnectableToolbarCommandHandler_tooltip_disconnect;
+
public static String RenameHandler_error_title;
public static String RenameHandler_error_renameFailed;
public static String RenameHandler_dialog_title;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
index 6c7d6f84e..86fd75d19 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
@@ -130,6 +130,9 @@ RenameHandler_dialog_error_nameExist=A connection with the name you specified al
RenameHandler_dialog_error_nameFormat=The name you specified contains illegal characters. Specify a different name.
RenameHandler_dialog_promptNewName=New Name:
+ConnectableToolbarCommandHandler_tooltip_connect=Connect ''{0}''
+ConnectableToolbarCommandHandler_tooltip_disconnect=Disconnect ''{0}''
+
TargetSelectorSection_title=Target
TargetSelectorSection_button_enableReal=Use running Target:
TargetSelectorSection_button_enableSimulator=Start local Simulator:

Back to the top