diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ILabeledObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ILabeledObject.java new file mode 100644 index 00000000000..2b8f86ad3f3 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ILabeledObject.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * Copyright (c) 2007 IBM Corporation and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Dykstal (IBM) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.rse.core.model; + +/** + * This interface provides a means of extending RSE model objects and property sets + * with labels that can be used for display purposes. + * The persistence characteristics of labels are left to the implementing + * objects. + */ +public interface ILabeledObject { + + /** + * @return the display label for the object. If this has not + * previously been set, this can return the name of object or + * some other generated or constant label. It may return null + * if no label can be determined. + */ + public String getLabel(); + + /** + * @param label A display label for this object. + */ + public void setLabel(String label); + +} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java index 005e8971a2e..19fa9a47221 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/PropertySet.java @@ -29,9 +29,10 @@ import java.util.Set; * Not thread-safe since the underlying {@link java.util.HashMap} is * not thread-safe. */ -public class PropertySet extends RSEPersistableObject implements IPropertySet, Observer { +public class PropertySet extends RSEPersistableObject implements IPropertySet, ILabeledObject, Observer { private String _name; + private String _label = null; private Map _properties; private IPropertySetContainer _container = null; @@ -44,6 +45,10 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, O public PropertySet(IPropertySet propertySet) { _name = propertySet.getName(); _properties = new HashMap(); + if (propertySet instanceof ILabeledObject) { + ILabeledObject p = (ILabeledObject) propertySet; + _label = p.getLabel(); + } String[] keys = propertySet.getPropertyKeys(); for (int i = 0; i < keys.length; i++) { @@ -67,6 +72,16 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, O public String getName() { return _name; } + + public String getLabel() { + if (_label != null) return _label; + return _name; + } + + public void setLabel(String label) { + _label = label; + setDirty(true); + } public String getDescription() { return getPropertyValue(DESCRIPTION_KEY); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java index 49088ec0bd5..b8588051504 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java @@ -20,6 +20,7 @@ package org.eclipse.rse.core.subsystems; import java.util.Arrays; import java.util.List; +import org.eclipse.rse.core.model.ILabeledObject; import org.eclipse.rse.core.model.IProperty; import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.IPropertyType; @@ -57,8 +58,9 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe protected static final ServerLaunchType SERVER_LAUNCH_TYPE_EDEFAULT = ServerLaunchType.DAEMON_LITERAL; - // proeprty set keys + // property set keys protected final String PROPERTY_SET_NAME = "Launcher Properties"; //$NON-NLS-1$ + private final String PROPERTY_SET_LABEL = RSECoreMessages.RESID_PROPERTYSET_LAUNCHER_PROPERTIES; protected final String KEY_DAEMON_PORT = "daemon.port"; //$NON-NLS-1$ protected final String KEY_REXEC_PORT = "rexec.port"; //$NON-NLS-1$ @@ -140,6 +142,10 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe { try { + if (set instanceof ILabeledObject) { + ILabeledObject ps = (ILabeledObject) set; + ps.setLabel(PROPERTY_SET_LABEL); + } IProperty launchTypeProperty = set.getProperty(KEY_SERVER_LAUNCH_TYPE_NAME); launchTypeProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); String launchTypeName = launchTypeProperty.getValue(); @@ -194,7 +200,10 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe IPropertySet set = getPropertySet(PROPERTY_SET_NAME); if (set == null) { - set = createPropertySet(PROPERTY_SET_NAME, getDescription()); + set = createPropertySet(PROPERTY_SET_NAME, getDescription()); + if (set instanceof ILabeledObject) { + ((ILabeledObject)set).setLabel(PROPERTY_SET_LABEL); + } } if (_serverLaunchType == null) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java index 7ca785bbe56..a96792eddca 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java @@ -37,6 +37,9 @@ public class RSECoreMessages extends NLS { public static String RESID_CONNECTION_PORT_LABEL; public static String RESID_SUBSYSTEM_AUTODETECT_LABEL; + public static String RESID_PROPERTYSET_REMOTE_SERVER_LAUNCHER; + public static String RESID_PROPERTYSET_LAUNCHER_PROPERTIES; + // Persistence public static String PropertyFileProvider_LoadingTaskName; public static String PropertyFileProvider_SavingTaskName; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties index 6c90e04e95b..1d1a347bbd7 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties @@ -31,6 +31,9 @@ RESID_PROP_SERVERLAUNCHER_INVOCATION=Server launch command RESID_CONNECTION_PORT_LABEL=Port RESID_CONNECTION_DAEMON_PORT_LABEL=Daemon Port +RESID_PROPERTYSET_REMOTE_SERVER_LAUNCHER=Remote Server Launcher +RESID_PROPERTYSET_LAUNCHER_PROPERTIES=Launcher Properties + # Persistence RSEPersistenceManager_DeleteProfileJobName=Delete RSE Profile Job PropertyFileProvider_SavingTaskName=Saving DOM diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java index 22a198c3130..09b76e7ba06 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java @@ -20,6 +20,7 @@ package org.eclipse.rse.internal.core.subsystems; import java.util.Arrays; import java.util.List; +import org.eclipse.rse.core.model.ILabeledObject; import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.RSEModelObject; @@ -28,11 +29,12 @@ import org.eclipse.rse.core.subsystems.IServerLauncherProperties; import org.eclipse.rse.internal.core.RSECoreMessages; -public abstract class ServerLauncher extends RSEModelObject implements IServerLauncherProperties +public abstract class ServerLauncher extends RSEModelObject implements IServerLauncherProperties, ILabeledObject { protected String _name; + private String _label = null; protected IConnectorService _connectorService; protected ServerLauncher(String name, IConnectorService service) @@ -47,6 +49,16 @@ public abstract class ServerLauncher extends RSEModelObject implements IServerLa return _name; } + public String getLabel() { + if (_label != null) return _label; + return _name; + } + + public void setLabel(String label) { + _label = label; + setDirty(true); + } + public String getDescription() { return RSECoreMessages.RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION; diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java index a5b885334e6..c2f468e1f9b 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.model.ILabeledObject; import org.eclipse.rse.core.model.IProperty; import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.IPropertyType; @@ -62,6 +63,10 @@ implements IPropertySource public String getName() { + if (_propertySet instanceof ILabeledObject) { + ILabeledObject ps = (ILabeledObject) _propertySet; + return ps.getLabel(); + } return _propertySet.getName(); } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java index ae6275a93a9..6985b4710aa 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java @@ -17,6 +17,7 @@ package org.eclipse.rse.ui.widgets.services; import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.model.ILabeledObject; import org.eclipse.rse.core.subsystems.IServerLauncherProperties; import org.eclipse.rse.ui.ISystemIconConstants; import org.eclipse.rse.ui.RSEUIPlugin; @@ -36,6 +37,10 @@ public class ServerLauncherPropertiesServiceElement extends RSEModelServiceEleme public String getName() { + if (_launcherProperties instanceof ILabeledObject) { + ILabeledObject lp = (ILabeledObject) _launcherProperties; + return lp.getLabel(); + } return _launcherProperties.getName(); } 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 8b5ef843ae6..2285de89859 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 @@ -52,6 +52,7 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; import org.eclipse.rse.core.filters.ISystemFilterSavePolicies; import org.eclipse.rse.core.filters.ISystemFilterString; import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.model.ILabeledObject; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage; import org.eclipse.rse.core.model.ISystemProfile; @@ -59,6 +60,7 @@ import org.eclipse.rse.core.model.ISystemProfileManager; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.SystemStartHere; import org.eclipse.rse.core.references.IRSEBaseReferencingObject; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.core.filters.SystemFilterPoolManager; import org.eclipse.rse.internal.core.filters.SystemFilterPoolWrapperInformation; import org.eclipse.rse.internal.core.filters.SystemFilterStartHere; @@ -2692,6 +2694,10 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration public IServerLauncherProperties createServerLauncher(IConnectorService connectorService) { IRemoteServerLauncher sl = new RemoteServerLauncher("Remote Server Launcher", connectorService); //$NON-NLS-1$ + if (sl instanceof ILabeledObject) { + ((ILabeledObject)sl).setLabel(RSECoreMessages.RESID_PROPERTYSET_REMOTE_SERVER_LAUNCHER); + } + IRSESystemType systemType = connectorService.getHost().getSystemType(); String systemTypeId = systemType.getId();