mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Fix bug 150490 - run remote command in a visible shell
This commit is contained in:
parent
e29fce740d
commit
12e47b831d
2 changed files with 12 additions and 14 deletions
|
@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.ui,
|
||||||
org.eclipse.rse.core,
|
org.eclipse.rse.core,
|
||||||
org.eclipse.rse.services,
|
org.eclipse.rse.services,
|
||||||
org.eclipse.rse.files.ui,
|
org.eclipse.rse.files.ui,
|
||||||
|
org.eclipse.rse.shells.ui,
|
||||||
org.eclipse.rse.subsystems.files.core,
|
org.eclipse.rse.subsystems.files.core,
|
||||||
org.eclipse.rse.subsystems.shells.core
|
org.eclipse.rse.subsystems.shells.core
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
|
|
||||||
package samples.ui.actions;
|
package samples.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.rse.files.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction;
|
import org.eclipse.rse.files.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction;
|
||||||
import org.eclipse.rse.internal.model.SystemRegistry;
|
|
||||||
import org.eclipse.rse.model.IHost;
|
import org.eclipse.rse.model.IHost;
|
||||||
|
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||||
|
|
||||||
|
@ -45,22 +45,17 @@ public class ShowJarContents extends SystemAbstractRemoteFilePopupMenuExtensionA
|
||||||
try {
|
try {
|
||||||
runCommand(cmdToRun);
|
runCommand(cmdToRun);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
//TODO: Display exception
|
MessageDialog.openError(getShell(), e.getClass().getName(), e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
|
public IRemoteCmdSubSystem getRemoteCmdSubSystem() {
|
||||||
//get the Command subsystem associated with the current host
|
//get the Command subsystem associated with the current host
|
||||||
IHost myHost = getSubSystem().getHost();
|
IHost myHost = getSubSystem().getHost();
|
||||||
ISubSystem[] subsys = SystemRegistry.getSystemRegistry().getSubSystems(myHost);
|
IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
|
||||||
for (int i=0; i<subsys.length; i++) {
|
for (int i=0; i<subsys.length; i++) {
|
||||||
if (subsys[i] instanceof IRemoteCmdSubSystem) {
|
if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
|
||||||
IRemoteCmdSubSystem ss = (IRemoteCmdSubSystem) subsys[i];
|
return subsys[i];
|
||||||
if (ss.getSubSystemConfiguration().supportsCommands()) {
|
|
||||||
// && ss.isConnected()
|
|
||||||
// TODO: Check, if the remote cmd subsys is capable of connecting on demand
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -70,10 +65,12 @@ public class ShowJarContents extends SystemAbstractRemoteFilePopupMenuExtensionA
|
||||||
{
|
{
|
||||||
IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
|
IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
|
||||||
if (cmdss!=null && cmdss.isConnected()) {
|
if (cmdss!=null && cmdss.isConnected()) {
|
||||||
Object[] result = cmdss.runCommand(command, null, "", false); //$NON-NLS-1$
|
//Option A: run the command invisibly
|
||||||
//TODO: Display the result, or is this done in the Shell automatically?
|
//cmdss.runCommand(command, null, "", false); //$NON-NLS-1$
|
||||||
|
//Option B: run the command in a visible shell
|
||||||
|
RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
//TODO: Display error - no command subsystem available
|
MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue