1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 21:45:22 +02:00

[190231][api] Remove unnecessary UI dependencies from SubSystemConfiguration

This commit is contained in:
Martin Oberhuber 2007-05-31 15:00:09 +00:00
parent 273d8bbee8
commit 60fd92fdb1
3 changed files with 165 additions and 463 deletions

View file

@ -14,6 +14,7 @@
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core * Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core
* Martin Oberhuber (Wind River) - [190231] Remove UI-only code from SubSystemConfiguration
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.view; package org.eclipse.rse.ui.view;
@ -44,6 +45,7 @@ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration; import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.core.subsystems.SubSystem; import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.core.subsystems.SubSystemConfiguration; import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
import org.eclipse.rse.internal.core.filters.SystemFilterPoolWrapperInformation; import org.eclipse.rse.internal.core.filters.SystemFilterPoolWrapperInformation;
@ -64,7 +66,9 @@ import org.eclipse.rse.internal.ui.actions.SystemFilterNewFilterPoolAction;
import org.eclipse.rse.internal.ui.actions.SystemFilterRemoveFilterPoolReferenceAction; import org.eclipse.rse.internal.ui.actions.SystemFilterRemoveFilterPoolReferenceAction;
import org.eclipse.rse.internal.ui.actions.SystemFilterSelectFilterPoolsAction; import org.eclipse.rse.internal.ui.actions.SystemFilterSelectFilterPoolsAction;
import org.eclipse.rse.internal.ui.actions.SystemFilterWorkWithFilterPoolsAction; import org.eclipse.rse.internal.ui.actions.SystemFilterWorkWithFilterPoolsAction;
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapter;
import org.eclipse.rse.ui.ISystemIconConstants; import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemMenuManager; import org.eclipse.rse.ui.SystemMenuManager;
@ -83,6 +87,7 @@ import org.eclipse.rse.ui.propertypages.SystemSubSystemPropertyPageCoreForm;
import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter; import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
import org.eclipse.rse.ui.validators.ISystemValidator; import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorPortInput; import org.eclipse.rse.ui.validators.ValidatorPortInput;
import org.eclipse.rse.ui.validators.ValidatorSpecialChar;
import org.eclipse.rse.ui.widgets.IServerLauncherForm; import org.eclipse.rse.ui.widgets.IServerLauncherForm;
import org.eclipse.rse.ui.widgets.RemoteServerLauncherForm; import org.eclipse.rse.ui.widgets.RemoteServerLauncherForm;
import org.eclipse.rse.ui.wizards.SubSystemServiceWizardPage; import org.eclipse.rse.ui.wizards.SubSystemServiceWizardPage;
@ -111,7 +116,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* Returns any framework-supplied actions remote objects that should be contributed to the popup menu * Returns any framework-supplied actions remote objects that should be contributed to the popup menu
* for the given selection list. This does nothing if this adapter does not implement ISystemRemoteElementAdapter, * for the given selection list. This does nothing if this adapter does not implement ISystemRemoteElementAdapter,
* else it potentially adds menu items for "User Actions" and Compile", for example. It queries the subsystem * else it potentially adds menu items for "User Actions" and Compile", for example. It queries the subsystem
* factory of the selected objects to determine if these actions are appropriate to add. * configuration of the selected objects to determine if these actions are appropriate to add.
* *
* <p> * <p>
* No need to override. * No need to override.
@ -122,12 +127,12 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first. * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
* @param subsystem the subsystem of the selection * @param subsystem the subsystem of the selection
*/ */
public void addCommonRemoteActions(ISubSystemConfiguration factory, SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystem subsystem) public void addCommonRemoteActions(ISubSystemConfiguration config, SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystem subsystem)
{ {
/** FIXME - UDAs should not be coupled to factory adapter /** FIXME - UDAs should not be coupled to subsystem configuration adapter
SystemCompileManager mgr = factory.getCompileManager(); SystemCompileManager mgr = config.getCompileManager();
if (factory.supportsCompileActions() && (mgr != null)) if (config.supportsCompileActions() && (mgr != null))
{ {
int size = selection.size(); int size = selection.size();
@ -164,9 +169,9 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
} }
} }
if (factory.supportsUserDefinedActions() && factory.supportsUserDefinedActions(selection)) if (config.supportsUserDefinedActions() && config.supportsUserDefinedActions(selection))
{ {
addUserDefinedActions(factory, shell, selection, menu, menuGroup, getActionSubSystem(factory, subsystem)); addUserDefinedActions(config, shell, selection, menu, menuGroup, getActionSubSystem(config, subsystem));
} }
**/ **/
} }
@ -176,7 +181,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// ----------------------------------- // -----------------------------------
/** /**
* Optionally return one or more wizard pages to append to the New Wizard connection if * Optionally return one or more wizard pages to append to the New Wizard connection if
* the user selects a system type that this subsystem factory supports. * the user selects a system type that this subsystem configuration supports.
* <p> * <p>
* Some details: * Some details:
* <ul> * <ul>
@ -188,19 +193,19 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* </ul> * </ul>
* Tip: consider extending {@link org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage} for your wizard page class. * Tip: consider extending {@link org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage} for your wizard page class.
*/ */
public ISystemNewConnectionWizardPage[] getNewConnectionWizardPages(ISubSystemConfiguration factory, IWizard wizard) public ISystemNewConnectionWizardPage[] getNewConnectionWizardPages(ISubSystemConfiguration config, IWizard wizard)
{ {
if (factory instanceof IServiceSubSystemConfiguration) if (config instanceof IServiceSubSystemConfiguration)
{ {
SubSystemServiceWizardPage page = new SubSystemServiceWizardPage(wizard, factory); SubSystemServiceWizardPage page = new SubSystemServiceWizardPage(wizard, config);
return new ISystemNewConnectionWizardPage[] {page}; return new ISystemNewConnectionWizardPage[] {page};
} }
else else
{ {
List pages = getSubSystemPropertyPages(factory); List pages = getSubSystemPropertyPages(config);
if (pages != null && pages.size() > 0) if (pages != null && pages.size() > 0)
{ {
SystemSubSystemsPropertiesWizardPage page = new SystemSubSystemsPropertiesWizardPage(wizard, factory, pages); SystemSubSystemsPropertiesWizardPage page = new SystemSubSystemsPropertiesWizardPage(wizard, config, pages);
return new ISystemNewConnectionWizardPage[] {page}; return new ISystemNewConnectionWizardPage[] {page};
} }
} }
@ -213,16 +218,16 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
/* /*
* Return the form used in the subsyste property page. This default implementation returns Syste * Return the form used in the subsyste property page. This default implementation returns Syste
*/ */
public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration factory, ISystemMessageLine msgLine, Object caller) public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration config, ISystemMessageLine msgLine, Object caller)
{ {
return new SystemSubSystemPropertyPageCoreForm(msgLine, caller); return new SystemSubSystemPropertyPageCoreForm(msgLine, caller);
} }
/** /**
* Gets the list of property pages applicable for a subsystem associated with this factory * Gets the list of property pages applicable for a subsystem associated with this subsystem configuration
* @return the list of subsystem property pages * @return the list of subsystem property pages
*/ */
protected List getSubSystemPropertyPages(ISubSystemConfiguration factory) protected List getSubSystemPropertyPages(ISubSystemConfiguration config)
{ {
List propertyPages= new ArrayList(); List propertyPages= new ArrayList();
// Get reference to the plug-in registry // Get reference to the plug-in registry
@ -255,7 +260,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
} }
if (objCls != null && ISubSystem.class.isAssignableFrom(objCls) && factory.isFactoryFor(objCls)) if (objCls != null && ISubSystem.class.isAssignableFrom(objCls) && config.isFactoryFor(objCls))
{ {
try try
{ {
@ -271,7 +276,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
return propertyPages; return propertyPages;
} }
// FIXME - UDAs no longer coupled with factory in core // FIXME - UDAs no longer coupled with config in core
// // --------------------------------- // // ---------------------------------
// // USER-DEFINED ACTIONS METHODS... // // USER-DEFINED ACTIONS METHODS...
// // --------------------------------- // // ---------------------------------
@ -289,14 +294,14 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// * @see #supportsUserDefinedActions() // * @see #supportsUserDefinedActions()
// * @see #createActionSubSystem() // * @see #createActionSubSystem()
// */ // */
// public SystemUDActionSubsystem getActionSubSystem(ISubSystemConfiguration factory, ISubSystem subsystem) // public SystemUDActionSubsystem getActionSubSystem(ISubSystemConfiguration config, ISubSystem subsystem)
// { // {
// if (udas == null) // if (udas == null)
// udas = createActionSubSystem(factory); // udas = createActionSubSystem(config);
// if (udas != null) // if (udas != null)
// { // {
// udas.setSubsystem(subsystem); // udas.setSubsystem(subsystem);
// udas.setSubSystemConfiguration(factory); // udas.setSubSystemConfiguration(config);
// } // }
// return udas; // return udas;
// } // }
@ -308,7 +313,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// * @see #supportsUserDefinedActions() // * @see #supportsUserDefinedActions()
// * @see #getActionSubSystem(ISubSystem) // * @see #getActionSubSystem(ISubSystem)
// */ // */
// protected SystemUDActionSubsystem createActionSubSystem(ISubSystemConfiguration factory) // protected SystemUDActionSubsystem createActionSubSystem(ISubSystemConfiguration config)
// { // {
// return null; // return null;
// } // }
@ -320,7 +325,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// * This is called by the addCommonRemoteObjectsActions method, if this subsystem // * This is called by the addCommonRemoteObjectsActions method, if this subsystem
// * supports user defined actions. // * supports user defined actions.
// */ // */
// public static void addUserDefinedActions(ISubSystemConfiguration factory, Shell shell, IStructuredSelection selection, SystemMenuManager menu, String menuGroup, SystemUDActionSubsystem userActionSubSystem) // public static void addUserDefinedActions(ISubSystemConfiguration config, Shell shell, IStructuredSelection selection, SystemMenuManager menu, String menuGroup, SystemUDActionSubsystem userActionSubSystem)
// { // {
// SystemUDACascadeAction act = new SystemUDACascadeAction(userActionSubSystem, selection); // SystemUDACascadeAction act = new SystemUDACascadeAction(userActionSubSystem, selection);
// menu.add(menuGroup, act); // menu.add(menuGroup, act);
@ -345,25 +350,26 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// FACTORY ATTRIBUTE METHODS... // FACTORY ATTRIBUTE METHODS...
// --------------------------------- // ---------------------------------
/*
/** * (non-Javadoc)
* Return image descriptor of this factory. * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
* This comes from the xml "icon" attribute of the extension point.
*/ */
public ImageDescriptor getImage(ISubSystemConfiguration factory) public ImageDescriptor getImage(ISubSystemConfiguration config)
{ {
// casting for now to allow for 2-phase refactoring - SubSystemConfiguration really shouldn't implement this ISubSystemConfigurationProxy proxy = config.getSubSystemConfigurationProxy();
return ((SubSystemConfiguration)factory).getImage(); Object adapterCandidate = Platform.getAdapterManager().getAdapter(proxy, SubSystemConfigurationProxyAdapter.class);
SubSystemConfigurationProxyAdapter adapter = (SubSystemConfigurationProxyAdapter) adapterCandidate;
ImageDescriptor result = adapter.getImageDescriptor();
return result;
} }
/** /*
* Return actual graphics Image of this factory. * (non-Javadoc)
* This is the same as calling getImage().createImage() but the resulting * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getGraphicsImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
* image is cached.
*/ */
public Image getGraphicsImage(ISubSystemConfiguration factory) public Image getGraphicsImage(ISubSystemConfiguration config)
{ {
ImageDescriptor id = getImage(factory); ImageDescriptor id = getImage(config);
if (id != null) if (id != null)
{ {
Image image = null; Image image = null;
@ -381,26 +387,26 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
return null; return null;
} }
/*
* (non-Javadoc)
/** * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getLiveImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
* Return image to use when this susystem is connection.
* This comes from the xml "iconlive" attribute of the extension point.
*/ */
public ImageDescriptor getLiveImage(ISubSystemConfiguration factory) public ImageDescriptor getLiveImage(ISubSystemConfiguration config)
{ {
// casting for now to allow for 2-phase refactoring - SubSystemConfiguration really shouldn't implement this ISubSystemConfigurationProxy proxy = config.getSubSystemConfigurationProxy();
return ((SubSystemConfiguration)factory).getLiveImage(); Object adapterCandidate = Platform.getAdapterManager().getAdapter(proxy, SubSystemConfigurationProxyAdapter.class);
SubSystemConfigurationProxyAdapter adapter = (SubSystemConfigurationProxyAdapter) adapterCandidate;
ImageDescriptor result = adapter.getLiveImageDescriptor();
return result;
} }
/** /*
* Return actual graphics LiveImage of this factory. * (non-Javadoc)
* This is the same as calling getLiveImage().createImage() but the resulting * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getGraphicsLiveImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
* image is cached.
*/ */
public Image getGraphicsLiveImage(ISubSystemConfiguration factory) public Image getGraphicsLiveImage(ISubSystemConfiguration config)
{ {
ImageDescriptor id = getLiveImage(factory); ImageDescriptor id = getLiveImage(config);
if (id != null) if (id != null)
{ {
Image image = null; Image image = null;
@ -432,7 +438,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
/** /**
* Returns a list of actions for the popup menu when user right clicks on a subsystem object from this factory. * Returns a list of actions for the popup menu when user right clicks on a subsystem object from this subsystem configuration.
* <p> * <p>
* Override if additional actions needs to be contributed. * Override if additional actions needs to be contributed.
* <p> * <p>
@ -442,16 +448,16 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param shell The Shell of the view where this action was launched from * @param shell The Shell of the view where this action was launched from
* @return array of IAction objects to contribute to the popup menu * @return array of IAction objects to contribute to the popup menu
*/ */
public IAction[] getSubSystemActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISubSystem selectedSubSystem) public IAction[] getSubSystemActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISubSystem selectedSubSystem)
{ {
Vector childActions = new Vector(); Vector childActions = new Vector();
if (factory.supportsFilters()) if (config.supportsFilters())
{ {
boolean showFilterPools = factory.showFilterPools(); boolean showFilterPools = config.showFilterPools();
// if showing filter pools, we have to add a "new filter pool" action here... // if showing filter pools, we have to add a "new filter pool" action here...
if (showFilterPools) if (showFilterPools)
{ {
IAction[] newFPActions = getSubSystemNewFilterPoolActions(menu, selection, shell, menuGroup, factory, selectedSubSystem); IAction[] newFPActions = getSubSystemNewFilterPoolActions(menu, selection, shell, menuGroup, config, selectedSubSystem);
if (newFPActions != null) if (newFPActions != null)
{ {
for (int idx = 0; idx < newFPActions.length; idx++) for (int idx = 0; idx < newFPActions.length; idx++)
@ -462,7 +468,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
{ {
SystemFilterAbstractFilterPoolAction fpAction = (SystemFilterAbstractFilterPoolAction) newFPActions[idx]; SystemFilterAbstractFilterPoolAction fpAction = (SystemFilterAbstractFilterPoolAction) newFPActions[idx];
fpAction.setFilterPoolManagerNamePreSelection(selectedSubSystem.getSystemProfile().getName()); fpAction.setFilterPoolManagerNamePreSelection(selectedSubSystem.getSystemProfile().getName());
fpAction.setFilterPoolManagerProvider(factory); fpAction.setFilterPoolManagerProvider(config);
} }
childActions.addElement(newFPActions[idx]); childActions.addElement(newFPActions[idx]);
} // end for loop } // end for loop
@ -477,7 +483,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// if not showing filter pools, we have to add a "new filter" action here... // if not showing filter pools, we have to add a "new filter" action here...
if (!showFilterPools) if (!showFilterPools)
{ {
IAction[] newFilterActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, factory, null); IAction[] newFilterActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, config, null);
if ((newFilterActions != null) && (newFilterActions.length > 0)) if ((newFilterActions != null) && (newFilterActions.length > 0))
{ {
// pre-scan for legacy // pre-scan for legacy
@ -498,18 +504,18 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// FIXME - UDAs moved out of here // FIXME - UDAs moved out of here
// // if user defined actions are supported, add an action to work with them... // // if user defined actions are supported, add an action to work with them...
// if (factory.supportsUserDefinedActions()) // if (config.supportsUserDefinedActions())
// childActions.addElement(new SystemWorkWithUDAsAction(shell, (ISubSystem)null)); // childActions.addElement(new SystemWorkWithUDAsAction(shell, (ISubSystem)null));
// // if named file types are supported, add an action to work with them... // // if named file types are supported, add an action to work with them...
// if (factory.supportsFileTypes()) // if (config.supportsFileTypes())
// childActions.addElement(new SystemWorkWithFileTypesAction(shell, null)); // childActions.addElement(new SystemWorkWithFileTypesAction(shell, null));
// // if compile actions are supported, add an action to work with them... // // if compile actions are supported, add an action to work with them...
// if (factory.supportsCompileActions()) // if (config.supportsCompileActions())
// childActions.addElement(new SystemWorkWithCompileCommandsAction(shell, false)); // childActions.addElement(new SystemWorkWithCompileCommandsAction(shell, false));
if (factory.supportsSubSystemConnect()) if (config.supportsSubSystemConnect())
{ {
// MJB: RE defect 40854 // MJB: RE defect 40854
addConnectOrDisconnectAction(childActions, shell, selectedSubSystem); addConnectOrDisconnectAction(childActions, shell, selectedSubSystem);
@ -519,7 +525,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
{ {
// premise: none of these actions' constructor need the current selection as input // premise: none of these actions' constructor need the current selection as input
int nbrBaseActions = 0; int nbrBaseActions = 0;
if (factory.supportsSubSystemConnect()) if (config.supportsSubSystemConnect())
{ {
//nbrBaseActions += 2; // 4; MJB: RE defect 50854 //nbrBaseActions += 2; // 4; MJB: RE defect 50854
if (selectedSubSystem.getConnectorService().supportsUserId()) if (selectedSubSystem.getConnectorService().supportsUserId())
@ -529,7 +535,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// nbrBaseActions += 2; // nbrBaseActions += 2;
subSystemActions = new IAction[nbrBaseActions]; subSystemActions = new IAction[nbrBaseActions];
int ssIdx = 0; int ssIdx = 0;
if (factory.supportsSubSystemConnect()) if (config.supportsSubSystemConnect())
{ {
// MJB: RE defect 40854 // MJB: RE defect 40854
//subSystemActions[ssIdx++] = new SystemConnectAction(shell); //subSystemActions[ssIdx++] = new SystemConnectAction(shell);
@ -581,11 +587,11 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* <p> * <p>
* This method is from the ISystemNewFilterActionConfigurator interface * This method is from the ISystemNewFilterActionConfigurator interface
*/ */
public void configureNewFilterAction(ISubSystemConfiguration factory, SystemNewFilterAction newFilterAction, Object callerData) public void configureNewFilterAction(ISubSystemConfiguration config, SystemNewFilterAction newFilterAction, Object callerData)
{ {
//System.out.println("Inside configureNewFilterAction! It worked!"); //System.out.println("Inside configureNewFilterAction! It worked!");
newFilterAction.setFromRSE(true); newFilterAction.setFromRSE(true);
boolean showFilterPools = factory.showFilterPools(); boolean showFilterPools = config.showFilterPools();
// It does not make sense, when invoked from a filterPool, to ask the user // It does not make sense, when invoked from a filterPool, to ask the user
// for the parent filter pool, or to ask the user whether the filter is connection // for the parent filter pool, or to ask the user whether the filter is connection
@ -629,7 +635,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
ISystemProfile activeProfile = selectedSubSystem.getHost().getSystemProfile(); ISystemProfile activeProfile = selectedSubSystem.getHost().getSystemProfile();
for (int idx = 0; idx < activeProfiles.length; idx++) for (int idx = 0; idx < activeProfiles.length; idx++)
{ {
ISystemFilterPool defaultPool = getDefaultSystemFilterPool(factory, activeProfiles[idx]); ISystemFilterPool defaultPool = getDefaultSystemFilterPool(config, activeProfiles[idx]);
if (defaultPool != null) if (defaultPool != null)
{ {
@ -647,10 +653,10 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* Given a profile, return the first (hopefully only) default pool for this * Given a profile, return the first (hopefully only) default pool for this
* profile. * profile.
*/ */
public ISystemFilterPool getDefaultSystemFilterPool(ISubSystemConfiguration factory, ISystemProfile profile) public ISystemFilterPool getDefaultSystemFilterPool(ISubSystemConfiguration config, ISystemProfile profile)
{ {
ISystemFilterPool pool = null; ISystemFilterPool pool = null;
ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile); ISystemFilterPoolManager mgr = config.getFilterPoolManager(profile);
pool = mgr.getFirstDefaultSystemFilterPool(); // RETURN FIRST pool = mgr.getFirstDefaultSystemFilterPool(); // RETURN FIRST
return pool; return pool;
} }
@ -672,7 +678,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param shell The Shell of the view where this action was launched from * @param shell The Shell of the view where this action was launched from
* @return array of IAction objects to contribute to the popup menu * @return array of IAction objects to contribute to the popup menu
*/ */
protected IAction[] getSubSystemNewFilterPoolActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISubSystem selectedSubSystem) protected IAction[] getSubSystemNewFilterPoolActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISubSystem selectedSubSystem)
{ {
IAction[] actions = new IAction[2]; IAction[] actions = new IAction[2];
actions[0] = new SystemFilterNewFilterPoolAction(shell); actions[0] = new SystemFilterNewFilterPoolAction(shell);
@ -766,7 +772,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
/** /**
* Returns a list of actions for the popup menu when user right clicks on a * Returns a list of actions for the popup menu when user right clicks on a
* filter pool object within a subsystem of this factory. * filter pool object within a subsystem of this subsystem configuration.
* Only supported and used by subsystems that support filters. * Only supported and used by subsystems that support filters.
* <p> * <p>
* YOU DO NOT NEED TO OVERRIDE THIS METHOD. * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
@ -777,10 +783,10 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool * @param selectedPool the currently selected pool
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
public IAction[] getFilterPoolActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISystemFilterPool selectedPool) public IAction[] getFilterPoolActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterPool selectedPool)
{ {
Vector childActions = new Vector(); Vector childActions = new Vector();
IAction[] newActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, factory, selectedPool); IAction[] newActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, config, selectedPool);
if (newActions != null) if (newActions != null)
{ {
for (int idx = 0; idx < newActions.length; idx++) for (int idx = 0; idx < newActions.length; idx++)
@ -828,10 +834,10 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool * @param selectedPool the currently selected pool
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
protected IAction[] getNewFilterPoolFilterActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISystemFilterPool selectedPool) protected IAction[] getNewFilterPoolFilterActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterPool selectedPool)
{ {
IAction[] actions = new IAction[1]; IAction[] actions = new IAction[1];
actions[0] = getNewFilterPoolFilterAction(factory, selectedPool, shell); actions[0] = getNewFilterPoolFilterAction(config, selectedPool, shell);
return actions; return actions;
} }
/** /**
@ -845,7 +851,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool * @param selectedPool the currently selected pool
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
protected IAction getNewFilterPoolFilterAction(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) protected IAction getNewFilterPoolFilterAction(ISubSystemConfiguration config, ISystemFilterPool selectedPool, Shell shell)
{ {
SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool); SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool);
action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0042"); //$NON-NLS-1$ action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0042"); //$NON-NLS-1$
@ -858,9 +864,9 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedFilter the currently selected filter * @param selectedFilter the currently selected filter
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
protected IAction getNewNestedFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell) protected IAction getNewNestedFilterAction(ISubSystemConfiguration config, ISystemFilter selectedFilter, Shell shell)
{ {
return getNewFilterPoolFilterAction(factory, selectedFilter.getParentFilterPool(), shell); return getNewFilterPoolFilterAction(config, selectedFilter.getParentFilterPool(), shell);
} }
/** /**
* Overridable method to return the action for changing an existing filter. * Overridable method to return the action for changing an existing filter.
@ -870,7 +876,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedFilter the currently selected filter * @param selectedFilter the currently selected filter
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
protected IAction getChangeFilterAction(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell) protected IAction getChangeFilterAction(ISubSystemConfiguration config, ISystemFilter selectedFilter, Shell shell)
{ {
/* We don't do this here now as this is overridable. Now done in SystemChangeFilterAction. /* We don't do this here now as this is overridable. Now done in SystemChangeFilterAction.
* Also, single filter string doesn't mean non-editable. * Also, single filter string doesn't mean non-editable.
@ -911,11 +917,11 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDescription(String)} * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDescription(String)}
* </ul> * </ul>
*/ */
public void customizeChangeFilterPropertyPage(ISubSystemConfiguration factory, SystemChangeFilterPropertyPage page, ISystemFilter selectedFilter, Shell shell) public void customizeChangeFilterPropertyPage(ISubSystemConfiguration config, SystemChangeFilterPropertyPage page, ISystemFilter selectedFilter, Shell shell)
{ {
// default behaviour is a total hack! We want to preserve all the configuration done on the // default behaviour is a total hack! We want to preserve all the configuration done on the
// Change dialog, so we instantiate it merely so that we can copy the configuration information... // Change dialog, so we instantiate it merely so that we can copy the configuration information...
IAction changeAction = getChangeFilterAction(factory, selectedFilter, shell); IAction changeAction = getChangeFilterAction(config, selectedFilter, shell);
if (changeAction instanceof SystemChangeFilterAction) if (changeAction instanceof SystemChangeFilterAction)
{ {
SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction; SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction;
@ -966,12 +972,12 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDescription(String)} * <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDescription(String)}
* </ul> * </ul>
*/ */
public void customizeFilterStringPropertyPage(ISubSystemConfiguration factory, SystemFilterStringPropertyPage page, ISystemFilterString selectedFilterString, Shell shell) public void customizeFilterStringPropertyPage(ISubSystemConfiguration config, SystemFilterStringPropertyPage page, ISystemFilterString selectedFilterString, Shell shell)
{ {
// default behaviour is a total hack! We want to preserve all the configuration done on the // default behaviour is a total hack! We want to preserve all the configuration done on the
// Change dialog, so we instantiate it merely so that we can copy the configuration information... // Change dialog, so we instantiate it merely so that we can copy the configuration information...
ISystemFilter selectedFilter = selectedFilterString.getParentSystemFilter(); ISystemFilter selectedFilter = selectedFilterString.getParentSystemFilter();
IAction changeAction = getChangeFilterAction(factory, selectedFilter, shell); IAction changeAction = getChangeFilterAction(config, selectedFilter, shell);
if (changeAction instanceof SystemChangeFilterAction) if (changeAction instanceof SystemChangeFilterAction)
{ {
SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction; SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction;
@ -998,19 +1004,19 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
/** /**
* Returns a list of actions for the popup menu when user right clicks on a * Returns a list of actions for the popup menu when user right clicks on a
* filter pool reference object within a subsystem of this factory. Note, * filter pool reference object within a subsystem of this subsystem configuration. Note,
* these are added to the list returned by getFilterPoolActions(). * these are added to the list returned by getFilterPoolActions().
* Only supported by subsystems that support filters. * Only supported by subsystems that support filters.
* @param selectedPoolReference the currently selected pool reference * @param selectedPoolReference the currently selected pool reference
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
public IAction[] getFilterPoolReferenceActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISystemFilterPoolReference selectedPoolReference) public IAction[] getFilterPoolReferenceActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterPoolReference selectedPoolReference)
{ {
ISystemFilterPool selectedPool = selectedPoolReference.getReferencedFilterPool(); ISystemFilterPool selectedPool = selectedPoolReference.getReferencedFilterPool();
if (filterPoolReferenceActions == null) if (filterPoolReferenceActions == null)
{ {
filterPoolReferenceActions = new IAction[3]; filterPoolReferenceActions = new IAction[3];
filterPoolReferenceActions[0] = getRemoveFilterPoolReferenceAction(factory, selectedPool, shell); filterPoolReferenceActions[0] = getRemoveFilterPoolReferenceAction(config, selectedPool, shell);
filterPoolReferenceActions[1] = new SystemFilterMoveUpFilterPoolReferenceAction(shell); filterPoolReferenceActions[1] = new SystemFilterMoveUpFilterPoolReferenceAction(shell);
((ISystemAction) filterPoolReferenceActions[1]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0063"); //$NON-NLS-1$ ((ISystemAction) filterPoolReferenceActions[1]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0063"); //$NON-NLS-1$
filterPoolReferenceActions[2] = new SystemFilterMoveDownFilterPoolReferenceAction(shell); filterPoolReferenceActions[2] = new SystemFilterMoveDownFilterPoolReferenceAction(shell);
@ -1026,7 +1032,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool * @param selectedPool the currently selected pool
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
protected IAction getRemoveFilterPoolReferenceAction(ISubSystemConfiguration factory, ISystemFilterPool selectedPool, Shell shell) protected IAction getRemoveFilterPoolReferenceAction(ISubSystemConfiguration config, ISystemFilterPool selectedPool, Shell shell)
{ {
ISystemAction action = new SystemFilterRemoveFilterPoolReferenceAction(shell); ISystemAction action = new SystemFilterRemoveFilterPoolReferenceAction(shell);
action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0062"); //$NON-NLS-1$ action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0062"); //$NON-NLS-1$
@ -1048,14 +1054,14 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* *
* @return the filter created by the user or null if they cancelled the prompting * @return the filter created by the user or null if they cancelled the prompting
*/ */
public ISystemFilter createFilterByPrompting(ISubSystemConfiguration factory, ISystemFilterReference referenceToPromptableFilter, Shell shell) throws Exception public ISystemFilter createFilterByPrompting(ISubSystemConfiguration config, ISystemFilterReference referenceToPromptableFilter, Shell shell) throws Exception
{ {
ISystemFilter filterPrompt = referenceToPromptableFilter.getReferencedFilter(); ISystemFilter filterPrompt = referenceToPromptableFilter.getReferencedFilter();
ISystemFilterPool selectedPool = filterPrompt.getParentFilterPool(); ISystemFilterPool selectedPool = filterPrompt.getParentFilterPool();
SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool); SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool);
Object simulatedSelectedParent = null; Object simulatedSelectedParent = null;
if (!factory.showFilterPools()) // if we are not showing filter pools, the parent will be the subsystem itself if (!config.showFilterPools()) // if we are not showing filter pools, the parent will be the subsystem itself
{ {
simulatedSelectedParent = referenceToPromptableFilter.getProvider(); // this is the subsystem simulatedSelectedParent = referenceToPromptableFilter.getProvider(); // this is the subsystem
action.setCallBackConfigurator(this, simulatedSelectedParent); action.setCallBackConfigurator(this, simulatedSelectedParent);
@ -1083,10 +1089,10 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* Most actions are handled in this base, except if you have your own action for * Most actions are handled in this base, except if you have your own action for
* creating a new nested filter. In this case, <b>override getNewFilterAction()</b> * creating a new nested filter. In this case, <b>override getNewFilterAction()</b>
*/ */
public IAction[] getFilterActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISystemFilter selectedFilter) public IAction[] getFilterActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilter selectedFilter)
{ {
Vector childActions = new Vector(); Vector childActions = new Vector();
Vector ourChildActions = getAdditionalFilterActions(factory, selectedFilter, shell); Vector ourChildActions = getAdditionalFilterActions(config, selectedFilter, shell);
int pasteIndex = -1; int pasteIndex = -1;
if (ourChildActions != null) if (ourChildActions != null)
for (int idx = 0; idx < ourChildActions.size(); idx++) for (int idx = 0; idx < ourChildActions.size(); idx++)
@ -1129,14 +1135,14 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
((SystemFilterMoveDownFilterAction) filterActions[fsIdx++]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0085"); //$NON-NLS-1$ ((SystemFilterMoveDownFilterAction) filterActions[fsIdx++]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0085"); //$NON-NLS-1$
} }
// add overridable dynamic actions // add overridable dynamic actions
if (factory.supportsNestedFilters()) if (config.supportsNestedFilters())
{ {
IAction newNestedFilterAction = getNewNestedFilterAction(factory, selectedFilter, shell); IAction newNestedFilterAction = getNewNestedFilterAction(config, selectedFilter, shell);
if (newNestedFilterAction != null) if (newNestedFilterAction != null)
childActions.addElement(newNestedFilterAction); childActions.addElement(newNestedFilterAction);
} }
// IAction chgFilterAction = getChangeFilterAction(factory, selectedFilter, shell); // IAction chgFilterAction = getChangeFilterAction(config, selectedFilter, shell);
// if (chgFilterAction != null) // if (chgFilterAction != null)
// childActions.addElement(chgFilterAction); // childActions.addElement(chgFilterAction);
/* /*
@ -1168,7 +1174,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @return Vector of IAction objects. * @return Vector of IAction objects.
* @see #getFilterActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystemConfiguration, ISystemFilter) * @see #getFilterActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystemConfiguration, ISystemFilter)
*/ */
protected Vector getAdditionalFilterActions(ISubSystemConfiguration factory, ISystemFilter selectedFilter, Shell shell) protected Vector getAdditionalFilterActions(ISubSystemConfiguration config, ISystemFilter selectedFilter, Shell shell)
{ {
return null; return null;
} }
@ -1179,7 +1185,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
/** /**
* Returns a list of actions for the popup menu when user right clicks on a * Returns a list of actions for the popup menu when user right clicks on a
* filter reference object within a subsystem of this factory. * filter reference object within a subsystem of this subsystem configuration.
* Only supported and used by subsystems that support filters. * Only supported and used by subsystems that support filters.
* <p> * <p>
* YOU DO NOT NEED TO OVERRIDE THIS METHOD. * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
@ -1190,7 +1196,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedFilterRef the currently selected filter reference * @param selectedFilterRef the currently selected filter reference
* @param shell parent shell of viewer where the popup menu is being constructed * @param shell parent shell of viewer where the popup menu is being constructed
*/ */
public IAction[] getFilterReferenceActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration factory, ISystemFilterReference selectedFilterRef) public IAction[] getFilterReferenceActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterReference selectedFilterRef)
{ {
return null; return null;
} }
@ -1206,7 +1212,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* Override if appropriate. * Override if appropriate.
* @return the UI form for the server launcher. * @return the UI form for the server launcher.
*/ */
public IServerLauncherForm getServerLauncherForm(ISubSystemConfiguration factory, Shell shell, ISystemMessageLine msgLine) public IServerLauncherForm getServerLauncherForm(ISubSystemConfiguration config, Shell shell, ISystemMessageLine msgLine)
{ {
return new RemoteServerLauncherForm(shell, msgLine); return new RemoteServerLauncherForm(shell, msgLine);
} }
@ -1238,7 +1244,14 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
public ISystemValidator getUserIdValidator(ISubSystemConfiguration config) { public ISystemValidator getUserIdValidator(ISubSystemConfiguration config) {
return ((SubSystemConfiguration)config).getUserIdValidator(); ISystemValidator userIdValidator =
new ValidatorSpecialChar(
"=;", //$NON-NLS-1$
false,
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_NOTVALID),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY));
// false => allow empty? No.
return userIdValidator;
} }
/** /**

View file

@ -12,13 +12,11 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - Replace SystemRegistry by ISystemRegistry * Martin Oberhuber (Wind River) - Replace SystemRegistry by ISystemRegistry
* Martin Oberhuber (Wind River) - [190231] Remove UI-only code from SubSystemConfiguration
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.servicesubsystem; package org.eclipse.rse.core.servicesubsystem;
import java.util.Vector;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage; import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
@ -28,11 +26,6 @@ import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.SubSystemConfiguration; import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
import org.eclipse.swt.widgets.Shell;
/** /**
* This class is to be used by subsystem-providers that do not desire to use MOF/EMF. It is * This class is to be used by subsystem-providers that do not desire to use MOF/EMF. It is
@ -44,11 +37,10 @@ import org.eclipse.swt.widgets.Shell;
* <li>{@link #createSubSystemInternal(org.eclipse.rse.core.model.IHost)}, to instantiate your subsystem class. * <li>{@link #createSubSystemInternal(org.eclipse.rse.core.model.IHost)}, to instantiate your subsystem class.
* </ul> * </ul>
* <p> * <p>
* For additional customization of the subsystem, you may supply a {@link SubSystemConfigurationAdapter}, * For additional customization of the subsystem, you may supply a {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter},
* which allows you to * which allows you to
* <li>supply your own subsystem popup menu actions via {@link SubSystemConfigurationAdapter#getSubSystemActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystemConfiguration, ISubSystem)} * <li>supply your own New->Filter popup menu action via {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewFilterPoolFilterAction(ISubSystemConfiguration, ISystemFilterPool, org.eclipse.swt.widgets.Shell)}, and
* <li>supply your own New->Filter popup menu action via {@link SubSystemConfigurationAdapter#getNewFilterPoolFilterAction(ISubSystemConfiguration, ISystemFilterPool, Shell)}, and * <li>supply your own Change Filter popup menu action via {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getChangeFilterAction(ISubSystemConfiguration, ISystemFilter, org.eclipse.swt.widgets.Shell)}.
* <li>supply your own Change Filter popup menu action via {@link SubSystemConfigurationAdapter#getChangeFilterAction(ISubSystemConfiguration, ISystemFilter,Shell)}.
* </ul> * </ul>
* <p> * <p>
* This class is typically used together with:</p> * This class is typically used together with:</p>
@ -81,7 +73,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
// ------------------------------------------------------ // ------------------------------------------------------
/** /**
* <i>Overridable configuration method. Default is <b>false</b></i><br> * <i>Overridable configuration method. Default is <b>false</b></i><br>
* Return true if instance of this factory's subsystems support connect and disconnect actions. * Return true if instance of this subsystem configuration's subsystems support connect and disconnect actions.
*/ */
public boolean supportsSubSystemConnect() public boolean supportsSubSystemConnect()
{ {
@ -90,7 +82,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
/** /**
* <i>Overridable configuration method. Default is <b>true</b></i><br> * <i>Overridable configuration method. Default is <b>true</b></i><br>
* Return true (default) or false to indicate if subsystems of this factory support user-editable * Return true (default) or false to indicate if subsystems of this subsystem configuration support user-editable
* port numbers. * port numbers.
*/ */
public boolean isPortEditable() public boolean isPortEditable()
@ -99,7 +91,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
} }
/** /**
* <i>Overridable configuration method. Default is <b>true</b></i><br> * <i>Overridable configuration method. Default is <b>true</b></i><br>
* Required method for subsystem factory child classes. Return true if you support filters, false otherwise. * Required method for subsystem configuration child classes. Return true if you support filters, false otherwise.
* If you support filters, then some housekeeping will be done for you automatically. Specifically, they * If you support filters, then some housekeeping will be done for you automatically. Specifically, they
* will be saved and restored for you automatically. * will be saved and restored for you automatically.
*/ */
@ -118,7 +110,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
/** /**
* <i>COverridable configuration method. Default is <b>false</b></i><br> * <i>COverridable configuration method. Default is <b>false</b></i><br>
* Return true if you support user-defined actions for the remote system objects returned from expansion of * Return true if you support user-defined actions for the remote system objects returned from expansion of
* subsystems created by this subsystem factory * subsystems created by this subsystem configuration
*/ */
public boolean supportsUserDefinedActions() public boolean supportsUserDefinedActions()
{ {
@ -159,10 +151,10 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
* After a new subsystem instance is created, the framework calls this method * After a new subsystem instance is created, the framework calls this method
* to initialize it. This is your opportunity to set default attribute values. * to initialize it. This is your opportunity to set default attribute values.
* *
* <p>The reason for the connect wizard pages parm is in case your factory contributes a page to that wizard, * <p>The reason for the connect wizard pages parameter is in case your subsystem configuration contributes a page to that wizard,
* whose values are needed to set the subsystem's initial state. For example, you might decide to add a * whose values are needed to set the subsystem's initial state. For example, you might decide to add a
* page to the connection wizard to prompt for a JDBC Driver name. If so, when this method is called at * page to the connection wizard to prompt for a JDBC Driver name. If so, when this method is called at
* the time a new connection is created apres the wizard, your page will have the user's value. You can * the time a new connection is created after the wizard, your page will have the user's value. You can
* thus use it here to initialize that subsystem property. Be use to use instanceof to find your particular * thus use it here to initialize that subsystem property. Be use to use instanceof to find your particular
* page. * page.
* </p> * </p>
@ -175,7 +167,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
* {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)} * {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)}
* method or null if you didn't override this method. * method or null if you didn't override this method.
* Note there may be more pages than you originally supplied, as you are passed all pages contributed * Note there may be more pages than you originally supplied, as you are passed all pages contributed
* by this factory object, including subclasses. Null on a clone operation. * by this subsystem configuration object, including subclasses. Null on a clone operation.
* *
* @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard) * @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)
*/ */
@ -189,9 +181,9 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
// -------------------------------- // --------------------------------
/** /**
* <i>Optionally overridable method affecting the visual display of objects within subsystems created by this factory.</i><br> * <i>Optionally overridable method affecting the visual display of objects within subsystems created by this subsystem configuration.</i><br>
* Return the translated string to show in the property sheet for the "type" property, for the selected * Return the translated string to show in the property sheet for the "type" property, for the selected
* filter. This method is only called for filters within subsystems created by this subsystem factory. * filter. This method is only called for filters within subsystems created by this subsystem configuration.
* <p> * <p>
* Returns a default string, override if appropriate. * Returns a default string, override if appropriate.
*/ */
@ -199,25 +191,5 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
{ {
return super.getTranslatedFilterTypeProperty(selectedFilter); return super.getTranslatedFilterTypeProperty(selectedFilter);
} }
/**
* <i>Overridable method for getting Remote System view popup menu actions. Called by {@link org.eclipse.rse.internal.ui.view.SystemView SystemView}
* when constructing the popup menu for a selected filter.</i><br>
* This method is only called for filters within subsystems created by this subsystem factory.<br>
* By default, this returns null. Override if appropriate.
*
* @see SubSystemConfigurationAdapter#getFilterActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystemConfiguration, ISystemFilter)
*
* @return Vector of IAction objects, which usually are subclasses of {@link org.eclipse.rse.ui.actions.SystemBaseAction SystemBaseAction} or
* {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseDialogAction} or
* {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction SystemBaseWizardAction} or
* {@link org.eclipse.rse.ui.actions.SystemBaseSubMenuAction SystemBaseSubMenuAction}.
*/
protected Vector getAdditionalFilterActions(ISystemFilter selectedFilter, Shell shell)
{
return null;
}
} }

View file

@ -21,6 +21,7 @@
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core * Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core
* Martin Oberhuber (Wind River) - [190231] Remove UI-only code from SubSystemConfiguration
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
@ -31,13 +32,8 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemModelChangeEvents; import org.eclipse.rse.core.events.ISystemModelChangeEvents;
@ -68,37 +64,25 @@ import org.eclipse.rse.internal.core.filters.SystemFilterStartHere;
import org.eclipse.rse.internal.core.model.SystemProfileManager; import org.eclipse.rse.internal.core.model.SystemProfileManager;
import org.eclipse.rse.internal.ui.SystemPropertyResources; import org.eclipse.rse.internal.ui.SystemPropertyResources;
import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapter;
import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemPreferencesManager; import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction; import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.rse.ui.messages.SystemMessageDialog; import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.propertypages.ISystemSubSystemPropertyPageCoreForm;
import org.eclipse.rse.ui.propertypages.SystemSubSystemPropertyPageCoreForm;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorSpecialChar;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.widgets.IServerLauncherForm;
import org.eclipse.rse.ui.widgets.RemoteServerLauncherForm;
import org.eclipse.rse.ui.wizards.ISubSystemPropertiesWizardPage; import org.eclipse.rse.ui.wizards.ISubSystemPropertiesWizardPage;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PropertyPage;
/** /**
* Abstract base class for subsystem factory extension points. * Abstract base class for subsystem configuration extension points.
* Child classes must implement the methods: * Child classes must implement the methods:
* <ul> * <ul>
* <li>#createSubSystemInternal(SystemConnection conn) * <li>#createSubSystemInternal(SystemConnection conn)
* </ul> * </ul>
* Child classes can optionally override: * Child classes can optionally override:
* <ul> * <ul>
* <li>SubSystemConfiguration#supportsFilters() to indicate if filters are to be enabled for this factory * <li>SubSystemConfiguration#supportsFilters() to indicate if filters are to be enabled for this subsystem configuration
* <li>SubSystemConfiguration#supportsNestedFilters() to indicate if filters can exist inside filters. * <li>SubSystemConfiguration#supportsNestedFilters() to indicate if filters can exist inside filters.
* <li>SubSystemConfiguration#supportsDuplicateFilterStrings() to indicate if filter strings can be duplicated within a filter * <li>SubSystemConfiguration#supportsDuplicateFilterStrings() to indicate if filter strings can be duplicated within a filter
* <li>SubSystemConfiguration#isCaseSensitive() to indicate if filter strings are case sensitive or not * <li>SubSystemConfiguration#isCaseSensitive() to indicate if filter strings are case sensitive or not
@ -108,14 +92,14 @@ import org.eclipse.ui.dialogs.PropertyPage;
* <li>SubSystemConfiguration#supportsFileTypes() to indicate if users can define their own named file types. * <li>SubSystemConfiguration#supportsFileTypes() to indicate if users can define their own named file types.
* <li>SubSystemConfiguration#isSubSystemsDeletable() if they support user-deleting of subsystems. Default is false. * <li>SubSystemConfiguration#isSubSystemsDeletable() if they support user-deleting of subsystems. Default is false.
* <li>SubSystemConfiguration#supportsSubSystemConnect() to return false if the connect() action is not supported * <li>SubSystemConfiguration#supportsSubSystemConnect() to return false if the connect() action is not supported
* <li>SubSystemConfiguration#supportsTargets() to return true if this factory supports the notions of targets. Normally, this is only for file system factories. * <li>SubSystemConfiguration#supportsTargets() to return true if this subsystem configuration supports the notions of targets. Normally, this is only for file system factories.
* <li>SubSystemConfiguration#getSubSystemActions() if they wish to supply actions for the right-click menu when * <li>SubSystemConfiguration#getSubSystemActions() if they wish to supply actions for the right-click menu when
* the user right clicks on a subsystem object created by this factory. * the user right clicks on a subsystem object created by this subsystem configuration.
* <li>CreateDefaultFilterPool() to create any default filter pool when a new profile is created. * <li>CreateDefaultFilterPool() to create any default filter pool when a new profile is created.
* <li>#initializeSubSystem(SubSystem ss, ISystemNewConnectionWizardPage[]) * <li>#initializeSubSystem(SubSystem ss, ISystemNewConnectionWizardPage[])
* </ul> * </ul>
* <p> * <p>
* A factory will maintain in memory a list of all subsystem objects it has. This * A subsystem configuration will maintain in memory a list of all subsystem objects it has. This
* list should be initialize from disk at restore time, and maintained as the subsystems are * list should be initialize from disk at restore time, and maintained as the subsystems are
* created and deleted throughout the session. At save time, each subsystem in the list * created and deleted throughout the session. At save time, each subsystem in the list
* is asked to save itself. The getSubSystems method should return this list. * is asked to save itself. The getSubSystems method should return this list.
@ -133,8 +117,6 @@ import org.eclipse.ui.dialogs.PropertyPage;
public abstract class SubSystemConfiguration implements ISubSystemConfiguration public abstract class SubSystemConfiguration implements ISubSystemConfiguration
{ {
// subsystem stuff... // subsystem stuff...
private Hashtable subSystemsRestoredFlags = new Hashtable(); private Hashtable subSystemsRestoredFlags = new Hashtable();
private ISubSystemConfigurationProxy proxy = null; private ISubSystemConfigurationProxy proxy = null;
@ -149,11 +131,9 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
protected ISystemFilterPoolManager[] filterPoolManagers = null; protected ISystemFilterPoolManager[] filterPoolManagers = null;
protected Hashtable filterPoolManagersPerProfile = new Hashtable(); protected Hashtable filterPoolManagersPerProfile = new Hashtable();
// other stuff... // other stuff...
private String translatedFilterType = null; private String translatedFilterType = null;
private static Hashtable brokenReferenceWarningsIssued = new Hashtable(); private static Hashtable brokenReferenceWarningsIssued = new Hashtable();
protected Hashtable imageTable = null;
protected IHost currentlySelectedConnection; protected IHost currentlySelectedConnection;
protected Object[] currentlySelected; protected Object[] currentlySelected;
@ -161,7 +141,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
protected static IHost currentlyProcessingConnection; protected static IHost currentlyProcessingConnection;
protected static SubSystemConfiguration currentlyProcessingSubSystemConfiguration; protected static SubSystemConfiguration currentlyProcessingSubSystemConfiguration;
protected java.util.List subSystemList = null; protected java.util.List subSystemList = null;
protected java.util.List filterPoolManagerList = null; protected java.util.List filterPoolManagerList = null;
@ -178,8 +157,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
SystemBasePlugin.logDebugMessage(this.getClass().getName(), "STARTED SSFACTORY"); //$NON-NLS-1$ SystemBasePlugin.logDebugMessage(this.getClass().getName(), "STARTED SSFACTORY"); //$NON-NLS-1$
} }
/** /**
* Reset for a full refresh from disk, such as after a team synch. * Reset for a full refresh from disk, such as after a team synch.
* Override this as required, but please call super.reset()!! * Override this as required, but please call super.reset()!!
@ -200,7 +177,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
// --------------------------------- // ---------------------------------
/** /**
* Return true if instance of this factory's subsystems support connect and disconnect actions. * Return true if instance of this subsystem configuration's subsystems support connect and disconnect actions.
* <b>By default, returns true</b>. * <b>By default, returns true</b>.
* Override if this is not the case. * Override if this is not the case.
*/ */
@ -209,7 +186,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return true; return true;
} }
/** /**
* Return true (default) or false to indicate if subsystems of this factory support user-editable * Return true (default) or false to indicate if subsystems of this subsystem configuration support user-editable
* port numbers. * port numbers.
*/ */
public boolean isPortEditable() public boolean isPortEditable()
@ -217,7 +194,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return true; return true;
} }
/** /**
* Return true if subsystem instances from this factory support remote command execution * Return true if subsystem instances from this subsystem configuration support remote command execution
* <p>RETURNS FALSE BY DEFAULT. * <p>RETURNS FALSE BY DEFAULT.
*/ */
public boolean supportsCommands() public boolean supportsCommands()
@ -225,7 +202,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return false; return false;
} }
/** /**
* Return true if subsystem instances from this factory support getting and setting properties * Return true if subsystem instances from this subsystem configuration support getting and setting properties
* <p>RETURNS FALSE BY DEFAULT. * <p>RETURNS FALSE BY DEFAULT.
* *
* @return <code>false</code> to indicate that Properties are not supported by default. * @return <code>false</code> to indicate that Properties are not supported by default.
@ -258,7 +235,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Required method for subsystem factory child classes. Return true if you filter caching. * Required method for subsystem configuration child classes. Return true if you filter caching.
* If you support filter caching, then the views will always check the in-memory cache for * If you support filter caching, then the views will always check the in-memory cache for
* filter results before attempting a query. * filter results before attempting a query.
* <p>Returns true in default implementation. * <p>Returns true in default implementation.
@ -269,7 +246,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Required method for subsystem factory child classes. Return true if you support filters, and you support * Required method for subsystem configuration child classes. Return true if you support filters, and you support
* multiple filter strings per filter. Return false to restrict the user to one string per filter. * multiple filter strings per filter. Return false to restrict the user to one string per filter.
* <p>Returns TRUE by default. * <p>Returns TRUE by default.
*/ */
@ -279,7 +256,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Required method for subsystem factory child classes if returning true from supportsFilters. * Required method for subsystem configuration child classes if returning true from supportsFilters.
* Return true if you support filters within filters, false otherwise. * Return true if you support filters within filters, false otherwise.
* <p>RETURNS supportsFilters() BY DEFAULT. * <p>RETURNS supportsFilters() BY DEFAULT.
*/ */
@ -299,7 +276,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Return true if filters of this subsystem factory support dropping into. * Return true if filters of this subsystem configuration support dropping into.
* Override this method to provide drop support for filters. * Override this method to provide drop support for filters.
*/ */
public boolean supportsDropInFilters() public boolean supportsDropInFilters()
@ -308,7 +285,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Return true if filters of this subsystem factory provide a custom implementation of drop support. * Return true if filters of this subsystem configuration provide a custom implementation of drop support.
* By default, the filter reference adapter treats a drop on a filter as an update to the list of filter * By default, the filter reference adapter treats a drop on a filter as an update to the list of filter
* strings for a filter. For things like files, it is more desirable to treat the drop as a physical * strings for a filter. For things like files, it is more desirable to treat the drop as a physical
* resource copy, so in that case, custom drop makes sense. * resource copy, so in that case, custom drop makes sense.
@ -322,74 +299,17 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
/** /**
* Return true if you support user-defined actions for the remote system objects returned from expansion of * Return true if you support user-defined actions for the remote system objects returned from expansion of
* subsystems created by this subsystem factory * subsystems created by this subsystem configuration
* <p>RETURNS false BY DEFAULT * <p>RETURNS false BY DEFAULT
*
* @see #supportsUserDefinedActions(ISelection)
*/ */
public boolean supportsUserDefinedActions() public boolean supportsUserDefinedActions()
{ {
return false; return false;
} }
/**
* Return true if you support user-defined actions for the remote system objects explicitly given. This
* calls supportsUserDefinedActions() by default. It is called when decided whether or not to show
* the User Actions menu for the current selection, if supportsUserDefinedActions() returns true.
*
*/
public boolean supportsUserDefinedActions(ISelection selection)
{
// no selection or empty selection, so default to subsystem factory
if (selection == null || selection.isEmpty()) {
return supportsUserDefinedActions();
}
else {
// selection is a structured selection
if (selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection)selection;
Iterator iter = sel.iterator();
boolean supportsUserDefinedActions = true;
// check if adapter of each object supports user defined actions
while (iter.hasNext()) {
Object obj = iter.next();
// we query adapter as to whether it supports user defined actions only
// if the adapter is a remote element adapter
ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)(Platform.getAdapterManager().getAdapter(obj, ISystemRemoteElementAdapter.class));
if (adapter != null) {
supportsUserDefinedActions = adapter.supportsUserDefinedActions(obj);
}
else {
supportsUserDefinedActions = supportsUserDefinedActions();
}
// if one of the selections doesn't support user defined actions, we return false
if (!supportsUserDefinedActions) {
return false;
}
}
// all adapters support user defined actions, so return whether the subsystem factory
// supports user defined actions
return supportsUserDefinedActions();
}
// not a structured selection, so default to asking subsystem factory
else {
return supportsUserDefinedActions();
}
}
}
/** /**
* Return true if you support compile actions for the remote system objects returned from expansion of * Return true if you support compile actions for the remote system objects returned from expansion of
* subsystems created by this subsystem factory. * subsystems created by this subsystem configuration.
* <p> * <p>
* By returning true, user sees a "Work with->Compile Commands..." action item in the popup menu for this * By returning true, user sees a "Work with->Compile Commands..." action item in the popup menu for this
* subsystem. The action is supplied by the framework, but is populated using overridable methods in this subsystem. * subsystem. The action is supplied by the framework, but is populated using overridable methods in this subsystem.
@ -442,7 +362,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return false; return false;
} }
/** /**
* Tell us if this subsystem factory supports targets, which are destinations for * Tell us if this subsystem configuration supports targets, which are destinations for
* pushes and builds. Normally only true for file system factories. * pushes and builds. Normally only true for file system factories.
*/ */
public boolean supportsTargets() public boolean supportsTargets()
@ -450,7 +370,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return false; return false;
} }
/** /**
* Tell us if this subsystem factory supports server launch properties, which allow the user * Tell us if this subsystem configuration supports server launch properties, which allow the user
* to configure how the server-side code for these subsystems are started. There is a Server * to configure how the server-side code for these subsystems are started. There is a Server
* Launch Setting property page, with a pluggable composite, where users can configure these * Launch Setting property page, with a pluggable composite, where users can configure these
* properties. * properties.
@ -467,7 +387,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* the server launcher to decide if a given remote server launch type is supported or not. * the server launcher to decide if a given remote server launch type is supported or not.
* <br> We return true by default. * <br> We return true by default.
* @see org.eclipse.rse.core.subsystems.ServerLaunchType * @see org.eclipse.rse.core.subsystems.ServerLaunchType
* @see #getServerLauncherForm(Shell, ISystemMessageLine)
*/ */
public boolean supportsServerLaunchType(ServerLaunchType serverLaunchType) public boolean supportsServerLaunchType(ServerLaunchType serverLaunchType)
{ {
@ -475,11 +394,11 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Determines whether this factory is responsible for the creation of subsytems of the specified type * Determines whether this subsystem configuration is responsible for the creation of subsytems of the specified type
* Subsystem factories should override this to indicate which subsystems they support. * Subsystem factories should override this to indicate which subsystems they support.
* *
* @param subSystemType type of subsystem * @param subSystemType type of subsystem
* @return whether this factory is for the specified subsystemtype * @return whether this subsystem configuration is for the specified subsystemtype
*/ */
public boolean isFactoryFor(Class subSystemType) public boolean isFactoryFor(Class subSystemType)
{ {
@ -487,102 +406,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return false; return false;
} }
/*
* Return the form used in the subsyste property page. This default implementation returns Syste
*/
public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISystemMessageLine msgLine, Object caller)
{
return new SystemSubSystemPropertyPageCoreForm(msgLine, caller);
}
/**
* Gets the list of property pages applicable for a subsystem associated with this factory
* @return the list of subsystem property pages
*/
protected List getSubSystemPropertyPages()
{
List propertyPages= new ArrayList();
// Get reference to the plug-in registry
IExtensionRegistry registry = Platform.getExtensionRegistry();
// Get configured property page extenders
IConfigurationElement[] propertyPageExtensions =
registry.getConfigurationElementsFor("org.eclipse.ui", "propertyPages"); //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < propertyPageExtensions.length; i++)
{
IConfigurationElement configurationElement = propertyPageExtensions[i];
String objectClass = configurationElement.getAttribute("objectClass"); //$NON-NLS-1$
String name = configurationElement.getAttribute("name"); //$NON-NLS-1$
Class objCls = null;
try
{
ClassLoader loader = getClass().getClassLoader();
objCls = Class.forName(objectClass, false, loader);
}
catch (Exception e)
{
}
if (objCls != null && ISubSystem.class.isAssignableFrom(objCls) && isFactoryFor(objCls))
{
try
{
PropertyPage page = (PropertyPage) configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
page.setTitle(name);
propertyPages.add(page);
}
catch (Exception e)
{
}
}
}
return propertyPages;
}
// FIXME - compile actions no longer part of core
// // ---------------------------------
// // COMPILE ACTIONS METHODS...
// // ---------------------------------
// /**
// * Get the singleton compile manager responsible for enabling the compile support
// * for remote source objects.
// * <p>
// * Do not override this, as the implementation is complete. However,
// * you must override createCompileManager()
// *
// * @see #supportsCompileActions()
// * @see #createCompileManager()
// */
// public SystemCompileManager getCompileManager()
// {
// if (compileManager == null)
// {
// compileManager = createCompileManager();
// if (compileManager != null)
// compileManager.setSubSystemConfiguration(this);
// }
// return compileManager;
// }
//
// /**
// * Overridable method to instantiate the SystemCompileManager for this factory.
// * This is typically your unique subclass of SystemCompileManager.
// * Called once only by getCompileManager (it is only instantiated once).
// *
// * @see #supportsCompileActions()
// * @see #getCompileManager()
// */
// protected SystemCompileManager createCompileManager()
// {
// return null;
// }
// --------------------------------- // ---------------------------------
// USER-PREFERENCE METHODS... // USER-PREFERENCE METHODS...
// --------------------------------- // ---------------------------------
@ -644,7 +467,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
// --------------------------------- // ---------------------------------
/** /**
* Return vendor of this factory. * Return vendor of this subsystem configuration.
* This comes from the xml "vendor" attribute of the extension point. * This comes from the xml "vendor" attribute of the extension point.
*/ */
public String getVendor() public String getVendor()
@ -653,7 +476,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Return name of this factory. * Return name of this subsystem configuration.
* This comes from the xml "name" attribute of the extension point. * This comes from the xml "name" attribute of the extension point.
*/ */
public String getName() public String getName()
@ -662,7 +485,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Return name of this factory. * Return name of this subsystem configuration.
* This comes from the xml "description" attribute of the extension point. * This comes from the xml "description" attribute of the extension point.
*/ */
public String getDescription() public String getDescription()
@ -671,91 +494,16 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Return unique id of this factory. * Return unique id of this subsystem configuration.
* This comes from the xml "id" attribute of the extension point. * This comes from the xml "id" attribute of the extension point.
*/ */
public String getId() public String getId()
{ {
return proxy.getId(); return proxy.getId();
} }
/**
* Return image descriptor of this factory.
* This comes from the xml "icon" attribute of the extension point.
*/
public ImageDescriptor getImage()
{
Object adapterCandidate = Platform.getAdapterManager().getAdapter(proxy, SubSystemConfigurationProxyAdapter.class);
SubSystemConfigurationProxyAdapter adapter = (SubSystemConfigurationProxyAdapter) adapterCandidate;
ImageDescriptor result = adapter.getImageDescriptor();
return result;
}
/** /**
* Return image to use when this susystem is connection. * Return the category this subsystem configuration subscribes to.
* This comes from the xml "iconlive" attribute of the extension point.
*/
public ImageDescriptor getLiveImage()
{
Object adapterCandidate = Platform.getAdapterManager().getAdapter(proxy, SubSystemConfigurationProxyAdapter.class);
SubSystemConfigurationProxyAdapter adapter = (SubSystemConfigurationProxyAdapter) adapterCandidate;
ImageDescriptor result = adapter.getLiveImageDescriptor();
return result;
}
/**
* Return actual graphics Image of this factory.
* This is the same as calling getImage().createImage() but the resulting
* image is cached.
*/
public Image getGraphicsImage()
{
ImageDescriptor id = getImage();
if (id != null)
{
Image image = null;
if (imageTable == null)
imageTable = new Hashtable();
else
image = (Image) imageTable.get(id);
if (image == null)
{
image = id.createImage();
imageTable.put(id, image);
}
return image;
}
return null;
}
/**
* Return actual graphics LiveImage of this factory.
* This is the same as calling getLiveImage().createImage() but the resulting
* image is cached.
*/
public Image getGraphicsLiveImage()
{
ImageDescriptor id = getLiveImage();
if (id != null)
{
Image image = null;
if (imageTable == null)
imageTable = new Hashtable();
else
image = (Image) imageTable.get(id);
if (image == null)
{
image = id.createImage();
imageTable.put(id, image);
}
return image;
}
return null;
}
/**
* Return the category this subsystem factory subscribes to.
* @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories * @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories
*/ */
public String getCategory() public String getCategory()
@ -763,7 +511,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return proxy.getCategory(); return proxy.getCategory();
} }
/** /**
* Return the system types this subsystem factory supports. * Return the system types this subsystem configuration supports.
*/ */
public IRSESystemType[] getSystemTypes() public IRSESystemType[] getSystemTypes()
{ {
@ -859,26 +607,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
// --------------------------------- // ---------------------------------
// SUBSYSTEM METHODS... // SUBSYSTEM METHODS...
// --------------------------------- // ---------------------------------
/**
* Return the validator for the userId.
* A default is supplied.
* Note this is only used for the subsystem's properties, so will not
* be used by the connection's default. Thus, is only of limited value.
* <p>
* This must be castable to ICellEditorValidator for the property sheet support.
*/
public ISystemValidator getUserIdValidator()
{
ISystemValidator userIdValidator =
new ValidatorSpecialChar(
"=;", //$NON-NLS-1$
false,
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_NOTVALID),
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY));
// false => allow empty? No.
return userIdValidator;
}
/** /**
* Called by SystemRegistry's renameSystemProfile method to ensure we update our * Called by SystemRegistry's renameSystemProfile method to ensure we update our
@ -1219,7 +947,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* {@link org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getNewConnectionWizardPages(ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)} * {@link org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getNewConnectionWizardPages(ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)}
* method or null if you didn't override this method. * method or null if you didn't override this method.
* Note there may be more pages than you originally supplied as it is all pages contributed by * Note there may be more pages than you originally supplied as it is all pages contributed by
* this factory object, including subclasses. * this subsystem configuration object, including subclasses.
*/ */
public ISubSystem createSubSystem(IHost conn, boolean creatingConnection, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages) public ISubSystem createSubSystem(IHost conn, boolean creatingConnection, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages)
{ {
@ -1419,7 +1147,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* Overridable. * Overridable.
* <p> * <p>
* Return the name to give a new subsystem. By default, it is given the name of this * Return the name to give a new subsystem. By default, it is given the name of this
* factory object. This is fine, unless you support multiple subsystem instances per * subsystem configuration object. This is fine, unless you support multiple subsystem instances per
* connection, in which case it is your responsibility to supply a unique name for * connection, in which case it is your responsibility to supply a unique name for
* each. * each.
* <p> * <p>
@ -1438,10 +1166,10 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
/** /**
* <i>Overridable</i> method to initialize subsystems after creation. The default behaviour here is to * <i>Overridable</i> method to initialize subsystems after creation. The default behaviour here is to
* set the subsystem's port property to 0, and to add to it a reference to the default filter pool for this * set the subsystem's port property to 0, and to add to it a reference to the default filter pool for this
* factory, if there is one. Typically subclasses call <samp>super().initializeSubSystem(...)</samp> * subsystem configuration, if there is one. Typically subclasses call <samp>super().initializeSubSystem(...)</samp>
* to get this default behaviour, then extend it. * to get this default behaviour, then extend it.
* *
* <p>The reason for the connect wizard pages parm is in case your factory contributes a page to that wizard, * <p>The reason for the connect wizard pages parm is in case your subsystem configuration contributes a page to that wizard,
* whose values are needed to set the subsystem's initial state. For example, you might decide to add a * whose values are needed to set the subsystem's initial state. For example, you might decide to add a
* page to the connection wizard to prompt for a JDBC Driver name. If so, when this method is called at * page to the connection wizard to prompt for a JDBC Driver name. If so, when this method is called at
* the time a new connection is created apres the wizard, your page will have the user's value. You can * the time a new connection is created apres the wizard, your page will have the user's value. You can
@ -1454,7 +1182,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)} * {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getNewConnectionWizardPages(org.eclipse.rse.core.subsystems.ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)}
* method or null if you didn't override this method. * method or null if you didn't override this method.
* Note there may be more pages than you originally supplied, as you are passed all pages contributed * Note there may be more pages than you originally supplied, as you are passed all pages contributed
* by this factory object, including subclasses. This is null when this method is called other than * by this subsystem configuration object, including subclasses. This is null when this method is called other than
* for a New Connection operation. * for a New Connection operation.
*/ */
protected void initializeSubSystem(ISubSystem ss, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages) protected void initializeSubSystem(ISubSystem ss, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages)
@ -1627,7 +1355,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Returns true if this factory allows users to delete instances of subsystem objects. * Returns true if this subsystem configuration allows users to delete instances of subsystem objects.
* Would only be true if users are allowed to create multiple instances of subsystem objects * Would only be true if users are allowed to create multiple instances of subsystem objects
* per connection. * per connection.
* Returns false by default. Override this and deleteSubSystem(SubSystem subsystem) to * Returns false by default. Override this and deleteSubSystem(SubSystem subsystem) to
@ -1639,11 +1367,11 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
} }
/** /**
* Deletes a given subsystem instance from the list maintained by this factory. * Deletes a given subsystem instance from the list maintained by this subsystem configuration.
* SystemRegistryImpl calls this when the user selects to delete a subsystem object, * SystemRegistryImpl calls this when the user selects to delete a subsystem object,
* or deletes the parent connection this subsystem is associated with. * or deletes the parent connection this subsystem is associated with.
* <p> * <p>
* In former case, this is only called if the factory supports user-deletable subsystems. * In former case, this is only called if the subsystem configuration supports user-deletable subsystems.
* <p> * <p>
* Handled for you! * Handled for you!
*/ */
@ -1812,14 +1540,14 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
/** /**
* <i>Overridable lifecycle method. Typically overridden to supply a default filter.</i><br> * <i>Overridable lifecycle method. Typically overridden to supply a default filter.</i><br>
* When the user creates a new profile in the RSE (which is mapped to a SystemFilterPoolManager * When the user creates a new profile in the RSE (which is mapped to a SystemFilterPoolManager
* by our parent class), each subsystem factory that supports filters is asked if it wants to * by our parent class), each subsystem configuration that supports filters is asked if it wants to
* create a default system filter pool in that profile. <br> * create a default system filter pool in that profile. <br>
* This is the method that is called to do that default filter pool creation in the new profile. * This is the method that is called to do that default filter pool creation in the new profile.
* <p> * <p>
* By default we create an <i>empty</i> filter pool with a generated name, and no pre-defined filters. * By default we create an <i>empty</i> filter pool with a generated name, and no pre-defined filters.
* If you don't want that behaviour, override this method and do one of the following:</p> * If you don't want that behaviour, override this method and do one of the following:</p>
* <ul> * <ul>
* <li>nothing if you don't want your subsystem factory to have a default filter pool in the new profile</li>. * <li>nothing if you don't want your subsystem configuration to have a default filter pool in the new profile</li>.
* <li>call super.createDefaultFilterPool(mgr) to get the default pool, and then than call <samp>mgr.createSystemFilter(pool,...)</samp> to create * <li>call super.createDefaultFilterPool(mgr) to get the default pool, and then than call <samp>mgr.createSystemFilter(pool,...)</samp> to create
* each filter and add it to the filter pool, if you want to pre-populate the default pool with * each filter and add it to the filter pool, if you want to pre-populate the default pool with
* default filters. * default filters.
@ -1835,7 +1563,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
pool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user pool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user
} catch (Exception exc) } catch (Exception exc)
{ {
SystemBasePlugin.logError("Error creating default filter pool in default subsystem factory",exc); //$NON-NLS-1$ SystemBasePlugin.logError("Error creating default filter pool in default subsystem configuration",exc); //$NON-NLS-1$
} }
return pool; return pool;
} }
@ -1891,7 +1619,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
filterPoolManagers = null; filterPoolManagers = null;
} }
/** /**
* Return an array of all filter pool managers owned by this subsystem factory. * Return an array of all filter pool managers owned by this subsystem configuration.
* This is a runtime array that only captures those filter pools that have been restored * This is a runtime array that only captures those filter pools that have been restored
* as a result of someone calling getFilterPoolManager(SystemProfile). * as a result of someone calling getFilterPoolManager(SystemProfile).
*/ */
@ -1935,7 +1663,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
{ {
try try
{ {
mgr = SystemFilterPoolManager.createSystemFilterPoolManager(profile, RSEUIPlugin.getDefault().getLogger(), this, // the caller mgr = SystemFilterPoolManager.createSystemFilterPoolManager(profile, RSECorePlugin.getDefault().getLogger(), this, // the caller
getFilterPoolManagerName(profile), // the filter pool manager name getFilterPoolManagerName(profile), // the filter pool manager name
supportsNestedFilters(), // whether or not nested filters are allowed supportsNestedFilters(), // whether or not nested filters are allowed
ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy); ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy);
@ -2017,7 +1745,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
ISystemFilterPoolManager oldMgr = getFilterPoolManager(oldProfile); // will restore it if necessary ISystemFilterPoolManager oldMgr = getFilterPoolManager(oldProfile); // will restore it if necessary
ISystemFilterPoolManager mgr = SystemFilterPoolManager.createSystemFilterPoolManager(newProfile, RSEUIPlugin.getDefault().getLogger(), this, // the caller ISystemFilterPoolManager mgr = SystemFilterPoolManager.createSystemFilterPoolManager(newProfile, RSECorePlugin.getDefault().getLogger(), this, // the caller
getFilterPoolManagerName(newProfile), // the filter pool manager name getFilterPoolManagerName(newProfile), // the filter pool manager name
supportsNestedFilters(), // whether or not nested filters are allowed supportsNestedFilters(), // whether or not nested filters are allowed
ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy); ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy);
@ -2743,17 +2471,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
sl.saveToProperties(); sl.saveToProperties();
return sl; return sl;
} }
/**
* Return the form used in the property page, etc for this server launcher.
* Only called if {@link #supportsServerLaunchProperties(IHost)} returns true.
* <p>
* We return {@link RemoteServerLauncherForm}.
* Override if appropriate.
*/
public IServerLauncherForm getServerLauncherForm(Shell shell, ISystemMessageLine msgLine)
{
return new RemoteServerLauncherForm(shell, msgLine);
}
// ------------------------------------------ // ------------------------------------------
// SAVE METHODS... // SAVE METHODS...