From 60fd92fdb1e10efa3a73868a3f3efc5b744d78d4 Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Thu, 31 May 2007 15:00:09 +0000 Subject: [PATCH] [190231][api] Remove unnecessary UI dependencies from SubSystemConfiguration --- .../view/SubSystemConfigurationAdapter.java | 209 +++++----- .../ServiceSubSystemConfiguration.java | 54 +-- .../subsystems/SubSystemConfiguration.java | 365 ++---------------- 3 files changed, 165 insertions(+), 463 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java index 639f14e8623..6d42748d2cc 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java @@ -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. * *
* 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. *
* Some details: *
* Override if additional actions needs to be contributed. *
@@ -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 *
* 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. *
* 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 *
* 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; } /** diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java index e42cda4ea6b..af32ec906b1 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/servicesubsystem/ServiceSubSystemConfiguration.java @@ -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; *
- * 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 - *
* This class is typically used together with:
@@ -81,7 +73,7 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati // ------------------------------------------------------ /** * Overridable configuration method. Default is falseThe reason for the connect wizard pages parm is in case your factory contributes a page to that wizard, + *
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. *
@@ -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 // -------------------------------- /** - * Optionally overridable method affecting the visual display of objects within subsystems created by this factory.
* Returns a default string, override if appropriate.
*/
@@ -199,25 +191,5 @@ public abstract class ServiceSubSystemConfiguration extends SubSystemConfigurati
{
return super.getTranslatedFilterTypeProperty(selectedFilter);
}
- /**
- * 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.
- * This method is only called for filters within subsystems created by this subsystem factory.
- * 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;
- }
-
-
-
}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java
index 0db6091733b..c48951142ed 100644
--- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java
+++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java
@@ -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:
*
- * 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. * By default, returns true. * 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 *
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 *
RETURNS FALSE BY DEFAULT.
*
* @return false
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.
*
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. *
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. *
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 *
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. *
* 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.
*
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.
-// *
-// * 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. - *
- * 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. *
* 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. *
@@ -1438,10 +1166,10 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration /** * Overridable 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 super().initializeSubSystem(...) + * subsystem configuration, if there is one. Typically subclasses call super().initializeSubSystem(...) * to get this default behaviour, then extend it. * - *
The reason for the connect wizard pages parm is in case your factory contributes a page to that wizard, + *
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. *
- * 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. *
* Handled for you!
*/
@@ -1812,14 +1540,14 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
/**
* Overridable lifecycle method. Typically overridden to supply a default filter.
* 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.
* This is the method that is called to do that default filter pool creation in the new profile.
*
* By default we create an empty 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:
*- * We return {@link RemoteServerLauncherForm}. - * Override if appropriate. - */ - public IServerLauncherForm getServerLauncherForm(Shell shell, ISystemMessageLine msgLine) - { - return new RemoteServerLauncherForm(shell, msgLine); - } // ------------------------------------------ // SAVE METHODS...