mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +02:00
[252058][251492] Added isOffline property test for a subsystem and moved "Launch Shell" action to the plugin.xml file.
This commit is contained in:
parent
0e7fa9c880
commit
4aab32e065
6 changed files with 90 additions and 97 deletions
|
@ -18,6 +18,8 @@ Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter fro
|
|||
Anna Dushistova (MontaVista) - [226550] [api] Launch Shell and Launch Terminal actions should be contributed declaratively
|
||||
Anna Dushistova (MontaVista) - [234274][api] Launch Shell / Terminal commands menu placement and category
|
||||
Anna Dushistova (MontaVista) - [235934] Launch Shell/Terminal commands enabled when selection is empty
|
||||
Anna Dushistova (MontaVista) - [252058] Actions for shells subsystem should be contributed declaratively
|
||||
Anna Dushistova (MontaVista) - [251492] Launch Shell Action is enabled in Offline mode
|
||||
-->
|
||||
<?eclipse version="3.0"?>
|
||||
<plugin>
|
||||
|
@ -148,28 +150,39 @@ Anna Dushistova (MontaVista) - [235934] Launch Shell/Terminal commands enabled
|
|||
<visibleWhen>
|
||||
<with variable="selection">
|
||||
<count value="1" />
|
||||
<iterate>
|
||||
<and>
|
||||
<test
|
||||
args="shells"
|
||||
property="org.eclipse.rse.core.hasSubSystemCategory"
|
||||
value="true">
|
||||
</test>
|
||||
<instanceof
|
||||
value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
|
||||
</instanceof>
|
||||
<test
|
||||
property="org.eclipse.rse.subsystems.files.isdirectory"
|
||||
value="true">
|
||||
</test>
|
||||
</and>
|
||||
<iterate>
|
||||
<and>
|
||||
<test
|
||||
property="org.eclipse.rse.core.isOffline"
|
||||
value="false">
|
||||
</test>
|
||||
<or>
|
||||
<and>
|
||||
<test
|
||||
args="shells"
|
||||
property="org.eclipse.rse.core.hasSubSystemCategory"
|
||||
value="true">
|
||||
</test>
|
||||
<instanceof
|
||||
value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
|
||||
</instanceof>
|
||||
<test
|
||||
property="org.eclipse.rse.subsystems.files.isdirectory"
|
||||
value="true">
|
||||
</test>
|
||||
</and>
|
||||
<instanceof
|
||||
value="org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem">
|
||||
</instanceof>
|
||||
</or>
|
||||
</and>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<command
|
||||
categoryId="org.eclipse.rse.ui.commands.category"
|
||||
id="org.eclipse.rse.shells.ui.actions.LaunchShellCommand"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||
* Anna Dushistova (MontaVista) - [149285] [ssh] multiple prompts and errors in case of incorrect username
|
||||
* Anna Dushistova (MontaVista) - [252058] Actions for shells subsystem should be contributed declaratively
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.shells.ui.actions;
|
||||
|
@ -715,6 +716,14 @@ public class SystemCommandAction extends SystemBaseAction
|
|||
{
|
||||
enable = checkObjectType(_selected);
|
||||
}
|
||||
} else if (selected instanceof IRemoteCmdSubSystem){
|
||||
_cmdSubSystem = (IRemoteCmdSubSystem)selected;
|
||||
_selected = null;
|
||||
enable = true;
|
||||
} else if (selected instanceof IRemoteFileSubSystem){
|
||||
_cmdSubSystem = RemoteCommandHelpers.getCmdSubSystem(((IRemoteFileSubSystem)selected).getHost());
|
||||
_selected = null;
|
||||
enable = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,26 +12,16 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
|
||||
* Anna Dushistova (MontaVista) - [252058] Actions for shells subsystem should be contributed declaratively
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.shells.ui.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.internal.shells.ui.ShellsUIPlugin;
|
||||
import org.eclipse.rse.internal.shells.ui.actions.SystemCommandAction;
|
||||
import org.eclipse.rse.internal.shells.ui.actions.SystemExportShellHistoryAction;
|
||||
import org.eclipse.rse.internal.shells.ui.actions.SystemExportShellOutputAction;
|
||||
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||
import org.eclipse.rse.ui.SystemMenuManager;
|
||||
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
|
@ -40,51 +30,8 @@ public class ShellServiceSubSystemConfigurationAdapter extends SubSystemConfigur
|
|||
{
|
||||
protected IAction _exportShellHistoryAction;
|
||||
protected IAction _exportShellOutputAction;
|
||||
protected SystemCommandAction _commandAction;
|
||||
protected ImageDescriptor _activeShellImageDescriptor;
|
||||
protected ImageDescriptor _inactiveShellImageDescriptor;
|
||||
|
||||
public IAction[] getSubSystemActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISubSystem selectedSubSystem)
|
||||
{
|
||||
List allActions = new ArrayList();
|
||||
IAction[] baseActions = super.getSubSystemActions(menu, selection, shell, menuGroup, factory, selectedSubSystem);
|
||||
for (int i = 0; i < baseActions.length; i++)
|
||||
{
|
||||
allActions.add(baseActions[i]);
|
||||
}
|
||||
|
||||
//launching shells and finding files
|
||||
if (selectedSubSystem instanceof IRemoteFileSubSystem)
|
||||
{
|
||||
IRemoteFileSubSystem fs = (IRemoteFileSubSystem) selectedSubSystem;
|
||||
IRemoteCmdSubSystem cmdSubSystem = RemoteCommandHelpers.getCmdSubSystem(fs.getHost());
|
||||
if (cmdSubSystem != null)
|
||||
{
|
||||
allActions.add(getCommandShellAction(cmdSubSystem, shell));
|
||||
}
|
||||
}
|
||||
else if (selectedSubSystem instanceof IRemoteCmdSubSystem)
|
||||
{
|
||||
allActions.add(getCommandShellAction((IRemoteCmdSubSystem)selectedSubSystem, shell));
|
||||
}
|
||||
|
||||
return (IAction[])allActions.toArray(new IAction[allActions.size()]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IAction getCommandShellAction(IRemoteCmdSubSystem selectedSubSystem, Shell shell)
|
||||
{
|
||||
if (_commandAction == null)
|
||||
{
|
||||
_commandAction = new SystemCommandAction(shell, true, selectedSubSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
_commandAction.setSubSystem(selectedSubSystem);
|
||||
}
|
||||
return _commandAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the command shell history export action for the subsystem. If there is none, return null
|
||||
|
|
|
@ -17,6 +17,7 @@ Yu-Fen Kuo (MontaVista) - [170910] Integrate Terminal with RSE
|
|||
Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core
|
||||
Anna Dushistova (MontaVista) - [234274][api] Launch Shell / Terminal commands menu placement and category
|
||||
Anna Dushistova (MontaVista) - [235934] Launch Shell/Terminal commands enabled when selection is empty
|
||||
Anna Dushistova (MontaVista) - [251492] Launch Shell Action is enabled in Offline mode
|
||||
-->
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
|
@ -62,31 +63,37 @@ Anna Dushistova (MontaVista) - [235934] Launch Shell/Terminal commands enabled
|
|||
<with variable="selection">
|
||||
<count value="1" />
|
||||
<iterate>
|
||||
<or>
|
||||
<and>
|
||||
<test
|
||||
args="terminals"
|
||||
property="org.eclipse.rse.core.hasSubSystemCategory"
|
||||
value="true">
|
||||
property="org.eclipse.rse.core.isOffline"
|
||||
value="false">
|
||||
</test>
|
||||
<instanceof
|
||||
value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
|
||||
</instanceof>
|
||||
<test
|
||||
property="org.eclipse.rse.subsystems.files.isdirectory"
|
||||
value="true">
|
||||
</test>
|
||||
</and>
|
||||
<instanceof
|
||||
<or>
|
||||
<and>
|
||||
<test
|
||||
args="terminals"
|
||||
property="org.eclipse.rse.core.hasSubSystemCategory"
|
||||
value="true">
|
||||
</test>
|
||||
<instanceof
|
||||
value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
|
||||
</instanceof>
|
||||
<test
|
||||
property="org.eclipse.rse.subsystems.files.isdirectory"
|
||||
value="true">
|
||||
</test>
|
||||
</and>
|
||||
<instanceof
|
||||
value="org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem">
|
||||
</instanceof>
|
||||
</or>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
</instanceof>
|
||||
</or>
|
||||
</and>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<command
|
||||
categoryId="org.eclipse.rse.ui.commands.category"
|
||||
|
|
|
@ -501,7 +501,7 @@ Anna Dushistova (MontaVista) - [234274][api] Launch Shell / Terminal commands m
|
|||
id="org.eclipse.rse.ui.SubSystemPropertyTester"
|
||||
type="org.eclipse.core.runtime.IAdaptable"
|
||||
namespace="org.eclipse.rse.core"
|
||||
properties="hasSubSystemCategory"
|
||||
properties="hasSubSystemCategory, isOffline"
|
||||
class="org.eclipse.rse.internal.ui.subsystems.SubSystemPropertyTester">
|
||||
</propertyTester>
|
||||
</extension>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core
|
||||
* Anna Dushistova (MontaVista) - [251492] Launch Shell Action is enabled in Offline mode
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.internal.ui.subsystems;
|
||||
|
||||
|
@ -48,6 +49,22 @@ public class SubSystemPropertyTester extends PropertyTester {
|
|||
} else {
|
||||
return !test;
|
||||
}
|
||||
}else if (property.toLowerCase().equals("isoffline")){ //$NON-NLS-1$
|
||||
boolean test = ((Boolean) expectedValue).booleanValue();
|
||||
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) receiver)
|
||||
.getAdapter(ISystemViewElementAdapter.class);
|
||||
if (adapter != null) {
|
||||
ISubSystem subsystem = adapter.getSubSystem(receiver);
|
||||
if (subsystem != null) {
|
||||
if(subsystem.isOffline()){
|
||||
return test;
|
||||
}
|
||||
}
|
||||
return !test;
|
||||
} else {
|
||||
return !test;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue