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:
parent
44b15f4ed1
commit
e88962a966
8 changed files with 235 additions and 268 deletions
|
@ -473,6 +473,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
|
|||
*
|
||||
* @param filterString filter pattern for objects to return.
|
||||
* @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;
|
||||
|
||||
|
@ -485,6 +487,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
|
|||
*
|
||||
* @param filterStrings array of filter patterns for objects to return.
|
||||
* @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;
|
||||
|
||||
|
@ -512,6 +516,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
|
|||
* @param parent Object that is being expanded.
|
||||
* @param filterString filter pattern for children of parent.
|
||||
* @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;
|
||||
|
||||
|
@ -542,6 +548,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
|
|||
* @param key Identifies property to set
|
||||
* @param value Value to set property to
|
||||
* @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;
|
||||
|
||||
|
@ -552,6 +560,8 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
|
|||
* @param subject Identifies which object to get the properties of
|
||||
* @param key Identifies property to get value of
|
||||
* @return String The value of the requested key.
|
||||
*
|
||||
* @deprecated this shouldn't be used
|
||||
*/
|
||||
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 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.
|
||||
*
|
||||
* @deprecated this shouldn't be used
|
||||
*/
|
||||
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 keys Identifies properties to get value of
|
||||
* @return The values of the requested keys.
|
||||
*
|
||||
* @deprecated this shouldn't be used
|
||||
*/
|
||||
public String[] getProperties(Object subject, String[] keys) throws Exception;
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ import java.util.List;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
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.subsystems.CommunicationsEvent;
|
||||
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,
|
||||
|
@ -635,7 +640,14 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
{
|
||||
this.shell = shellWindow;
|
||||
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;
|
||||
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
|
||||
* @deprecated
|
||||
*/
|
||||
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
|
||||
{
|
||||
//dwd if (shell != null)
|
||||
//dwd this.shell = shell;
|
||||
if (isConnected())
|
||||
{
|
||||
return internalRunCommand(null, command, context, interpretOutput);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
//dwd this.shell = shell; // FIXME remove this
|
||||
|
||||
RunCommandJob job = new RunCommandJob(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;
|
||||
}
|
||||
return internalRunCommand(null, command, context, interpretOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* overridden so that for universal we don't need to do in modal thread
|
||||
*/
|
||||
public Object[] runCommand(IProgressMonitor monitor, String command, Object context, boolean interpretOutput) throws Exception
|
||||
{
|
||||
//dwd if (shell != null)
|
||||
//dwd this.shell = shell;
|
||||
return internalRunCommand(monitor, command, context, interpretOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* overridden so that for universal we don't need to do in modal thread
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public IRemoteCommandShell runShell(Object context) throws Exception
|
||||
{
|
||||
|
@ -855,24 +854,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
//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);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
SystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
||||
|
@ -880,6 +862,18 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
|
||||
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
|
||||
|
@ -890,17 +884,36 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
* 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.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public Object[] runCommand(String command, Object context) throws Exception
|
||||
{
|
||||
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.
|
||||
*
|
||||
* @param input the command to invoke in the shell.
|
||||
* @param commandObject the shell or command to send the invocation to.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
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
|
||||
SendCommandToShellJob job = new SendCommandToShellJob(input, commandObject);
|
||||
|
||||
IStatus status = scheduleJob(job, null, true);
|
||||
if (status.isOK())
|
||||
{
|
||||
return;
|
||||
}
|
||||
scheduleJob(job, null);
|
||||
}
|
||||
catch (InterruptedException exc)
|
||||
{
|
||||
|
@ -941,6 +950,27 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
"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.
|
||||
|
@ -964,7 +994,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
{
|
||||
//dwd this.shell = shell; // FIXME remove this
|
||||
CancelShellJob job = new CancelShellJob(commandObject);
|
||||
scheduleJob(job, null, false);
|
||||
scheduleJob(job, null);
|
||||
}
|
||||
catch (InterruptedException exc)
|
||||
{
|
||||
|
@ -979,6 +1009,30 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
"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.
|
||||
|
@ -1002,7 +1056,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
{
|
||||
//dwd this.shell = shell; // FIXME remove this
|
||||
RemoveShellJob job = new RemoveShellJob(commandObject);
|
||||
scheduleJob(job, null, false);
|
||||
scheduleJob(job, null);
|
||||
}
|
||||
catch (InterruptedException exc)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.eclipse.rse.subsystems.shells.core.subsystems;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.rse.core.subsystems.IRemoteSystemEnvVar;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
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
|
||||
* are messages logged by the command.
|
||||
* @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;
|
||||
|
||||
|
@ -61,6 +64,8 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
* @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
|
||||
*
|
||||
* @deprecated use runCommand(IProgressMonitor monitor, String command, Object conecxt, boolean interpretOutput)
|
||||
*/
|
||||
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.
|
||||
* @return An object that represents the command and it's output.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*
|
||||
* @deprecated use runShell(IProgressMonitor monitor, Object context)
|
||||
*/
|
||||
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.
|
||||
* @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
|
||||
*
|
||||
* @deprecated use sendCommandToShell(IProgressMonitor, String input, Object commmandObject)
|
||||
*/
|
||||
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.
|
||||
* @param commandObject the shell or command to cancel.
|
||||
*
|
||||
* @deprecated use cancelShell(IProgressMonitor monitor, Object commandObject)
|
||||
*/
|
||||
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.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.view;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.rse.core.SystemAdapterHelpers;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||
|
@ -579,7 +580,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
|
|||
Object[] children = null;
|
||||
try
|
||||
{
|
||||
children = subsystem.resolveFilterString(filterString);
|
||||
children = subsystem.resolveFilterString(new NullProgressMonitor(), filterString);
|
||||
} catch (InterruptedException exc)
|
||||
{
|
||||
if (canceledObject == null)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.view;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemMessageObject;
|
||||
|
@ -85,7 +86,7 @@ public class SystemTestFilterStringAPIProviderImpl
|
|||
return children;
|
||||
try
|
||||
{
|
||||
children = subsystem.resolveFilterString(filterString);
|
||||
children = subsystem.resolveFilterString(new NullProgressMonitor(), filterString);
|
||||
if ((children == null) || (children.length==0))
|
||||
{
|
||||
if (nullObject == null)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
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.ISystemFilterPool;
|
||||
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
|
||||
|
@ -136,7 +137,7 @@ public class SystemViewAPIProviderForFilterStrings
|
|||
Object[] children = null;
|
||||
try
|
||||
{
|
||||
children = ss.resolveFilterString(filterStringReference.getString());
|
||||
children = ss.resolveFilterString(new NullProgressMonitor(), filterStringReference.getString());
|
||||
if ((children == null) || (children.length==0))
|
||||
{
|
||||
children = new SystemMessageObject[1];
|
||||
|
|
|
@ -143,6 +143,8 @@ public class SystemViewDataDragAdapter extends DragSourceAdapter
|
|||
else
|
||||
{
|
||||
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.detail = DND.DROP_COPY;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1579,9 +1579,11 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
*/
|
||||
public class ConnectJob extends SubSystemOperationJob
|
||||
{
|
||||
public ConnectJob()
|
||||
private SubSystem _ss;
|
||||
public ConnectJob(SubSystem ss)
|
||||
{
|
||||
super(GenericMessages.RSESubSystemOperation_Connect_message);
|
||||
_ss = ss;
|
||||
}
|
||||
|
||||
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());
|
||||
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>
|
||||
* @param filterString filter pattern for objects to return.
|
||||
* @return the results of resolving the filter string.
|
||||
*
|
||||
* @deprecated use resolveFilterString(IProgressMonitor monitor, String filterString) instead
|
||||
*/
|
||||
public Object[] resolveFilterString(String filterString)
|
||||
throws Exception
|
||||
|
@ -1994,36 +2001,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
ok = promptForPassword();
|
||||
if (ok)
|
||||
{
|
||||
Display display = Display.getCurrent();
|
||||
if (display != null)
|
||||
{
|
||||
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
|
||||
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
|
||||
|
@ -2039,6 +2022,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
*
|
||||
* @param filterStrings array of filter patterns for objects to return.
|
||||
* @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)
|
||||
throws Exception
|
||||
|
@ -2057,39 +2042,16 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
|
||||
if (ok)
|
||||
{
|
||||
Display display = Display.getCurrent();
|
||||
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);
|
||||
}
|
||||
}
|
||||
return internalResolveFilterStrings(new NullProgressMonitor(), filterStrings);
|
||||
}
|
||||
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?
|
||||
if (context instanceof SystemPromptDialog)
|
||||
|
@ -2099,7 +2061,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
{
|
||||
showOperationErrorMessage(shell, status.getException());
|
||||
}
|
||||
return status;
|
||||
return;
|
||||
}
|
||||
job.setPriority(Job.INTERACTIVE);
|
||||
//job.setUser(true);
|
||||
|
@ -2108,31 +2070,6 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
job.setRule(rule);
|
||||
}
|
||||
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>
|
||||
* @param parent Object that is being expanded.
|
||||
* @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)
|
||||
throws Exception
|
||||
|
@ -2311,36 +2250,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
ok = promptForPassword();
|
||||
if (ok)
|
||||
{
|
||||
Display display = Display.getCurrent();
|
||||
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);
|
||||
}
|
||||
}
|
||||
return internalResolveFilterString(new NullProgressMonitor(), parent, filterString);
|
||||
}
|
||||
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 value Value to set property to
|
||||
* @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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2402,34 +2296,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
* @param subject Identifies which object to get the properties of
|
||||
* @param key Identifies property to get value of
|
||||
* @return String The value of the requested key.
|
||||
*
|
||||
* @deprecated this shouldn't be used
|
||||
*/
|
||||
public String getProperty(Object subject, String key)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2441,33 +2313,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
* @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.
|
||||
* @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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2555,12 +2406,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
//dwd ((ProgressMonitorDialog) runnableContext).setCancelable(true);
|
||||
//dwd }
|
||||
getConnectorService().promptForPassword(forcePrompt); // prompt for userid and password
|
||||
ConnectJob job = new ConnectJob();
|
||||
scheduleJob(job, null, shell != null);
|
||||
IStatus status = job.getResult();
|
||||
if (status != null && status.isOK()) {
|
||||
registry.connectedStatusChange(this, true, false);
|
||||
}
|
||||
ConnectJob job = new ConnectJob(this);
|
||||
scheduleJob(job, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2679,33 +2526,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
* @param subject Identifies which object to get the properties of
|
||||
* @param keys the array of property keys.
|
||||
* @return the values for the given property keys.
|
||||
*
|
||||
* @deprecated this shouldn't be used
|
||||
*/
|
||||
public String[] getProperties(Object subject, String[] keys)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue