mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
[226550] [api] Launch Shell and Launch Terminal actions should be contributed declaratively (patch applied from Anna Dushistova)
This commit is contained in:
parent
ddfb122b6b
commit
87b6c82ef9
4 changed files with 69 additions and 147 deletions
|
@ -55,6 +55,7 @@
|
||||||
* David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
|
* David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
|
||||||
* Rupen Mardirossian (IBM) - [227213] Copy and pasting to the parent folder will create a "Copy of" that resource
|
* Rupen Mardirossian (IBM) - [227213] Copy and pasting to the parent folder will create a "Copy of" that resource
|
||||||
* David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
|
* David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
|
||||||
|
* Anna Dushistova (MontaVista) - [226550] [api] Launch Shell and Launch Terminal actions should be contributed declaratively
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.view;
|
package org.eclipse.rse.internal.files.ui.view;
|
||||||
|
@ -157,7 +158,6 @@ import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileRoot;
|
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileRoot;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResultsContentsType;
|
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResultsContentsType;
|
||||||
import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
|
import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
|
||||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
|
||||||
import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||||
import org.eclipse.rse.ui.ISystemMessages;
|
import org.eclipse.rse.ui.ISystemMessages;
|
||||||
|
@ -3452,8 +3452,6 @@ public class SystemViewRemoteFileAdapter
|
||||||
* If the given value is <code>false</code>, then returns <code>true</code> if the target is not an archive file.</li>
|
* If the given value is <code>false</code>, then returns <code>true</code> if the target is not an archive file.</li>
|
||||||
* <li>name="isVirtual". If the given value is <code>true</code>, then returns <code>true</code> if the target is a virtual file.
|
* <li>name="isVirtual". If the given value is <code>true</code>, then returns <code>true</code> if the target is a virtual file.
|
||||||
* If the given value is <code>false</code>, then returns <code>true</code> if the target is not a virtual file.</li>
|
* If the given value is <code>false</code>, then returns <code>true</code> if the target is not a virtual file.</li>
|
||||||
* <li>name="isCommandSubSystemExists". If the given value is <code>true</code>, then returns <code>true</code> if the host contains a command subsystem.
|
|
||||||
* If the given value is <code>false</code>, then returns <code>true</code> if the host does not contain a command subsystem.</li>
|
|
||||||
* </ol>
|
* </ol>
|
||||||
* <p>
|
* <p>
|
||||||
* @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
|
* @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
|
||||||
|
@ -3635,32 +3633,6 @@ public class SystemViewRemoteFileAdapter
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (inName.equals("iscommandsubsystemexists")) { //$NON-NLS-1$
|
|
||||||
|
|
||||||
boolean test = value.equals("true"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
ISubSystem subsystem = getSubSystem(tgt);
|
|
||||||
|
|
||||||
if (subsystem != null) {
|
|
||||||
IHost host = subsystem.getHost();
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
|
||||||
|
|
||||||
ISubSystem[] subsystems = registry.getSubSystems(host);
|
|
||||||
|
|
||||||
for (int i = 0; i < subsystems.length; i++) {
|
|
||||||
ISubSystem temp = subsystems[i];
|
|
||||||
|
|
||||||
if (temp instanceof IRemoteCmdSubSystem) {
|
|
||||||
return test;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return !test;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return !test;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.testAttribute(target, name, value);
|
return super.testAttribute(target, name, value);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
|
Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
|
||||||
This program and the accompanying materials are made available under the terms
|
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
|
of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
available at http://www.eclipse.org/legal/epl-v10.html
|
available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -15,6 +15,7 @@ Contributors:
|
||||||
Martin Oberhuber (Wind River) - [180519] declaratively register adapter factories
|
Martin Oberhuber (Wind River) - [180519] declaratively register adapter factories
|
||||||
Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
||||||
Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
|
Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
|
||||||
|
Anna Dushistova (MontaVista) - [226550] [api] Launch Shell and Launch Terminal actions should be contributed declaratively
|
||||||
-->
|
-->
|
||||||
<?eclipse version="3.0"?>
|
<?eclipse version="3.0"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -133,38 +134,52 @@ Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter fro
|
||||||
</page>
|
</page>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.popupMenus">
|
point="org.eclipse.ui.menus">
|
||||||
<objectContribution
|
<menuContribution
|
||||||
objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"
|
locationURI="popup:org.eclipse.rse.ui.view.systemView?after=additions">
|
||||||
id="org.eclipse.rse.shells.ui.launch">
|
<command
|
||||||
<visibility>
|
commandId="org.eclipse.rse.shells.ui.actions.LaunchShellCommand"
|
||||||
<and>
|
icon="icons/full/obj16/systemshell.gif"
|
||||||
<objectState name="isdirectory" value="true"/>
|
|
||||||
<objectState name="isCommandSubSystemExists" value="true"/>
|
|
||||||
</and>
|
|
||||||
</visibility>
|
|
||||||
<action
|
|
||||||
label="%Launch_Shell"
|
label="%Launch_Shell"
|
||||||
icon="icons/full/obj16/systemshell.gif"
|
tooltip="%Launch_Shell_Tooltip">
|
||||||
tooltip="%Launch_Shell_Tooltip"
|
<visibleWhen>
|
||||||
class="org.eclipse.rse.internal.shells.ui.actions.LaunchShellActionDelegate"
|
<iterate>
|
||||||
enablesFor="1"
|
<and>
|
||||||
id="org.eclipse.rse.shells.ui.actions.LaunchShellActionDelegate">
|
<test
|
||||||
</action>
|
args="shells"
|
||||||
<!--
|
property="org.eclipse.rse.core.hasSubSystemCategory"
|
||||||
<action
|
value="true">
|
||||||
label="test command"
|
</test>
|
||||||
icon="icons/full/obj16/systemshell.gif"
|
<instanceof
|
||||||
tooltip="%Launch_Shell_Tooltip"
|
value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
|
||||||
class="org.eclipse.rse.shells.ui.actions.LaunchCommandActionDelegate"
|
</instanceof>
|
||||||
enablesFor="1"
|
<test
|
||||||
id="org.eclipse.rse.shells.ui.actions.LaunchCommandActionDelegate">
|
property="org.eclipse.rse.subsystems.files.isdirectory"
|
||||||
</action>
|
value="true">
|
||||||
-->
|
</test>
|
||||||
</objectContribution>
|
</and>
|
||||||
|
</iterate>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
|
</extension>
|
||||||
|
<extension point="org.eclipse.ui.commands">
|
||||||
|
<category
|
||||||
|
id="org.eclipse.rse.shells.ui.commands.category"
|
||||||
|
name="Shells">
|
||||||
|
</category>
|
||||||
|
<command
|
||||||
|
categoryId="org.eclipse.rse.shells.ui.commands.category"
|
||||||
|
id="org.eclipse.rse.shells.ui.actions.LaunchShellCommand"
|
||||||
|
name="%Launch_Shell">
|
||||||
|
</command>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.handlers">
|
||||||
|
<handler
|
||||||
|
class="org.eclipse.rse.internal.shells.ui.handlers.LaunchShellCommandHandler"
|
||||||
|
commandId="org.eclipse.rse.shells.ui.actions.LaunchShellCommand">
|
||||||
|
</handler>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
/********************************************************************************
|
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation 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
|
|
||||||
*
|
|
||||||
* Initial Contributors:
|
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.shells.ui.actions;
|
|
||||||
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.rse.ui.SystemBasePlugin;
|
|
||||||
import org.eclipse.ui.IActionDelegate;
|
|
||||||
import org.eclipse.ui.actions.ActionDelegate;
|
|
||||||
|
|
||||||
public class LaunchCommandActionDelegate extends ActionDelegate implements IActionDelegate
|
|
||||||
{
|
|
||||||
private SystemCommandAction _launchAction;
|
|
||||||
private ISelection _selection;
|
|
||||||
public LaunchCommandActionDelegate()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run(IAction action)
|
|
||||||
{
|
|
||||||
if (_launchAction == null)
|
|
||||||
{
|
|
||||||
_launchAction = new SystemCommandAction(SystemBasePlugin.getActiveWorkbenchShell(), false);
|
|
||||||
}
|
|
||||||
_launchAction.updateSelection((IStructuredSelection)_selection);
|
|
||||||
_launchAction.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
|
||||||
*/
|
|
||||||
public void selectionChanged(IAction action, ISelection selection)
|
|
||||||
{
|
|
||||||
_selection = selection;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -12,42 +12,30 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||||
|
* Anna Dushistova (MontaVista) - Adopted from LaunchShellActionDelegate
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.shells.ui.handlers;
|
||||||
|
|
||||||
package org.eclipse.rse.internal.shells.ui.actions;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.rse.internal.shells.ui.actions.SystemCommandAction;
|
||||||
import org.eclipse.rse.ui.SystemBasePlugin;
|
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||||
import org.eclipse.ui.IActionDelegate;
|
import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
import org.eclipse.ui.actions.ActionDelegate;
|
|
||||||
|
|
||||||
public class LaunchShellActionDelegate extends ActionDelegate implements IActionDelegate
|
public class LaunchShellCommandHandler extends AbstractHandler {
|
||||||
{
|
|
||||||
private SystemCommandAction _launchAction;
|
private SystemCommandAction _launchAction;
|
||||||
private ISelection _selection;
|
|
||||||
public LaunchShellActionDelegate()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run(IAction action)
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
{
|
if (_launchAction == null) {
|
||||||
if (_launchAction == null)
|
_launchAction = new SystemCommandAction(SystemBasePlugin
|
||||||
{
|
.getActiveWorkbenchShell(), true);
|
||||||
_launchAction = new SystemCommandAction(SystemBasePlugin.getActiveWorkbenchShell(), true);
|
|
||||||
}
|
}
|
||||||
_launchAction.updateSelection((IStructuredSelection)_selection);
|
_launchAction.updateSelection((IStructuredSelection) HandlerUtil
|
||||||
|
.getCurrentSelection(event));
|
||||||
_launchAction.run();
|
_launchAction.run();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
|
||||||
*/
|
|
||||||
public void selectionChanged(IAction action, ISelection selection)
|
|
||||||
{
|
|
||||||
_selection = selection;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue