mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-21 07:05:58 +02:00
[cleanup] commented out superfluous shell references, rewrote runnablecontext support
This commit is contained in:
parent
e97fb98f5f
commit
c932705105
2 changed files with 68 additions and 71 deletions
|
@ -811,8 +811,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
*/
|
*/
|
||||||
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
|
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
|
||||||
{
|
{
|
||||||
if (shell != null)
|
//dwd if (shell != null)
|
||||||
this.shell = shell;
|
//dwd this.shell = shell;
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
{
|
{
|
||||||
return internalRunCommand(null, command, context, interpretOutput);
|
return internalRunCommand(null, command, context, interpretOutput);
|
||||||
|
@ -821,7 +821,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; // FIXME remove this
|
//dwd this.shell = shell; // FIXME remove this
|
||||||
|
|
||||||
RunCommandJob job = new RunCommandJob(command, context, interpretOutput);
|
RunCommandJob job = new RunCommandJob(command, context, interpretOutput);
|
||||||
|
|
||||||
|
@ -847,8 +847,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
*/
|
*/
|
||||||
public IRemoteCommandShell runShell(Object context) throws Exception
|
public IRemoteCommandShell runShell(Object context) throws Exception
|
||||||
{
|
{
|
||||||
if (shell != null)
|
//dwd if (shell != null)
|
||||||
this.shell = shell;
|
//dwd this.shell = shell;
|
||||||
IRemoteCommandShell cmdShell = null;
|
IRemoteCommandShell cmdShell = null;
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
{
|
{
|
||||||
|
@ -858,7 +858,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; // FIXME remove this
|
//dwd this.shell = shell; // FIXME remove this
|
||||||
RunShellJob job = new RunShellJob(context);
|
RunShellJob job = new RunShellJob(context);
|
||||||
|
|
||||||
IStatus status = scheduleJob(job, null, true);
|
IStatus status = scheduleJob(job, null, true);
|
||||||
|
@ -912,7 +912,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; // FIXME remove this
|
//dwd this.shell = shell; // FIXME remove this
|
||||||
SendCommandToShellJob job = new SendCommandToShellJob(input, commandObject);
|
SendCommandToShellJob job = new SendCommandToShellJob(input, commandObject);
|
||||||
|
|
||||||
IStatus status = scheduleJob(job, null, true);
|
IStatus status = scheduleJob(job, null, true);
|
||||||
|
@ -955,7 +955,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; // FIXME remove this
|
//dwd this.shell = shell; // FIXME remove this
|
||||||
CancelShellJob job = new CancelShellJob(commandObject);
|
CancelShellJob job = new CancelShellJob(commandObject);
|
||||||
scheduleJob(job, null, false);
|
scheduleJob(job, null, false);
|
||||||
}
|
}
|
||||||
|
@ -995,7 +995,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; // FIXME remove this
|
//dwd this.shell = shell; // FIXME remove this
|
||||||
RemoveShellJob job = new RemoveShellJob(commandObject);
|
RemoveShellJob job = new RemoveShellJob(commandObject);
|
||||||
scheduleJob(job, null, false);
|
scheduleJob(job, null, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
|
@ -128,7 +129,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
protected ISubSystemConfiguration parentSubSystemConfiguration;
|
protected ISubSystemConfiguration parentSubSystemConfiguration;
|
||||||
protected String previousUserIdKey;
|
protected String previousUserIdKey;
|
||||||
|
|
||||||
protected Shell shell;
|
protected Shell shell = null;
|
||||||
protected boolean supportsConnecting = true;
|
protected boolean supportsConnecting = true;
|
||||||
protected boolean sortResults = true;
|
protected boolean sortResults = true;
|
||||||
protected boolean runInThread = true;
|
protected boolean runInThread = true;
|
||||||
|
@ -155,6 +156,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
*/
|
*/
|
||||||
protected ISystemFilterPoolReferenceManager filterPoolReferenceManager = null;
|
protected ISystemFilterPoolReferenceManager filterPoolReferenceManager = null;
|
||||||
|
|
||||||
|
private class NullRunnableContext implements IRunnableContext {
|
||||||
|
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
|
||||||
|
IProgressMonitor monitor = new NullProgressMonitor();
|
||||||
|
runnable.run(monitor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inner class which extends UIJob to connect this connection
|
* Inner class which extends UIJob to connect this connection
|
||||||
|
@ -185,8 +192,6 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
}
|
}
|
||||||
if (shell == null)
|
if (shell == null)
|
||||||
shell = SystemBasePlugin.getActiveWorkbenchShell();
|
shell = SystemBasePlugin.getActiveWorkbenchShell();
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connect(false);
|
connect(false);
|
||||||
|
@ -1992,7 +1997,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
ResolveAbsoluteJob job = new ResolveAbsoluteJob(filterString);
|
ResolveAbsoluteJob job = new ResolveAbsoluteJob(filterString);
|
||||||
|
|
||||||
IStatus status = scheduleJob(job, null, shell != null);
|
IStatus status = scheduleJob(job, null, shell != null);
|
||||||
|
@ -2052,7 +2057,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
ResolveAbsolutesJob job = new ResolveAbsolutesJob(filterStrings[0], filterStrings);
|
ResolveAbsolutesJob job = new ResolveAbsolutesJob(filterStrings[0], filterStrings);
|
||||||
|
|
||||||
IStatus status = scheduleJob(job, null, true);
|
IStatus status = scheduleJob(job, null, true);
|
||||||
|
@ -2077,7 +2082,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
|
|
||||||
protected IStatus scheduleJob(SubSystemOperationJob job, ISchedulingRule rule, boolean synch) throws InterruptedException
|
protected IStatus scheduleJob(SubSystemOperationJob job, ISchedulingRule rule, boolean synch) throws InterruptedException
|
||||||
{
|
{
|
||||||
IRunnableContext context = getRunnableContext(shell);
|
IRunnableContext context = getRunnableContext(/*shell*/); // dwd needed for side effect or for prompt?
|
||||||
if (context instanceof SystemPromptDialog)
|
if (context instanceof SystemPromptDialog)
|
||||||
{
|
{
|
||||||
IStatus status = job.runInContext(context);
|
IStatus status = job.runInContext(context);
|
||||||
|
@ -2300,7 +2305,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
|
|
||||||
ResolveRelativeJob job = new ResolveRelativeJob(filterString, parent);
|
ResolveRelativeJob job = new ResolveRelativeJob(filterString, parent);
|
||||||
|
|
||||||
|
@ -2356,7 +2361,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
SetPropertyJob job = new SetPropertyJob(subject, key, value);
|
SetPropertyJob job = new SetPropertyJob(subject, key, value);
|
||||||
|
|
||||||
IStatus status = scheduleJob(job, null, true);
|
IStatus status = scheduleJob(job, null, true);
|
||||||
|
@ -2394,7 +2399,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
GetPropertyJob job = new GetPropertyJob(subject, key);
|
GetPropertyJob job = new GetPropertyJob(subject, key);
|
||||||
scheduleJob(job, null, true);
|
scheduleJob(job, null, true);
|
||||||
|
|
||||||
|
@ -2434,7 +2439,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
SetPropertiesJob job = new SetPropertiesJob(subject, keys, values);
|
SetPropertiesJob job = new SetPropertiesJob(subject, keys, values);
|
||||||
|
|
||||||
IStatus status = scheduleJob(job, null, true);
|
IStatus status = scheduleJob(job, null, true);
|
||||||
|
@ -2512,7 +2517,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
msg.makeSubstitution(hostName);
|
msg.makeSubstitution(hostName);
|
||||||
throw new SystemMessageException(msg);
|
throw new SystemMessageException(msg);
|
||||||
}
|
}
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
// yantzi: artemis 6.0, offline support
|
// yantzi: artemis 6.0, offline support
|
||||||
if (isOffline()) {
|
if (isOffline()) {
|
||||||
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT);
|
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OFFLINE_CANT_CONNECT);
|
||||||
|
@ -2521,10 +2526,11 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
}
|
}
|
||||||
//DY operation = OPERATION_CONNECT;
|
//DY operation = OPERATION_CONNECT;
|
||||||
if (!isConnected() && supportsConnecting) {
|
if (!isConnected() && supportsConnecting) {
|
||||||
IRunnableContext runnableContext = getRunnableContext(shell);
|
getRunnableContext(/*shell*/); // dwd needed only for side effect of setting shell to the shell for the active workbench window
|
||||||
if (runnableContext instanceof ProgressMonitorDialog) {
|
//dwd IRunnableContext runnableContext = getRunnableContext(shell);
|
||||||
((ProgressMonitorDialog) runnableContext).setCancelable(true);
|
//dwd if (runnableContext instanceof ProgressMonitorDialog) {
|
||||||
}
|
//dwd ((ProgressMonitorDialog) runnableContext).setCancelable(true);
|
||||||
|
//dwd }
|
||||||
getConnectorService().promptForPassword(forcePrompt); // prompt for userid and password
|
getConnectorService().promptForPassword(forcePrompt); // prompt for userid and password
|
||||||
ConnectJob job = new ConnectJob();
|
ConnectJob job = new ConnectJob();
|
||||||
scheduleJob(job, null, shell != null);
|
scheduleJob(job, null, shell != null);
|
||||||
|
@ -2613,7 +2619,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
public void disconnect(boolean collapseTree) throws Exception
|
public void disconnect(boolean collapseTree) throws Exception
|
||||||
{
|
{
|
||||||
_disconnecting = true;
|
_disconnecting = true;
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
if (!isConnected() || !supportsConnecting)
|
if (!isConnected() || !supportsConnecting)
|
||||||
{
|
{
|
||||||
// disconnected but may not have notified viewers (i.e. network problem)
|
// disconnected but may not have notified viewers (i.e. network problem)
|
||||||
|
@ -2657,7 +2663,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
public String[] getProperties(Object subject, String[] keys)
|
public String[] getProperties(Object subject, String[] keys)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
|
|
||||||
if (!isConnected())
|
if (!isConnected())
|
||||||
|
@ -3045,43 +3051,34 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
* use one for all phases of a single operation, such as connecting
|
* use one for all phases of a single operation, such as connecting
|
||||||
* and resolving.
|
* and resolving.
|
||||||
*/
|
*/
|
||||||
protected IRunnableContext getRunnableContext(Shell rshell)
|
protected IRunnableContext getRunnableContext(/*Shell rshell*/) {
|
||||||
{
|
if (Display.getCurrent() == null) {
|
||||||
// for wizards and dialogs, use the specified context
|
return new NullRunnableContext();
|
||||||
|
}
|
||||||
|
// for wizards and dialogs use the specified context that was placed in the registry
|
||||||
IRunnableContext irc = RSEUIPlugin.getTheSystemRegistry().getRunnableContext();
|
IRunnableContext irc = RSEUIPlugin.getTheSystemRegistry().getRunnableContext();
|
||||||
if (irc != null)
|
if (irc != null) {
|
||||||
{
|
|
||||||
SystemBasePlugin.logInfo("Got runnable context from system registry");
|
SystemBasePlugin.logInfo("Got runnable context from system registry");
|
||||||
return irc;
|
return irc;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// for other cases, use statusbar
|
// for other cases, use statusbar
|
||||||
IWorkbenchWindow win = SystemBasePlugin.getActiveWorkbenchWindow();
|
IWorkbenchWindow win = SystemBasePlugin.getActiveWorkbenchWindow();
|
||||||
if (win != null)
|
if (win != null) {
|
||||||
{
|
|
||||||
Shell winShell = getActiveWorkbenchShell();
|
Shell winShell = getActiveWorkbenchShell();
|
||||||
if (winShell != null && !winShell.isDisposed() && winShell.isVisible())
|
if (winShell != null && !winShell.isDisposed() && winShell.isVisible()) {
|
||||||
{
|
|
||||||
SystemBasePlugin.logInfo("Using active workbench window as runnable context");
|
SystemBasePlugin.logInfo("Using active workbench window as runnable context");
|
||||||
shell = winShell;
|
shell = winShell;
|
||||||
return win;
|
return win;
|
||||||
}
|
//dwd } else {
|
||||||
else
|
//dwd win = null;
|
||||||
{
|
|
||||||
win = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//dwd if (shell == null || shell.isDisposed() || !shell.isVisible()) {
|
||||||
if (shell == null || shell.isDisposed() || !shell.isVisible())
|
//dwd SystemBasePlugin.logInfo("Using progress monitor dialog with given shell as parent");
|
||||||
{
|
//dwd shell = rshell;
|
||||||
SystemBasePlugin.logInfo("Using progress monitor dialog with given shell as parent");
|
//dwd }
|
||||||
shell = rshell;
|
//dwd IRunnableContext dlg = new ProgressMonitorDialog(rshell);
|
||||||
}
|
IRunnableContext dlg = new ProgressMonitorDialog(shell);
|
||||||
|
|
||||||
|
|
||||||
IRunnableContext dlg = new ProgressMonitorDialog(rshell);
|
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue