1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-20 06:35:50 +02:00

[160353] avoid sychronous jobs - new apis + deprecation of the old ones

This commit is contained in:
David McKnight 2007-01-08 17:41:10 +00:00
parent 44b15f4ed1
commit e88962a966
8 changed files with 235 additions and 268 deletions

View file

@ -473,6 +473,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* *
* @param filterString filter pattern for objects to return. * @param filterString filter pattern for objects to return.
* @return Array of objects that are the result of this filter string * @return Array of objects that are the result of this filter string
*
* @deprecated use resolveFilterString(IProgressMonitor monitor, String filterString) instead
*/ */
public Object[] resolveFilterString(String filterString) throws Exception; public Object[] resolveFilterString(String filterString) throws Exception;
@ -485,6 +487,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* *
* @param filterStrings array of filter patterns for objects to return. * @param filterStrings array of filter patterns for objects to return.
* @return Array of objects that are the result of resolving all the filter strings * @return Array of objects that are the result of resolving all the filter strings
*
* @deprecated use resolveFilterStrings(IProgressMonitor monitor, String[] filterStrings) instead
*/ */
public Object[] resolveFilterStrings(String[] filterStrings) throws Exception; public Object[] resolveFilterStrings(String[] filterStrings) throws Exception;
@ -512,6 +516,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param parent Object that is being expanded. * @param parent Object that is being expanded.
* @param filterString filter pattern for children of parent. * @param filterString filter pattern for children of parent.
* @return Array of objects that are the result of this filter string * @return Array of objects that are the result of this filter string
*
* @deprecated use resolveFilterString(IProgressMonitor monitor, String filterString) instead
*/ */
public Object[] resolveFilterString(Object parent, String filterString) throws Exception; public Object[] resolveFilterString(Object parent, String filterString) throws Exception;
@ -542,6 +548,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param key Identifies property to set * @param key Identifies property to set
* @param value Value to set property to * @param value Value to set property to
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation.
*
* @deprecated this shouldn't be used
*/ */
public Object setProperty(Object subject, String key, String value) throws Exception; public Object setProperty(Object subject, String key, String value) throws Exception;
@ -552,6 +560,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param key Identifies property to get value of * @param key Identifies property to get value of
* @return String The value of the requested key. * @return String The value of the requested key.
*
* @deprecated this shouldn't be used
*/ */
public String getProperty(Object subject, String key) throws Exception; public String getProperty(Object subject, String key) throws Exception;
@ -563,6 +573,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param keys Identifies the properties to set * @param keys Identifies the properties to set
* @param values Values to set properties to. One to one mapping to keys by index number * @param values Values to set properties to. One to one mapping to keys by index number
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation.
*
* @deprecated this shouldn't be used
*/ */
public Object setProperties(Object subject, String[] keys, String[] values) throws Exception; public Object setProperties(Object subject, String[] keys, String[] values) throws Exception;
@ -573,6 +585,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param keys Identifies properties to get value of * @param keys Identifies properties to get value of
* @return The values of the requested keys. * @return The values of the requested keys.
*
* @deprecated this shouldn't be used
*/ */
public String[] getProperties(Object subject, String[] keys) throws Exception; public String[] getProperties(Object subject, String[] keys) throws Exception;

View file

@ -23,11 +23,11 @@ import java.util.List;
import java.util.StringTokenizer; 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.NullProgressMonitor; 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;
import org.eclipse.rse.core.model.IProperty;
import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.subsystems.CommunicationsEvent; import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener; import org.eclipse.rse.core.subsystems.ICommunicationsListener;
@ -605,7 +605,12 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
} }
} }
setRemoteAttribute(COMMAND_SHELLS_MEMENTO, shellBuffer.toString()); IPropertySet set = getPropertySet("Remote"); //$NON-NLS-1$
if (set != null)
{
IProperty property = set.getProperty(COMMAND_SHELLS_MEMENTO);
property.setValue(shellBuffer.toString());
}
} }
protected void internalRemoveShell(Object command) throws java.lang.reflect.InvocationTargetException, protected void internalRemoveShell(Object command) throws java.lang.reflect.InvocationTargetException,
@ -635,7 +640,14 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{ {
this.shell = shellWindow; this.shell = shellWindow;
IRemoteCommandShell[] results = null; IRemoteCommandShell[] results = null;
String shellStr = getRemoteAttribute(COMMAND_SHELLS_MEMENTO);
String shellStr = null;
IPropertySet set = getPropertySet("Remote"); //$NON-NLS-1$
if (set != null)
{
shellStr = set.getPropertyValue(COMMAND_SHELLS_MEMENTO);
}
int numShells = 0; int numShells = 0;
if (shellStr != null && shellStr.length() > 0) if (shellStr != null && shellStr.length() > 0)
{ {
@ -807,42 +819,29 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* overridden so that for universal we don't need to do in modal thread * overridden so that for universal we don't need to do in modal thread
* @deprecated
*/ */
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
{ {
//dwd if (shell != null) //dwd if (shell != null)
//dwd this.shell = shell; //dwd this.shell = shell;
if (isConnected()) return internalRunCommand(null, command, context, interpretOutput);
{ }
return internalRunCommand(null, command, context, interpretOutput);
} /**
else * overridden so that for universal we don't need to do in modal thread
{ */
try public Object[] runCommand(IProgressMonitor monitor, String command, Object context, boolean interpretOutput) throws Exception
{ {
//dwd this.shell = shell; // FIXME remove this //dwd if (shell != null)
//dwd this.shell = shell;
RunCommandJob job = new RunCommandJob(command, context, interpretOutput); return internalRunCommand(monitor, command, context, interpretOutput);
IStatus status = scheduleJob(job, null, true);
if (status.isOK())
{
return job.getOutputs();
}
}
catch (InterruptedException exc)
{
if (shell == null)
throw exc;
else
showOperationCancelledMessage(shell);
}
return null;
}
} }
/** /**
* overridden so that for universal we don't need to do in modal thread * overridden so that for universal we don't need to do in modal thread
*
* @deprecated
*/ */
public IRemoteCommandShell runShell(Object context) throws Exception public IRemoteCommandShell runShell(Object context) throws Exception
{ {
@ -855,24 +854,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
} }
else else
{ {
try return null;
{
//dwd this.shell = shell; // FIXME remove this
RunShellJob job = new RunShellJob(context);
IStatus status = scheduleJob(job, null, true);
if (status.isOK())
{
return (IRemoteCommandShell) job.getOutputs()[0];
}
}
catch (InterruptedException exc)
{
if (shell == null)
throw exc;
else
showOperationCancelledMessage(shell);
}
} }
SystemRegistry registry = RSEUIPlugin.getTheSystemRegistry(); SystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
@ -880,6 +862,18 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
return cmdShell; return cmdShell;
} }
/**
* overridden so that for universal we don't need to do in modal thread
*/
public IRemoteCommandShell runShell(IProgressMonitor monitor, Object context) throws Exception
{
IRemoteCommandShell cmdShell = internalRunShell(monitor, context);
SystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this));
return cmdShell;
}
/** /**
* Execute a remote command. This is only applicable if the subsystem * Execute a remote command. This is only applicable if the subsystem
@ -890,17 +884,36 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* valid and means to use the default context. * valid and means to use the default context.
* @return Array of objects that are the result of running this command. * @return Array of objects that are the result of running this command.
* Typically, these are messages logged by the command. * Typically, these are messages logged by the command.
*
* @deprecated
*/ */
public Object[] runCommand(String command, Object context) throws Exception public Object[] runCommand(String command, Object context) throws Exception
{ {
return runCommand(command, context, true); return runCommand(command, context, true);
} }
/**
* Execute a remote command. This is only applicable if the subsystem
* factory reports true for supportsCommands().
*
* @param command Command to be executed remotely.
* @param context context of a command (i.e. working directory). <code>null</code> is
* valid and means to use the default context.
* @return Array of objects that are the result of running this command.
* Typically, these are messages logged by the command.
*/
public Object[] runCommand(IProgressMonitor monitor, String command, Object context) throws Exception
{
return runCommand(monitor, command, context, true);
}
/** /**
* Send a command as input to a running command shell. * Send a command as input to a running command shell.
* *
* @param input the command to invoke in the shell. * @param input the command to invoke in the shell.
* @param commandObject the shell or command to send the invocation to. * @param commandObject the shell or command to send the invocation to.
*
* @deprecated
*/ */
public void sendCommandToShell(String input, Object commandObject) throws Exception public void sendCommandToShell(String input, Object commandObject) throws Exception
{ {
@ -921,11 +934,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
//dwd 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); scheduleJob(job, null);
if (status.isOK())
{
return;
}
} }
catch (InterruptedException exc) catch (InterruptedException exc)
{ {
@ -941,6 +950,27 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
"in SubSystemImpl.sendCommandToShell: isConnected() returning false!"); //$NON-NLS-1$ "in SubSystemImpl.sendCommandToShell: isConnected() returning false!"); //$NON-NLS-1$
} }
/**
* Send a command as input to a running command shell.
*
* @param monitor the progress monitor
* @param input the command to invoke in the shell.
* @param commandObject the shell or command to send the invocation to.
*/
public void sendCommandToShell(IProgressMonitor monitor, String input, Object commandObject) throws Exception
{
boolean ok = true;
if (!isConnected())
ok = promptForPassword();
if (ok)
{
internalSendCommandToShell(monitor, input, commandObject);
}
else
SystemBasePlugin.logDebugMessage(this.getClass().getName(),
"in SubSystemImpl.sendCommandToShell: isConnected() returning false!"); //$NON-NLS-1$
}
/** /**
* Cancel a shell or running command. * Cancel a shell or running command.
@ -964,7 +994,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{ {
//dwd 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);
} }
catch (InterruptedException exc) catch (InterruptedException exc)
{ {
@ -979,6 +1009,30 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
"in SubSystemImpl.cancelShell: isConnected() returning false!"); //$NON-NLS-1$ "in SubSystemImpl.cancelShell: isConnected() returning false!"); //$NON-NLS-1$
} }
} }
/**
* Cancel a shell or running command.
*
* @param monitor the progress monitor
* @param commandObject the shell or command to cancel.
*/
public void cancelShell(IProgressMonitor monitor, Object commandObject) throws Exception
{
boolean ok = true;
if (!isConnected())
ok = promptForPassword();
if (ok)
{
internalCancelShell(monitor, commandObject);
}
else
{
SystemBasePlugin.logDebugMessage(this.getClass().getName(),
"in SubSystemImpl.cancelShell: isConnected() returning false!"); //$NON-NLS-1$
}
}
/** /**
* Remove and Cancel a shell or running command. * Remove and Cancel a shell or running command.
@ -1002,7 +1056,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{ {
//dwd 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);
} }
catch (InterruptedException exc) catch (InterruptedException exc)
{ {

View file

@ -21,6 +21,7 @@ package org.eclipse.rse.subsystems.shells.core.subsystems;
import java.util.List; import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.subsystems.IRemoteSystemEnvVar; import org.eclipse.rse.core.subsystems.IRemoteSystemEnvVar;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
@ -48,6 +49,8 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
* @return Array of objects that are the result of running this command. Typically, these * @return Array of objects that are the result of running this command. Typically, these
* are messages logged by the command. * are messages logged by the command.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*
* @deprecated use runCommand(IProgressMonitor monitor, String command, Object context)
*/ */
public Object[] runCommand(String command, Object context) throws Exception; public Object[] runCommand(String command, Object context) throws Exception;
@ -61,6 +64,8 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
* @return Array of objects that are the result of running this command. Typically, these * @return Array of objects that are the result of running this command. Typically, these
* are messages logged by the command. * are messages logged by the command.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*
* @deprecated use runCommand(IProgressMonitor monitor, String command, Object conecxt, boolean interpretOutput)
*/ */
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception; public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception;
@ -71,23 +76,85 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
* @param context context of a shell (i.e. working directory). Null is valid and means to use the default context. * @param context context of a shell (i.e. working directory). Null is valid and means to use the default context.
* @return An object that represents the command and it's output. * @return An object that represents the command and it's output.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*
* @deprecated use runShell(IProgressMonitor monitor, Object context)
*/ */
public IRemoteCommandShell runShell(Object context) throws Exception; public IRemoteCommandShell runShell(Object context) throws Exception;
/**
* Execute a remote command. This is only applicable if the subsystem factory reports
* true for supportsCommands().
* @param monitor the progress monitor
* @param command Command to be executed remotely.
* @param context context of a command (i.e. working directory). Null is valid and means to run the
* command as a shell command in the default shell.
* @return Array of objects that are the result of running this command. Typically, these
* are messages logged by the command.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*/
public Object[] runCommand(IProgressMonitor monitor, String command, Object context) throws Exception;
/**
* Execute a remote command. This is only applicable if the subsystem factory reports
* true for supportsCommands().
* @param monitor the progress monitor
* @param command Command to be executed remotely.
* @param context context of a command (i.e. working directory). Null is valid and means to run the
* command as a shell command in the default shell.
* @param interpretOutput whether to interpret the output or not
* @return Array of objects that are the result of running this command. Typically, these
* are messages logged by the command.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*/
public Object[] runCommand(IProgressMonitor monitor, String command, Object context, boolean interpretOutput) throws Exception;
/**
* Launch a new command shell. This is only applicable if the subsystem factory reports
* true for supportsCommands().
* @param monitor the progress monitor
* @param context context of a shell (i.e. working directory). Null is valid and means to use the default context.
* @return An object that represents the command and it's output.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*
*/
public IRemoteCommandShell runShell(IProgressMonitor monitor, Object context) throws Exception;
/** /**
* Send a command as input to a running command shell. * Send a command as input to a running command shell.
* @param input the command to invoke in the shell. * @param input the command to invoke in the shell.
* @param commandObject the shell or command to send the invocation to. * @param commandObject the shell or command to send the invocation to.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*
* @deprecated use sendCommandToShell(IProgressMonitor, String input, Object commmandObject)
*/ */
public void sendCommandToShell(String input, Object commandObject) throws Exception; public void sendCommandToShell(String input, Object commandObject) throws Exception;
/**
* Send a command as input to a running command shell.
* @param monitor the progress monitor
* @param input the command to invoke in the shell.
* @param commandObject the shell or command to send the invocation to.
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
*/
public void sendCommandToShell(IProgressMonitor monitor, String input, Object commandObject) throws Exception;
/** /**
* Cancel a shell or running command. * Cancel a shell or running command.
* @param commandObject the shell or command to cancel. * @param commandObject the shell or command to cancel.
*
* @deprecated use cancelShell(IProgressMonitor monitor, Object commandObject)
*/ */
public void cancelShell(Object commandObject) throws Exception; public void cancelShell(Object commandObject) throws Exception;
/**
* Cancel a shell or running command.
* @param monitor the progress monitor
* @param commandObject the shell or command to cancel
*
*/
public void cancelShell(IProgressMonitor monitor, Object commandObject) throws Exception;
/** /**
* Remove a shell. If the shell is running cancel it first. * Remove a shell. If the shell is running cancel it first.

View file

@ -15,6 +15,7 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.view; package org.eclipse.rse.ui.view;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemAdapterHelpers;
import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
@ -579,7 +580,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
Object[] children = null; Object[] children = null;
try try
{ {
children = subsystem.resolveFilterString(filterString); children = subsystem.resolveFilterString(new NullProgressMonitor(), filterString);
} catch (InterruptedException exc) } catch (InterruptedException exc)
{ {
if (canceledObject == null) if (canceledObject == null)

View file

@ -15,6 +15,7 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.view; package org.eclipse.rse.ui.view;
import org.eclipse.core.runtime.NullProgressMonitor;
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;
import org.eclipse.rse.core.model.ISystemMessageObject; import org.eclipse.rse.core.model.ISystemMessageObject;
@ -85,7 +86,7 @@ public class SystemTestFilterStringAPIProviderImpl
return children; return children;
try try
{ {
children = subsystem.resolveFilterString(filterString); children = subsystem.resolveFilterString(new NullProgressMonitor(), filterString);
if ((children == null) || (children.length==0)) if ((children == null) || (children.length==0))
{ {
if (nullObject == null) if (nullObject == null)

View file

@ -15,6 +15,7 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.view; package org.eclipse.rse.ui.view;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolReference; import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
@ -136,7 +137,7 @@ public class SystemViewAPIProviderForFilterStrings
Object[] children = null; Object[] children = null;
try try
{ {
children = ss.resolveFilterString(filterStringReference.getString()); children = ss.resolveFilterString(new NullProgressMonitor(), filterStringReference.getString());
if ((children == null) || (children.length==0)) if ((children == null) || (children.length==0))
{ {
children = new SystemMessageObject[1]; children = new SystemMessageObject[1];

View file

@ -143,6 +143,8 @@ public class SystemViewDataDragAdapter extends DragSourceAdapter
else else
{ {
event.doit = true; event.doit = true;
event.detail = DND.DROP_COPY;
event.feedback = DND.FEEDBACK_INSERT_AFTER;
} }
} }
} }
@ -204,6 +206,7 @@ public class SystemViewDataDragAdapter extends DragSourceAdapter
{ {
event.doit = true; event.doit = true;
event.detail = DND.DROP_COPY; event.detail = DND.DROP_COPY;
} }
else else
{ {

View file

@ -1579,9 +1579,11 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
*/ */
public class ConnectJob extends SubSystemOperationJob public class ConnectJob extends SubSystemOperationJob
{ {
public ConnectJob() private SubSystem _ss;
public ConnectJob(SubSystem ss)
{ {
super(GenericMessages.RSESubSystemOperation_Connect_message); super(GenericMessages.RSESubSystemOperation_Connect_message);
_ss = ss;
} }
public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception public void performOperation(IProgressMonitor mon) throws InterruptedException, Exception
@ -1594,6 +1596,9 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
if (!implicitConnect(true, mon, msg, totalWorkUnits)) throw new Exception(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText()); if (!implicitConnect(true, mon, msg, totalWorkUnits)) throw new Exception(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED).makeSubstitution(getHostName()).getLevelOneText());
internalConnect(mon); internalConnect(mon);
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
registry.connectedStatusChange(_ss, true, false);
} }
} }
@ -1985,6 +1990,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* <p> * <p>
* @param filterString filter pattern for objects to return. * @param filterString filter pattern for objects to return.
* @return the results of resolving the filter string. * @return the results of resolving the filter string.
*
* @deprecated use resolveFilterString(IProgressMonitor monitor, String filterString) instead
*/ */
public Object[] resolveFilterString(String filterString) public Object[] resolveFilterString(String filterString)
throws Exception throws Exception
@ -1994,36 +2001,12 @@ 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); return internalResolveFilterString(new NullProgressMonitor(), filterString);
}
else
{
try
{
ResolveAbsoluteJob job = new ResolveAbsoluteJob(filterString);
IStatus status = scheduleJob(job, null, shell != null);
if (status.isOK())
{
if (sortResults && (job.getOutputs()!=null))
return sortResolvedFilterStringObjects(job.getOutputs());
else
return job.getOutputs();
}
}
catch (InterruptedException exc)
{
if (shell == null) throw exc;
else showOperationCancelledMessage(shell);
}
}
} }
else else
System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!"); //$NON-NLS-1$ {
return null; return null;
}
} }
/** /**
* Resolve multiple absolute filter strings. This is only applicable if the subsystem * Resolve multiple absolute filter strings. This is only applicable if the subsystem
@ -2039,6 +2022,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* *
* @param filterStrings array of filter patterns for objects to return. * @param filterStrings array of filter patterns for objects to return.
* @return Array of objects that are the result of resolving all the filter strings * @return Array of objects that are the result of resolving all the filter strings
*
* @deprecated should use resolveFilterStrings(IProgressMonitor monitor, String[] filterStrings) instead
*/ */
public Object[] resolveFilterStrings(String[] filterStrings) public Object[] resolveFilterStrings(String[] filterStrings)
throws Exception throws Exception
@ -2057,39 +2042,16 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
if (ok) if (ok)
{ {
Display display = Display.getCurrent(); return internalResolveFilterStrings(new NullProgressMonitor(), filterStrings);
if (display != null)
{
return internalResolveFilterStrings(new NullProgressMonitor(), filterStrings);
}
else
{
try
{
ResolveAbsolutesJob job = new ResolveAbsolutesJob(filterStrings[0], filterStrings);
IStatus status = scheduleJob(job, null, true);
if (status.isOK())
{
if (sortResults && (job.getOutputs()!=null))
return sortResolvedFilterStringObjects(job.getOutputs());
else
return job.getOutputs();
}
}
catch (InterruptedException exc)
{
if (shell == null) throw exc;
else showOperationCancelledMessage(shell);
}
}
} }
else else
System.out.println("in SubSystemImpl.resolveFilterString: isConnected() returning false!"); //$NON-NLS-1$ {
return null; return null;
}
} }
protected IStatus scheduleJob(SubSystemOperationJob job, ISchedulingRule rule, boolean synch) throws InterruptedException protected void scheduleJob(SubSystemOperationJob job, ISchedulingRule rule) throws InterruptedException
{ {
IRunnableContext context = getRunnableContext(/*shell*/); // dwd needed for side effect or for prompt? IRunnableContext context = getRunnableContext(/*shell*/); // dwd needed for side effect or for prompt?
if (context instanceof SystemPromptDialog) if (context instanceof SystemPromptDialog)
@ -2099,7 +2061,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
{ {
showOperationErrorMessage(shell, status.getException()); showOperationErrorMessage(shell, status.getException());
} }
return status; return;
} }
job.setPriority(Job.INTERACTIVE); job.setPriority(Job.INTERACTIVE);
//job.setUser(true); //job.setUser(true);
@ -2108,31 +2070,6 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
job.setRule(rule); job.setRule(rule);
} }
job.schedule(); job.schedule();
if (synch)
{
Display display = Display.getCurrent();
while (!job.hasStarted())
{
while (display!=null && display.readAndDispatch()) {
//Process everything on event queue
}
if (!job.hasStarted()) Thread.sleep(200);
}
while (job.getResult() == null)
{
while (display!=null && display.readAndDispatch()) {
//Process everything on event queue
}
if (job.getResult() == null) Thread.sleep(200);
}
return job.getResult();
}
else
{
return Status.OK_STATUS;
}
} }
/** /**
@ -2302,6 +2239,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* <p> * <p>
* @param parent Object that is being expanded. * @param parent Object that is being expanded.
* @param filterString filter pattern for children of parent. Typically just "*". * @param filterString filter pattern for children of parent. Typically just "*".
*
* @deprecated use resolveFilterString(IProgressMonitor monitor, Object parent, String filterString) instead
*/ */
public Object[] resolveFilterString(Object parent, String filterString) public Object[] resolveFilterString(Object parent, String filterString)
throws Exception throws Exception
@ -2311,36 +2250,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
ok = promptForPassword(); ok = promptForPassword();
if (ok) if (ok)
{ {
Display display = Display.getCurrent(); return internalResolveFilterString(new NullProgressMonitor(), parent, filterString);
if (display != null)
{
return internalResolveFilterString(new NullProgressMonitor(), parent, filterString);
}
else
{
try
{
ResolveRelativeJob job = new ResolveRelativeJob(filterString, parent);
IStatus status = scheduleJob(job, null, true);
if (status.isOK())
{
if ((job.getOutputs()!=null) && (job.getOutputs().length>1))
return sortResolvedFilterStringObjects(job.getOutputs());
else return job.getOutputs();
}
}
catch (InterruptedException exc)
{
if (shell == null) throw exc;
else showOperationCancelledMessage(shell);
}
}
} }
else else
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "in SubSystemImpl.resolveFilterString: isConnected() returning false!"); //$NON-NLS-1$ {
return null; return null;
}
} }
@ -2365,33 +2280,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* @param key Identifies property to set * @param key Identifies property to set
* @param value Value to set property to * @param value Value to set property to
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation.
*
* @deprecated this shouldn't be used
*/ */
public Object setProperty(Object subject, String key, String value) public Object setProperty(Object subject, String key, String value)
throws Exception throws Exception
{ {
boolean ok = true;
if (!isConnected())
ok = promptForPassword();
if (ok)
{
try
{
SetPropertyJob job = new SetPropertyJob(subject, key, value);
IStatus status = scheduleJob(job, null, true);
if (status.isOK())
{
return job.getOutputs()[0];
}
}
catch (InterruptedException exc)
{
if (shell == null) throw exc;
else showOperationCancelledMessage(shell);
}
}
else
System.out.println("in SubSystemImpl.setProperty: isConnected() returning false!"); //$NON-NLS-1$
return null; return null;
} }
@ -2402,34 +2296,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param key Identifies property to get value of * @param key Identifies property to get value of
* @return String The value of the requested key. * @return String The value of the requested key.
*
* @deprecated this shouldn't be used
*/ */
public String getProperty(Object subject, String key) public String getProperty(Object subject, String key)
throws Exception throws Exception
{ {
boolean ok = true;
if (!isConnected())
ok = promptForPassword();
if (ok)
{
try
{
GetPropertyJob job = new GetPropertyJob(subject, key);
scheduleJob(job, null, true);
IStatus status = job.getResult();
if (status.isOK())
{
return job.getOutputStrings()[0];
}
}
catch (InterruptedException exc)
{
if (shell == null) throw exc;
else showOperationCancelledMessage(shell);
}
}
else
System.out.println("in SubSystemImpl.getProperty: isConnected() returning false!"); //$NON-NLS-1$
return null; return null;
} }
@ -2441,33 +2313,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* @param keys the array of propertie keys to set. * @param keys the array of propertie keys to set.
* @param values the array of values to set. The value at a certain index corresponds to the property key at the same index. * @param values the array of values to set. The value at a certain index corresponds to the property key at the same index.
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation.
*
* @deprecated this shouldn't be used
*/ */
public Object setProperties(Object subject, String[] keys, String[] values) public Object setProperties(Object subject, String[] keys, String[] values)
throws Exception throws Exception
{ {
boolean ok = true;
if (!isConnected())
ok = promptForPassword();
if (ok)
{
try
{
SetPropertiesJob job = new SetPropertiesJob(subject, keys, values);
IStatus status = scheduleJob(job, null, true);
if (status.isOK())
{
return job.getOutputs()[0];
}
}
catch (InterruptedException exc)
{
if (shell == null) throw exc;
else showOperationCancelledMessage(shell);
}
}
else
System.out.println("in SubSystemImpl.setProperties: isConnected() returning false!"); //$NON-NLS-1$
return null; return null;
} }
@ -2555,12 +2406,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
//dwd ((ProgressMonitorDialog) runnableContext).setCancelable(true); //dwd ((ProgressMonitorDialog) runnableContext).setCancelable(true);
//dwd } //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(this);
scheduleJob(job, null, shell != null); scheduleJob(job, null);
IStatus status = job.getResult();
if (status != null && status.isOK()) {
registry.connectedStatusChange(this, true, false);
}
} }
} }
@ -2679,33 +2526,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param keys the array of property keys. * @param keys the array of property keys.
* @return the values for the given property keys. * @return the values for the given property keys.
*
* @deprecated this shouldn't be used
*/ */
public String[] getProperties(Object subject, String[] keys) public String[] getProperties(Object subject, String[] keys)
throws Exception throws Exception
{ {
boolean ok = true;
if (!isConnected())
ok = promptForPassword();
if (ok)
{
try
{
GetPropertiesJob job = new GetPropertiesJob(subject, keys);
IStatus status = scheduleJob(job, null, true);
if (status.isOK())
{
return job.getOutputStrings();
}
}
catch (InterruptedException exc)
{
if (shell == null) throw exc;
else showOperationCancelledMessage(shell);
}
}
return null; return null;
} }