Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Torregrosa Paez2016-05-10 07:41:38 -0400
committerPablo Torregrosa Paez2016-05-10 07:41:38 -0400
commit077911a68758a8103ab5d49d2cc0e8d875158e2a (patch)
tree1b11f3e7746174a890ecb41b053a2b78f038be22 /target_explorer
parent46e1ca204904d252667c551b38adb8e2dd9e75ff (diff)
downloadorg.eclipse.tcf-077911a68758a8103ab5d49d2cc0e8d875158e2a.tar.gz
org.eclipse.tcf-077911a68758a8103ab5d49d2cc0e8d875158e2a.tar.xz
org.eclipse.tcf-077911a68758a8103ab5d49d2cc0e8d875158e2a.zip
Target Explorer: Add "Rename" action to the toolbar connection menu.
Change-Id: Ia320636f72ea2adae5dbb45c1ff77a2c45b8e325 Signed-off-by: Pablo Torregrosa Paez <pablo.torregrosa@windriver.com>
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml32
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameToolbarCommandHandler.java27
5 files changed, 67 insertions, 2 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
index cbe139c00..1aaafe387 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
@@ -84,6 +84,7 @@ command.delete.mnemonic=l
command.rename.label=Rename
command.rename.tooltip=Rename the selected connection
+command.rename.toolbar.tooltip=Rename the selected connection
command.rename.mnemonic=R
command.refresh.label=Refresh
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
index b95c939af..e7e21b421 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
@@ -364,6 +364,7 @@
<separator name="group.history" visible="true"/>
<separator name="group.open" visible="true"/>
<separator name="group.delete" visible="false"/>
+ <separator name="group.rename" visible="false"/>
<separator name="group.new" visible="false"/>
<separator name="group.additions" visible="true"/>
</menu>
@@ -631,6 +632,11 @@
commandId="org.eclipse.tcf.te.tcf.ui.toolbar.command.delete"
mnemonic="%command.delete.mnemonic"/>
</menuContribution>
+ <menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.ui.DefaultContextSelectorToolbarContribution?after=group.rename">
+ <command
+ commandId="org.eclipse.tcf.te.tcf.ui.toolbar.command.rename"
+ mnemonic="%command.rename.mnemonic"/>
+ </menuContribution>
<menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.ui.DefaultContextSelectorToolbarContribution?after=group.new">
<command
commandId="org.eclipse.tcf.te.tcf.ui.toolbar.command.new"
@@ -793,6 +799,13 @@
description="%command.delete.toolbar.tooltip">
</command>
<command
+ id="org.eclipse.tcf.te.tcf.ui.toolbar.command.rename"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_Rename"
+ name="%command.rename.label"
+ description="%command.rename.toolbar.tooltip">
+ </command>
+ <command
id="org.eclipse.tcf.te.tcf.ui.command.debug"
categoryId="org.eclipse.tcf.te.ui.commands.category"
helpContextId="org.eclipse.tcf.te.tcf.ui.command_Debug"
@@ -861,6 +874,10 @@
icon="icons/etool16/delete.gif">
</image>
<image
+ commandId="org.eclipse.tcf.te.tcf.ui.toolbar.command.rename"
+ icon="icons/elcl16/rename.gif">
+ </image>
+ <image
commandId="org.eclipse.tcf.te.tcf.ui.command.debug"
icon="icons/etool16/debug_exc.gif">
</image>
@@ -1049,6 +1066,21 @@
</with>
</enabledWhen>
</handler>
+
+ <handler
+ commandId="org.eclipse.tcf.te.tcf.ui.toolbar.command.rename"
+ class="org.eclipse.tcf.te.tcf.ui.handler.RenameToolbarCommandHandler">
+ <activeWhen>
+ <with variable="defaultContextSelection">
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="defaultContextSelection">
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/>
+ </with>
+ </enabledWhen>
+ </handler>
<handler
commandId="org.eclipse.tcf.te.tcf.ui.toolbar.command.debug"
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 e5867b902..073ee7d85 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
@@ -483,6 +483,7 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener, IProperty
}
menuMgr.add(new Separator("group.open")); //$NON-NLS-1$
menuMgr.add(new GroupMarker("group.delete")); //$NON-NLS-1$
+ menuMgr.add(new GroupMarker("group.rename")); //$NON-NLS-1$
menuMgr.add(new GroupMarker("group.new")); //$NON-NLS-1$
menuMgr.add(new Separator("group.additions")); //$NON-NLS-1$
final IMenuService service = (IMenuService)serviceLocator.getService(IMenuService.class);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java
index dacab0ade..379e57a7a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2012, 2016 Wind River Systems, Inc. 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 http://www.eclipse.org/legal/epl-v10.html
@@ -65,7 +65,7 @@ public class RenameHandler extends AbstractHandler {
// Get the shell
shell = HandlerUtil.getActiveShell(event);
// Get the current selection
- ISelection selection = HandlerUtil.getCurrentSelection(event);
+ ISelection selection = getSelection(event);
// Delete the selection
if (selection != null) {
rename(selection, new Callback() {
@@ -82,6 +82,10 @@ public class RenameHandler extends AbstractHandler {
return null;
}
+ protected ISelection getSelection(ExecutionEvent event) {
+ return HandlerUtil.getCurrentSelection(event);
+ }
+
/**
* Renames all elements from the given selection and invokes the
* given callback once done.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameToolbarCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameToolbarCommandHandler.java
new file mode 100644
index 000000000..ec703d5ad
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RenameToolbarCommandHandler.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Wind River Systems, Inc. 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 http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.ui.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
+
+public class RenameToolbarCommandHandler extends RenameHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.handler.RenameHandler#getSelection(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ protected ISelection getSelection(ExecutionEvent event) {
+ return new StructuredSelection(ServiceManager.getInstance().getService(IDefaultContextService.class).getDefaultContext(null));
+ }
+}

Back to the top