1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-10 18:45:26 +02:00

using deferred queries for connecting while resolving filters

This commit is contained in:
David McKnight 2006-05-31 19:03:22 +00:00
parent 5eba8943c3
commit 0643ed91f3
3 changed files with 48 additions and 3 deletions

View file

@ -26,7 +26,12 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.core.subsystems.SubSystem.ConnectJob;
import org.eclipse.rse.core.subsystems.SubSystem.ConnectJobNoShell;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter; import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.IWorkbenchSite;
@ -101,6 +106,29 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
//handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()])); //handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()]));
} }
public class PromptForPassword implements Runnable
{
public SubSystem _ss;
public PromptForPassword(SubSystem ss)
{
_ss = ss;
}
public void run()
{
Shell shell = Display.getCurrent().getActiveShell();
try
{
_ss.promptForPassword(shell);
}
catch (Exception e)
{
}
}
}
/** /**
* Subclasses must override this method to perform the operation. * Subclasses must override this method to perform the operation.
* Clients should never call this method directly. * Clients should never call this method directly.
@ -111,6 +139,22 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
*/ */
protected void execute(IProgressMonitor monitor) throws Exception, InterruptedException protected void execute(IProgressMonitor monitor) throws Exception, InterruptedException
{ {
SubSystem ss = (SubSystem)_adapter.getSubSystem(_remoteObject);
synchronized (ss)
{
if (!ss.isConnected())
{
Display dis = Display.getDefault();
dis.syncExec(new PromptForPassword(ss));
//ss.connect(monitor);
//ConnectJob conjob = ss.new ConnectJob();
//conjob.run(monitor);
ss.getConnectorService().connect(monitor);
}
}
Object[] children = _adapter.getChildren(monitor, _remoteObject); Object[] children = _adapter.getChildren(monitor, _remoteObject);
_collector.add(children, monitor); _collector.add(children, monitor);
monitor.done(); monitor.done();

View file

@ -243,7 +243,7 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
ISubSystem ss = adapter.getSubSystem(element); ISubSystem ss = adapter.getSubSystem(element);
if (ss != null) if (ss != null)
{ {
if (ss.isConnected()) // if (ss.isConnected())
{ {
Object[] children = manager.getChildren(element); Object[] children = manager.getChildren(element);

View file

@ -1347,6 +1347,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
} }
catch(InvocationTargetException exc) catch(InvocationTargetException exc)
{ {
exc.printStackTrace();
monitor.done(); monitor.done();
String excMsg = exc.getTargetException().getMessage(); String excMsg = exc.getTargetException().getMessage();
if ((excMsg == null) || (excMsg.length()==0)) if ((excMsg == null) || (excMsg.length()==0))
@ -1599,7 +1600,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
/** /**
* Represents the subsystem operation of connecting the subsystem to the remote machine. * Represents the subsystem operation of connecting the subsystem to the remote machine.
*/ */
protected class ConnectJob extends SubSystemOperationJob public class ConnectJob extends SubSystemOperationJob
{ {
public ConnectJob() public ConnectJob()
{ {
@ -2564,7 +2565,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* monitor. * monitor.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message. * @param Shell parent shell used to show error message. Null means you will handle showing the error message.
*/ */
protected boolean promptForPassword(Shell shell) throws Exception public boolean promptForPassword(Shell shell) throws Exception
{ {
boolean ok = false; boolean ok = false;
if (!supportsConnecting) if (!supportsConnecting)