mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[181064] persist environment variables in the order they were entered
This commit is contained in:
parent
1be96bcbef
commit
0336dce69b
12 changed files with 241 additions and 169 deletions
|
@ -88,6 +88,8 @@ public interface IPropertySet {
|
|||
*
|
||||
* Provided that the Set has a description, the
|
||||
* @link{DESCRIPTION_KEY} key will also be in the list.
|
||||
* The interface defines no particular ordering for the
|
||||
* keys.
|
||||
*
|
||||
* @return String array of Property keys.
|
||||
*/
|
||||
|
@ -161,4 +163,8 @@ public interface IPropertySet {
|
|||
*/
|
||||
public void setContainer(IPropertySetContainer container);
|
||||
|
||||
/**
|
||||
* @return the container of this property set or null if there is no container.
|
||||
*/
|
||||
public IPropertySetContainer getContainer();
|
||||
}
|
|
@ -16,19 +16,69 @@
|
|||
|
||||
package org.eclipse.rse.core.model;
|
||||
|
||||
/**
|
||||
* A property set container is capable of containing property sets. This interface allows for the
|
||||
* addition, retrieval, and deletion of property sets from the container. A property set may have only
|
||||
* one container.
|
||||
*/
|
||||
public interface IPropertySetContainer {
|
||||
|
||||
/**
|
||||
* Retrieves an array all property sets known to this container. It will return an empty array if this
|
||||
* container has property sets. The order of these property sets is not dictated by the interface.
|
||||
* @return an array of property sets.
|
||||
*/
|
||||
public IPropertySet[] getPropertySets();
|
||||
|
||||
/**
|
||||
* Retrieves a particular property set by its name.
|
||||
* @param name the name of the property set.
|
||||
* @return the named property set or null if one by that name does not exist.
|
||||
*/
|
||||
public IPropertySet getPropertySet(String name);
|
||||
|
||||
/**
|
||||
* Creates a new property set of a particular name in this container.
|
||||
* If one already exists
|
||||
* by this name it is replaced with a new empty property set.
|
||||
* @param name the name of the property set.
|
||||
* @return The property set.
|
||||
*/
|
||||
public IPropertySet createPropertySet(String name);
|
||||
|
||||
/**
|
||||
* Creates a new property set of a particular name and description in this container.
|
||||
* If one already exists
|
||||
* by this name it is replaced with a new empty property set.
|
||||
* @param name the name of the property set.
|
||||
* @param description the description (usually already localized) for this property set.
|
||||
* @return the newly created property set.
|
||||
*/
|
||||
public IPropertySet createPropertySet(String name, String description);
|
||||
|
||||
/**
|
||||
* Adds an existing property set to this container. If the property set already has a container
|
||||
* it is removed from that container and added to this one. If this container already
|
||||
* has a property set by this name, this one replaces it.
|
||||
* @param set the property set to be added.
|
||||
* @return true if the property set was added.
|
||||
*/
|
||||
public boolean addPropertySet(IPropertySet set);
|
||||
|
||||
/**
|
||||
* Adds a number of existing property sets to this container.
|
||||
* @param sets the sets to be added
|
||||
* @return true if all property sets were added.
|
||||
* @see #addPropertySet(IPropertySet)
|
||||
*/
|
||||
public boolean addPropertySets(IPropertySet[] sets);
|
||||
|
||||
/**
|
||||
* Removes a particular property set from this container.
|
||||
* @param name the name of the property set to be removed
|
||||
* @return true if the property set was removed;
|
||||
* false if a property set was not removed, usually if it does not exist in the container.
|
||||
*/
|
||||
public boolean removePropertySet(String name);
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.eclipse.rse.core.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A property list is an ordered property set. As items are added and removed their arrival order is
|
||||
* maintained.
|
||||
*/
|
||||
public class PropertyList extends PropertySet {
|
||||
|
||||
private List _keys = new ArrayList(10);
|
||||
|
||||
public PropertyList(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public IProperty addProperty(String key, IProperty property) {
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
return super.addProperty(key, property);
|
||||
}
|
||||
|
||||
public IProperty addProperty(String key, String value) {
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
return super.addProperty(key, value);
|
||||
}
|
||||
|
||||
public IProperty addProperty(String key, String value, IPropertyType type) {
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
return super.addProperty(key, value, type);
|
||||
}
|
||||
|
||||
public String[] getPropertyKeys() {
|
||||
return (String[]) _keys.toArray(new String[_keys.size()]);
|
||||
}
|
||||
|
||||
public boolean removeProperty(String key) {
|
||||
_keys.remove(key);
|
||||
return super.removeProperty(key);
|
||||
}
|
||||
|
||||
public void setProperties(Map map) {
|
||||
_keys.clear();
|
||||
_keys.addAll(map.keySet());
|
||||
super.setProperties(map);
|
||||
}
|
||||
|
||||
}
|
|
@ -30,6 +30,7 @@ import java.util.Set;
|
|||
* not thread-safe.
|
||||
*/
|
||||
public class PropertySet extends RSEPersistableObject implements IPropertySet, Observer {
|
||||
|
||||
private String _name;
|
||||
private Map _properties;
|
||||
private IPropertySetContainer _container = null;
|
||||
|
@ -178,6 +179,10 @@ public class PropertySet extends RSEPersistableObject implements IPropertySet, O
|
|||
_container = container;
|
||||
}
|
||||
|
||||
public IPropertySetContainer getContainer() {
|
||||
return _container;
|
||||
}
|
||||
|
||||
public void update(Observable o, Object arg) {
|
||||
setDirty(true);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,10 @@ public abstract class PropertySetContainer extends RSEPersistableObject implemen
|
|||
}
|
||||
|
||||
public boolean addPropertySet(IPropertySet set) {
|
||||
IPropertySetContainer old = set.getContainer();
|
||||
if (old != null) {
|
||||
old.removePropertySet(set.getName());
|
||||
}
|
||||
set.setContainer(this);
|
||||
_propertySets.put(set.getName(), set);
|
||||
return true;
|
||||
|
|
|
@ -61,12 +61,14 @@ public interface IRemoteSystemEnvVar {
|
|||
* @generated This field/method will be replaced during code generation
|
||||
* @return The value of the AdditionalAttributes attribute
|
||||
* Additional attributes that may need to be persisted per environment variable.
|
||||
* @deprecated
|
||||
*/
|
||||
String getAdditionalAttributes();
|
||||
|
||||
/**
|
||||
* @generated This field/method will be replaced during code generation
|
||||
* @param value The new value of the AdditionalAttributes attribute
|
||||
* @deprecated
|
||||
*/
|
||||
void setAdditionalAttributes(String value);
|
||||
|
||||
|
|
|
@ -161,18 +161,23 @@ public class RSEDOMExporter implements IRSEDOMExporter {
|
|||
*/
|
||||
public RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject modelObject, boolean clean) {
|
||||
IPropertySet[] propertySets = modelObject.getPropertySets();
|
||||
RSEDOMNode[] result = new RSEDOMNode[propertySets.length];
|
||||
for (int i = 0; i < propertySets.length; i++) {
|
||||
IPropertySet set = propertySets[i];
|
||||
RSEDOMNode node = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
|
||||
RSEDOMNode propertySetNode = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
|
||||
String[] keys = set.getPropertyKeys();
|
||||
for (int k = 0; k < keys.length; k++) {
|
||||
String key = keys[k];
|
||||
String value = set.getPropertyValue(key);
|
||||
IPropertyType type = set.getPropertyType(key);
|
||||
node.addAttribute(key, value, type.toString());
|
||||
RSEDOMNode propertyNode = new RSEDOMNode(propertySetNode, IRSEDOMConstants.TYPE_PROPERTY, key);
|
||||
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, type.toString());
|
||||
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE, value);
|
||||
|
||||
}
|
||||
result[i] = propertySetNode;
|
||||
}
|
||||
return parent.getChildren();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -423,14 +423,23 @@ public class RSEDOMImporter {
|
|||
public IPropertySet restorePropertySet(IRSEModelObject modelObject, RSEDOMNode propertySetNode) {
|
||||
String name = propertySetNode.getName();
|
||||
IPropertySet set = modelObject.createPropertySet(name);
|
||||
// properties used to be stored as attributes, get those first for compatability
|
||||
RSEDOMNodeAttribute[] attributes = propertySetNode.getAttributes();
|
||||
for (int i = 0; i < attributes.length; i++) {
|
||||
RSEDOMNodeAttribute attribute = attributes[i];
|
||||
String typeStr = attribute.getType();
|
||||
IPropertyType type = PropertyType.fromString(typeStr);
|
||||
|
||||
set.addProperty(attribute.getKey(), attribute.getValue(), type);
|
||||
|
||||
}
|
||||
// properties are now stored as children, get those next
|
||||
RSEDOMNode[] children = propertySetNode.getChildren();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
RSEDOMNode child = children[i];
|
||||
String propertyName = child.getName();
|
||||
String propertyValue = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE).getValue();
|
||||
String propertyTypeName = child.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue();
|
||||
IPropertyType propertyType = PropertyType.fromString(propertyTypeName);
|
||||
set.addProperty(propertyName, propertyValue, propertyType);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ public class RemoteSystemEnvVar implements IRemoteSystemEnvVar
|
|||
/**
|
||||
* @generated This field/method will be replaced during code generation
|
||||
* Additional attributes that may need to be persisted per environment variable.
|
||||
* @deprecated
|
||||
*/
|
||||
public String getAdditionalAttributes()
|
||||
{
|
||||
|
@ -136,6 +137,7 @@ public class RemoteSystemEnvVar implements IRemoteSystemEnvVar
|
|||
|
||||
/**
|
||||
* @generated This field/method will be replaced during code generation.
|
||||
* @deprecated
|
||||
*/
|
||||
public void setAdditionalAttributes(String newAdditionalAttributes)
|
||||
{
|
||||
|
|
|
@ -216,13 +216,6 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
*/
|
||||
public String getInvalidEnvironmentVariableNameCharacters();
|
||||
|
||||
/**
|
||||
* <i><b>Private</b>. Do not override or call.</i>
|
||||
* @generated This field/method will be replaced during code generation
|
||||
* @return The list of EnvVars references
|
||||
*/
|
||||
java.util.List getEnvVars();
|
||||
|
||||
public List getHostEnvironmentVariables();
|
||||
|
||||
|
||||
|
|
|
@ -18,17 +18,18 @@ package org.eclipse.rse.subsystems.shells.core.subsystems;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.IProperty;
|
||||
import org.eclipse.rse.core.model.IPropertySet;
|
||||
import org.eclipse.rse.core.model.PropertyList;
|
||||
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
|
||||
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
|
||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||
|
@ -57,12 +58,9 @@ import org.eclipse.swt.widgets.Shell;
|
|||
public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmdSubSystem, ICommunicationsListener
|
||||
{
|
||||
|
||||
public static String COMMAND_SHELLS_MEMENTO = "commandshells"; //$NON-NLS-1$
|
||||
|
||||
protected java.util.List envVars = null;
|
||||
|
||||
protected List _envVars;
|
||||
|
||||
private static String COMMAND_SHELLS_MEMENTO = "commandshells"; //$NON-NLS-1$
|
||||
private static String ENVIRONMENT_VARS = "EnvironmentVariables"; //$NON-NLS-1$
|
||||
|
||||
protected ArrayList _cmdShells;
|
||||
|
||||
protected IRemoteCommandShell _defaultShell;
|
||||
|
@ -128,164 +126,115 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
* RemoteSystemEnvVar objects. Array returned may be size zero but will not
|
||||
* be null.
|
||||
*/
|
||||
public IRemoteSystemEnvVar[] getEnvironmentVariableList()
|
||||
{
|
||||
java.util.List initEVL = getEnvVars();
|
||||
IRemoteSystemEnvVar[] envl = new IRemoteSystemEnvVar[initEVL.size()];
|
||||
Iterator i = initEVL.iterator();
|
||||
int idx = 0;
|
||||
while (i.hasNext())
|
||||
envl[idx++] = (IRemoteSystemEnvVar) i.next();
|
||||
return envl;
|
||||
public IRemoteSystemEnvVar[] getEnvironmentVariableList() {
|
||||
IPropertySet environmentVariables = getEnvironmentVariables();
|
||||
String[] names = environmentVariables.getPropertyKeys();
|
||||
IRemoteSystemEnvVar[] result = new IRemoteSystemEnvVar[names.length];
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
String name = names[i];
|
||||
String value = environmentVariables.getPropertyValue(name);
|
||||
IRemoteSystemEnvVar v = new RemoteSystemEnvVar();
|
||||
v.setName(name);
|
||||
v.setValue(value);
|
||||
result[i] = v;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the initial environment variable list entries, all in one shot, using
|
||||
* a pair of String arrays: the first is the environment variable names, the
|
||||
* second is the corresponding environment variable values.
|
||||
* <p>
|
||||
* Note, this calls getParentSubSystemConfiguration().saveSubSystem(this) for you.
|
||||
* @param names the array of names
|
||||
* @param values the array of string values
|
||||
*/
|
||||
public void setEnvironmentVariableList(String[] envVarNames, String[] envVarValues)
|
||||
{
|
||||
java.util.List initEVL = getEnvVars();
|
||||
initEVL.clear();
|
||||
if (envVarNames != null)
|
||||
{
|
||||
IRemoteSystemEnvVar rsev = null;
|
||||
for (int idx = 0; idx < envVarNames.length; idx++)
|
||||
{
|
||||
rsev = new RemoteSystemEnvVar();
|
||||
rsev.setName(envVarNames[idx]);
|
||||
rsev.setValue(envVarValues[idx]);
|
||||
initEVL.add(rsev);
|
||||
public void setEnvironmentVariableList(String[] names, String[] values) {
|
||||
removePropertySet(ENVIRONMENT_VARS);
|
||||
IPropertySet environmentVariables = getEnvironmentVariables();
|
||||
if (names != null) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
environmentVariables.addProperty(names[i], values[i]);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
if (getSubSystemConfiguration() != null)
|
||||
getSubSystemConfiguration().saveSubSystem(this);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SystemBasePlugin.logError("Error saving command subsystem after setting env var entries", exc); //$NON-NLS-1$
|
||||
try {
|
||||
if (getSubSystemConfiguration() != null) getSubSystemConfiguration().saveSubSystem(this);
|
||||
} catch (Exception exc) {
|
||||
RSECorePlugin.getDefault().getLogger().logError("Error saving command subsystem after setting env var entries", exc); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add environment variable entry, given a name and value
|
||||
*/
|
||||
public void addEnvironmentVariable(String name, String value)
|
||||
{
|
||||
/*
|
||||
* FIXME RemoteSystemEnvVar rsev =
|
||||
* SubSystemConfigurationImpl.getSSMOFfactory().createRemoteSystemEnvVar();
|
||||
* rsev.setName(name); rsev.setValue(value);
|
||||
* addEnvironmentVariable(rsev);
|
||||
*/
|
||||
RemoteSystemEnvVar rsev = new RemoteSystemEnvVar();
|
||||
rsev.setName(name);
|
||||
rsev.setValue(value);
|
||||
addEnvironmentVariable(rsev);
|
||||
return;
|
||||
public void addEnvironmentVariable(String name, String value) {
|
||||
IPropertySet environmentVariables = getEnvironmentVariables();
|
||||
environmentVariables.addProperty(name, value);
|
||||
commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add environment variable entry, given a RemoteSystemEnvVar object
|
||||
*/
|
||||
public void addEnvironmentVariable(IRemoteSystemEnvVar rsev)
|
||||
{
|
||||
getEnvVars().add(rsev);
|
||||
try
|
||||
{
|
||||
getSubSystemConfiguration().saveSubSystem(this);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SystemBasePlugin.logError("Error saving command subsystem after adding env var entry", exc); //$NON-NLS-1$
|
||||
}
|
||||
public void addEnvironmentVariable(IRemoteSystemEnvVar rsev) {
|
||||
addEnvironmentVariable(rsev.getName(), rsev.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove environment variable entry given its RemoteSystemEnvVar object
|
||||
* @param rsev the remote system environment variable to remove
|
||||
*/
|
||||
public void removeEnvironmentVariable(IRemoteSystemEnvVar rsev)
|
||||
{
|
||||
getEnvVars().remove(rsev);
|
||||
try
|
||||
{
|
||||
getSubSystemConfiguration().saveSubSystem(this);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SystemBasePlugin.logError("Error saving command subsystem after removing env var entry", exc); //$NON-NLS-1$
|
||||
}
|
||||
public void removeEnvironmentVariable(IRemoteSystemEnvVar rsev) {
|
||||
removeEnvironmentVariable(rsev.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove environment variable entry given only its environment variable
|
||||
* name
|
||||
*/
|
||||
public void removeEnvironmentVariable(String name)
|
||||
{
|
||||
IRemoteSystemEnvVar rsev = getEnvironmentVariable(name);
|
||||
if (rsev != null)
|
||||
removeEnvironmentVariable(rsev);
|
||||
public void removeEnvironmentVariable(String name) {
|
||||
IPropertySet environmentVariables = getEnvironmentVariables();
|
||||
environmentVariables.removeProperty(name);
|
||||
commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an environment variable name, find its RemoteSystemEnvVar object.
|
||||
* Returns null if not found!
|
||||
* Returns null if not found.
|
||||
*/
|
||||
public IRemoteSystemEnvVar getEnvironmentVariable(String name)
|
||||
{
|
||||
java.util.List envVarList = getEnvVars();
|
||||
IRemoteSystemEnvVar match = null;
|
||||
Iterator i = envVarList.iterator();
|
||||
while ((match == null) && i.hasNext())
|
||||
{
|
||||
IRemoteSystemEnvVar rsev = (IRemoteSystemEnvVar) i.next();
|
||||
if (rsev.getName().equals(name))
|
||||
match = rsev;
|
||||
public IRemoteSystemEnvVar getEnvironmentVariable(String name) {
|
||||
IRemoteSystemEnvVar result = null;
|
||||
String value = getEnvironmentVariableValue(name);
|
||||
if (value != null) {
|
||||
result = new RemoteSystemEnvVar();
|
||||
result.setName(name);
|
||||
result.setValue(value);
|
||||
}
|
||||
return match;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an environment variable name, find its value. Returns null if not
|
||||
* found.
|
||||
*/
|
||||
public String getEnvironmentVariableValue(String name)
|
||||
{
|
||||
IRemoteSystemEnvVar match = getEnvironmentVariable(name);
|
||||
if (match != null)
|
||||
return match.getValue();
|
||||
else
|
||||
return null;
|
||||
public String getEnvironmentVariableValue(String name) {
|
||||
IPropertySet environmentVariables = getEnvironmentVariables();
|
||||
String value = environmentVariables.getPropertyValue(name);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected String[] getEnvVarsAsStringArray()
|
||||
{
|
||||
String[] envVars = null;
|
||||
IRemoteSystemEnvVar[] list = getEnvironmentVariableList();
|
||||
if (list != null && list.length > 0)
|
||||
{
|
||||
envVars = new String[list.length];
|
||||
for (int i = 0; i < list.length; i++)
|
||||
{
|
||||
String name = list[i].getName();
|
||||
if (isWindows())
|
||||
{
|
||||
name = name.toUpperCase();
|
||||
}
|
||||
envVars[i] = name + "=" + list[i].getValue(); //$NON-NLS-1$
|
||||
}
|
||||
protected String[] getEnvVarsAsStringArray() {
|
||||
IPropertySet environmentVariables = getEnvironmentVariables();
|
||||
String[] names = environmentVariables.getPropertyKeys();
|
||||
String[] result = new String[names.length];
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
String name = names[i];
|
||||
String value = environmentVariables.getPropertyValue(name);
|
||||
result[i] = name + "=" + value; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return envVars;
|
||||
return result;
|
||||
}
|
||||
|
||||
protected boolean isUniqueVariable(List variables, String varName)
|
||||
|
@ -460,7 +409,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
* @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(IProgressMonitor,String)
|
||||
*/
|
||||
protected Object[] internalResolveFilterString(IProgressMonitor monitor, String filterString)
|
||||
throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
|
||||
throws InvocationTargetException, InterruptedException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -611,8 +560,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
}
|
||||
}
|
||||
|
||||
protected void internalRemoveShell(Object command) throws java.lang.reflect.InvocationTargetException,
|
||||
java.lang.InterruptedException
|
||||
protected void internalRemoveShell(Object command) throws InvocationTargetException,
|
||||
InterruptedException
|
||||
{
|
||||
if (command instanceof IRemoteCommandShell)
|
||||
{
|
||||
|
@ -800,19 +749,23 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated This field/method will be replaced during code generation
|
||||
*/
|
||||
public java.util.List getEnvVars()
|
||||
{
|
||||
if (envVars == null)
|
||||
{
|
||||
envVars = new ArrayList();// FIXME new
|
||||
// EObjectContainmenteList(RemoteSystemEnvVar.class,
|
||||
// this,
|
||||
// SubsystemsPackage.REMOTE_CMD_SUB_SYSTEM__ENV_VARS);
|
||||
private IPropertySet getEnvironmentVariables() {
|
||||
IPropertySet environmentVariables = getPropertySet(ENVIRONMENT_VARS);
|
||||
if (environmentVariables == null) {
|
||||
environmentVariables = createPropertySet(ENVIRONMENT_VARS);
|
||||
}
|
||||
return envVars;
|
||||
return environmentVariables;
|
||||
}
|
||||
|
||||
public IPropertySet createPropertySet(String name) {
|
||||
IPropertySet result = null;
|
||||
if (name.equals(ENVIRONMENT_VARS)) {
|
||||
result = new PropertyList(ENVIRONMENT_VARS);
|
||||
addPropertySet(result);
|
||||
} else {
|
||||
result = super.createPropertySet(name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -821,8 +774,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
*/
|
||||
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
|
||||
{
|
||||
//dwd if (shell != null)
|
||||
//dwd this.shell = shell;
|
||||
return internalRunCommand(null, command, context, interpretOutput);
|
||||
}
|
||||
|
||||
|
@ -831,8 +782,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
*/
|
||||
public Object[] runCommand(IProgressMonitor monitor, String command, Object context, boolean interpretOutput) throws Exception
|
||||
{
|
||||
//dwd if (shell != null)
|
||||
//dwd this.shell = shell;
|
||||
return internalRunCommand(monitor, command, context, interpretOutput);
|
||||
}
|
||||
|
||||
|
@ -843,8 +792,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
*/
|
||||
public IRemoteCommandShell runShell(Object context) throws Exception
|
||||
{
|
||||
//dwd if (shell != null)
|
||||
//dwd this.shell = shell;
|
||||
IRemoteCommandShell cmdShell = null;
|
||||
if (isConnected())
|
||||
{
|
||||
|
@ -929,7 +876,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
{
|
||||
try
|
||||
{
|
||||
//dwd this.shell = shell; // FIXME remove this
|
||||
SendCommandToShellJob job = new SendCommandToShellJob(input, commandObject);
|
||||
|
||||
scheduleJob(job, null);
|
||||
|
@ -990,7 +936,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
{
|
||||
try
|
||||
{
|
||||
//dwd this.shell = shell; // FIXME remove this
|
||||
CancelShellJob job = new CancelShellJob(commandObject);
|
||||
scheduleJob(job, null);
|
||||
}
|
||||
|
@ -1052,7 +997,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
{
|
||||
try
|
||||
{
|
||||
//dwd this.shell = shell; // FIXME remove this
|
||||
RemoveShellJob job = new RemoveShellJob(commandObject);
|
||||
scheduleJob(job, null);
|
||||
}
|
||||
|
@ -1264,7 +1208,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
* <li>if the user cancels (monitor.isCanceled()), throw new
|
||||
* InterruptedException()
|
||||
* <li>if something else bad happens, throw new
|
||||
* java.lang.reflect.InvocationTargetException(exc);
|
||||
* InvocationTargetException(exc);
|
||||
* <li>do not worry about calling monitor.done() ... caller will do that!
|
||||
* </ul>
|
||||
* YOU MUST OVERRIDE THIS IF YOU SUPPORT COMMANDS!
|
||||
|
@ -1284,30 +1228,30 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
* <li>if the user cancels (monitor.isCanceled()), throw new
|
||||
* InterruptedException()
|
||||
* <li>if something else bad happens, throw new
|
||||
* java.lang.reflect.InvocationTargetException(exc);
|
||||
* InvocationTargetException(exc);
|
||||
* <li>do not worry about calling monitor.done() ... caller will do that!
|
||||
* </ul>
|
||||
* YOU MUST OVERRIDE THIS IF YOU SUPPORT COMMANDS!
|
||||
*/
|
||||
protected Object[] internalRunCommand(IProgressMonitor monitor, String cmd, Object context, boolean interpretOutput)
|
||||
throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException, SystemMessageException
|
||||
throws InvocationTargetException, InterruptedException, SystemMessageException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected IRemoteCommandShell internalRunShell(IProgressMonitor monitor, Object context)
|
||||
throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException, SystemMessageException
|
||||
throws InvocationTargetException, InterruptedException, SystemMessageException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void internalCancelShell(IProgressMonitor monitor, Object command)
|
||||
throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
|
||||
throws InvocationTargetException, InterruptedException
|
||||
{
|
||||
}
|
||||
|
||||
protected void internalSendCommandToShell(IProgressMonitor monitor, String cmd, Object command)
|
||||
throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
|
||||
throws InvocationTargetException, InterruptedException
|
||||
{
|
||||
}
|
||||
}
|
|
@ -590,17 +590,17 @@ public class EnvironmentVariablesForm extends SystemBaseForm implements Selectio
|
|||
}
|
||||
|
||||
// next check for duplicate env var names
|
||||
String existingName;
|
||||
int currentSelection = envVarTable.getSelectionIndex();
|
||||
for (int i = 0; i < envVars.size() && msg == null; i++)
|
||||
{
|
||||
existingName = ((EnvironmentVariable) envVars.get(i)).getName();
|
||||
if (currentSelection != i && existingName.equals(name))
|
||||
{
|
||||
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE);
|
||||
msg.makeSubstitution(existingName);
|
||||
}
|
||||
}
|
||||
int numberFound = 0;
|
||||
int itemCount = envVarTable.getItemCount();
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
TableItem item = envVarTable.getItem(i);
|
||||
String itemName = item.getText(0);
|
||||
if (itemName.equals(name)) numberFound++;
|
||||
}
|
||||
if (numberFound > 1) {
|
||||
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE);
|
||||
msg.makeSubstitution(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue