1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +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) - [186773] split ISystemRegistryUI from ISystemRegistry
* 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;
@ -44,6 +45,7 @@ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystem;
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.SubSystemConfiguration;
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.SystemFilterSelectFilterPoolsAction;
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.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin;
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.validators.ISystemValidator;
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.RemoteServerLauncherForm;
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
* 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
* 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>
* 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 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
SystemCompileManager mgr = factory.getCompileManager();
/** FIXME - UDAs should not be coupled to subsystem configuration adapter
SystemCompileManager mgr = config.getCompileManager();
if (factory.supportsCompileActions() && (mgr != null))
if (config.supportsCompileActions() && (mgr != null))
{
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
* the user selects a system type that this subsystem factory supports.
* the user selects a system type that this subsystem configuration supports.
* <p>
* Some details:
* <ul>
@ -188,19 +193,19 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* </ul>
* 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};
}
else
{
List pages = getSubSystemPropertyPages(factory);
List pages = getSubSystemPropertyPages(config);
if (pages != null && pages.size() > 0)
{
SystemSubSystemsPropertiesWizardPage page = new SystemSubSystemsPropertiesWizardPage(wizard, factory, pages);
SystemSubSystemsPropertiesWizardPage page = new SystemSubSystemsPropertiesWizardPage(wizard, config, pages);
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
*/
public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration factory, ISystemMessageLine msgLine, Object caller)
public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration config, ISystemMessageLine msgLine, Object 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
*/
protected List getSubSystemPropertyPages(ISubSystemConfiguration factory)
protected List getSubSystemPropertyPages(ISubSystemConfiguration config)
{
List propertyPages= new ArrayList();
// 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
{
@ -271,7 +276,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
return propertyPages;
}
// FIXME - UDAs no longer coupled with factory in core
// FIXME - UDAs no longer coupled with config in core
// // ---------------------------------
// // USER-DEFINED ACTIONS METHODS...
// // ---------------------------------
@ -289,14 +294,14 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// * @see #supportsUserDefinedActions()
// * @see #createActionSubSystem()
// */
// public SystemUDActionSubsystem getActionSubSystem(ISubSystemConfiguration factory, ISubSystem subsystem)
// public SystemUDActionSubsystem getActionSubSystem(ISubSystemConfiguration config, ISubSystem subsystem)
// {
// if (udas == null)
// udas = createActionSubSystem(factory);
// udas = createActionSubSystem(config);
// if (udas != null)
// {
// udas.setSubsystem(subsystem);
// udas.setSubSystemConfiguration(factory);
// udas.setSubSystemConfiguration(config);
// }
// return udas;
// }
@ -308,7 +313,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// * @see #supportsUserDefinedActions()
// * @see #getActionSubSystem(ISubSystem)
// */
// protected SystemUDActionSubsystem createActionSubSystem(ISubSystemConfiguration factory)
// protected SystemUDActionSubsystem createActionSubSystem(ISubSystemConfiguration config)
// {
// return null;
// }
@ -320,7 +325,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// * This is called by the addCommonRemoteObjectsActions method, if this subsystem
// * 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);
// menu.add(menuGroup, act);
@ -345,25 +350,26 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// FACTORY ATTRIBUTE METHODS...
// ---------------------------------
/**
* Return image descriptor of this factory.
* This comes from the xml "icon" attribute of the extension point.
/*
* (non-Javadoc)
* @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
*/
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
return ((SubSystemConfiguration)factory).getImage();
ISubSystemConfigurationProxy proxy = config.getSubSystemConfigurationProxy();
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.
* This is the same as calling getImage().createImage() but the resulting
* image is cached.
/*
* (non-Javadoc)
* @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getGraphicsImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
*/
public Image getGraphicsImage(ISubSystemConfiguration factory)
public Image getGraphicsImage(ISubSystemConfiguration config)
{
ImageDescriptor id = getImage(factory);
ImageDescriptor id = getImage(config);
if (id != null)
{
Image image = null;
@ -381,26 +387,26 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
return null;
}
/**
* Return image to use when this susystem is connection.
* This comes from the xml "iconlive" attribute of the extension point.
/*
* (non-Javadoc)
* @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getLiveImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
*/
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
return ((SubSystemConfiguration)factory).getLiveImage();
ISubSystemConfigurationProxy proxy = config.getSubSystemConfigurationProxy();
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.
* This is the same as calling getLiveImage().createImage() but the resulting
* image is cached.
/*
* (non-Javadoc)
* @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getGraphicsLiveImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
*/
public Image getGraphicsLiveImage(ISubSystemConfiguration factory)
public Image getGraphicsLiveImage(ISubSystemConfiguration config)
{
ImageDescriptor id = getLiveImage(factory);
ImageDescriptor id = getLiveImage(config);
if (id != 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>
* Override if additional actions needs to be contributed.
* <p>
@ -442,16 +448,16 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param shell The Shell of the view where this action was launched from
* @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();
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 (showFilterPools)
{
IAction[] newFPActions = getSubSystemNewFilterPoolActions(menu, selection, shell, menuGroup, factory, selectedSubSystem);
IAction[] newFPActions = getSubSystemNewFilterPoolActions(menu, selection, shell, menuGroup, config, selectedSubSystem);
if (newFPActions != null)
{
for (int idx = 0; idx < newFPActions.length; idx++)
@ -462,7 +468,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
{
SystemFilterAbstractFilterPoolAction fpAction = (SystemFilterAbstractFilterPoolAction) newFPActions[idx];
fpAction.setFilterPoolManagerNamePreSelection(selectedSubSystem.getSystemProfile().getName());
fpAction.setFilterPoolManagerProvider(factory);
fpAction.setFilterPoolManagerProvider(config);
}
childActions.addElement(newFPActions[idx]);
} // 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 (!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))
{
// pre-scan for legacy
@ -498,18 +504,18 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// FIXME - UDAs moved out of here
// // 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));
// // 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));
// // if compile actions are supported, add an action to work with them...
// if (factory.supportsCompileActions())
// if (config.supportsCompileActions())
// childActions.addElement(new SystemWorkWithCompileCommandsAction(shell, false));
if (factory.supportsSubSystemConnect())
if (config.supportsSubSystemConnect())
{
// MJB: RE defect 40854
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
int nbrBaseActions = 0;
if (factory.supportsSubSystemConnect())
if (config.supportsSubSystemConnect())
{
//nbrBaseActions += 2; // 4; MJB: RE defect 50854
if (selectedSubSystem.getConnectorService().supportsUserId())
@ -529,7 +535,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// nbrBaseActions += 2;
subSystemActions = new IAction[nbrBaseActions];
int ssIdx = 0;
if (factory.supportsSubSystemConnect())
if (config.supportsSubSystemConnect())
{
// MJB: RE defect 40854
//subSystemActions[ssIdx++] = new SystemConnectAction(shell);
@ -581,11 +587,11 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* <p>
* 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!");
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
// 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();
for (int idx = 0; idx < activeProfiles.length; idx++)
{
ISystemFilterPool defaultPool = getDefaultSystemFilterPool(factory, activeProfiles[idx]);
ISystemFilterPool defaultPool = getDefaultSystemFilterPool(config, activeProfiles[idx]);
if (defaultPool != null)
{
@ -647,10 +653,10 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* Given a profile, return the first (hopefully only) default pool for this
* profile.
*/
public ISystemFilterPool getDefaultSystemFilterPool(ISubSystemConfiguration factory, ISystemProfile profile)
public ISystemFilterPool getDefaultSystemFilterPool(ISubSystemConfiguration config, ISystemProfile profile)
{
ISystemFilterPool pool = null;
ISystemFilterPoolManager mgr = factory.getFilterPoolManager(profile);
ISystemFilterPoolManager mgr = config.getFilterPoolManager(profile);
pool = mgr.getFirstDefaultSystemFilterPool(); // RETURN FIRST
return pool;
}
@ -672,7 +678,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param shell The Shell of the view where this action was launched from
* @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];
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
* 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.
* <p>
* YOU DO NOT NEED TO OVERRIDE THIS METHOD.
@ -777,10 +783,10 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool
* @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();
IAction[] newActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, factory, selectedPool);
IAction[] newActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, config, selectedPool);
if (newActions != null)
{
for (int idx = 0; idx < newActions.length; idx++)
@ -828,10 +834,10 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool
* @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];
actions[0] = getNewFilterPoolFilterAction(factory, selectedPool, shell);
actions[0] = getNewFilterPoolFilterAction(config, selectedPool, shell);
return actions;
}
/**
@ -845,7 +851,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool
* @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);
action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0042"); //$NON-NLS-1$
@ -858,9 +864,9 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedFilter the currently selected filter
* @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.
@ -870,7 +876,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedFilter the currently selected filter
* @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.
* 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)}
* </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
// 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)
{
SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction;
@ -966,12 +972,12 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDescription(String)}
* </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
// Change dialog, so we instantiate it merely so that we can copy the configuration information...
ISystemFilter selectedFilter = selectedFilterString.getParentSystemFilter();
IAction changeAction = getChangeFilterAction(factory, selectedFilter, shell);
IAction changeAction = getChangeFilterAction(config, selectedFilter, shell);
if (changeAction instanceof SystemChangeFilterAction)
{
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
* 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().
* Only supported by subsystems that support filters.
* @param selectedPoolReference the currently selected pool reference
* @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();
if (filterPoolReferenceActions == null)
{
filterPoolReferenceActions = new IAction[3];
filterPoolReferenceActions[0] = getRemoveFilterPoolReferenceAction(factory, selectedPool, shell);
filterPoolReferenceActions[0] = getRemoveFilterPoolReferenceAction(config, selectedPool, shell);
filterPoolReferenceActions[1] = new SystemFilterMoveUpFilterPoolReferenceAction(shell);
((ISystemAction) filterPoolReferenceActions[1]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0063"); //$NON-NLS-1$
filterPoolReferenceActions[2] = new SystemFilterMoveDownFilterPoolReferenceAction(shell);
@ -1026,7 +1032,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @param selectedPool the currently selected pool
* @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);
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
*/
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();
ISystemFilterPool selectedPool = filterPrompt.getParentFilterPool();
SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool);
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
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
* 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 ourChildActions = getAdditionalFilterActions(factory, selectedFilter, shell);
Vector ourChildActions = getAdditionalFilterActions(config, selectedFilter, shell);
int pasteIndex = -1;
if (ourChildActions != null)
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$
}
// 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)
childActions.addElement(newNestedFilterAction);
}
// IAction chgFilterAction = getChangeFilterAction(factory, selectedFilter, shell);
// IAction chgFilterAction = getChangeFilterAction(config, selectedFilter, shell);
// if (chgFilterAction != null)
// childActions.addElement(chgFilterAction);
/*
@ -1168,7 +1174,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* @return Vector of IAction objects.
* @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;
}
@ -1179,7 +1185,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
/**
* 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.
* <p>
* 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 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;
}
@ -1206,7 +1212,7 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
* Override if appropriate.
* @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);
}
@ -1238,7 +1244,14 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
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:
* 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;
import java.util.Vector;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
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.ISubSystemConfiguration;
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
@ -44,11 +37,10 @@ import org.eclipse.swt.widgets.Shell;
* <li>{@link #createSubSystemInternal(org.eclipse.rse.core.model.IHost)}, to instantiate your subsystem class.
* </ul>
* <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
* <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 SubSystemConfigurationAdapter#getNewFilterPoolFilterAction(ISubSystemConfiguration, ISystemFilterPool, Shell)}, and
* <li>supply your own Change Filter popup menu action via {@link SubSystemConfigurationAdapter#getChangeFilterAction(ISubSystemConfiguration, ISystemFilter,Shell)}.
* <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 Change Filter popup menu action via {@link org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#getChangeFilterAction(ISubSystemConfiguration, ISystemFilter, org.eclipse.swt.widgets.Shell)}.
* </ul>
* <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>
* 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()
{
@ -90,7 +82,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
/**
* <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.
*/
public boolean isPortEditable()
@ -99,7 +91,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
}
/**
* <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
* 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>
* 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()
{
@ -159,10 +151,10 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
* After a new subsystem instance is created, the framework calls this method
* 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
* 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
* page.
* </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)}
* 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
* 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)
*/
@ -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
* 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>
* Returns a default string, override if appropriate.
*/
@ -199,25 +191,5 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
{
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) - [186773] split ISystemRegistryUI from ISystemRegistry
* 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;
@ -31,13 +32,8 @@ import java.util.Iterator;
import java.util.List;
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.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.RSECorePlugin;
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.ui.SystemPropertyResources;
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.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemPreferencesManager;
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.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.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:
* <ul>
* <li>#createSubSystemInternal(SystemConnection conn)
* </ul>
* Child classes can optionally override:
* <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#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
@ -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#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#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
* 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>#initializeSubSystem(SubSystem ss, ISystemNewConnectionWizardPage[])
* </ul>
* <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
* 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.
@ -133,8 +117,6 @@ import org.eclipse.ui.dialogs.PropertyPage;
public abstract class SubSystemConfiguration implements ISubSystemConfiguration
{
// subsystem stuff...
private Hashtable subSystemsRestoredFlags = new Hashtable();
private ISubSystemConfigurationProxy proxy = null;
@ -149,11 +131,9 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
protected ISystemFilterPoolManager[] filterPoolManagers = null;
protected Hashtable filterPoolManagersPerProfile = new Hashtable();
// other stuff...
private String translatedFilterType = null;
private static Hashtable brokenReferenceWarningsIssued = new Hashtable();
protected Hashtable imageTable = null;
protected IHost currentlySelectedConnection;
protected Object[] currentlySelected;
@ -161,7 +141,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
protected static IHost currentlyProcessingConnection;
protected static SubSystemConfiguration currentlyProcessingSubSystemConfiguration;
protected java.util.List subSystemList = 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$
}
/**
* Reset for a full refresh from disk, such as after a team synch.
* 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>.
* Override if this is not the case.
*/
@ -209,7 +186,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
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.
*/
public boolean isPortEditable()
@ -217,7 +194,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
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.
*/
public boolean supportsCommands()
@ -225,7 +202,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
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.
*
* @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
* filter results before attempting a query.
* <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.
* <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.
* <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.
*/
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
* 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.
@ -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
* subsystems created by this subsystem factory
* subsystems created by this subsystem configuration
* <p>RETURNS false BY DEFAULT
*
* @see #supportsUserDefinedActions(ISelection)
*/
public boolean supportsUserDefinedActions()
{
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
* subsystems created by this subsystem factory.
* subsystems created by this subsystem configuration.
* <p>
* 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.
@ -442,7 +362,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
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.
*/
public boolean supportsTargets()
@ -450,7 +370,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
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
* Launch Setting property page, with a pluggable composite, where users can configure these
* 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.
* <br> We return true by default.
* @see org.eclipse.rse.core.subsystems.ServerLaunchType
* @see #getServerLauncherForm(Shell, ISystemMessageLine)
*/
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.
*
* @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)
{
@ -487,102 +406,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
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...
// ---------------------------------
@ -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.
*/
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.
*/
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.
*/
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.
*/
public String 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.
* 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.
* Return the category this subsystem configuration subscribes to.
* @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories
*/
public String getCategory()
@ -763,7 +511,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
return proxy.getCategory();
}
/**
* Return the system types this subsystem factory supports.
* Return the system types this subsystem configuration supports.
*/
public IRSESystemType[] getSystemTypes()
{
@ -859,26 +607,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
// ---------------------------------
// 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
@ -1219,7 +947,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* {@link org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getNewConnectionWizardPages(ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)}
* 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
* this factory object, including subclasses.
* this subsystem configuration object, including subclasses.
*/
public ISubSystem createSubSystem(IHost conn, boolean creatingConnection, ISystemNewConnectionWizardPage[] yourNewConnectionWizardPages)
{
@ -1419,7 +1147,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* Overridable.
* <p>
* 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
* each.
* <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
* 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.
*
* <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
* 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
@ -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)}
* 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
* 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.
*/
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
* per connection.
* 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,
* or deletes the parent connection this subsystem is associated with.
* <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>
* 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>
* 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>
* This is the method that is called to do that default filter pool creation in the new profile.
* <p>
* 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>
* <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
* each filter and add it to the filter pool, if you want to pre-populate the default pool with
* 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
} 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;
}
@ -1891,7 +1619,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
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
* as a result of someone calling getFilterPoolManager(SystemProfile).
*/
@ -1935,7 +1663,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
{
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
supportsNestedFilters(), // whether or not nested filters are allowed
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 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
supportsNestedFilters(), // whether or not nested filters are allowed
ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy);
@ -2743,17 +2471,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
sl.saveToProperties();
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...