1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-18 14:35:23 +02:00

get rid of subsystem calls with Shell parameters

This commit is contained in:
David McKnight 2006-09-05 16:22:14 +00:00
parent 692138a429
commit b4a63e3cc4
46 changed files with 142 additions and 222 deletions

View file

@ -925,7 +925,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
{ {
try try
{ {
promptForPassword(Display.getDefault().getActiveShell(), true); promptForPassword(true);
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
@ -1037,7 +1037,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
{ {
try try
{ {
promptForPassword(Display.getDefault().getActiveShell(), true); promptForPassword(true);
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
@ -1139,7 +1139,7 @@ public class DStoreConnectorService extends AbstractConnectorService implements
protected boolean promptForTrusting(Shell shell, X509Certificate cert) protected boolean promptForTrusting( X509Certificate cert)
{ {
return true; return true;
} }

View file

@ -8,8 +8,7 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources, org.eclipse.core.resources,
org.eclipse.rse.logging, org.eclipse.rse.logging,
org.eclipse.rse.services, org.eclipse.rse.services
org.eclipse.swt
Eclipse-LazyStart: true Eclipse-LazyStart: true
Export-Package: org.eclipse.rse.core, Export-Package: org.eclipse.rse.core,
org.eclipse.rse.core.filters, org.eclipse.rse.core.filters,

View file

@ -18,7 +18,6 @@ package org.eclipse.rse.core.subsystems;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IRSEModelObject; import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.swt.widgets.Shell;
/** /**
@ -175,7 +174,7 @@ public interface IConnectorService extends IRSEModelObject
* @param forcePrompt forces the prompt dialog to be displayed even if the password is currently * @param forcePrompt forces the prompt dialog to be displayed even if the password is currently
* in memory. * in memory.
*/ */
public void promptForPassword(Shell shell, boolean forcePrompt) public void promptForPassword(boolean forcePrompt)
throws InterruptedException; throws InterruptedException;
/** /**
* Set the password if you got it from somewhere * Set the password if you got it from somewhere

View file

@ -28,7 +28,6 @@ import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.persistance.IRSEPersistableContainer; import org.eclipse.rse.core.persistance.IRSEPersistableContainer;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.swt.widgets.Shell;
@ -340,13 +339,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* by all subsystems in which case this will always return false. * by all subsystems in which case this will always return false.
*/ */
public boolean isOffline(); public boolean isOffline();
/**
* Connect to the remote system.
* In addition to calling getSystem().connect(),this might fire events.
*
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
*/
public void connect(Shell shell) throws Exception;
/** /**
* Connect to the remote system. * Connect to the remote system.
* This uses Display.syncExec to get an active Shell and then calls connect(Shell) * This uses Display.syncExec to get an active Shell and then calls connect(Shell)
@ -357,11 +350,10 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* Connect to the remote system, optionally forcing a signon prompt even if the password * Connect to the remote system, optionally forcing a signon prompt even if the password
* is cached in memory or on disk. * is cached in memory or on disk.
* *
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param forcePrompt forces the prompt dialog to be displayed even if the password is currently * @param forcePrompt forces the prompt dialog to be displayed even if the password is currently
* in memory. * in memory.
*/ */
public void connect(Shell shell, boolean forcePrompt) throws Exception; public void connect(boolean forcePrompt) throws Exception;
/** /**
@ -369,7 +361,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* In addition to calling getSystem().disconnect(),this must fire an * In addition to calling getSystem().disconnect(),this must fire an
* event to collapse the expanded nodes in the tree under this node. * event to collapse the expanded nodes in the tree under this node.
*/ */
public void disconnect(Shell shell) throws Exception; public void disconnect() throws Exception;
/** /**
* Disconnect from the remote system. * Disconnect from the remote system.
@ -377,7 +369,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* event to collapse the expanded nodes in the tree under this node * event to collapse the expanded nodes in the tree under this node
* depending on the value of collapseTree. * depending on the value of collapseTree.
*/ */
public void disconnect(Shell shell, boolean collapseTree) throws Exception; public void disconnect(boolean collapseTree) throws Exception;
@ -479,10 +471,9 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* type. Be sure to register your adapter factory. * type. Be sure to register your adapter factory.
* *
* @param filterString filter pattern for objects to return. * @param filterString filter pattern for objects to return.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Array of objects that are the result of this filter string * @return Array of objects that are the result of this filter string
*/ */
public Object[] resolveFilterString(String filterString, Shell shell) public Object[] resolveFilterString(String filterString)
throws Exception; throws Exception;
/** /**
* Resolve multiple absolute filter strings. This is only applicable if the subsystem * Resolve multiple absolute filter strings. This is only applicable if the subsystem
@ -492,10 +483,9 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* filter strings versus a single filter string. * filter strings versus a single filter string.
* *
* @param filterStrings array of filter patterns for objects to return. * @param filterStrings array of filter patterns for objects to return.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @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
*/ */
public Object[] resolveFilterStrings(String[] filterStrings, Shell shell) public Object[] resolveFilterStrings(String[] filterStrings)
throws Exception; throws Exception;
/** /**
@ -521,10 +511,9 @@ 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.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Array of objects that are the result of this filter string * @return Array of objects that are the result of this filter string
*/ */
public Object[] resolveFilterString(Object parent, String filterString, Shell shell) public Object[] resolveFilterString(Object parent, String filterString)
throws Exception; throws Exception;
/* /*
@ -553,10 +542,9 @@ 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 set * @param key Identifies property to set
* @param value Value to set property to * @param value Value to set property to
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @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.
*/ */
public Object setProperty(Object subject, String key, String value, Shell shell) public Object setProperty(Object subject, String key, String value)
throws Exception; throws Exception;
/** /**
@ -565,10 +553,9 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* true for supportsProperties(). * true for supportsProperties().
* @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
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return String The value of the requested key. * @return String The value of the requested key.
*/ */
public String getProperty(Object subject, String key, Shell shell) public String getProperty(Object subject, String key)
throws Exception; throws Exception;
/** /**
@ -578,10 +565,9 @@ 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 set * @param key Identifies property to set
* @param value Values to set properties to. One to one mapping to keys by index number * @param value Values to set properties to. One to one mapping to keys by index number
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @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.
*/ */
public Object setProperties(Object subject, String[] keys, String[] values, Shell shell) public Object setProperties(Object subject, String[] keys, String[] values)
throws Exception; throws Exception;
/** /**
@ -590,10 +576,9 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* true for supportsProperties(). * true for supportsProperties().
* @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
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Object The values of the requested keys. * @return Object The values of the requested keys.
*/ */
public String[] getProperties(Object subject, String[] keys, Shell shell) public String[] getProperties(Object subject, String[] keys)
throws Exception; throws Exception;
/** /**

View file

@ -24,7 +24,7 @@ import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage; import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.persistance.IRSEPersistableContainer; import org.eclipse.rse.core.persistance.IRSEPersistableContainer;
import org.eclipse.swt.widgets.Shell;
public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvider, IRSEPersistableContainer public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvider, IRSEPersistableContainer
@ -344,24 +344,23 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
* disconnect. * disconnect.
* <p> * <p>
* The subsystem will be saved to disk. * The subsystem will be saved to disk.
* @param shell parent shell needed in case an error message is displayed
* @param subsystem target of the update action * @param subsystem target of the update action
* @param updateUserId true if we are updating the userId, else false to ignore userId * @param updateUserId true if we are updating the userId, else false to ignore userId
* @param userId new local user Id. Ignored if updateUserId is false * @param userId new local user Id. Ignored if updateUserId is false
* @param updatePort true if we are updating the port, else false to ignore port * @param updatePort true if we are updating the port, else false to ignore port
* @param port new local port value. Ignored if updatePort is false * @param port new local port value. Ignored if updatePort is false
*/ */
public void updateSubSystem(Shell shell, ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port); public void updateSubSystem(ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port);
/** /**
* Update the port for the given subsystem instance. * Update the port for the given subsystem instance.
* Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)} * Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
*/ */
public void setSubSystemPort(Shell shell, ISubSystem subsystem, int port); public void setSubSystemPort(ISubSystem subsystem, int port);
/** /**
* Update the user ID for the given subsystem instance. * Update the user ID for the given subsystem instance.
* Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)} * Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
*/ */
public void setSubSystemUserId(Shell shell, ISubSystem subsystem, String userId); public void setSubSystemUserId(ISubSystem subsystem, String userId);
/** /**
* Returns true if this factory allows users to delete instances of subsystem objects. * Returns true if this factory allows users to delete instances of subsystem objects.

View file

@ -115,7 +115,7 @@ public class RSEFileSystem extends FileSystem
try try
{ {
ss.connect(shell); ss.connect();
} }
catch (Exception e) catch (Exception e)
{ {
@ -138,26 +138,8 @@ public class RSEFileSystem extends FileSystem
if (!fs.isConnected()) if (!fs.isConnected())
{ {
Shell shell = null;
try
{
//if (PlatformUI.isWorkbenchRunning())
{
//shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
shell = SystemBasePlugin.getActiveWorkbenchShell(); fs.getConnectorService().promptForPassword(false);
}
}
catch (Exception e)
{
}
if (shell == null)
{
shell = new Shell();
}
fs.getConnectorService().promptForPassword(shell, false);
fs.getConnectorService().connect(new NullProgressMonitor()); fs.getConnectorService().connect(new NullProgressMonitor());
//fs.connect(shell); //fs.connect(shell);
} }

View file

@ -570,8 +570,7 @@ public abstract class SystemTempFileListener implements IResourceChangeListener
// if not, attemp to connect to it // if not, attemp to connect to it
if (!fs.isConnected()) if (!fs.isConnected())
{ {
Shell theShell = SystemBasePlugin.getActiveWorkbenchShell(); fs.connect();
fs.connect(theShell);
} }
} }
catch (Exception e) catch (Exception e)

View file

@ -720,7 +720,7 @@ public class SystemViewRemoteFileAdapter
} }
else else
{ {
children = ss.resolveFilterString(file, filter, getShell()); children = ss.resolveFilterString(file, filter);
} }
if ((children == null) || (children.length == 0)) if ((children == null) || (children.length == 0))
{ {

View file

@ -603,7 +603,7 @@ public class SystemQualifiedRemoteFolderCombo extends Composite
{ {
try try
{ {
ss.connect(getShell()); // will throw exception if fails. ss.connect(); // will throw exception if fails.
} catch (InterruptedException exc) } catch (InterruptedException exc)
{ {
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_CANCELLED); msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_CANCELLED);

View file

@ -130,7 +130,7 @@ public class RemoteCommandHelpers
try try
{ {
IRemoteCommandShell defaultShell= cmdSubSystem.getDefaultShell(shell); IRemoteCommandShell defaultShell= cmdSubSystem.getDefaultShell();
showInView(defaultShell, isCompile, cmdString); showInView(defaultShell, isCompile, cmdString);
@ -154,9 +154,9 @@ public class RemoteCommandHelpers
cdCmd = "cd /d " + path; //$NON-NLS-1$ cdCmd = "cd /d " + path; //$NON-NLS-1$
} }
cmdSubSystem.sendCommandToShell(cdCmd, shell, defaultShell); cmdSubSystem.sendCommandToShell(cdCmd, defaultShell);
} }
cmdSubSystem.sendCommandToShell(cmdString, shell, defaultShell); cmdSubSystem.sendCommandToShell(cmdString, defaultShell);
} }

View file

@ -148,7 +148,7 @@ public class SystemRemoteCommandEntryForm extends Composite
{ {
try try
{ {
currSubSystem.runCommand(cmd, getShell(), null); currSubSystem.runCommand(cmd, null);
} }
catch ( Exception e ) catch ( Exception e )
{ {

View file

@ -402,7 +402,7 @@ public class SystemCommandAction extends SystemBaseAction
if (launchNewShell) if (launchNewShell)
{ {
Object[] results = cmdSubSystem.runCommand(cmd, shell, _selected); Object[] results = cmdSubSystem.runCommand(cmd, _selected);
Object cmdObject = results[0]; Object cmdObject = results[0];
if (cmdObject instanceof IRemoteCommandShell) if (cmdObject instanceof IRemoteCommandShell)
{ {
@ -412,7 +412,7 @@ public class SystemCommandAction extends SystemBaseAction
else else
{ {
// run command in shell // run command in shell
IRemoteCommandShell defaultShell = cmdSubSystem.getDefaultShell(shell); IRemoteCommandShell defaultShell = cmdSubSystem.getDefaultShell();
if (defaultShell != null) if (defaultShell != null)
{ {
showInView(defaultShell); showInView(defaultShell);
@ -424,8 +424,8 @@ public class SystemCommandAction extends SystemBaseAction
{ {
cdCmd = "cd /d " + path; //$NON-NLS-1$ cdCmd = "cd /d " + path; //$NON-NLS-1$
} }
cmdSubSystem.sendCommandToShell(cdCmd, shell, defaultShell); cmdSubSystem.sendCommandToShell(cdCmd, defaultShell);
cmdSubSystem.sendCommandToShell(cmd, shell, defaultShell); cmdSubSystem.sendCommandToShell(cmd, defaultShell);
} }
} }
else else
@ -433,7 +433,7 @@ public class SystemCommandAction extends SystemBaseAction
IRemoteCmdSubSystem cmdSubSystem = getCommandSubSystem(); IRemoteCmdSubSystem cmdSubSystem = getCommandSubSystem();
if (cmdSubSystem != null) if (cmdSubSystem != null)
{ {
Object[] results = cmdSubSystem.runCommand(cmd, shell, _selected); Object[] results = cmdSubSystem.runCommand(cmd, _selected);
Object cmdObject = results[0]; Object cmdObject = results[0];
if (cmdObject instanceof IRemoteCommandShell) if (cmdObject instanceof IRemoteCommandShell)
{ {
@ -483,15 +483,15 @@ public class SystemCommandAction extends SystemBaseAction
{ {
SystemCommandsUI commandsUI = SystemCommandsUI.getInstance(); SystemCommandsUI commandsUI = SystemCommandsUI.getInstance();
SystemCommandsViewPart cmdsPart = commandsUI.activateCommandsView(); SystemCommandsViewPart cmdsPart = commandsUI.activateCommandsView();
IRemoteCommandShell cmd = cmdSubSystem.runShell(shell, _selected); IRemoteCommandShell cmd = cmdSubSystem.runShell(_selected);
cmdsPart.updateOutput(cmd); cmdsPart.updateOutput(cmd);
} }
else else
{ {
cmdSubSystem.connect(shell); cmdSubSystem.connect();
SystemCommandsUI commandsUI = SystemCommandsUI.getInstance(); SystemCommandsUI commandsUI = SystemCommandsUI.getInstance();
SystemCommandsViewPart cmdsPart = commandsUI.activateCommandsView(); SystemCommandsViewPart cmdsPart = commandsUI.activateCommandsView();
IRemoteCommandShell cmd = cmdSubSystem.runShell(shell, _selected); IRemoteCommandShell cmd = cmdSubSystem.runShell( _selected);
cmdsPart.updateOutput(cmd); cmdsPart.updateOutput(cmd);
//showInView(cmd); //showInView(cmd);
} }

View file

@ -49,7 +49,7 @@ public class SystemTerminateRemoveShellAction extends SystemTerminateShellAction
IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem(); IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem();
if (cmdSubSystem != null) if (cmdSubSystem != null)
{ {
cmdSubSystem.removeShell(getShell(), command); cmdSubSystem.removeShell(command);
} }
} }
catch (Exception e) catch (Exception e)

View file

@ -81,7 +81,7 @@ public class SystemTerminateShellAction extends SystemBaseShellAction
IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem(); IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem();
if (cmdSubSystem != null) if (cmdSubSystem != null)
{ {
cmdSubSystem.cancelShell(getShell(), command); cmdSubSystem.cancelShell(command);
} }
} }
catch (Exception e) catch (Exception e)

View file

@ -443,7 +443,7 @@ FocusListener
IRemoteCmdSubSystem commandSubSystem = remoteCommand.getCommandSubSystem(); IRemoteCmdSubSystem commandSubSystem = remoteCommand.getCommandSubSystem();
try try
{ {
commandSubSystem.sendCommandToShell(inputStr, _viewer.getShell(), remoteCommand); commandSubSystem.sendCommandToShell(inputStr, remoteCommand);
} }
catch (Exception e) catch (Exception e)
{ {
@ -464,7 +464,7 @@ FocusListener
IRemoteCmdSubSystem commandSubSystem = remoteCommand.getCommandSubSystem(); IRemoteCmdSubSystem commandSubSystem = remoteCommand.getCommandSubSystem();
try try
{ {
commandSubSystem.sendCommandToShell("#break", _viewer.getShell(), remoteCommand); commandSubSystem.sendCommandToShell("#break", remoteCommand);
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -147,7 +147,7 @@ public class SystemCommandsViewPart
{ {
try try
{ {
IRemoteCommandShell cmd = _cmdSubSystem.runShell(getShell(), null); IRemoteCommandShell cmd = _cmdSubSystem.runShell( null);
if (cmd != null) if (cmd != null)
{ {
showInView(cmd); showInView(cmd);

View file

@ -820,7 +820,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
try try
{ {
_cachedRemoteFiles.clear(); _cachedRemoteFiles.clear();
disconnect(SystemBasePlugin.getActiveWorkbenchShell()); disconnect();
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -107,8 +107,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
try try
{ {
// deduce active shell from display // deduce active shell from display
Shell shell = Display.getCurrent().getActiveShell(); context.getParentRemoteFileSubSystem().connect();
context.getParentRemoteFileSubSystem().connect(shell);
} catch (Exception exc) {} } catch (Exception exc) {}
} }

View file

@ -58,8 +58,7 @@ public class RemoteProcessImpl implements IRemoteProcess, ISystemProcessRemoteCo
try try
{ {
// deduce active shell from display // deduce active shell from display
Shell shell = Display.getCurrent().getActiveShell(); context.getParentRemoteProcessSubSystem().connect();
context.getParentRemoteProcessSubSystem().connect(shell);
} catch (Exception exc) {} } catch (Exception exc) {}
_underlyingProcess = process; _underlyingProcess = process;

View file

@ -155,7 +155,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
IProcessServiceSubSystemConfiguration factory = (IProcessServiceSubSystemConfiguration)fact; IProcessServiceSubSystemConfiguration factory = (IProcessServiceSubSystemConfiguration)fact;
try try
{ {
disconnect(SystemBasePlugin.getActiveWorkbenchShell()); disconnect();
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -488,12 +488,12 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* @param shell the window used for notification * @param shell the window used for notification
* @return the default running command shell * @return the default running command shell
*/ */
public IRemoteCommandShell getDefaultShell(Shell shell) throws Exception public IRemoteCommandShell getDefaultShell() throws Exception
{ {
IRemoteCommandShell[] shells = getShells(); IRemoteCommandShell[] shells = getShells();
if (shells == null || shells.length == 0) if (shells == null || shells.length == 0)
{ {
return runShell(shell, null); return runShell( null);
} }
else else
{ {
@ -809,7 +809,7 @@ 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
*/ */
public Object[] runCommand(String command, Shell shell, Object context, boolean interpretOutput) throws Exception public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
{ {
if (shell != null) if (shell != null)
this.shell = shell; this.shell = shell;
@ -845,7 +845,7 @@ 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
*/ */
public IRemoteCommandShell runShell(Shell shell, Object context) throws Exception public IRemoteCommandShell runShell(Object context) throws Exception
{ {
if (shell != null) if (shell != null)
this.shell = shell; this.shell = shell;
@ -887,31 +887,27 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* factory reports true for supportsCommands(). * factory reports true for supportsCommands().
* *
* @param command Command to be executed remotely. * @param command Command to be executed remotely.
* @param shell parent shell used to show error message. Null means you will
* handle showing the error message.
* @param context context of a command (i.e. working directory). <code>null</code> is * @param context context of a command (i.e. working directory). <code>null</code> is
* 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.
*/ */
public Object[] runCommand(String command, Shell shell, Object context) throws Exception public Object[] runCommand(String command, Object context) throws Exception
{ {
return runCommand(command, shell, context, true); return runCommand(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 shell parent shell used to show error message. Null means you will
* handle showing the error message.
* @param commandObject the shell or command to send the invocation to. * @param commandObject the shell or command to send the invocation to.
*/ */
public void sendCommandToShell(String input, Shell shell, Object commandObject) throws Exception public void sendCommandToShell(String input, Object commandObject) throws Exception
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try
@ -942,11 +938,9 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Cancel a shell or running command. * Cancel a shell or running command.
* *
* @param shell parent shell used to show error message. Null means you will
* handle showing the error message.
* @param commandObject the shell or command to cancel. * @param commandObject the shell or command to cancel.
*/ */
public void cancelShell(Shell shell, Object commandObject) throws Exception public void cancelShell(Object commandObject) throws Exception
{ {
if (isConnected()) if (isConnected())
{ {
@ -956,7 +950,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try
@ -986,7 +980,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* handle showing the error message. * handle showing the error message.
* @param commandObject the shell or command to cancel. * @param commandObject the shell or command to cancel.
*/ */
public void removeShell(Shell shell, Object commandObject) throws Exception public void removeShell(Object commandObject) throws Exception
{ {
if (isConnected()) if (isConnected())
{ {
@ -996,7 +990,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try

View file

@ -104,7 +104,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
try try
{ {
RSEUIPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this); RSEUIPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
_remoteCmdShell = _cmdSubSystem.runShell(getShell(), _pwd); _remoteCmdShell = _cmdSubSystem.runShell( _pwd);
} }
catch (Exception e) catch (Exception e)
{ {
@ -136,7 +136,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
{ {
try try
{ {
_cmdSubSystem.cancelShell(getShell(), _remoteCmdShell); _cmdSubSystem.cancelShell( _remoteCmdShell);
} }
catch (Exception e) catch (Exception e)
{ {
@ -182,7 +182,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
// echo command appended after ; so that // echo command appended after ; so that
// it isn't treated like stdin for the intial command // it isn't treated like stdin for the intial command
_cmdSubSystem.sendCommandToShell(cmd + _cmdSeparator + echoCmd, getShell(), _remoteCmdShell); _cmdSubSystem.sendCommandToShell(cmd + _cmdSeparator + echoCmd, _remoteCmdShell);
} }
catch (Exception e) catch (Exception e)
@ -203,7 +203,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
{ {
try try
{ {
_cmdSubSystem.sendCommandToShell(input, getShell(), _remoteCmdShell); _cmdSubSystem.sendCommandToShell(input, _remoteCmdShell);
} }
catch (Exception e) catch (Exception e)

View file

@ -39,7 +39,7 @@ public class SimpleCommandOperation
public void runCommand(String command) throws Exception public void runCommand(String command) throws Exception
{ {
Object[] result =_subsystem.runCommand(command, null, _workingDirectory, false); Object[] result =_subsystem.runCommand(command, _workingDirectory, false);
_cmdShell = (IRemoteCommandShell)result[0]; _cmdShell = (IRemoteCommandShell)result[0];
} }
@ -52,7 +52,7 @@ public class SimpleCommandOperation
{ {
if (isActive()) if (isActive())
{ {
_subsystem.sendCommandToShell(input, null, _cmdShell); _subsystem.sendCommandToShell(input, _cmdShell);
} }
} }
@ -82,7 +82,7 @@ public class SimpleCommandOperation
{ {
if (_cmdShell != null && _cmdShell.isActive()) if (_cmdShell != null && _cmdShell.isActive())
{ {
_cmdShell.getCommandSubSystem().cancelShell(null, _cmdShell); _cmdShell.getCommandSubSystem().cancelShell(_cmdShell);
} }
} }

View file

@ -43,20 +43,18 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
* Execute a remote command. This is only applicable if the subsystem factory reports * Execute a remote command. This is only applicable if the subsystem factory reports
* true for supportsCommands(). * true for supportsCommands().
* @param command Command to be executed remotely. * @param command Command to be executed remotely.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Object context context of a command (i.e. working directory). Null is valid and means to run the * @param Object 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. * command as a shell command in the default shell.
* @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.core.subsystems.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.core.subsystems.shells.ui.RemoteCommandHelpers
*/ */
public Object[] runCommand(String command, Shell shell, Object context) throws Exception; public Object[] runCommand(String command, Object context) throws Exception;
/** /**
* Execute a remote command. This is only applicable if the subsystem factory reports * Execute a remote command. This is only applicable if the subsystem factory reports
* true for supportsCommands(). * true for supportsCommands().
* @param command Command to be executed remotely. * @param command Command to be executed remotely.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Object context context of a command (i.e. working directory). Null is valid and means to run the * @param Object 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. * command as a shell command in the default shell.
* @param interpretOutput whether to interpret the output or not * @param interpretOutput whether to interpret the output or not
@ -64,49 +62,44 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
* are messages logged by the command. * are messages logged by the command.
* @see org.eclipse.rse.core.subsystems.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.core.subsystems.shells.ui.RemoteCommandHelpers
*/ */
public Object[] runCommand(String command, Shell shell, Object context, boolean interpretOutput) throws Exception; public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception;
/** /**
* Launch a new command shell. This is only applicable if the subsystem factory reports * Launch a new command shell. This is only applicable if the subsystem factory reports
* true for supportsCommands(). * true for supportsCommands().
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Object context context of a shell (i.e. working directory). Null is valid and means to use the default context. * @param Object 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.core.subsystems.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.core.subsystems.shells.ui.RemoteCommandHelpers
*/ */
public IRemoteCommandShell runShell(Shell shell, Object context) throws Exception; public IRemoteCommandShell runShell(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 String input the command to invoke in the shell. * @param String input the command to invoke in the shell.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Object commandObject the shell or command to send the invocation to. * @param Object commandObject the shell or command to send the invocation to.
* @see org.eclipse.rse.core.subsystems.shells.ui.RemoteCommandHelpers * @see org.eclipse.rse.core.subsystems.shells.ui.RemoteCommandHelpers
*/ */
public void sendCommandToShell(String input, Shell shell, Object commandObject) throws Exception; public void sendCommandToShell(String input, Object commandObject) throws Exception;
/** /**
* Cancel a shell or running command. * Cancel a shell or running command.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Object commandObject the shell or command to cancel. * @param Object commandObject the shell or command to cancel.
*/ */
public void cancelShell(Shell shell, Object commandObject) throws Exception; public void cancelShell(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.
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param Object commandObject the shell or command to cancel & remove. * @param Object commandObject the shell or command to cancel & remove.
*/ */
public void removeShell(Shell shell, Object commandObject) throws Exception; public void removeShell(Object commandObject) throws Exception;
/** /**
* Get the default running command shell for this command subsystem. If no such shell exists or is running, a new one is launched. * Get the default running command shell for this command subsystem. If no such shell exists or is running, a new one is launched.
* @param shell a window used for notification
* @return the default running command shell * @return the default running command shell
*/ */
public IRemoteCommandShell getDefaultShell(Shell shell) throws Exception; public IRemoteCommandShell getDefaultShell() throws Exception;
/** /**
* Get all command shells and transient commands that have been run or are running for this command subsystem. * Get all command shells and transient commands that have been run or are running for this command subsystem.

View file

@ -213,7 +213,7 @@ public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements I
IShellServiceSubSystemConfiguration factory = (IShellServiceSubSystemConfiguration)fact; IShellServiceSubSystemConfiguration factory = (IShellServiceSubSystemConfiguration)fact;
try try
{ {
disconnect(SystemBasePlugin.getActiveWorkbenchShell()); disconnect();
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -65,9 +65,9 @@ public class SystemConnectAction extends SystemBaseAction
ISubSystem ss = (ISubSystem)getFirstSelection(); ISubSystem ss = (ISubSystem)getFirstSelection();
try { try {
if (ss.getHost().getSystemType().equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) if (ss.getHost().getSystemType().equals(IRSESystemType.SYSTEMTYPE_WINDOWS))
ss.connect(getShell()); ss.connect();
else else
ss.connect(getShell(), true); ss.connect(true);
} catch (Exception exc) {} // msg already shown } catch (Exception exc) {} // msg already shown
} }
} }

View file

@ -85,7 +85,7 @@ public class SystemConnectAllSubSystemsAction extends SystemBaseAction
{ {
try try
{ {
subsystem.connect(shell, false); subsystem.connect(false);
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -63,7 +63,7 @@ public class SystemDisconnectAction extends SystemBaseAction
{ {
ISubSystem ss = (ISubSystem)getFirstSelection(); ISubSystem ss = (ISubSystem)getFirstSelection();
try { try {
ss.disconnect(getShell()); ss.disconnect();
} catch (Exception exc) {} // msg already shown } catch (Exception exc) {} // msg already shown
} }
} }

View file

@ -91,7 +91,7 @@ public class SystemWorkOfflineAction extends SystemBaseAction
{ {
try try
{ {
subsystems[i].disconnect(getShell(), false); subsystems[i].disconnect(false);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// user cancelled disconnect // user cancelled disconnect
cancelled = true; cancelled = true;

View file

@ -129,10 +129,9 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
public void run() public void run()
{ {
Shell shell = Display.getCurrent().getActiveShell();
try try
{ {
_ss.promptForPassword(shell); _ss.promptForPassword();
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -119,7 +119,7 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
{ {
try try
{ {
subsystems[i].disconnect(getShell(), false); subsystems[i].disconnect(false);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// user cancelled disconnect // user cancelled disconnect
cancelled = true; cancelled = true;

View file

@ -365,7 +365,7 @@ public class SystemSubSystemPropertyPageCoreForm extends AbstractSystemSubSystem
// ambiquity as the parent could be the connnection or the user preferences setting for this // ambiquity as the parent could be the connnection or the user preferences setting for this
// system type. Because of this decision, we don't need to tell updateSubSystem(...) where // system type. Because of this decision, we don't need to tell updateSubSystem(...) where
// to update, as it always the local subsystem. // to update, as it always the local subsystem.
ssFactory.updateSubSystem(getShell(), subsys, true, userId, false, subsys.getConnectorService().getPort()); ssFactory.updateSubSystem(subsys, true, userId, false, subsys.getConnectorService().getPort());
} }
/** /**
* Change the subsystem port value * Change the subsystem port value
@ -382,7 +382,7 @@ public class SystemSubSystemPropertyPageCoreForm extends AbstractSystemSubSystem
*/ */
int portInteger = portPrompt.getPort(); int portInteger = portPrompt.getPort();
ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
ssFactory.updateSubSystem(getShell(), subsys, false, subsys.getLocalUserId(), true, portInteger); ssFactory.updateSubSystem(subsys, false, subsys.getLocalUserId(), true, portInteger);
} }
/** /**

View file

@ -515,7 +515,7 @@ public class SystemDNDTransferRunnable extends Job
{ {
try try
{ {
targetSubSystem.connect(SystemBasePlugin.getActiveWorkbenchShell()); targetSubSystem.connect();
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -579,7 +579,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
Object[] children = null; Object[] children = null;
try try
{ {
children = subsystem.resolveFilterString(filterString, shell); children = subsystem.resolveFilterString(filterString);
} catch (InterruptedException exc) } catch (InterruptedException exc)
{ {
if (canceledObject == null) if (canceledObject == null)

View file

@ -89,7 +89,7 @@ public class SystemTestFilterStringAPIProviderImpl
return children; return children;
try try
{ {
children = subsystem.resolveFilterString(filterString, shell); children = subsystem.resolveFilterString(filterString);
if ((children == null) || (children.length==0)) if ((children == null) || (children.length==0))
{ {
if (nullObject == null) if (nullObject == null)

View file

@ -136,7 +136,7 @@ public class SystemViewAPIProviderForFilterStrings
Object[] children = null; Object[] children = null;
try try
{ {
children = ss.resolveFilterString(filterStringReference.getString(),getShell()); children = ss.resolveFilterString(filterStringReference.getString());
if ((children == null) || (children.length==0)) if ((children == null) || (children.length==0))
{ {
children = new SystemMessageObject[1]; children = new SystemMessageObject[1];

View file

@ -182,7 +182,7 @@ public class SystemViewAPIProviderForFilters
String[] filterStrings = referencedFilter.getFilterStrings(); String[] filterStrings = referencedFilter.getFilterStrings();
try try
{ {
Object[] allChildren = ss.resolveFilterStrings(filterStrings,getShell()); Object[] allChildren = ss.resolveFilterStrings(filterStrings);
int nbrNestedFilters = (nestedFilterReferences==null) ? 0: nestedFilterReferences.length; int nbrNestedFilters = (nestedFilterReferences==null) ? 0: nestedFilterReferences.length;
children = new Object[nbrNestedFilters + allChildren.length]; children = new Object[nbrNestedFilters + allChildren.length];
int idx = 0; int idx = 0;

View file

@ -214,7 +214,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
} }
// otherwise, get children and then cache // otherwise, get children and then cache
else { else {
children = checkForNull(ss.resolveFilterStrings(filterStrings,shell), true); children = checkForNull(ss.resolveFilterStrings(filterStrings), true);
if (ss.getSubSystemConfiguration().supportsFilterCaching()) { if (ss.getSubSystemConfiguration().supportsFilterCaching()) {
simpleFilter.setContents(SystemChildrenContentsType.getInstance(), children); simpleFilter.setContents(SystemChildrenContentsType.getInstance(), children);

View file

@ -360,7 +360,7 @@ public class SystemViewFilterReferenceAdapter
if (monitor == null) if (monitor == null)
{ {
Shell shell = getShell(); Shell shell = getShell();
allChildren = ss.resolveFilterStrings(filterStrings, shell); allChildren = ss.resolveFilterStrings(filterStrings);
} }
else else
{ {

View file

@ -468,7 +468,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
// ambiquity as the parent could be the connnection or the user preferences setting for this // ambiquity as the parent could be the connnection or the user preferences setting for this
// system type. Because of this decision, we don't need to tell updateSubSystem(...) where // system type. Because of this decision, we don't need to tell updateSubSystem(...) where
// to update, as it always the local subsystem. // to update, as it always the local subsystem.
ssFactory.updateSubSystem((Shell)null, subsys, true, userId, false, subsys.getConnectorService().getPort()); ssFactory.updateSubSystem(subsys, true, userId, false, subsys.getConnectorService().getPort());
} }
/** /**
* Change the subsystem port value * Change the subsystem port value
@ -511,7 +511,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
} }
int portInt = portInteger.intValue(); int portInt = portInteger.intValue();
ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
ssFactory.updateSubSystem((Shell)null, subsys, false, subsys.getLocalUserId(), true, portInt); ssFactory.updateSubSystem(subsys, false, subsys.getLocalUserId(), true, portInt);
} }

View file

@ -2382,7 +2382,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
{ {
try try
{ {
if (subsystems[idx].isConnected()) subsystems[idx].disconnect(shell); // MJB: added conditional for defect 45754 if (subsystems[idx].isConnected()) subsystems[idx].disconnect(); // MJB: added conditional for defect 45754
if (defaultUserIdChanged) if (defaultUserIdChanged)
{ {
subsystems[idx].getConnectorService().clearUserIdCache(); subsystems[idx].getConnectorService().clearUserIdCache();
@ -2669,10 +2669,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
try try
{ {
//ss.getConnectorService().disconnect(); defect 40675 //ss.getConnectorService().disconnect(); defect 40675
Shell shell = null; ss.disconnect();
if (Display.getCurrent() != null)
shell = Display.getCurrent().getActiveShell();
ss.disconnect(shell);
} }
catch (InterruptedException exc) catch (InterruptedException exc)
{ {

View file

@ -451,12 +451,11 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
* <li>If a valid password is not found then prompt the user. * <li>If a valid password is not found then prompt the user.
* </ol> * </ol>
* Must be run in the UI thread. * Must be run in the UI thread.
* @param shell parent for the prompt dialog if needed.
* Can be null if the password is known to exist in either this class or in the password store. * Can be null if the password is known to exist in either this class or in the password store.
* @param forcePrompt if true then present the prompt even if the password was found and is valid. * @param forcePrompt if true then present the prompt even if the password was found and is valid.
* @throws InterruptedException if user is prompted and user cancels that prompt or if isSuppressSignonPrompt is true. * @throws InterruptedException if user is prompted and user cancels that prompt or if isSuppressSignonPrompt is true.
*/ */
public void promptForPassword(Shell shell, boolean forcePrompt) throws InterruptedException { public void promptForPassword(boolean forcePrompt) throws InterruptedException {
// dy: March 24, 2003: check if prompting is temporarily suppressed by a tool // dy: March 24, 2003: check if prompting is temporarily suppressed by a tool
// vendor, this should only be suppressed if the user cancelled a previous signon // vendor, this should only be suppressed if the user cancelled a previous signon
// dialog (or some other good reason) // dialog (or some other good reason)
@ -634,7 +633,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
String ssLocalUserId = subsystem.getLocalUserId(); String ssLocalUserId = subsystem.getLocalUserId();
if (ssLocalUserId != null) { // defect 42709 if (ssLocalUserId != null) { // defect 42709
ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration(); ISubSystemConfiguration ssc = subsystem.getSubSystemConfiguration();
ssc.updateSubSystem(shell, subsystem, true, userId, false, 0); ssc.updateSubSystem(subsystem, true, userId, false, 0);
} else { // it seems intuitive to update the connection object. defect 42709. Phil } else { // it seems intuitive to update the connection object. defect 42709. Phil
int whereToUpdate = USERID_LOCATION_CONNECTION; int whereToUpdate = USERID_LOCATION_CONNECTION;
IHost conn = subsystem.getHost(); IHost conn = subsystem.getHost();

View file

@ -200,7 +200,7 @@ public abstract class AbstractConnectorServiceManager implements IConnectorServi
if ( (ss != subsystem) && sharesSystem(ss) ) if ( (ss != subsystem) && sharesSystem(ss) )
{ {
ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
ssFactory.updateSubSystem(shell, ss, updateUserId, userId, updatePort, port); ssFactory.updateSubSystem(ss, updateUserId, userId, updatePort, port);
} }
} }
} }

View file

@ -189,7 +189,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
try try
{ {
connect(shell); connect();
} }
catch (Exception e) catch (Exception e)
{ {
@ -515,7 +515,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
Shell shell = display.getActiveShell(); Shell shell = display.getActiveShell();
if (shell != null && !shell.isDisposed()) if (shell != null && !shell.isDisposed())
{ {
connect(shell); connect();
} }
else else
{ {
@ -1982,12 +1982,12 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* @param filterString filter pattern for objects to return. * @param filterString filter pattern for objects to return.
* @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.
*/ */
public Object[] resolveFilterString(String filterString, Shell shell) public Object[] resolveFilterString(String filterString)
throws Exception throws Exception
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try
@ -2033,7 +2033,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* @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.
* @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
*/ */
public Object[] resolveFilterStrings(String[] filterStrings, Shell shell) public Object[] resolveFilterStrings(String[] filterStrings)
throws Exception throws Exception
{ {
@ -2045,7 +2045,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
} }
if (!isConnected()) { if (!isConnected()) {
ok = promptForPassword(shell); ok = promptForPassword();
} }
if (ok) if (ok)
@ -2160,7 +2160,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
Object[] results = internalResolveFilterString(monitor, filterString); Object[] results = internalResolveFilterString(monitor, filterString);
@ -2202,7 +2202,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
Object[] results = internalResolveFilterStrings(monitor, filterStrings); Object[] results = internalResolveFilterStrings(monitor, filterStrings);
@ -2245,7 +2245,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
@ -2288,14 +2288,13 @@ 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 "*".
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
*/ */
public Object[] resolveFilterString(Object parent, String filterString, Shell shell) public Object[] resolveFilterString(Object parent, String filterString)
throws Exception throws Exception
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
@ -2345,15 +2344,14 @@ 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 set * @param key Identifies property to set
* @param value Value to set property to * @param value Value to set property to
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @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.
*/ */
public Object setProperty(Object subject, String key, String value, Shell shell) public Object setProperty(Object subject, String key, String value)
throws Exception throws Exception
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try
@ -2384,15 +2382,14 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* true for supportsProperties(). * true for supportsProperties().
* @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
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return String The value of the requested key. * @return String The value of the requested key.
*/ */
public String getProperty(Object subject, String key, Shell shell) public String getProperty(Object subject, String key)
throws Exception throws Exception
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try
@ -2425,15 +2422,14 @@ 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 set * @param key Identifies property to set
* @param value Values to set properties to. One to one mapping to keys by index number * @param value Values to set properties to. One to one mapping to keys by index number
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @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.
*/ */
public Object setProperties(Object subject, String[] keys, String[] values, Shell shell) public Object setProperties(Object subject, String[] keys, String[] values)
throws Exception throws Exception
{ {
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try
@ -2465,19 +2461,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
*/ */
public abstract void initializeSubSystem(IProgressMonitor monitor); public abstract void initializeSubSystem(IProgressMonitor monitor);
/**
* Attempt to connect to the remote system.
* You do not need to override this, as it does the progress monitor and error message
* displaying for you.
* <p>
* Override internalConnect if you want, but by default it calls getSystem().connect(IProgressMonitor).
*
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
*/
public void connect(Shell shell) throws Exception
{
connect(shell, false);
}
/** /**
* Attempt to connect to the remote system when a Shell is not available. * Attempt to connect to the remote system when a Shell is not available.
* You do not need to override this, as it does the progress monitor and error message * You do not need to override this, as it does the progress monitor and error message
@ -2512,11 +2496,10 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* <p> * <p>
* Override internalConnect if you want, but by default it calls getSystem().connect(IProgressMonitor). * Override internalConnect if you want, but by default it calls getSystem().connect(IProgressMonitor).
* *
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param forcePrompt Forces the signon prompt to be displayed even if a valid password in cached in memory * @param forcePrompt Forces the signon prompt to be displayed even if a valid password in cached in memory
* or saved on disk. * or saved on disk.
*/ */
public void connect(Shell shell, boolean forcePrompt) throws Exception { public void connect(boolean forcePrompt) throws Exception {
// yantzi: artemis60, (defect 53082) check that the connection has not been deleted before continuing, // yantzi: artemis60, (defect 53082) check that the connection has not been deleted before continuing,
// this is a defenisve measure to protect against code that stores a handle to subsystems but does // this is a defenisve measure to protect against code that stores a handle to subsystems but does
// not do this check // not do this check
@ -2542,7 +2525,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
if (runnableContext instanceof ProgressMonitorDialog) { if (runnableContext instanceof ProgressMonitorDialog) {
((ProgressMonitorDialog) runnableContext).setCancelable(true); ((ProgressMonitorDialog) runnableContext).setCancelable(true);
} }
getConnectorService().promptForPassword(shell, 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);
IStatus status = job.getResult(); IStatus status = job.getResult();
@ -2555,12 +2538,11 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
/** /**
* A convenience method, fully equivalent to promptForPassword(shell, false). * A convenience method, fully equivalent to promptForPassword(false).
* @param Shell parent shell used to show any error messages.
*/ */
public boolean promptForPassword(Shell shell) throws Exception public boolean promptForPassword() throws Exception
{ {
return promptForPassword(shell, false); return promptForPassword(false);
} }
/** /**
@ -2568,11 +2550,10 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* but we have detected the user is not connected so we prompt for password outside * but we have detected the user is not connected so we prompt for password outside
* of the progress monitor, then set a flag to do the connection within the progress * of the progress monitor, then set a flag to do the connection within the progress
* monitor. * monitor.
* @param Shell parent shell used to show error messages.
* @param force true if the prompting should be forced, false if prompting can be skipped if credentials have been stored. * @param force true if the prompting should be forced, false if prompting can be skipped if credentials have been stored.
* @return true if the credentials are obtained * @return true if the credentials are obtained
*/ */
public boolean promptForPassword(Shell shell, boolean force) throws Exception public boolean promptForPassword(boolean force) throws Exception
{ {
boolean ok = false; boolean ok = false;
if (!supportsConnecting) if (!supportsConnecting)
@ -2592,7 +2573,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
try try
{ {
getConnectorService().promptForPassword(shell, force); // prompt for password getConnectorService().promptForPassword(force); // prompt for password
doConnection = true; doConnection = true;
ok = true; ok = true;
} }
@ -2614,11 +2595,10 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* <p> * <p>
* Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor). * Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor).
* *
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
*/ */
public void disconnect(Shell shell) throws Exception public void disconnect() throws Exception
{ {
disconnect(shell, true); disconnect(true);
} }
/** /**
@ -2628,10 +2608,9 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* <p> * <p>
* Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor). * Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor).
* *
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @param collapseTree collapse the tree in the system view * @param collapseTree collapse the tree in the system view
*/ */
public void disconnect(Shell shell, boolean collapseTree) throws Exception public void disconnect(boolean collapseTree) throws Exception
{ {
_disconnecting = true; _disconnecting = true;
this.shell = shell; //FIXME remove this this.shell = shell; //FIXME remove this
@ -2673,17 +2652,16 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
* true for supportsProperties(). * true for supportsProperties().
* @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
* @param Shell parent shell used to show error message. Null means you will handle showing the error message.
* @return Object The values of the requested keys. * @return Object The values of the requested keys.
*/ */
public String[] getProperties(Object subject, String[] keys, Shell shell) public String[] getProperties(Object subject, String[] keys)
throws Exception throws Exception
{ {
this.shell = shell; //FIXME remove this this.shell = shell; //FIXME remove this
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(shell); ok = promptForPassword();
if (ok) if (ok)
{ {
try try

View file

@ -936,7 +936,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
{ {
try try
{ {
subsystems[idx].disconnect((Shell) null); // be nice if we had a shell to pass! subsystems[idx].disconnect(); // be nice if we had a shell to pass!
} }
catch (Exception exc) catch (Exception exc)
{ {
@ -1453,14 +1453,13 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* The changes to the subsystem configuration will be saved to disk. * The changes to the subsystem configuration will be saved to disk.
* Further, it will be asked to disconnect as this data affects the connection. * Further, it will be asked to disconnect as this data affects the connection.
* <p> * <p>
* @param shell parent shell needed in case an error message is displayed
* @param subsystem target of the update action * @param subsystem target of the update action
* @param updateUserId true if we are updating the userId, else false to ignore userId * @param updateUserId true if we are updating the userId, else false to ignore userId
* @param userId new local user Id. Ignored if updateUserId is false * @param userId new local user Id. Ignored if updateUserId is false
* @param updatePort true if we are updating the port, else false to ignore port * @param updatePort true if we are updating the port, else false to ignore port
* @param port new local port value. Ignored if updatePort is false * @param port new local port value. Ignored if updatePort is false
*/ */
public void updateSubSystem(Shell shell, ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port) public void updateSubSystem(ISubSystem subsystem, boolean updateUserId, String userId, boolean updatePort, int port)
{ {
// we pushed down the code that checks if this change is real, such that // we pushed down the code that checks if this change is real, such that
// in a multi-subsystem environment it will not enter an infinite loop // in a multi-subsystem environment it will not enter an infinite loop
@ -1510,17 +1509,17 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* Update the port for the given subsystem instance. * Update the port for the given subsystem instance.
* Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)} * Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
*/ */
public void setSubSystemPort(Shell shell, ISubSystem subsystem, int port) public void setSubSystemPort(ISubSystem subsystem, int port)
{ {
updateSubSystem(shell, subsystem, false, null, true, port); updateSubSystem( subsystem, false, null, true, port);
} }
/** /**
* Update the user ID for the given subsystem instance. * Update the user ID for the given subsystem instance.
* Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)} * Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
*/ */
public void setSubSystemUserId(Shell shell, ISubSystem subsystem, String userId) public void setSubSystemUserId(ISubSystem subsystem, String userId)
{ {
updateSubSystem(shell, subsystem, true, userId, false, 0); updateSubSystem(subsystem, true, userId, false, 0);
} }
/** /**
@ -1588,7 +1587,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
{ {
try try
{ {
subsystem.disconnect((Shell) null); // just in case. subsystem.disconnect(); // just in case.
} }
catch (Exception exc) catch (Exception exc)
{ {