mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-30 03:33:37 +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) - [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) - [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) - [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"?>
|
<?eclipse version="3.0"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -148,28 +150,39 @@ Anna Dushistova (MontaVista) - [235934] Launch Shell/Terminal commands enabled
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
<with variable="selection">
|
<with variable="selection">
|
||||||
<count value="1" />
|
<count value="1" />
|
||||||
<iterate>
|
<iterate>
|
||||||
<and>
|
<and>
|
||||||
<test
|
<test
|
||||||
args="shells"
|
property="org.eclipse.rse.core.isOffline"
|
||||||
property="org.eclipse.rse.core.hasSubSystemCategory"
|
value="false">
|
||||||
value="true">
|
</test>
|
||||||
</test>
|
<or>
|
||||||
<instanceof
|
<and>
|
||||||
value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
|
<test
|
||||||
</instanceof>
|
args="shells"
|
||||||
<test
|
property="org.eclipse.rse.core.hasSubSystemCategory"
|
||||||
property="org.eclipse.rse.subsystems.files.isdirectory"
|
value="true">
|
||||||
value="true">
|
</test>
|
||||||
</test>
|
<instanceof
|
||||||
</and>
|
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>
|
</iterate>
|
||||||
</with>
|
</with>
|
||||||
</visibleWhen>
|
</visibleWhen>
|
||||||
</command>
|
</command>
|
||||||
</menuContribution>
|
</menuContribution>
|
||||||
</extension>
|
</extension>
|
||||||
<extension point="org.eclipse.ui.commands">
|
<extension point="org.eclipse.ui.commands">
|
||||||
<command
|
<command
|
||||||
categoryId="org.eclipse.rse.ui.commands.category"
|
categoryId="org.eclipse.rse.ui.commands.category"
|
||||||
id="org.eclipse.rse.shells.ui.actions.LaunchShellCommand"
|
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) - [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
|
* 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) - [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;
|
package org.eclipse.rse.internal.shells.ui.actions;
|
||||||
|
@ -715,6 +716,14 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
{
|
{
|
||||||
enable = checkObjectType(_selected);
|
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:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
|
* 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;
|
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.action.IAction;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
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.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.SystemExportShellHistoryAction;
|
||||||
import org.eclipse.rse.internal.shells.ui.actions.SystemExportShellOutputAction;
|
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.rse.ui.view.SubSystemConfigurationAdapter;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
@ -40,51 +30,8 @@ public class ShellServiceSubSystemConfigurationAdapter extends SubSystemConfigur
|
||||||
{
|
{
|
||||||
protected IAction _exportShellHistoryAction;
|
protected IAction _exportShellHistoryAction;
|
||||||
protected IAction _exportShellOutputAction;
|
protected IAction _exportShellOutputAction;
|
||||||
protected SystemCommandAction _commandAction;
|
|
||||||
protected ImageDescriptor _activeShellImageDescriptor;
|
protected ImageDescriptor _activeShellImageDescriptor;
|
||||||
protected ImageDescriptor _inactiveShellImageDescriptor;
|
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
|
* 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) - [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) - [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) - [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"?>
|
<?eclipse version="3.2"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -62,31 +63,37 @@ Anna Dushistova (MontaVista) - [235934] Launch Shell/Terminal commands enabled
|
||||||
<with variable="selection">
|
<with variable="selection">
|
||||||
<count value="1" />
|
<count value="1" />
|
||||||
<iterate>
|
<iterate>
|
||||||
<or>
|
|
||||||
<and>
|
<and>
|
||||||
<test
|
<test
|
||||||
args="terminals"
|
property="org.eclipse.rse.core.isOffline"
|
||||||
property="org.eclipse.rse.core.hasSubSystemCategory"
|
value="false">
|
||||||
value="true">
|
|
||||||
</test>
|
</test>
|
||||||
<instanceof
|
<or>
|
||||||
value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile">
|
<and>
|
||||||
</instanceof>
|
<test
|
||||||
<test
|
args="terminals"
|
||||||
property="org.eclipse.rse.subsystems.files.isdirectory"
|
property="org.eclipse.rse.core.hasSubSystemCategory"
|
||||||
value="true">
|
value="true">
|
||||||
</test>
|
</test>
|
||||||
</and>
|
<instanceof
|
||||||
<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">
|
value="org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem">
|
||||||
</instanceof>
|
</instanceof>
|
||||||
</or>
|
</or>
|
||||||
</iterate>
|
</and>
|
||||||
</with>
|
</iterate>
|
||||||
</visibleWhen>
|
</with>
|
||||||
</command>
|
</visibleWhen>
|
||||||
</menuContribution>
|
</command>
|
||||||
</extension>
|
</menuContribution>
|
||||||
|
</extension>
|
||||||
<extension point="org.eclipse.ui.commands">
|
<extension point="org.eclipse.ui.commands">
|
||||||
<command
|
<command
|
||||||
categoryId="org.eclipse.rse.ui.commands.category"
|
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"
|
id="org.eclipse.rse.ui.SubSystemPropertyTester"
|
||||||
type="org.eclipse.core.runtime.IAdaptable"
|
type="org.eclipse.core.runtime.IAdaptable"
|
||||||
namespace="org.eclipse.rse.core"
|
namespace="org.eclipse.rse.core"
|
||||||
properties="hasSubSystemCategory"
|
properties="hasSubSystemCategory, isOffline"
|
||||||
class="org.eclipse.rse.internal.ui.subsystems.SubSystemPropertyTester">
|
class="org.eclipse.rse.internal.ui.subsystems.SubSystemPropertyTester">
|
||||||
</propertyTester>
|
</propertyTester>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anna Dushistova (MontaVista) - [227535] [rseterminal][api] terminals.ui should not depend on files.core
|
* 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;
|
package org.eclipse.rse.internal.ui.subsystems;
|
||||||
|
|
||||||
|
@ -48,6 +49,22 @@ public class SubSystemPropertyTester extends PropertyTester {
|
||||||
} else {
|
} else {
|
||||||
return !test;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue