mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
don't use job when on main thread
This commit is contained in:
parent
2077b763ea
commit
5a0ab16969
2 changed files with 61 additions and 12 deletions
|
@ -24,6 +24,7 @@ import java.util.StringTokenizer;
|
||||||
|
|
||||||
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.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.rse.core.SystemBasePlugin;
|
import org.eclipse.rse.core.SystemBasePlugin;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
|
@ -910,6 +911,13 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
ok = promptForPassword();
|
ok = promptForPassword();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
Display display = Display.getCurrent();
|
||||||
|
if (display != null)
|
||||||
|
{
|
||||||
|
internalSendCommandToShell(new NullProgressMonitor(), input, commandObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//dwd this.shell = shell; // FIXME remove this
|
//dwd this.shell = shell; // FIXME remove this
|
||||||
|
@ -928,6 +936,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
else
|
else
|
||||||
showOperationCancelledMessage(shell);
|
showOperationCancelledMessage(shell);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SystemBasePlugin.logDebugMessage(this.getClass().getName(),
|
SystemBasePlugin.logDebugMessage(this.getClass().getName(),
|
||||||
|
|
|
@ -1591,9 +1591,25 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
*/
|
*/
|
||||||
protected class DisconnectJob extends SubSystemOperationJob
|
protected class DisconnectJob extends SubSystemOperationJob
|
||||||
{
|
{
|
||||||
public DisconnectJob()
|
public class PostDisconnect implements Runnable
|
||||||
|
{
|
||||||
|
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
getConnectorService().reset();
|
||||||
|
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
||||||
|
sr.connectedStatusChange(_subsystem, false, true, _collapseTree);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean _collapseTree;
|
||||||
|
private SubSystem _subsystem;
|
||||||
|
public DisconnectJob(boolean collapseTree, SubSystem subsystem)
|
||||||
{
|
{
|
||||||
super(GenericMessages.RSESubSystemOperation_Disconnect_message);
|
super(GenericMessages.RSESubSystemOperation_Disconnect_message);
|
||||||
|
_collapseTree = collapseTree;
|
||||||
|
_subsystem = subsystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception
|
public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception
|
||||||
|
@ -1605,7 +1621,11 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
|
|
||||||
if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText());
|
if (!implicitConnect(false, mon, msg, totalWorkUnits)) throw new Exception(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText());
|
||||||
internalDisconnect(mon);
|
internalDisconnect(mon);
|
||||||
|
_disconnecting = false;
|
||||||
|
_connectionError = false;
|
||||||
|
Display.getDefault().asyncExec(new PostDisconnect());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1969,6 +1989,13 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
ok = promptForPassword();
|
ok = promptForPassword();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
Display display = Display.getCurrent();
|
||||||
|
if (display != null)
|
||||||
|
{
|
||||||
|
return internalResolveFilterString(new NullProgressMonitor(), filterString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//dwd this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
|
@ -1988,7 +2015,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
if (shell == null) throw exc;
|
if (shell == null) throw exc;
|
||||||
else showOperationCancelledMessage(shell);
|
else showOperationCancelledMessage(shell);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!");
|
System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!");
|
||||||
|
@ -2029,6 +2056,13 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
Display display = Display.getCurrent();
|
||||||
|
if (display != null)
|
||||||
|
{
|
||||||
|
return internalResolveFilterStrings(new NullProgressMonitor(), filterStrings);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//dwd this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
|
@ -2048,6 +2082,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
if (shell == null) throw exc;
|
if (shell == null) throw exc;
|
||||||
else showOperationCancelledMessage(shell);
|
else showOperationCancelledMessage(shell);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!");
|
System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!");
|
||||||
|
@ -2276,7 +2311,13 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
ok = promptForPassword();
|
ok = promptForPassword();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
Display display = Display.getCurrent();
|
||||||
|
if (display != null)
|
||||||
|
{
|
||||||
|
return internalResolveFilterString(new NullProgressMonitor(), parent, filterString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//dwd this.shell = shell; //FIXME remove this
|
//dwd this.shell = shell; //FIXME remove this
|
||||||
|
@ -2296,6 +2337,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
if (shell == null) throw exc;
|
if (shell == null) throw exc;
|
||||||
else showOperationCancelledMessage(shell);
|
else showOperationCancelledMessage(shell);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "in SubSystemImpl.resolveFilterString: isConnected() returning false!");
|
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "in SubSystemImpl.resolveFilterString: isConnected() returning false!");
|
||||||
|
@ -2602,17 +2644,14 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
sr.connectedStatusChange(this, false, true, collapseTree);
|
sr.connectedStatusChange(this, false, true, collapseTree);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DisconnectJob job = new DisconnectJob();
|
*/
|
||||||
IStatus status = scheduleJob(job, this, true);
|
|
||||||
if (status.isOK())
|
DisconnectJob job = new DisconnectJob(collapseTree, this);
|
||||||
{
|
job.schedule();
|
||||||
getConnectorService().reset();
|
/*
|
||||||
ISystemRegistry sr = RSEUIPlugin.getDefault().getSystemRegistry();
|
|
||||||
sr.connectedStatusChange(this, false, true, collapseTree);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (InterruptedException exc)
|
catch (InterruptedException exc)
|
||||||
{
|
{
|
||||||
|
@ -2625,6 +2664,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
||||||
_disconnecting = false;
|
_disconnecting = false;
|
||||||
_connectionError = false;
|
_connectionError = false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue