diff options
Diffstat (limited to 'target_explorer')
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)); + } +} |