diff options
author | Jared Burns | 2003-05-22 16:22:22 +0000 |
---|---|---|
committer | Jared Burns | 2003-05-22 16:22:22 +0000 |
commit | 56c060f2c25774b44226174cb9180869c1f26b2d (patch) | |
tree | ab29ec1a71b642b406f7331cc26e8f97b872209f | |
parent | 8cfcb47909ba66de548d9066ccbe111b8c49deca (diff) | |
download | eclipse.platform.debug-56c060f2c25774b44226174cb9180869c1f26b2d.tar.gz eclipse.platform.debug-56c060f2c25774b44226174cb9180869c1f26b2d.tar.xz eclipse.platform.debug-56c060f2c25774b44226174cb9180869c1f26b2d.zip |
Bug 37241 - Support for core variables
65 files changed, 1650 insertions, 633 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java index 6fcdf732a..f67aa12cf 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java @@ -30,12 +30,14 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.model.IProcess; +import org.eclipse.debug.core.variables.ISimpleVariableRegistry; import org.eclipse.debug.internal.core.BreakpointManager; import org.eclipse.debug.internal.core.DebugCoreMessages; import org.eclipse.debug.internal.core.ExpressionManager; import org.eclipse.debug.internal.core.LaunchManager; import org.eclipse.debug.internal.core.ListenerList; import org.eclipse.debug.internal.core.RuntimeProcess; +import org.eclipse.debug.internal.core.SimpleVariableRegistry; /** * There is one instance of the debug plug-in available from @@ -108,7 +110,14 @@ public class DebugPlugin extends Plugin { * * @since 3.0 */ - public static final String EXTENSION_POINT_LAUNCH_DELEGATES= "launchDelegates"; //$NON-NLS-1$ + public static final String EXTENSION_POINT_LAUNCH_DELEGATES= "launchDelegates"; //$NON-NLS-1$ + /** + * Simple identifier constant (value <code>"simpleLaunchVariables"</code>) for the + * simple launch variables extension point. + * + * @since 3.0 + */ + public static final String EXTENSION_POINT_SIMPLE_LAUNCH_VARIABLES= "simpleLaunchVariables"; //$NON-NLS-1$ /** * Status code indicating an unexpected internal error. @@ -146,6 +155,11 @@ public class DebugPlugin extends Plugin { * The singleton launch manager. */ private LaunchManager fLaunchManager; + + /** + * The singleton variable registry. + */ + private SimpleVariableRegistry fVariableRegistry; /** * The collection of debug event listeners. @@ -334,6 +348,18 @@ public class DebugPlugin extends Plugin { } /** + * Returns the registry of simple launch variables. + * + * @return the registry of simple launch variables + */ + public ISimpleVariableRegistry getSimpleVariableRegistry() { + if (fVariableRegistry == null) { + fVariableRegistry = new SimpleVariableRegistry(); + } + return fVariableRegistry; + } + + /** * Returns the status handler registered for the given * status, or <code>null</code> if none. * @@ -422,6 +448,9 @@ public class DebugPlugin extends Plugin { if (fEventListeners != null) { fEventListeners.removeAll(); } + if (fVariableRegistry != null) { + fVariableRegistry.storeVariables(); + } setDefault(null); ResourcesPlugin.getWorkspace().removeSaveParticipant(this); } @@ -608,6 +637,16 @@ public class DebugPlugin extends Plugin { } /** + * Logs the given message with this plug-in's log and the given + * throwable or <code>null</code> if none. + * @param message the message to log + * @param throwable the exception that occurred or <code>null</code> if none + */ + public static void logMessage(String message, Throwable throwable) { + log(new Status(IStatus.ERROR, getUniqueIdentifier(), INTERNAL_ERROR, message, throwable)); + } + + /** * Logs the specified status with this plug-in's log. * * @param status status to log diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ISimpleLaunchVariable.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ISimpleLaunchVariable.java new file mode 100644 index 000000000..2a525b7e3 --- /dev/null +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ISimpleLaunchVariable.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.core.variables; + +/** + * A variable that can be assigned a value. + */ +public interface ISimpleLaunchVariable { + /** + * Returns this variable's name. + * @return + */ + public String getName(); + /** + * Returns the value of this variable. If no value has been assigned + * to this variable, it will attempt to use the variable's initializer if + * one is defined. If no value is assigned and no initializer can set + * the variable's value, returns <code>null</code>. + * @return the variable's value or <code>null</code> if none can be + * determined + */ + public String getText(); + /** + * Sets the text value of this variable + * @param value the value to assign to this variable + */ + public void setText(String value); +} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ISimpleVariableRegistry.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ISimpleVariableRegistry.java new file mode 100644 index 000000000..d1d90c8e7 --- /dev/null +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ISimpleVariableRegistry.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.core.variables; + + +/** + * The registry of simple variables defined by the user and + * contributed via extension point. The singleton instance of + * the simple variable registry can be accessed from + * <code>org.eclipse.debug.core.DebugPlugin</code>. + * <p> + * Clients are not intended to implement this interface. + * </p> + * @see org.eclipse.debug.core.variables.ISimpleLaunchVariable + * @since 3.0 + */ +public interface ISimpleVariableRegistry { + /** + * Adds the given variable to this variable registry. + * @param variable the variable to add + */ + public void addVariable(ISimpleLaunchVariable variable); + /** + * Adds the given variables to this variable registry + * @param variables the variables to add + */ + public void addVariables(ISimpleLaunchVariable[] variables); + /** + * Removes the given variable from this registry. Has no effect + * if the given variable is not in this registry. + * @param variable the variable to remove + */ + public void removeVariable(ISimpleLaunchVariable variable); + /** + * Clears this registry, removing all variables. + */ + public void clear(); + /** + * Stores the variables in this registry in a file in the metadata. + */ + public void storeVariables(); + /** + * Returns the variable with the given name or <code>null</code> + * if no such variable exists. If multiple variables with the given name have + * been added to this registry, returns the most recently added variable + * with that name. + * @param name the name of the variable + * @return the launch configuration variable with the given name or + * <code>null</code> if no such variable exists. + */ + public ISimpleLaunchVariable getVariable(String name); + /** + * Returns all the variables contained in this registry + * @return the variables in this registry. + */ + public ISimpleLaunchVariable[] getVariables(); +} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IVariableInitializer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IVariableInitializer.java new file mode 100644 index 000000000..91a22036e --- /dev/null +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IVariableInitializer.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.core.variables; + +public interface IVariableInitializer { + /** + * Runs this initializer and returns the computed value. + * @return the variable value computed by this initializer + */ + public String getText(); +} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/SimpleLaunchVariable.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/SimpleLaunchVariable.java new file mode 100644 index 000000000..7c4a84510 --- /dev/null +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/SimpleLaunchVariable.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.core.variables; + + +public class SimpleLaunchVariable implements ISimpleLaunchVariable { + + protected IVariableInitializer fVariableInitializer= null; + protected String fName= null; + protected String fValue= null; + + /** + * Creates a new launch configuration variable with the given initializer or <code>null</code> + * if none is available. + * @param initializer the initializer that should be used to calculate this variable's + * value if no value is set or <code>null</code> if no initializer is defined. + * @param initialValue the variable's initial value or <code>null</code> if no initial value + * should be set. + */ + public SimpleLaunchVariable(String name, IVariableInitializer initializer, String initialValue) { + this(name); + fVariableInitializer= initializer; + fValue= initialValue; + } + + /** + * Creates a new launch configuration varible with the given name. + * @param name + */ + public SimpleLaunchVariable(String name) { + fName= name; + } + + /** + * Creates a new variable with no name. Do not call. + */ + private SimpleLaunchVariable() { + } + + /** + * @see ISimpleLaunchVariable#getInitializer() + */ + public IVariableInitializer getInitializer() { + return fVariableInitializer; + } + + /** + * @see ISimpleLaunchVariable#getName() + */ + public String getName() { + return fName; + } + + /** + * @see ISimpleLaunchVariable#getText() + */ + public String getText() { + if (fValue == null && getInitializer() != null) { + fValue= getInitializer().getText(); + } + return fValue; + } + + /** + * @see ISimpleLaunchVariable#setText(String) + */ + public void setText(String value) { + fValue= value; + } + +} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SimpleVariableRegistry.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SimpleVariableRegistry.java new file mode 100644 index 000000000..fd9b90ed2 --- /dev/null +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SimpleVariableRegistry.java @@ -0,0 +1,266 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.core; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.xerces.dom.DocumentImpl; +import org.apache.xml.serialize.Method; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.Serializer; +import org.apache.xml.serialize.SerializerFactory; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.variables.ISimpleLaunchVariable; +import org.eclipse.debug.core.variables.ISimpleVariableRegistry; +import org.eclipse.debug.core.variables.IVariableInitializer; +import org.eclipse.debug.core.variables.SimpleLaunchVariable; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +/** + * A registry of simple variables, used for retrieving launch configuration + * variable objects based on their names. + */ +public class SimpleVariableRegistry implements ISimpleVariableRegistry { + + // Variable extension point constants + private static final String ELEMENT_VARIABLE="variable"; //$NON-NLS-1$ + private static final String ATTR_NAME= "name"; //$NON-NLS-1$ + private static final String ATTR_INITIAL_VALUE= "initialValue"; //$NON-NLS-1$ + private static final String ATTR_INITIALIZER_CLASS= "initializerClass"; //$NON-NLS-1$ + // Persisted variable XML constants + private static final String SIMPLE_VARIABLES_TAG= "simpleVariables"; //$NON-NLS-1$ + private static final String VARIABLE_TAG= "variable"; //$NON-NLS-1$ + private static final String NAME_TAG= "name"; //$NON-NLS-1$ + private static final String VALUE_TAG= "value"; //$NON-NLS-1$ + + private static final class VariableDefinition { + public String name; + public String value; + public int end; + } + + private Map fVariables= new HashMap(); + + public SimpleVariableRegistry() { + loadExtensions(); + loadVariables(); + } + + /** + * @see ISimpleVariableRegistry#addVariable(ISimpleLaunchVariable) + */ + public void addVariable(ISimpleLaunchVariable variable) { + fVariables.put(variable.getName(), variable); + } + + /** + * @see ISimpleVariableRegistry#addVariables(ISimpleLaunchVariable[]) + */ + public void addVariables(ISimpleLaunchVariable[] variables) { + for (int i = 0; i < variables.length; i++) { + addVariable(variables[i]); + } + } + + /** + * @see ISimpleVariableRegistry#removeVariable(ISimpleLaunchVariable) + */ + public void removeVariable(ISimpleLaunchVariable variable) { + fVariables.remove(variable.getName()); + } + + /** + * @see ISimpleVariableRegistry#clear() + */ + public void clear() { + fVariables.clear(); + } + + /** + * @see ISimpleVariableRegistry#getVariable(String) + */ + public ISimpleLaunchVariable getVariable(String name) { + return (ISimpleLaunchVariable) fVariables.get(name); + } + + /** + * @see ISimpleVariableRegistry#getVariables() + */ + public ISimpleLaunchVariable[] getVariables() { + return (ISimpleLaunchVariable[]) fVariables.values().toArray(new ISimpleLaunchVariable[0]); + } + + /** + * Loads the variables contributed via extension. + */ + public void loadExtensions() { + IExtensionPoint point= DebugPlugin.getDefault().getDescriptor().getExtensionPoint(DebugPlugin.EXTENSION_POINT_SIMPLE_LAUNCH_VARIABLES); + IConfigurationElement elements[]= point.getConfigurationElements(); + for (int i = 0; i < elements.length; i++) { + IConfigurationElement element = elements[i]; + if (!element.getName().equals(ELEMENT_VARIABLE)) { + DebugPlugin.logMessage(MessageFormat.format("Invalid simple launch variable extension found: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$ + continue; + } + String name= element.getAttribute(ATTR_NAME); + if (name == null) { + DebugPlugin.logMessage(MessageFormat.format("Invalid simple launch variable extension found: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$ + continue; + } + IVariableInitializer initializer= null; + if (element.getAttribute(ATTR_INITIALIZER_CLASS) != null) { + try { + initializer= (IVariableInitializer) element.createExecutableExtension(ATTR_INITIALIZER_CLASS); + } catch (CoreException e) { + DebugPlugin.logMessage(MessageFormat.format("Failed to load launch configuration breakpoint initializer: {0}", new String[] {element.getAttribute(ATTR_INITIALIZER_CLASS)}), e); //$NON-NLS-1$ + } + } + String initialValue= element.getAttribute(ATTR_INITIAL_VALUE); + ISimpleLaunchVariable variable= new SimpleLaunchVariable(name, initializer, initialValue); + fVariables.put(variable.getName(), variable); + } + } + + /** + * Loads the variables from a file in the metadata. + */ + public void loadVariables() { + File file= getVariableFile(); + if (!file.exists()) { + return; + } + Element root= null; + try { + FileInputStream inputStream= new FileInputStream(file); + DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + root = parser.parse(new InputSource(inputStream)).getDocumentElement(); + } catch (Throwable throwable) { + DebugPlugin.logMessage("An exception occurred while loading launch configuration variables.", throwable); //$NON-NLS-1$ + return; + } + if (!root.getNodeName().equals(SIMPLE_VARIABLES_TAG)) { + DebugPlugin.logMessage("Invalid format encountered while loading launch configuration variables.", null); //$NON-NLS-1$ + return; + } + NodeList list= root.getChildNodes(); + for (int i= 0, numItems= list.getLength(); i < numItems; i++) { + Node node= list.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element= (Element) node; + if (!element.getNodeName().equals(VARIABLE_TAG)) { + DebugPlugin.logMessage(MessageFormat.format("Invalid XML element encountered while loading launch configuration variables: {0}", new String[] {node.getNodeName()}), null); //$NON-NLS-1$ + continue; + } + String name= element.getAttribute(NAME_TAG); + if (name.length() > 0) { + ISimpleLaunchVariable variable= getVariable(name);; + if (variable == null) { + variable= new SimpleLaunchVariable(name); + } + String value= element.getAttribute(VALUE_TAG); + if (value.length() > 0) { + variable.setText(value); + } + fVariables.put(name, variable); + } else { + DebugPlugin.logMessage("Invalid variable entry encountered while loading launch configuration variables. Variable name is null.", null); //$NON-NLS-1$ + } + } + } + } + + /** + * @see ISimpleVariableRegistry#storeVariables() + */ + public void storeVariables() { + if (fVariables.isEmpty()) { + getVariableFile().delete(); + return; + } + try { + String xml= getVariablesAsXML(); + File file= getVariableFile(); + if (!file.exists()) { + file.createNewFile(); + } + FileOutputStream stream = new FileOutputStream(file); + stream.write(xml.getBytes("UTF8")); //$NON-NLS-1$ + stream.close(); + } catch (IOException exception) { + DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, "An exception occurred while storing launch configuration variables.", exception)); //$NON-NLS-1$ + } + } + + /** + * Returns the file in which variables are persisted + * @return the file in which variables are persisted + */ + private File getVariableFile() { + IPath path= DebugPlugin.getDefault().getStateLocation().append(".launchConfigurationVariables"); //$NON-NLS-1$ + return path.toFile(); + } + + /** + * Returns the map of variables in this registry in XML format suitable for persistance. + * @return the variables in this registry in XML format + * @throws IOException if an I/O exception occurs while creating the XML. + */ + private String getVariablesAsXML() throws IOException { + Set entries= fVariables.entrySet(); + Iterator iter= entries.iterator(); + + Document document= new DocumentImpl(); + Element rootElement= document.createElement(SIMPLE_VARIABLES_TAG); + document.appendChild(rootElement); + while (iter.hasNext()) { + Map.Entry entry= (Map.Entry) iter.next(); + Element element= document.createElement(VARIABLE_TAG); + element.setAttribute(NAME_TAG, (String)entry.getKey()); + element.setAttribute(VALUE_TAG, ((ISimpleLaunchVariable)entry.getValue()).getText()); + rootElement.appendChild(element); + } + + ByteArrayOutputStream s= new ByteArrayOutputStream(); + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$ + + Serializer serializer = + SerializerFactory.getSerializerFactory(Method.XML).makeSerializer( + new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$ + format); + serializer.asDOMSerializer().serialize(document); + return s.toString("UTF8"); //$NON-NLS-1$ + } +} diff --git a/org.eclipse.debug.core/plugin.properties b/org.eclipse.debug.core/plugin.properties index 370c25eef..082258cef 100644 --- a/org.eclipse.debug.core/plugin.properties +++ b/org.eclipse.debug.core/plugin.properties @@ -19,3 +19,4 @@ statusHandlerExtensionPointName=Status Handler sourceLocatorsExtensionPointName=Source Locator launchModesExtensionPointName=Launch Modes launchDelegatesExtensionPointName=Launch Delegates +simpleLaunchVariablesName=Simple Launch Configuration Variables
\ No newline at end of file diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml index 198e75d79..c8b1a5fd6 100644 --- a/org.eclipse.debug.core/plugin.xml +++ b/org.eclipse.debug.core/plugin.xml @@ -1,58 +1,88 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- File written by PDE 1.0 --> <plugin id="org.eclipse.debug.core" name="%pluginName" version="2.1.0" provider-name="%providerName" class="org.eclipse.debug.core.DebugPlugin"> -<!-- Required plugins --> -<requires> - <import plugin="org.apache.xerces"/> - <import plugin="org.eclipse.core.resources"/> -</requires> -<!-- Runtime --> -<runtime> - <library name="dtcore.jar"> - <export name="*"/> - <packages prefixes="org.eclipse.debug.core,org.eclipse.debug.internal.core"/> - </library> -</runtime> + <runtime> + <library name="dtcore.jar"> + <export name="*"/> + <packages prefixes="org.eclipse.debug.core,org.eclipse.debug.internal.core"/> + </library> + </runtime> + <requires> + <import plugin="org.apache.xerces"/> + <import plugin="org.eclipse.core.resources"/> + </requires> + <!-- Extension points --> -<extension-point id="breakpoints" name="%breakpointExtensionPointName" schema= "schema/breakpoints.exsd"/> -<extension-point id="launchConfigurationComparators" name="%launchConfigurationComparatorsExtensionPointName" schema= "schema/launchConfigurationComparators.exsd"/> -<extension-point id="launchConfigurationTypes" name="%launchConfigurationTypeNameExtensionPointName" schema= "schema/launchConfigurationTypes.exsd"/> -<extension-point id="launchModes" name="%launchModesExtensionPointName" schema= "schema/launchModes.exsd"/> -<extension-point id="launchDelegates" name="%launchDelegatesExtensionPointName" schema= "schema/launchDelegates.exsd"/> -<extension-point id="launchers" name="%launcherExtensionPointName" schema= "schema/launchers.exsd"/> -<extension-point id="sourceLocators" name="%sourceLocatorsExtensionPointName" schema= "schema/sourceLocators.exsd"/> -<extension-point id="statusHandlers" name="%statusHandlerExtensionPointName" schema= "schema/statusHandlers.exsd"/> + <extension-point id="breakpoints" name="%breakpointExtensionPointName" schema="schema/breakpoints.exsd"/> + <extension-point id="launchConfigurationComparators" name="%launchConfigurationComparatorsExtensionPointName" schema="schema/launchConfigurationComparators.exsd"/> + <extension-point id="launchConfigurationTypes" name="%launchConfigurationTypeNameExtensionPointName" schema="schema/launchConfigurationTypes.exsd"/> + <extension-point id="launchModes" name="%launchModesExtensionPointName" schema="schema/launchModes.exsd"/> + <extension-point id="launchDelegates" name="%launchDelegatesExtensionPointName" schema="schema/launchDelegates.exsd"/> + <extension-point id="launchers" name="%launcherExtensionPointName" schema="schema/launchers.exsd"/> + <extension-point id="sourceLocators" name="%sourceLocatorsExtensionPointName" schema="schema/sourceLocators.exsd"/> + <extension-point id="statusHandlers" name="%statusHandlerExtensionPointName" schema="schema/statusHandlers.exsd"/> + <extension-point id="simpleLaunchVariables" name="%simpleLaunchVariablesName"/> <!-- Extensions --> -<extension id="breakpointMarker" point="org.eclipse.core.resources.markers"> - <super type="org.eclipse.core.resources.marker"/> - <persistent value="true"/> - <attribute name="org.eclipse.debug.core.modelIdentifier"/> - <attribute name="org.eclipse.debug.core.enabled"/> - <attribute name="org.eclipse.debug.core.registered"/> - <attribute name="org.eclipse.debug.core.persisted"/> -</extension> -<extension id="lineBreakpointMarker" point="org.eclipse.core.resources.markers"> - <super type="org.eclipse.debug.core.breakpointMarker"/> - <super type="org.eclipse.core.resources.textmarker"/> - <persistent value="true"/> -</extension> - -<extension point="org.eclipse.team.core.fileTypes"> - <fileTypes extension="launch" type="text"/> -</extension> - -<extension point="org.eclipse.debug.core.launchModes"> - <launchMode mode="run"/> - <launchMode mode="debug"/> - <launchMode mode="profile"/> -</extension> + <extension + id="breakpointMarker" + point="org.eclipse.core.resources.markers"> + <super + type="org.eclipse.core.resources.marker"> + </super> + <persistent + value="true"> + </persistent> + <attribute + name="org.eclipse.debug.core.modelIdentifier"> + </attribute> + <attribute + name="org.eclipse.debug.core.enabled"> + </attribute> + <attribute + name="org.eclipse.debug.core.registered"> + </attribute> + <attribute + name="org.eclipse.debug.core.persisted"> + </attribute> + </extension> + <extension + id="lineBreakpointMarker" + point="org.eclipse.core.resources.markers"> + <super + type="org.eclipse.debug.core.breakpointMarker"> + </super> + <super + type="org.eclipse.core.resources.textmarker"> + </super> + <persistent + value="true"> + </persistent> + </extension> + <extension + point="org.eclipse.team.core.fileTypes"> + <fileTypes + type="text" + extension="launch"> + </fileTypes> + </extension> + <extension + point="org.eclipse.debug.core.launchModes"> + <launchMode + mode="run"> + </launchMode> + <launchMode + mode="debug"> + </launchMode> + <launchMode + mode="profile"> + </launchMode> + </extension> </plugin> diff --git a/org.eclipse.debug.core/schema/simpleLaunchVariables.exsd b/org.eclipse.debug.core/schema/simpleLaunchVariables.exsd new file mode 100644 index 000000000..eee88ed34 --- /dev/null +++ b/org.eclipse.debug.core/schema/simpleLaunchVariables.exsd @@ -0,0 +1,135 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.debug.core"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.debug.core" id="simpleLaunchVariables" name="Simple Launch Variables"/> + </appInfo> + <documentation> + This extension point defines a mechanism for defining simple launch configuration variables. + </documentation> + </annotation> + + <element name="extension"> + <complexType> + <sequence> + <element ref="simpleLaunchVariables" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + a fully qualified identifier of the target extension point + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + an optional identifier of the extension instance + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + an optional name of the extension instance + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="simpleLaunchVariable"> + <complexType> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + specifies a unique name for this variable. + </documentation> + </annotation> + </attribute> + <attribute name="initialValue" type="string"> + <annotation> + <documentation> + specifies the initial value for this variable. + </documentation> + </annotation> + </attribute> + <attribute name="initializerClass" type="string"> + <annotation> + <documentation> + specifies the fully qualified name of the java class that implements <samp>org.eclipse.debug.core.variables.IVariableInitializer</samp>. + </documentation> + </annotation> + </attribute> + <attribute name="description" type="string"> + <annotation> + <documentation> + specifies the human-readable description of this variable + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + The following is an example of a launch configuration variable extension point with an initial value: + +<p> +<pre> + <extension point="org.eclipse.debug.core.simpleLaunchVariables"> + <variable + name="FOO_HOME" + initialValue="/usr/local/foo" + </breakpoint> + </extension> +</pre> +</p> + +In the example above, the specified variable is created with the initial value "/usr/local/foo". + + The following is an example of a launch configuration variable extension point with an initializer class: +<p> +<pre> + <extension point="org.eclipse.debug.core.simpleLaunchVariables"> + <variable + name="FOO_HOME" + initializerClass="com.example.FooLocator"> + </breakpoint> + </extension> +</pre> +</p> + +In the example above, the variable FOO_HOME is created and the class "com.example.FooLocator" will be +used to initialize the value the first time it's requested. + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + Value of the attribute <b>initializerClass</b> must be a fully qualified name of a Java class that implements the interface <b>org.eclipse.debug.core.variables.IVariableInitializer</b>. + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + <p> +<a href="hglegal.htm"> + <img SRC="ngibmcpy.gif" + ALT="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." + BORDER=0 height=14 width=324></a> +</p> + </documentation> + </annotation> + +</schema> diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 0ca856a22..7a3602119 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -45,7 +45,7 @@ ExpressionView.name=Expressions LaunchActionSet.label=Launch LaunchConfigurationTabGroupExtensionName=Launch Configuration Tab Group LaunchShortcutsName=Launch Shortcut -LaunchConfigurationVariablesName=Launch Configuration Variables +ContextLaunchVariablesName=Context Launch Variables LaunchConfigurationTypeImageExtensionName=Launch Configuration Type Image LaunchConfigurationTypePropertyPage.name=Launch Configuration Type LaunchConfigurationTypesPreferencePage.name=Launch Configuration Types @@ -98,7 +98,7 @@ TerminateAndRemoveAction.label=Terminate and Remo&ve VariablesView.name=Variables VariableViewsPreferencePage.name=Variable Views VariablesContentProvidersName=Variables Content Providers - +SimpleVariablePreferencePage.name=Launch Variables #launch configuration variables workspace_loc.description= Expands to the workspace root's absolute file system path. project_loc.description= Expands to the absolute file system path of the selected resource's project. diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index e2d37a39e..5b5b66d16 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -6,14 +6,12 @@ provider-name="%providerName" class="org.eclipse.debug.internal.ui.DebugUIPlugin"> -<!-- Runtime --> <runtime> <library name="dtui.jar"> <export name="*"/> <packages prefixes="org.eclipse.debug.ui,org.eclipse.debug.internal.ui"/> </library> </runtime> -<!-- Required plugins --> <requires> <import plugin="org.apache.xerces"/> <import plugin="org.eclipse.core.resources"/> @@ -32,9 +30,9 @@ <extension-point id="launchConfigurationTypeImages" name="%LaunchConfigurationTypeImageExtensionName" schema="schema/launchConfigurationTypeImages.exsd"/> <extension-point id="launchGroups" name="%LaunchGroupsExtensionName" schema="schema/launchGroups.exsd"/> <extension-point id="launchShortcuts" name="%LaunchShortcutsName" schema="schema/launchShortcuts.exsd"/> - <extension-point id="launchConfigurationVariables" name="%LaunchConfigurationVariablesName"/> + <extension-point id="contextLaunchVariables" name="%ContextLaunchVariablesName" scheme="schema/contextLaunchVariables.exsd"/> <extension-point id="variablesContentProviders" name="%VariablesContentProvidersName"/> - + <!-- Extensions --> <extension point="org.eclipse.ui.perspectives"> @@ -118,6 +116,12 @@ class="org.eclipse.debug.internal.ui.preferences.DebugActionGroupsPreferencePage" id="org.eclipse.debug.ui.DebugActionGroupsPreferencePage"> </page> + <page + name="%SimpleVariablePreferencePage.name" + category="org.eclipse.debug.ui.DebugPreferencePage" + class="org.eclipse.debug.internal.ui.preferences.SimpleVariablePreferencePage" + id="org.eclipse.debug.ui.SimpleVariablePreferencePage"> + </page> </extension> <extension point="org.eclipse.ui.actionSets"> @@ -245,7 +249,7 @@ </separator> <separator name="profileGroup"> - </separator> + </separator> <separator name="emptyLaunchGroup"> </separator> @@ -284,7 +288,7 @@ class="org.eclipse.debug.internal.ui.actions.ProfileHistoryMenuAction" menubarPath="org.eclipse.ui.run/profileGroup" id="org.eclipse.debug.internal.ui.actions.ProfileHistoryMenuAction"> - </action> + </action> <action definitionId="org.eclipse.debug.internal.ui.actions.OpenRunConfigurations" label="%OpenRunConfigurations.label" @@ -319,7 +323,7 @@ helpContextId="profile_last_action_context" label="%ProfileLastAction.label" menubarPath="org.eclipse.ui.run/relaunchGroup"> - </action> + </action> <action id="org.eclipse.debug.internal.ui.actions.DebugLastAction" hoverIcon="icons/full/clcl16/debuglast_co.gif" @@ -341,7 +345,7 @@ helpContextId="run_last_action_context" label="%RunLastAction.label" menubarPath="org.eclipse.ui.run/relaunchGroup"> - </action> + </action> <action toolbarPath="debug" id="org.eclipse.debug.internal.ui.actions.RunDropDownAction" @@ -585,10 +589,10 @@ label="%DetailPaneWordWrapAction.label" helpContextId="detail_pane_word_wrap_action_context" tooltip="%DetailPaneWordWrapAction.tooltip" + state="false" class="org.eclipse.debug.internal.ui.views.variables.DetailPaneWordWrapAction" menubarPath="viewActions" - id="org.eclipse.debug.ui.variableViewActions.toolbar.detailPaneWordWrap" - state="false"> + id="org.eclipse.debug.ui.variableViewActions.toolbar.detailPaneWordWrap"> </action> </viewContribution> <viewContribution @@ -626,10 +630,10 @@ label="%DetailPaneWordWrapAction.label" helpContextId="detail_pane_word_wrap_action_context" tooltip="%DetailPaneWordWrapAction.tooltip" + state="false" class="org.eclipse.debug.internal.ui.views.variables.DetailPaneWordWrapAction" menubarPath="viewActions" - id="org.eclipse.debug.ui.expresssionsView.toolbar.detailPaneWordWrap" - state="false"> + id="org.eclipse.debug.ui.expresssionsView.toolbar.detailPaneWordWrap"> </action> </viewContribution> </extension> @@ -926,7 +930,6 @@ </action> </viewerContribution> </extension> - <extension id="instructionPointer" point="org.eclipse.core.resources.markers"> @@ -989,7 +992,7 @@ image="icons/full/ctool16/profile_exc.gif" mode="profile" id="org.eclipse.debug.ui.launchGroup.profile"> - </launchGroup> + </launchGroup> </extension> <extension point="org.eclipse.ui.propertyPages"> @@ -1025,255 +1028,241 @@ </description> </fontDefinition> </extension> - - <!-- commands and their bindings --> - <extension point="org.eclipse.ui.commands"> - <category - name="%runCategory.name" - description="%runCategory.description" - id="org.eclipse.debug.ui.category.run" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.StepWithFiltersActionDelegate" +<!-- commands and their bindings --> + <extension + point="org.eclipse.ui.commands"> + <category + name="%runCategory.name" + description="%runCategory.description" + id="org.eclipse.debug.ui.category.run"> + </category> + <command name="%ActionDefinition.stepWithFilters.name" description="%ActionDefinition.stepWithFilters.description" - /> - <keyBinding - string="Shift+F5" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.StepWithFiltersActionDelegate" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.StepIntoActionDelegate" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.StepWithFiltersActionDelegate"> + </command> + <keyBinding + string="Shift+F5" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.StepWithFiltersActionDelegate" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.stepInto.name" description="%ActionDefinition.stepInto.description" - /> - <keyBinding - string="F5" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.StepIntoActionDelegate" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.StepOverActionDelegate" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.StepIntoActionDelegate"> + </command> + <keyBinding + string="F5" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.StepIntoActionDelegate" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.stepOver.name" description="%ActionDefinition.stepOver.description" - /> - <keyBinding - string="F6" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.StepOverActionDelegate" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.StepReturnActionDelegate" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.StepOverActionDelegate"> + </command> + <keyBinding + string="F6" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.StepOverActionDelegate" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.stepReturn.name" description="%ActionDefinition.stepReturn.description" - /> - <keyBinding - string="F7" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.StepReturnActionDelegate" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.ResumeActionDelegate" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.StepReturnActionDelegate"> + </command> + <keyBinding + string="F7" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.StepReturnActionDelegate" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.resume.name" description="%ActionDefinition.resume.description" - /> - <keyBinding - string="F8" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.ResumeActionDelegate" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.TerminateActionDelegate" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.ResumeActionDelegate"> + </command> + <keyBinding + string="F8" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.ResumeActionDelegate" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.terminate.name" description="%ActionDefinition.terminate.description" - /> - <keyBinding - string="" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.TerminateActionDelegate" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.SuspendActionDelegate" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.TerminateActionDelegate"> + </command> + <keyBinding + string="" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.TerminateActionDelegate" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.suspend.name" description="%ActionDefinition.suspend.description" - /> - <keyBinding - string="" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.SuspendActionDelegate" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.OpenProfileConfigurations" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.SuspendActionDelegate"> + </command> + <keyBinding + string="" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.SuspendActionDelegate" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.openProfile.name" description="%ActionDefinition.openProfile.description" - /> - <keyBinding - string="" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.OpenProfileConfigurations" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.OpenRunConfigurations" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.OpenProfileConfigurations"> + </command> + <keyBinding + string="" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.OpenProfileConfigurations" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.openRun.name" description="%ActionDefinition.openRun.description" - /> - <keyBinding - string="" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.OpenRunConfigurations" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.OpenDebugConfigurations" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.OpenRunConfigurations"> + </command> + <keyBinding + string="" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.OpenRunConfigurations" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.openDebug.name" description="%ActionDefinition.openDebug.description" - /> - <keyBinding - string="" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.OpenDebugConfigurations" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.DebugLastAction" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.OpenDebugConfigurations"> + </command> + <keyBinding + string="" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.OpenDebugConfigurations" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.debugLast.name" description="%ActionDefinition.debugLast.description" - /> - <keyBinding - string="F11" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.DebugLastAction" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.RunLastAction" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.DebugLastAction"> + </command> + <keyBinding + string="F11" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.DebugLastAction" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.runLast.name" description="%ActionDefinition.runLast.description" - /> - <keyBinding - string="Ctrl+F11" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.RunLastAction" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - <command - category="org.eclipse.debug.ui.category.run" - id="org.eclipse.debug.internal.ui.actions.ProfileLastAction" + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.RunLastAction"> + </command> + <keyBinding + string="Ctrl+F11" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.RunLastAction" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <command name="%ActionDefinition.profileLast.name" description="%ActionDefinition.profileLast.description" - /> - <keyBinding - string="Ctrl+F11" - scope="org.eclipse.ui.globalScope" - command="org.eclipse.debug.internal.ui.actions.RunLastAction" - configuration="org.eclipse.ui.defaultAcceleratorConfiguration" - /> - - </extension> - - <!-- Variable Extensions --> - <extension point="org.eclipse.debug.ui.launchConfigurationVariables"> - <variable - tag="workspace_loc" - description="%workspace_loc.description" - expanderClass="org.eclipse.debug.ui.variables.WorkspaceExpander"> - </variable> - <variable - tag="project_loc" - description="%project_loc.description" - expanderClass="org.eclipse.debug.ui.variables.ProjectExpander"> - </variable> - <variable - tag="project_path" - description="%project_path.description" - expanderClass="org.eclipse.debug.ui.variables.ProjectExpander"> - </variable> - <variable - tag="project_name" - description="%project_name.description" - expanderClass="org.eclipse.debug.ui.variables.ProjectNameExpander"> - </variable> - <variable - tag="resource_loc" - description="%resource_loc.description" - componentClass="org.eclipse.debug.ui.variables.SpecificFileResourceComponent" - expanderClass="org.eclipse.debug.ui.variables.ResourceExpander"> - </variable> - <variable - tag="resource_path" - description="%resource_path.description" - componentClass="org.eclipse.debug.ui.variables.SpecificFileResourceComponent" - expanderClass="org.eclipse.debug.ui.variables.ResourceExpander"> - </variable> - <variable - tag="resource_name" - description="%resource_name.description" - expanderClass="org.eclipse.debug.ui.variables.ResourceNameExpander"> - </variable> - <variable - tag="container_loc" - description="%container_loc.description" - expanderClass="org.eclipse.debug.ui.variables.ContainerExpander"> - </variable> - <variable - tag="container_path" - description="%container_path.description" - expanderClass="org.eclipse.debug.ui.variables.ContainerExpander"> - </variable> - <variable - tag="container_name" - description="%container_name.description" - expanderClass="org.eclipse.debug.ui.variables.ContainerNameExpander"> - </variable> - <variable - tag="string_prompt" - description="%string_prompt.description" - expanderClass="org.eclipse.debug.ui.variables.StringPromptExpander"> - </variable> - <variable - tag="file_prompt" - description="%file_prompt.description" - expanderClass="org.eclipse.debug.ui.variables.FilePromptExpander"> - </variable> - <variable - tag="folder_prompt" - description="%folder_prompt.description" - expanderClass="org.eclipse.debug.ui.variables.FolderPromptExpander"> - </variable> - </extension> - + category="org.eclipse.debug.ui.category.run" + id="org.eclipse.debug.internal.ui.actions.ProfileLastAction"> + </command> + <keyBinding + string="Ctrl+F11" + scope="org.eclipse.ui.globalScope" + command="org.eclipse.debug.internal.ui.actions.RunLastAction" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + </extension> +<!-- Context Variable Extensions --> + <extension + point="org.eclipse.debug.ui.contextLaunchVariables"> + <variable + name="workspace_loc" + expanderClass="org.eclipse.debug.ui.launchVariables.WorkspaceExpander" + description="%workspace_loc.description"> + </variable> + <variable + name="project_loc" + expanderClass="org.eclipse.debug.ui.launchVariables.ProjectExpander" + description="%project_loc.description"> + </variable> + <variable + name="project_path" + expanderClass="org.eclipse.debug.ui.launchVariables.ProjectExpander" + description="%project_path.description"> + </variable> + <variable + name="project_name" + expanderClass="org.eclipse.debug.ui.launchVariables.ProjectNameExpander" + description="%project_name.description"> + </variable> + <variable + name="resource_loc" + componentClass="org.eclipse.debug.ui.launchVariables.SpecificFileResourceComponent" + expanderClass="org.eclipse.debug.ui.launchVariables.ResourceExpander" + description="%resource_loc.description"> + </variable> + <variable + name="resource_path" + componentClass="org.eclipse.debug.ui.launchVariables.SpecificFileResourceComponent" + expanderClass="org.eclipse.debug.ui.launchVariables.ResourceExpander" + description="%resource_path.description"> + </variable> + <variable + name="resource_name" + expanderClass="org.eclipse.debug.ui.launchVariables.ResourceNameExpander" + description="%resource_name.description"> + </variable> + <variable + name="container_loc" + expanderClass="org.eclipse.debug.ui.launchVariables.ContainerExpander" + description="%container_loc.description"> + </variable> + <variable + name="container_path" + expanderClass="org.eclipse.debug.ui.launchVariables.ContainerExpander" + description="%container_path.description"> + </variable> + <variable + name="container_name" + expanderClass="org.eclipse.debug.ui.launchVariables.ContainerNameExpander" + description="%container_name.description"> + </variable> + <variable + name="string_prompt" + expanderClass="org.eclipse.debug.ui.launchVariables.StringPromptExpander" + description="%string_prompt.description"> + </variable> + <variable + name="file_prompt" + expanderClass="org.eclipse.debug.ui.launchVariables.FilePromptExpander" + description="%file_prompt.description"> + </variable> + <variable + name="folder_prompt" + expanderClass="org.eclipse.debug.ui.launchVariables.FolderPromptExpander" + description="%folder_prompt.description"> + </variable> + </extension> + </plugin> diff --git a/org.eclipse.debug.ui/schema/contextLaunchVariables.exsd b/org.eclipse.debug.ui/schema/contextLaunchVariables.exsd new file mode 100644 index 000000000..6885b8299 --- /dev/null +++ b/org.eclipse.debug.ui/schema/contextLaunchVariables.exsd @@ -0,0 +1,119 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.debug.ui"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.debug.ui" id="contextLaunchVariables" name="Context Launch Variables"/> + </appInfo> + <documentation> + [Enter description of this extension point.] + </documentation> + </annotation> + + <element name="extension"> + <complexType> + <sequence> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="variable"> + <complexType> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="expanderClass" type="string" use="required"> + <annotation> + <documentation> + specifies a class which implements <samp></samp>, which is used to determine the value of the variable + </documentation> + </annotation> + </attribute> + <attribute name="description" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="componentClass" type="string"> + <annotation> + <documentation> + specifies a class which implements <samp>IVariableComponent</samp>, that allows the user to select arguments for the variable. + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + [Enter the first release in which this extension point appears.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + + </documentation> + </annotation> + +</schema> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java index b363f6fc1..8afbbefe9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java @@ -11,9 +11,9 @@ package org.eclipse.debug.internal.ui; -import java.util.HashMap; import java.net.MalformedURLException; import java.net.URL; +import java.util.HashMap; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionPoint; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index f24c5b734..2225775ae 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -49,8 +49,8 @@ import org.eclipse.debug.internal.ui.views.console.ConsoleDocumentManager; import org.eclipse.debug.internal.ui.views.variables.VariablesContentProviderManager; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.variables.LaunchConfigurationVariableRegistry; -import org.eclipse.debug.ui.variables.VariableContextManager; +import org.eclipse.debug.ui.launchVariables.ContextLaunchVariableRegistry; +import org.eclipse.debug.ui.launchVariables.VariableContextManager; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; @@ -121,7 +121,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { /** * Collection of launch configuration variables */ - private LaunchConfigurationVariableRegistry toolVariableRegistry; + private ContextLaunchVariableRegistry contextLaunchVariableRegistry; /** * Returns whether the debug UI plug-in is in trace @@ -200,13 +200,13 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { } /** - * Returns the registry of launch configuration variables. + * Returns the registry of context launch variables. */ - public LaunchConfigurationVariableRegistry getToolVariableRegistry() { - if (toolVariableRegistry == null) { - toolVariableRegistry = new LaunchConfigurationVariableRegistry(); + public ContextLaunchVariableRegistry getContextVariableRegistry() { + if (contextLaunchVariableRegistry == null) { + contextLaunchVariableRegistry = new ContextLaunchVariableRegistry(); } - return toolVariableRegistry; + return contextLaunchVariableRegistry; } public static IWorkbenchWindow getActiveWorkbenchWindow() { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java index c0e889cd9..613358e43 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java @@ -11,6 +11,8 @@ package org.eclipse.debug.internal.ui; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.util.Assert; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DragSource; import org.eclipse.swt.dnd.DropTarget; @@ -26,9 +28,6 @@ import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Widget; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.util.Assert; - /** * Utility class to simplify access to some SWT resources. */ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties index aa7617e04..05abf2a34 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties @@ -139,3 +139,5 @@ VariableUtil.The_variable_named_____{0}_____does_not_exist._4=The variable named WorkingSetComponent.1=&Specify Resources... WorkingSetComponent.2=workingSet WorkingSetComponent.3=Working set resources need to be specified +VariableUtil.5=Could not resolve environment. +VariableUtil.6=Invalid environment specified for the launch configuration named {0}. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties index 2c2496472..b307ff4ae 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties @@ -71,3 +71,13 @@ VariableViewsPreferencePage.Orientation_of_detail_pane_in_variables_view_1=Orien VariableViewsPreferencePage.Underneath_the_variables_tree_pane_3=&Underneath the variables tree pane VariableViewsPreferencePage.To_the_right_of_variables_tree_pane_2=&To the right of variables tree pane VariabeViewsPreferencePage.Debug_Variable_Views_Settings_1=Debug Variable Views Settings. +SimpleVariablePreferencePage.3=Variable +SimpleVariablePreferencePage.4=Value +SimpleVariablePreferencePage.5=Create and configure simple launch variables. +SimpleVariablePreferencePage.7=New +SimpleVariablePreferencePage.8=Edit +SimpleVariablePreferencePage.9=Remove +SimpleVariablePreferencePage.10=New Variable +SimpleVariablePreferencePage.11=Choose a name for the new variable: +SimpleVariablePreferencePage.12=Variable Value +SimpleVariablePreferencePage.13=Input the value for {0} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/SimpleVariablePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/SimpleVariablePreferencePage.java new file mode 100644 index 000000000..2898c7f8f --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/SimpleVariablePreferencePage.java @@ -0,0 +1,297 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.preferences; + +import java.text.MessageFormat; +import java.util.Iterator; + +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.variables.ISimpleLaunchVariable; +import org.eclipse.debug.core.variables.ISimpleVariableRegistry; +import org.eclipse.debug.core.variables.SimpleLaunchVariable; +import org.eclipse.debug.internal.ui.SWTUtil; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.viewers.ColumnLayoutData; +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class SimpleVariablePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private TableViewer variableTable; + protected Button envAddButton; + protected Button envEditButton; + protected Button envRemoveButton; + + protected static final String PROPERTY_VARIABLE= "variable"; //$NON-NLS-1$ + protected static final String PROPERTY_VALUE= "value"; //$NON-NLS-1$ + protected static String[] variableTableColumnProperties= {PROPERTY_VARIABLE, PROPERTY_VALUE}; + protected String[] variableTableColumnHeaders= {DebugPreferencesMessages.getString("SimpleVariablePreferencePage.3"), DebugPreferencesMessages.getString("SimpleVariablePreferencePage.4")}; //$NON-NLS-1$ //$NON-NLS-2$ + protected ColumnLayoutData[] variableTableColumnLayouts= {new ColumnWeightData(50), new ColumnWeightData(50)}; + + private ISimpleLaunchVariable[] originalVariableState= new ISimpleLaunchVariable[0]; + + public SimpleVariablePreferencePage() { + setDescription(DebugPreferencesMessages.getString("SimpleVariablePreferencePage.5")); //$NON-NLS-1$ + } + + protected Control createContents(Composite parent) { + originalVariableState= getVariableRegistry().getVariables(); + Font font= parent.getFont(); + //The main composite + Composite composite = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.marginHeight=0; + layout.marginWidth=0; + layout.numColumns= 2; + composite.setLayout(layout); + composite.setFont(font); + + createTable(composite); + createButtons(composite); + + return composite; + } + + protected void createTable(Composite parent) { + Font font= parent.getFont(); + // Create table composite + Composite tableComposite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.numColumns = 1; + GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.heightHint = 150; + tableComposite.setLayout(layout); + tableComposite.setLayoutData(gridData); + tableComposite.setFont(font); + // Create table + variableTable = new TableViewer(tableComposite); + Table table = variableTable.getTable(); + TableLayout tableLayout = new TableLayout(); + table.setLayout(tableLayout); + table.setHeaderVisible(true); + table.setFont(font); + gridData = new GridData(GridData.FILL_BOTH); + variableTable.getControl().setLayoutData(gridData); + variableTable.setContentProvider(new SimpleVariableContentProvider()); + variableTable.setColumnProperties(variableTableColumnProperties); + variableTable.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + handleTableSelectionChanged(event); + } + }); + // Create columns + for (int i = 0; i < variableTableColumnHeaders.length; i++) { + tableLayout.addColumnData(variableTableColumnLayouts[i]); + TableColumn tc = new TableColumn(table, SWT.NONE, i); + tc.setResizable(variableTableColumnLayouts[i].resizable); + tc.setText(variableTableColumnHeaders[i]); + } + variableTable.setInput(getVariableRegistry()); + variableTable.setLabelProvider(new SimpleVariableLabelProvider()); + } + + /** + * Creates the add/edit/remove buttons for the variable table + * @param parent the composite in which the buttons should be created + */ + protected void createButtons(Composite parent) { + // Create button composite + Composite buttonComposite = new Composite(parent, SWT.NONE); + GridLayout glayout = new GridLayout(); + glayout.marginHeight = 0; + glayout.marginWidth = 0; + glayout.numColumns = 1; + GridData gdata = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END); + buttonComposite.setLayout(glayout); + buttonComposite.setLayoutData(gdata); + buttonComposite.setFont(parent.getFont()); + + // Create a little vertical space + Label label= new Label(buttonComposite, SWT.NONE); + GridData gd= new GridData(); + gd.horizontalSpan= 1; + label.setLayoutData(gd); + // Create buttons + envAddButton = SWTUtil.createPushButton(buttonComposite, DebugPreferencesMessages.getString("SimpleVariablePreferencePage.7"), null); //$NON-NLS-1$ + envAddButton.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent event) { + handleAddButtonPressed(); + } + }); + envEditButton = SWTUtil.createPushButton(buttonComposite, DebugPreferencesMessages.getString("SimpleVariablePreferencePage.8"), null); //$NON-NLS-1$ + envEditButton.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent event) { + handleEditButtonPressed(); + } + }); + envEditButton.setEnabled(false); + envRemoveButton = SWTUtil.createPushButton(buttonComposite, DebugPreferencesMessages.getString("SimpleVariablePreferencePage.9"), null); //$NON-NLS-1$ + envRemoveButton.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent event) { + handleRemoveButtonPressed(); + } + }); + envRemoveButton.setEnabled(false); + } + + private void handleAddButtonPressed() { + InputDialog dialog= new InputDialog(getShell(), DebugPreferencesMessages.getString("SimpleVariablePreferencePage.10"), DebugPreferencesMessages.getString("SimpleVariablePreferencePage.11"), null, null); //$NON-NLS-1$ //$NON-NLS-2$ + if (dialog.open() != Dialog.OK) { + return; + } + String name= dialog.getValue(); + if (name.length() > 0) { + ISimpleLaunchVariable variable= new SimpleLaunchVariable(dialog.getValue()); + if (editVariable(variable)) { + getVariableRegistry().addVariable(variable); + variableTable.refresh(); + } + } + } + + private void handleEditButtonPressed() { + IStructuredSelection selection= (IStructuredSelection) variableTable.getSelection(); + ISimpleLaunchVariable variable= (ISimpleLaunchVariable) selection.getFirstElement(); + if (variable == null) { + return; + } + editVariable(variable); + } + + private boolean editVariable(ISimpleLaunchVariable variable) { + InputDialog dialog= new InputDialog(getShell(), DebugPreferencesMessages.getString("SimpleVariablePreferencePage.12"), MessageFormat.format(DebugPreferencesMessages.getString("SimpleVariablePreferencePage.13"), new String[] {variable.getName()}), variable.getText(), null); //$NON-NLS-1$ //$NON-NLS-2$ + if (dialog.open() != Dialog.OK) { + return false; + } + variable.setText(dialog.getValue()); + variableTable.update(variable, null); + return true; + } + + private void handleRemoveButtonPressed() { + IStructuredSelection selection= (IStructuredSelection) variableTable.getSelection(); + Iterator iter= selection.iterator(); + ISimpleVariableRegistry registry= getVariableRegistry(); + while (iter.hasNext()) { + registry.removeVariable((ISimpleLaunchVariable) iter.next()); + } + } + + /** + * Responds to a selection changed event in the environment table + * @param event the selection change event + */ + protected void handleTableSelectionChanged(SelectionChangedEvent event) { + boolean enabled = !(variableTable.getSelection().isEmpty()); + envEditButton.setEnabled(enabled); + envRemoveButton.setEnabled(enabled); + } + + public void init(IWorkbench workbench) { + } + + public boolean performCancel() { + ISimpleVariableRegistry registry= getVariableRegistry(); + registry.clear(); + registry.addVariables(originalVariableState); + return super.performCancel(); + } + + protected void performDefaults() { + getVariableRegistry().clear(); + variableTable.refresh(); + super.performDefaults(); + } + + private void restoreVariableState() { + } + + public boolean performOk() { + ISimpleVariableRegistry registry= getVariableRegistry(); + originalVariableState= registry.getVariables(); + registry.storeVariables(); // Write the file immediately. Don't wait for shutdown. + return super.performOk(); + } + + /** + * Returns the DebugPlugin's singleton instance of the + * variable registry + * @return the singleton instance of the simple variable registry. + */ + private ISimpleVariableRegistry getVariableRegistry() { + return DebugPlugin.getDefault().getSimpleVariableRegistry(); + } + + private class SimpleVariableContentProvider implements IStructuredContentProvider { + public Object[] getElements(Object inputElement) { + if (inputElement instanceof ISimpleVariableRegistry) { + return ((ISimpleVariableRegistry) inputElement).getVariables(); + } + return null; + } + public void dispose() { + } + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + } + + private class SimpleVariableLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + public String getColumnText(Object element, int columnIndex) { + if (element instanceof ISimpleLaunchVariable) { + switch (columnIndex) { + case 0 : + return ((ISimpleLaunchVariable) element).getName(); + case 1: + String value= ((ISimpleLaunchVariable) element).getText(); + if (value == null) { + value= ""; //$NON-NLS-1$ + } + return value; + } + } + return null; + } + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleDocument.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleDocument.java index 370d28711..d47a6b772 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleDocument.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleDocument.java @@ -11,7 +11,7 @@ package org.eclipse.debug.internal.ui.views.console; -import org.eclipse.debug.ui.console.*; +import org.eclipse.debug.ui.console.IConsoleColorProvider; import org.eclipse.jface.text.AbstractDocument; import org.eclipse.jface.text.DefaultLineTracker; import org.eclipse.jface.text.ITextStore; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/HyperlinkPosition.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/HyperlinkPosition.java index cbc1ab6ee..1d2dce43f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/HyperlinkPosition.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/HyperlinkPosition.java @@ -12,7 +12,7 @@ package org.eclipse.debug.internal.ui.views.console; import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.ui.console.*; +import org.eclipse.debug.ui.console.IConsoleHyperlink; import org.eclipse.jface.text.Position; /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java index e1eedeb7c..87942fbdb 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java @@ -18,8 +18,8 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.internal.ui.SWTUtil; import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java index ccb25477f..dfde75b3a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java @@ -696,6 +696,8 @@ public interface IDebugUIConstants { /** * Launch configuration attribute - a map of variables passed into * Runtime.exec(...) when a launch configuration is launched. + * + * @since 3.0 */ public static final String ATTR_ENVIRONMENT_VARIABLES = PLUGIN_ID + ".environmentVariables"; //$NON-NLS-1$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/AbstractVariableComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/AbstractVariableComponent.java index b644c8672..4a1fcaf51 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/AbstractVariableComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/AbstractVariableComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ContainerExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerExpander.java index 6307cb175..9c5d6e836 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ContainerExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ContainerNameExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerNameExpander.java index 8b3f0db41..32888c66c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ContainerNameExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerNameExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IContainer; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/LaunchConfigurationVariable.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariable.java index 8c1a3cd82..c5c14d8a4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/LaunchConfigurationVariable.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariable.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.runtime.CoreException; @@ -26,7 +26,7 @@ import org.eclipse.swt.widgets.Label; * Abtract representation of launch configuration variables. * @since 3.0 */ -public class LaunchConfigurationVariable { +public class ContextLaunchVariable implements IContextLaunchVariable { private static final IVariableComponent defaultComponent = new DefaultVariableComponent(false); private String tag; @@ -41,7 +41,7 @@ public class LaunchConfigurationVariable { * @param description a short description of what the variable will expand to * @param element the configuration element */ - public LaunchConfigurationVariable(String tag, String description, IConfigurationElement element) { + public ContextLaunchVariable(String tag, String description, IConfigurationElement element) { super(); this.tag = tag; this.description = description; @@ -49,12 +49,12 @@ public class LaunchConfigurationVariable { } /** - * Returns the object that can expand the variable + * @see IContextLaunchVariable */ public IVariableExpander getExpander() { if (expander == null) { try { - expander = (IVariableExpander) createObject(LaunchConfigurationVariableRegistry.TAG_EXPANDER_CLASS); + expander = (IVariableExpander) createObject(ContextLaunchVariableRegistry.TAG_EXPANDER_CLASS); } catch (ClassCastException exception) { } if (expander == null) { @@ -80,15 +80,14 @@ public class LaunchConfigurationVariable { } /** - * Returns the component class to allow - * visual editing of the variable's value. + * @see IContextLaunchVariable#getComponent() */ public final IVariableComponent getComponent() { - String className = element.getAttribute(LaunchConfigurationVariableRegistry.TAG_COMPONENT_CLASS); + String className = element.getAttribute(ContextLaunchVariableRegistry.TAG_COMPONENT_CLASS); if (className == null || className.trim().length() == 0) return defaultComponent; - Object component = createObject(LaunchConfigurationVariableRegistry.TAG_COMPONENT_CLASS); + Object component = createObject(ContextLaunchVariableRegistry.TAG_COMPONENT_CLASS); if (component == null) return new DefaultVariableComponent(true); else @@ -96,16 +95,16 @@ public class LaunchConfigurationVariable { } /** - * Returns the variable's description + * @see IContextLaunchVariable#getDescription() */ public final String getDescription() { return description; } /** - * Returns the variable's tag + * @see IContextLaunchVariable#getName() */ - public final String getTag() { + public final String getName() { return tag; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/LaunchConfigurationVariableRegistry.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariableRegistry.java index 5e3f87f27..22cc0de08 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/LaunchConfigurationVariableRegistry.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariableRegistry.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import java.util.SortedMap; @@ -24,10 +24,10 @@ import org.eclipse.core.runtime.Status; import org.eclipse.debug.internal.ui.DebugUIPlugin; /** - * General registry for launch configuration variables. + * Registry for context launch variables. * @since 3.0 */ -public class LaunchConfigurationVariableRegistry { +public class ContextLaunchVariableRegistry { // Format of the variable extension points // <extension point="org.eclipse.debug.ui.launchConfigurationVariables> // <variable @@ -43,7 +43,7 @@ public class LaunchConfigurationVariableRegistry { * Element and attribute tags of a variable extension. */ protected static final String TAG_VARIABLE = "variable"; //$NON-NLS-1$ - protected static final String TAG_TAG = "tag"; //$NON-NLS-1$ + protected static final String TAG_NAME = "name"; //$NON-NLS-1$ protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$ protected static final String TAG_COMPONENT_CLASS = "componentClass"; //$NON-NLS-1$ protected static final String TAG_EXPANDER_CLASS = "expanderClass"; //$NON-NLS-1$ @@ -64,14 +64,14 @@ public class LaunchConfigurationVariableRegistry { */ protected String pluginId; - public LaunchConfigurationVariableRegistry() { - this(DebugUIPlugin.getUniqueIdentifier(), IVariableConstants.EXTENSION_POINT_CONFIGURATION_VARIABLES); + public ContextLaunchVariableRegistry() { + this(DebugUIPlugin.getUniqueIdentifier(), IVariableConstants.EXTENSION_POINT_CONTEXT_LAUNCH_VARIABLES); } /** * Creates a new registry and loads the variables. */ - protected LaunchConfigurationVariableRegistry(String pluginId, String extensionPointId) { + protected ContextLaunchVariableRegistry(String pluginId, String extensionPointId) { this.pluginId= pluginId; this.extensionPointId = extensionPointId; loadVariables(); @@ -81,8 +81,8 @@ public class LaunchConfigurationVariableRegistry { * Returns the variable for the specified tag, or * <code>null</code> if none found. */ - protected final LaunchConfigurationVariable findVariable(String tag) { - return (LaunchConfigurationVariable) variables.get(tag); + protected final IContextLaunchVariable findVariable(String tag) { + return (IContextLaunchVariable) variables.get(tag); } /** @@ -96,15 +96,15 @@ public class LaunchConfigurationVariableRegistry { /** * Returns the variable for the given tag or <code>null</code> if none. */ - public LaunchConfigurationVariable getVariable(String tag) { + public IContextLaunchVariable getVariable(String tag) { return findVariable(tag); } /** * Returns the list of argument variables in the registry. */ - public LaunchConfigurationVariable[] getVariables() { - LaunchConfigurationVariable[] results = new LaunchConfigurationVariable[getVariableCount()]; + public IContextLaunchVariable[] getVariables() { + IContextLaunchVariable[] results = new ContextLaunchVariable[getVariableCount()]; variables.values().toArray(results); return results; } @@ -123,7 +123,7 @@ public class LaunchConfigurationVariableRegistry { for (int j = 0; j < elements.length; j++) { IConfigurationElement element = elements[j]; if (element.getName().equals(TAG_VARIABLE)) { - String tag = element.getAttribute(TAG_TAG); + String tag = element.getAttribute(TAG_NAME); String description = element.getAttribute(TAG_DESCRIPTION); String className = element.getAttribute(TAG_EXPANDER_CLASS); @@ -152,8 +152,8 @@ public class LaunchConfigurationVariableRegistry { /** * Creates a new variable from the specified information. */ - protected LaunchConfigurationVariable newVariable(String tag, String description, IConfigurationElement element) { - return new LaunchConfigurationVariable(tag, description, element); + protected IContextLaunchVariable newVariable(String tag, String description, IConfigurationElement element) { + return new ContextLaunchVariable(tag, description, element); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/DefaultVariableExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/DefaultVariableExpander.java index faf74dfd4..ba46a0093 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/DefaultVariableExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/DefaultVariableExpander.java @@ -8,14 +8,13 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import java.text.MessageFormat; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.debug.internal.ui.DebugUIPlugin; @@ -39,14 +38,6 @@ public class DefaultVariableExpander implements IVariableExpander { } /** - * @see IVariableExpander#getPath(String, String, ExpandVariableContext) - */ - public IPath getPath(String varTag, String varValue, ExpandVariableContext context) throws CoreException { - throwExpansionException(varTag, MessageFormat.format(LaunchConfigurationsMessages.getString("DefaultVariableExpander.No_expander_class_defined_for_the_variable_{0}_1"), new String[] {varTag})); //$NON-NLS-1$ - return null; - } - - /** * @see IVariableExpander#getResources(String, String, ExpandVariableContext) */ public IResource[] getResources(String varTag, String varValue, ExpandVariableContext context) throws CoreException { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ExpandVariableContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ExpandVariableContext.java index 08bb5f793..3cf6a82dc 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ExpandVariableContext.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ExpandVariableContext.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/FilePromptExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/FilePromptExpander.java index 6c79bd449..e43a04bf4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/FilePromptExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/FilePromptExpander.java @@ -9,7 +9,7 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.swt.widgets.FileDialog; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/FolderPromptExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/FolderPromptExpander.java index ed0316432..15b1f5f19 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/FolderPromptExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/FolderPromptExpander.java @@ -9,7 +9,7 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.swt.widgets.DirectoryDialog; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextLaunchVariable.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextLaunchVariable.java new file mode 100644 index 000000000..ab6d56727 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextLaunchVariable.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.ui.launchVariables; + +/** + * @since 3.0 + */ +public interface IContextLaunchVariable { + /** + * Returns the object that can expand the variable. + */ + public IVariableExpander getExpander(); + /** + * Returns the component class to allow + * visual editing of the variable's value. + */ + public IVariableComponent getComponent(); + /** + * Returns the variable's description or <code>null</code> if none + * is specified. + */ + public String getDescription(); + /** + * Returns the variable's name. + */ + public String getName(); +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableComponent.java index f8fe1e849..b85369202 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.swt.widgets.Composite; @@ -19,8 +19,7 @@ import org.eclipse.swt.widgets.Control; * variable extension points to provide visual editing * of the variable. * <p> - * This interface is not to be extended by clients. Clients - * may implement this interface. + * Clients may implement this interface. * </p> */ public interface IVariableComponent { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableComponentContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableComponentContainer.java index 0cc218fc5..986820fcd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableComponentContainer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableComponentContainer.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.jface.dialogs.IMessageProvider; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableConstants.java index 837b8b603..9eb4fc1cf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableConstants.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; public interface IVariableConstants { /** @@ -77,9 +77,9 @@ public interface IVariableConstants { public static final String VAR_EDITOR_SEL_TEXT = "editor_sel_text"; //$NON-NLS-1$ /** * Extension point to declare launch configuration variables. - * (value<code>launchConfigurationVariables</code>). + * (value<code>contextLaunchVariables</code>). */ - public static final String EXTENSION_POINT_CONFIGURATION_VARIABLES = "launchConfigurationVariables"; //$NON-NLS-1$ + public static final String EXTENSION_POINT_CONTEXT_LAUNCH_VARIABLES = "contextLaunchVariables"; //$NON-NLS-1$ /** * XML tag used to designate the root of the persisted IWorkingSet */ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableExpander.java index 58accbe5d..730309287 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/IVariableExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableExpander.java @@ -8,27 +8,14 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; public interface IVariableExpander { /** - * Returns the path location to a file or directory - * for the given variable tag and value. The path does - * not need to exist. - * - * @param varTag the variable tag name - * @param varValue the value for the variable - * @param context the context the variable should use to expand itself - * @return the <code>IPath</code> to a file/directory - * @throws CoreException if the given variable could not be expanded - */ - public IPath getPath(String varTag, String varValue, ExpandVariableContext context) throws CoreException; - /** * Returns the <code>IResource</code> list * for the given variable tag and value. * diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/LaunchConfigurationVariableForm.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/LaunchConfigurationVariableForm.java index ddfe7708e..63ba55d4d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/LaunchConfigurationVariableForm.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/LaunchConfigurationVariableForm.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.swt.SWT; @@ -34,7 +34,7 @@ public class LaunchConfigurationVariableForm { private static final int VISIBLE_ITEM_COUNT = 6; private String variableListLabelText; - private LaunchConfigurationVariable[] variables; + private IContextLaunchVariable[] variables; private IVariableComponent[] components; private IVariableComponentContainer dialogPage; @@ -50,7 +50,7 @@ public class LaunchConfigurationVariableForm { * @param variableListLabelText the label text to use for identifying the list of variables * @param variables the collection of variables to display to the user */ - public LaunchConfigurationVariableForm(String variableListLabelText, LaunchConfigurationVariable[] variables) { + public LaunchConfigurationVariableForm(String variableListLabelText, IContextLaunchVariable[] variables) { super(); this.variableListLabelText = variableListLabelText; this.variables = variables; @@ -160,9 +160,9 @@ public class LaunchConfigurationVariableForm { */ private void createVariableComponents() { for (int i = 0; i < variables.length; i++) { - LaunchConfigurationVariable var = variables[i]; + IContextLaunchVariable var = variables[i]; components[i] = var.getComponent(); - components[i].createContents(variableComposite, var.getTag(), dialogPage); + components[i].createContents(variableComposite, var.getName(), dialogPage); } } @@ -173,7 +173,7 @@ public class LaunchConfigurationVariableForm { public String getSelectedVariable() { if (activeComponentIndex != -1) { String varValue = components[activeComponentIndex].getVariableValue(); - return VariableUtil.buildVariableTag(variables[activeComponentIndex].getTag(), varValue); + return VariableUtil.buildVariableTag(variables[activeComponentIndex].getName(), varValue); } return null; @@ -202,7 +202,7 @@ public class LaunchConfigurationVariableForm { String[] items = new String[variables.length]; StringBuffer buffer = new StringBuffer(80); for (int i = 0; i < variables.length; i++) { - VariableUtil.buildVariableTag(variables[i].getTag(), null, buffer); + VariableUtil.buildVariableTag(variables[i].getName(), null, buffer); buffer.append(" - "); //$NON-NLS-1$ buffer.append(variables[i].getDescription()); items[i] = buffer.toString(); @@ -214,7 +214,7 @@ public class LaunchConfigurationVariableForm { public void selectVariable(String varName, String varValue) { if (varName != null && varName.length() > 0) { for (int i = 0; i < variables.length; i++) { - if (varName.equals(variables[i].getTag())) { + if (varName.equals(variables[i].getName())) { variableList.select(i); updateVariableComposite(varValue, true); return; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ProjectExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ProjectExpander.java index ec7418b15..332e4e824 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ProjectExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ProjectExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ProjectNameExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ProjectNameExpander.java index e85145140..f21234d45 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ProjectNameExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ProjectNameExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/PromptExpanderBase.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/PromptExpanderBase.java index af0f89018..0e4a4fba9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/PromptExpanderBase.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/PromptExpanderBase.java @@ -9,7 +9,7 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import java.text.MessageFormat; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ResourceComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceComponent.java index cc93649ad..002d6359d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ResourceComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ResourceExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceExpander.java index b0c3be15a..56ad1bd8a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ResourceExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ResourceNameExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceNameExpander.java index 9af856fd2..f680575ee 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/ResourceNameExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceNameExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/SpecificFileResourceComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFileResourceComponent.java index 86f73c980..2fe0b69ec 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/SpecificFileResourceComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFileResourceComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/SpecificFolderResourceComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFolderResourceComponent.java index 9cdd193fc..7da720ae7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/SpecificFolderResourceComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFolderResourceComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/StringPromptExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/StringPromptExpander.java index cf43d9e44..187595a6e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/StringPromptExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/StringPromptExpander.java @@ -9,7 +9,7 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; import org.eclipse.jface.dialogs.InputDialog; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/VariableContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableContextManager.java index 3bb34a127..b61bd4692 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/VariableContextManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableContextManager.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/VariableSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableSelectionDialog.java index 91880911b..f888f64d0 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/VariableSelectionDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableSelectionDialog.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; @@ -44,7 +44,7 @@ public class VariableSelectionDialog extends SelectionDialog { protected Control createDialogArea(Composite parent) { // Create the dialog area Composite composite= (Composite)super.createDialogArea(parent); - LaunchConfigurationVariable[] variables= DebugUIPlugin.getDefault().getToolVariableRegistry().getVariables(); + IContextLaunchVariable[] variables= DebugUIPlugin.getDefault().getContextVariableRegistry().getVariables(); form= new LaunchConfigurationVariableForm(LaunchConfigurationsMessages.getString("VariableSelectionDialog.Choose_a_variable__2"), variables); //$NON-NLS-1$ form.createContents(composite, new IVariableComponentContainer() { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/VariableUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableUtil.java index 952311b24..f8787a472 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/VariableUtil.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableUtil.java @@ -10,7 +10,7 @@ * Tomasz Stanczak - Fix for Bug 29504 * Keith Seitz (keiths@redhat.com) - environment variables contribution (Bug 27243) *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import java.text.MessageFormat; import java.util.ArrayList; @@ -19,13 +19,17 @@ import java.util.List; import java.util.Map; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.variables.ISimpleLaunchVariable; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; +import org.eclipse.debug.ui.IDebugUIConstants; /** * Utility for dealing with variables + * @since 3.0 */ public class VariableUtil { /** @@ -84,14 +88,13 @@ public class VariableUtil { } /** - * Extracts from the source text the variable tag's name - * and argument. + * Extracts a variable name and argument from the given string. * * @param text the source text to parse for a variable tag * @param start the index in the string to start the search * @return the variable definition */ - public static VariableDefinition extractVariableTag(String text, int start) { + public static VariableDefinition extractVariableDefinition(String text, int start) { VariableDefinition varDef = new VariableDefinition(); varDef.start = text.indexOf(VAR_TAG_START, start); @@ -164,112 +167,50 @@ public class VariableUtil { * @param status multi status to report any problems expanding variables * @return the argument text with all variables expanded, or <code>null</code> if not possible */ - public static String expandTextVariables(String argument, ExpandVariableContext context, MultiStatus status) { + public static String expandVariables(String argument, MultiStatus status) { StringBuffer buffer = new StringBuffer(); - int start = 0; - while (true) { - VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableTag(argument, start); - // No more variables found... - if (varDef.start == -1) { - if (start == 0) { - buffer.append(argument); - } else { - buffer.append(argument.substring(start)); - } - break; - } - - // Invalid variable format + VariableDefinition varDef= extractVariableDefinition(argument, start); + while (varDef.start > -1) { if (varDef.end == -1 || varDef.name == null || varDef.name.length() == 0) { + // Invalid variable format status.merge(DebugUIPlugin.newErrorStatus(MessageFormat.format(LaunchConfigurationsMessages.getString("VariableUtil.Invalid_variable_format__{0}_1"), new String[] {argument.substring(varDef.start)}), null)); //$NON-NLS-1$ return null; } - // Copy text between start and variable. if (varDef.start > start) { buffer.append(argument.substring(start, varDef.start)); } start = varDef.end; - - // Lookup the variable if it exists - LaunchConfigurationVariableRegistry registry = DebugUIPlugin.getDefault().getToolVariableRegistry(); - LaunchConfigurationVariable variable = registry.getVariable(varDef.name); - if (variable == null) { - status.merge(DebugUIPlugin.newErrorStatus(MessageFormat.format(LaunchConfigurationsMessages.getString("VariableUtil.The_variable_named_____{0}_____does_not_exist._2"), new Object[] {varDef.name}), null)); //$NON-NLS-1$ - return null; - } - - // Expand the variable as text if possible - String text = null; - try { - text= variable.getExpander().getText(varDef.name, varDef.argument, context); - } catch (CoreException exception) { - status.merge(exception.getStatus()); - return null; + // Look up the context variable if it exists + ContextLaunchVariableRegistry registry = DebugUIPlugin.getDefault().getContextVariableRegistry(); + IContextLaunchVariable contextVariable = registry.getVariable(varDef.name); + if (contextVariable != null) { + String text = null; + try { + text= contextVariable.getExpander().getText(varDef.name, varDef.argument, VariableContextManager.getDefault().getVariableContext()); + } catch (CoreException exception) { + status.merge(exception.getStatus()); + return null; + } + buffer.append(text); + } else { + // If no context variable found, look up a simple variable + ISimpleLaunchVariable simpleVariable= DebugPlugin.getDefault().getSimpleVariableRegistry().getVariable(varDef.name); + if (simpleVariable == null) { + status.merge(DebugUIPlugin.newErrorStatus(MessageFormat.format(LaunchConfigurationsMessages.getString("VariableUtil.The_variable_named_____{0}_____does_not_exist._2"), new Object[] {varDef.name}), null)); //$NON-NLS-1$ + return null; + } + buffer.append(simpleVariable.getText()); } - buffer.append(text); - } - return buffer.toString(); - } - - /** - * Returns the expanded location if represented by a - * location variable. Otherwise, the location given is - * returned unless an unknown variable was detected. - * - * @param locationText a location either as a path or a variable - * with leading and trailing spaces already removed. - * @param context the context used to expand the variable - * @param status multi status to report any problems expanding variables - * @return the location as a string or <code>null</code> if not possible - */ - public static String expandLocationText(String locationText, ExpandVariableContext context, MultiStatus status) { - if (locationText == null || locationText.length() == 0) { - return ""; //$NON-NLS-1$ - } - - VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableTag(locationText, 0); - // Return if no variable found - if (varDef.start < 0) { - return locationText; + varDef = extractVariableDefinition(argument, start); } - - StringBuffer buffer= new StringBuffer(); - int start= 0; - while (varDef.start >= 0) { - // Invalid variable format - if (varDef.name == null || varDef.name.length() == 0 || varDef.end == -1) { - status.merge(DebugUIPlugin.newErrorStatus(MessageFormat.format(LaunchConfigurationsMessages.getString("VariableUtil.Invalid_variable_format__{0}_3"), new String[] {locationText.substring(varDef.start)}), null)); //$NON-NLS-1$ - return null; - } - - // Append text before the variable - buffer.append(locationText.substring(start, varDef.start)); - - // Lookup the variable if it exist - LaunchConfigurationVariableRegistry registry; - registry = DebugUIPlugin.getDefault().getToolVariableRegistry(); - LaunchConfigurationVariable variable = registry.getVariable(varDef.name); - if (variable == null) { - status.merge(DebugUIPlugin.newErrorStatus(MessageFormat.format(LaunchConfigurationsMessages.getString("VariableUtil.The_variable_named_____{0}_____does_not_exist._4"), new Object[] {varDef.name}), null)); //$NON-NLS-1$ - return null; - } - - // Expand the variable into a IPath if possible - IPath path= null; - try { - path= variable.getExpander().getPath(varDef.name, varDef.argument, context); - } catch (CoreException exception) { - status.merge(exception.getStatus()); - return null; - } - buffer.append(path.toOSString()); - start= varDef.end; - varDef= VariableUtil.extractVariableTag(locationText, start); + // No more variables + if (start == 0) { + buffer.append(argument); + } else { + buffer.append(argument.substring(start)); } - // Append text remaining after the variables - buffer.append(locationText.substring(start)); return buffer.toString(); } @@ -282,9 +223,8 @@ public class VariableUtil { * @param status multi status to report any problems expanding variables * @return String[] the list of variables in "variable=value" form */ - public static String[] expandEnvironment(Map envMap, ExpandVariableContext context, MultiStatus status) { + public static String[] expandEnvironment(Map envMap, MultiStatus status) { String[] vars = null; - if (envMap != null && envMap.size() > 0) { Map.Entry e; Iterator iter = envMap.entrySet().iterator(); @@ -292,32 +232,33 @@ public class VariableUtil { int i = 0; while (iter.hasNext()) { e = (Map.Entry) iter.next(); - vars[i++] = (String) e.getKey() + '=' + VariableUtil.expandTextVariables((String) e.getValue(), context, status); + vars[i++] = (String) e.getKey() + '=' + expandVariables((String) e.getValue(), status); } } - return vars; } /** - * Returns a list of individual arguments where all - * variables have been expanded. + * Returns a list of individual strings where all + * variables have been expanded. The given string + * is separated into individual strings based on whitespace + * deliniation. * - * @param arguments the arguments with leading and trailing + * @param sourceString the source string with leading and trailing * spaces already removed. * @param context the context used to expand the variable(s) * @param status multi status to report any problems expanding variables * @return the list of individual arguments where some elements in the * list maybe <code>null</code> if problems expanding variable(s). */ - public static String[] expandArguments(String arguments, ExpandVariableContext context, MultiStatus status) { - if (arguments == null || arguments.length() == 0) { + public static String[] expandStrings(String sourceString, MultiStatus status) { + if (sourceString == null || sourceString.length() == 0) { return new String[0]; } - String[] argList = parseArgumentsIntoList(arguments); + String[] argList = parseStringIntoList(sourceString); for (int i = 0; i < argList.length; i++) { - argList[i] = VariableUtil.expandTextVariables(argList[i], context, status); + argList[i] = expandVariables(argList[i], status); } return argList; @@ -325,7 +266,7 @@ public class VariableUtil { /** * Parses the argument text into an array of individual - * arguments using the space character as the delimiter. + * strings using the space character as the delimiter. * An individual argument containing spaces must have a * double quote (") at the start and end. Two double * quotes together is taken to mean an embedded double @@ -336,7 +277,7 @@ public class VariableUtil { * @param arguments the arguments as one string * @return the array of arguments */ - public static String[] parseArgumentsIntoList(String arguments) { + public static String[] parseStringIntoList(String arguments) { if (arguments == null || arguments.length() == 0) { return new String[0]; } @@ -383,18 +324,18 @@ public class VariableUtil { } break; - case VariableUtil.VAR_TAG_START_CHAR1 : + case VAR_TAG_START_CHAR1 : buffer.append(ch); if (!inVar && start < end) { - if (arguments.charAt(start) == VariableUtil.VAR_TAG_START_CHAR2) { - buffer.append(VariableUtil.VAR_TAG_START_CHAR2); + if (arguments.charAt(start) == VAR_TAG_START_CHAR2) { + buffer.append(VAR_TAG_START_CHAR2); inVar = true; start++; } } break; - case VariableUtil.VAR_TAG_END_CHAR1 : + case VAR_TAG_END_CHAR1 : buffer.append(ch); inVar = false; break; @@ -415,4 +356,34 @@ public class VariableUtil { return results; } + /** + * Returns an array of (expanded) environment variables to be used when + * running the launch configuration or <code>null</code> if unspecified + * + * @param configuration launch configuration + * @param context context used to expand environment variable values + * @return String[] the array of "variable=value" pairs, suitable for + * passing to Process.exec + * @throws CoreException if unable to access associated attribute or if + * unable to resolve a variable in an environment variable's value + */ + public static String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException { + Map envMap = configuration.getAttribute(IDebugUIConstants.ATTR_ENVIRONMENT_VARIABLES, (Map) null); + if (envMap != null) { + MultiStatus status = new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), 0, LaunchConfigurationsMessages.getString("VariableUtil.5"), null); //$NON-NLS-1$ + String[] expandedEnvironment = VariableUtil.expandEnvironment(envMap, status); + if (status.isOK()) { + if (expandedEnvironment != null && expandedEnvironment.length > 0) { + return expandedEnvironment; + } else { + String message = MessageFormat.format(LaunchConfigurationsMessages.getString("VariableUtil.6"), new Object[] { configuration.getName()}); //$NON-NLS-1$ + throw new CoreException(DebugUIPlugin.newErrorStatus(message, null)); + } + } else { + throw new CoreException(status); + } + } + return null; + } + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/WorkingSetComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkingSetComponent.java index e7eae265d..44340ec3c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/WorkingSetComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkingSetComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import java.io.IOException; import java.io.StringWriter; @@ -143,7 +143,7 @@ public class WorkingSetComponent extends AbstractVariableComponent { } /* (non-Javadoc) - * @see org.eclipse.debug.ui.variables.IVariableComponent#dispose() + * @see org.eclipse.debug.ui.launchVariables.IVariableComponent#dispose() */ public void dispose() { if (labelProvider != null) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/WorkingSetExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkingSetExpander.java index 4ea6beebf..f7235aaa8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/WorkingSetExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkingSetExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import java.io.StringReader; import java.text.MessageFormat; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/WorkspaceExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkspaceExpander.java index 1857c1771..15dfce7e1 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/variables/WorkspaceExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkspaceExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.variables; +package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java index 65569f8b9..5f85f57a5 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java @@ -16,9 +16,9 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.debug.ui.variables.IVariableComponentContainer; -import org.eclipse.debug.ui.variables.VariableUtil; -import org.eclipse.debug.ui.variables.WorkingSetComponent; +import org.eclipse.debug.ui.launchVariables.IVariableComponentContainer; +import org.eclipse.debug.ui.launchVariables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.WorkingSetComponent; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -132,7 +132,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab impl workingSetButton.setSelection(buildScope != null); if (buildScope != null) { - VariableUtil.VariableDefinition variable= VariableUtil.extractVariableTag(buildScope, 0); + VariableUtil.VariableDefinition variable= VariableUtil.extractVariableDefinition(buildScope, 0); workingSetComponent.setVariableValue(variable.argument); } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties index 00a36bf38..9f619bbf6 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties @@ -63,7 +63,5 @@ ExternalToolsBuilderTab.workingSet_label=&Run this builder for the specified wor ExternalToolsBuilderTab.workingSet_tooltip=Runs whenever a resource changes that is specified in the working set and a build of the correct type has occurred ExternalToolsBuilderTab.buildKindError=At least one type of build kind must be selected ExternalToolsUtil.Could_not_resolve_an_argument._1=Could not resolve an argument. -ExternalToolsUtil.Could_not_resolve_environment._1=Could not resolve environment. -ExternalToolsUtil.Invalid_environment_specified_for_the_launch_configuration_named_{0}._2=Invalid environment specified for the launch configuration named {0}. ExternalToolsUtil.Could_not_resolve_location._3=Could not resolve location. ExternalToolsUtil.Could_not_resolve_working_directory._4=Could not resolve working directory. diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java index cc49b750b..03bb5ff0d 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java @@ -18,14 +18,16 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.variables.ISimpleVariableRegistry; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.debug.ui.variables.LaunchConfigurationVariableRegistry; -import org.eclipse.debug.ui.variables.IVariableConstants; -import org.eclipse.debug.ui.variables.VariableSelectionDialog; -import org.eclipse.debug.ui.variables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.IVariableConstants; +import org.eclipse.debug.ui.launchVariables.ContextLaunchVariableRegistry; +import org.eclipse.debug.ui.launchVariables.VariableSelectionDialog; +import org.eclipse.debug.ui.launchVariables.VariableUtil; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -434,7 +436,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa */ private String validateVariables(String value) { int start= 0; - VariableUtil.VariableDefinition variable = VariableUtil.extractVariableTag(value, start); + VariableUtil.VariableDefinition variable = VariableUtil.extractVariableDefinition(value, start); while (variable.start != -1) { if (variable.end == -1) { return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Invalid_Expected_closing_}"); //$NON-NLS-1$ @@ -442,18 +444,19 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa if (variable.name == null || variable.name.length() == 0) { return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.No_variable_specified"); //$NON-NLS-1$ } - LaunchConfigurationVariableRegistry registry = DebugUIPlugin.getDefault().getToolVariableRegistry(); - if (registry.getVariable(variable.name) == null) { + ContextLaunchVariableRegistry contextVariableRegistry = DebugUIPlugin.getDefault().getContextVariableRegistry(); + ISimpleVariableRegistry simpleVariableRegistry= DebugPlugin.getDefault().getSimpleVariableRegistry(); + if (contextVariableRegistry.getVariable(variable.name) == null && simpleVariableRegistry.getVariable(variable.name) == null) { return MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Unknown_variable"), new String[] {variable.name}); //$NON-NLS-1$ } start= variable.end; - variable = VariableUtil.extractVariableTag(value, start); + variable = VariableUtil.extractVariableDefinition(value, start); } return null; } private boolean containsVariable(String value) { - return VariableUtil.extractVariableTag(value, 0).start != -1; + return VariableUtil.extractVariableDefinition(value, 0).start != -1; } /** diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsRefreshTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsRefreshTab.java index 06bdde2a1..fe38eb911 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsRefreshTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsRefreshTab.java @@ -15,10 +15,10 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.debug.ui.variables.LaunchConfigurationVariable; -import org.eclipse.debug.ui.variables.LaunchConfigurationVariableForm; -import org.eclipse.debug.ui.variables.IVariableComponentContainer; -import org.eclipse.debug.ui.variables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.IContextLaunchVariable; +import org.eclipse.debug.ui.launchVariables.IVariableComponentContainer; +import org.eclipse.debug.ui.launchVariables.LaunchConfigurationVariableForm; +import org.eclipse.debug.ui.launchVariables.VariableUtil; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -108,7 +108,7 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl */ private void createScopeComponent(Composite parent) { String label = ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Choose_scope_v&ariable___2"); //$NON-NLS-1$ - LaunchConfigurationVariable[] vars = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry().getVariables(); + IContextLaunchVariable[] vars = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry().getVariables(); variableForm = new LaunchConfigurationVariableForm(label, vars); variableForm.createContents(parent, this); } @@ -142,7 +142,7 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl String varName = null; String varValue = null; if (scope != null) { - VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableTag(scope, 0); + VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableDefinition(scope, 0); varName = varDef.name; varValue = varDef.argument; } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java index 77012af7c..727329968 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java @@ -26,11 +26,9 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.variables.ExpandVariableContext; -import org.eclipse.debug.ui.variables.LaunchConfigurationVariable; -import org.eclipse.debug.ui.variables.VariableContextManager; -import org.eclipse.debug.ui.variables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.IContextLaunchVariable; +import org.eclipse.debug.ui.launchVariables.VariableContextManager; +import org.eclipse.debug.ui.launchVariables.VariableUtil; import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; import org.eclipse.ui.externaltools.internal.registry.ExternalToolMigration; @@ -65,48 +63,6 @@ public class ExternalToolsUtil { throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception)); } - /** - * Returns an array of (expanded) environment variables to be used when - * running the launch configuration or <code>null</code> if unspecified - * - * @param configuration launch configuration - * @param context context used to expand environment variable values - * @return String[] the array of "variable=value" pairs, suitable for - * passing to Process.exec - * @throws CoreException if unable to access associated attribute or if - * unable to resolve a variable in an environment variable's value - */ - public static String[] getEnvironment(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { - Map envMap = configuration.getAttribute(IDebugUIConstants.ATTR_ENVIRONMENT_VARIABLES, (Map) null); - if (envMap != null) { - MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Could_not_resolve_environment._1"), null); //$NON-NLS-1$ - String[] expandedEnvironment = VariableUtil.expandEnvironment(envMap, context, status); - if (status.isOK()) { - if (expandedEnvironment != null && expandedEnvironment.length > 0) { - return expandedEnvironment; - } else { - String msg = MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Invalid_environment_specified_for_the_launch_configuration_named_{0}._2"), new Object[] { configuration.getName()}); //$NON-NLS-1$ - abort(msg, null, 0); - } - } else { - throw new CoreException(status); - } - } - return null; - } - - /** - * Returns active variable context. The active variable context is used to - * expand variable expressions. If the workspace is currently being built, - * the context is associated with the project being built. Otherwise, the - * context is associated with the selected resource. - * - * @return active variable context - */ - public static ExpandVariableContext getVariableContext() { - return VariableContextManager.getDefault().getVariableContext(); - } - /** * Expands and returns the location attribute of the given launch * configuration, based on the given variable context. The location is @@ -120,13 +76,13 @@ public class ExternalToolsUtil { * resolved location does not point to an existing file in the local file * system */ - public static IPath getLocation(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { + public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException { String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null); if (location == null) { abort(MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Location_not_specified_by_{0}_1"), new String[] { configuration.getName()}), null, 0); //$NON-NLS-1$ } else { MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Could_not_resolve_location._3"), null); //$NON-NLS-1$ - String expandedLocation = VariableUtil.expandLocationText(location, context, status); + String expandedLocation = VariableUtil.expandVariables(location, status); if (status.isOK()) { if (expandedLocation == null || expandedLocation.length() == 0) { String msg = MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.invalidLocation_{0}"), new Object[] { configuration.getName()}); //$NON-NLS-1$ @@ -177,11 +133,11 @@ public class ExternalToolsUtil { * resolved location does not point to an existing directory in the local * file system */ - public static IPath getWorkingDirectory(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { + public static IPath getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException { String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null); if (location != null) { MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Could_not_resolve_working_directory._4"), null); //$NON-NLS-1$ - String expandedLocation = VariableUtil.expandLocationText(location, context, status); + String expandedLocation = VariableUtil.expandVariables(location, status); if (status.isOK()) { if (expandedLocation != null && expandedLocation.length() > 0) { File path = new File(expandedLocation); @@ -211,11 +167,11 @@ public class ExternalToolsUtil { * @throws CoreException if unable to retrieve the associated launch * configuration attribute, or if unable to resolve any variables */ - public static String[] getArguments(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { + public static String[] getArguments(ILaunchConfiguration configuration) throws CoreException { String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null); if (args != null) { MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Could_not_resolve_an_argument._1"), null); //$NON-NLS-1$ - String[] expandedArgs = VariableUtil.expandArguments(args, context, status); + String[] expandedArgs = VariableUtil.expandStrings(args, status); if (status.isOK()) { return expandedArgs; } else { @@ -257,8 +213,8 @@ public class ExternalToolsUtil { * @param monitor progress monitor * @throws CoreException if an exception occurrs while refreshing resources */ - public static void refreshResources(ILaunchConfiguration configuration, ExpandVariableContext context, IProgressMonitor monitor) throws CoreException { - IResource[] resources= getResourcesForRefreshScope(configuration, context, monitor); + public static void refreshResources(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { + IResource[] resources= getResourcesForRefreshScope(configuration, monitor); if (resources == null || resources.length == 0){ return; } @@ -301,13 +257,13 @@ public class ExternalToolsUtil { * @param monitor progress monitor * @throws CoreException if an exception occurs while refreshing resources */ - public static IResource[] getResourcesForRefreshScope(ILaunchConfiguration configuration, ExpandVariableContext context, IProgressMonitor monitor) throws CoreException { + public static IResource[] getResourcesForRefreshScope(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { String scope = getRefreshScope(configuration); if (scope == null) { return null; } - return getResourcesForScope(configuration, context, monitor, scope); + return getResourcesForScope(configuration, monitor, scope); } /** @@ -318,25 +274,25 @@ public class ExternalToolsUtil { * @param monitor progress monitor * @throws CoreException if an exception occurs while refreshing resources */ - public static IResource[] getResourcesForBuildScope(ILaunchConfiguration configuration, ExpandVariableContext context, IProgressMonitor monitor) throws CoreException { + public static IResource[] getResourcesForBuildScope(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { String scope = configuration.getAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, (String) null); if (scope == null) { return null; } - return getResourcesForScope(configuration, context, monitor, scope); + return getResourcesForScope(configuration, monitor, scope); } - private static IResource[] getResourcesForScope(ILaunchConfiguration configuration, ExpandVariableContext context, IProgressMonitor monitor, String scope) throws CoreException { - VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableTag(scope, 0); + private static IResource[] getResourcesForScope(ILaunchConfiguration configuration, IProgressMonitor monitor, String scope) throws CoreException { + VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableDefinition(scope, 0); if (varDef.start == -1 || varDef.end == -1 || varDef.name == null) { String msg = MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.invalidRefreshVarFormat"), new Object[] { configuration.getName()}); //$NON-NLS-1$ abort(msg, null, 0); } RefreshScopeVariableRegistry registry = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry(); - LaunchConfigurationVariable variable = registry.getVariable(varDef.name); + IContextLaunchVariable variable = registry.getVariable(varDef.name); if (variable == null) { String msg = MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.noRefreshVarNamed"), new Object[] { configuration.getName(), varDef.name }); //$NON-NLS-1$ abort(msg, null, 0); @@ -346,7 +302,7 @@ public class ExternalToolsUtil { return null; } - return variable.getExpander().getResources(varDef.name, varDef.argument, context); + return variable.getExpander().getResources(varDef.name, varDef.argument, VariableContextManager.getDefault().getVariableContext()); } /** diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java index 45f6e0868..826933e04 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java @@ -64,7 +64,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { return null; } - IResource[] resources= ExternalToolsUtil.getResourcesForBuildScope(config, ExternalToolsUtil.getVariableContext(), monitor); + IResource[] resources= ExternalToolsUtil.getResourcesForBuildScope(config, monitor); boolean buildForChange= true; if (resources != null && resources.length > 0) { buildForChange= buildScopeIndicatesBuild(resources); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java index 8f0918cf5..dc44ea47f 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java @@ -20,8 +20,8 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.variables.IVariableConstants; -import org.eclipse.debug.ui.variables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.IVariableConstants; +import org.eclipse.debug.ui.launchVariables.VariableUtil; import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; /** @@ -172,7 +172,7 @@ public final class ExternalToolMigration { // Update the location... String location = (String) args.get(TAG_TOOL_LOCATION); if (location != null) { - VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableTag(location, 0); + VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableDefinition(location, 0); if (IVariableConstants.VAR_WORKSPACE_LOC.equals(varDef.name)) { location = VariableUtil.buildVariableTag(IVariableConstants.VAR_RESOURCE_LOC, varDef.argument); } @@ -182,7 +182,7 @@ public final class ExternalToolMigration { // Update the refresh scope... String refresh = (String) args.get(TAG_TOOL_REFRESH); if (refresh != null) { - VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableTag(refresh, 0); + VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableDefinition(refresh, 0); if ("none".equals(varDef.name)) { //$NON-NLS-1$ refresh = null; } @@ -196,7 +196,7 @@ public final class ExternalToolMigration { int start = 0; ArrayList targets = new ArrayList(); StringBuffer buffer = new StringBuffer(); - VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableTag(arguments, start); + VariableUtil.VariableDefinition varDef = VariableUtil.extractVariableDefinition(arguments, start); while (varDef.end != -1) { if ("ant_target".equals(varDef.name) && varDef.argument != null) { //$NON-NLS-1$ targets.add(varDef.argument); @@ -205,7 +205,7 @@ public final class ExternalToolMigration { buffer.append(arguments.substring(start, varDef.end)); } start = varDef.end; - varDef = VariableUtil.extractVariableTag(arguments, start); + varDef = VariableUtil.extractVariableDefinition(arguments, start); } buffer.append(arguments.substring(start, arguments.length())); arguments = buffer.toString(); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeExpander.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeExpander.java index b514b5268..8fee23eeb 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeExpander.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeExpander.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.ui.externaltools.internal.variables; -import org.eclipse.debug.ui.variables.DefaultVariableExpander; -import org.eclipse.debug.ui.variables.ExpandVariableContext; +import org.eclipse.debug.ui.launchVariables.DefaultVariableExpander; +import org.eclipse.debug.ui.launchVariables.ExpandVariableContext; import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder; diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/RefreshScopeVariableRegistry.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/RefreshScopeVariableRegistry.java index 5e07b262b..6a94c9308 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/RefreshScopeVariableRegistry.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/RefreshScopeVariableRegistry.java @@ -10,13 +10,13 @@ *******************************************************************************/ package org.eclipse.ui.externaltools.internal.variables; -import org.eclipse.debug.ui.variables.LaunchConfigurationVariableRegistry; +import org.eclipse.debug.ui.launchVariables.ContextLaunchVariableRegistry; import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; /** * Registry of all available refresh scope variables. */ -public class RefreshScopeVariableRegistry extends LaunchConfigurationVariableRegistry { +public class RefreshScopeVariableRegistry extends ContextLaunchVariableRegistry { /** * Creates the registry and loads the variables. diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java index 05563301e..33d0e793e 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java @@ -24,7 +24,6 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; -import org.eclipse.debug.ui.variables.ExpandVariableContext; /** * Refreshes resources as specified by a lanunch configuration, when @@ -32,14 +31,12 @@ import org.eclipse.debug.ui.variables.ExpandVariableContext; */ public class BackgroundResourceRefresher implements IDebugEventSetListener, Runnable, IRunnableWithProgress { - private ExpandVariableContext fContext; private ILaunchConfiguration fConfiguration; private IProcess fProcess; - public BackgroundResourceRefresher(ILaunchConfiguration configuration, IProcess process, ExpandVariableContext context) { + public BackgroundResourceRefresher(ILaunchConfiguration configuration, IProcess process) { fConfiguration = configuration; fProcess = process; - fContext = context; } /** @@ -99,7 +96,7 @@ public class BackgroundResourceRefresher implements IDebugEventSetListener, Runn */ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { - ExternalToolsUtil.refreshResources(fConfiguration, fContext, monitor); + ExternalToolsUtil.refreshResources(fConfiguration, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java index 0cbd47702..3ed2c2c42 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java @@ -26,13 +26,13 @@ import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; import org.eclipse.debug.core.model.IProcess; +import org.eclipse.debug.ui.launchVariables.VariableUtil; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.IWindowListener; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil; import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; -import org.eclipse.debug.ui.variables.ExpandVariableContext; /** * Launch delegate for a program. @@ -95,29 +95,22 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate { return; } - // get variable context - ExpandVariableContext resourceContext = ExternalToolsUtil.getVariableContext(); - - if (monitor.isCanceled()) { - return; - } - // resolve location - IPath location = ExternalToolsUtil.getLocation(configuration, resourceContext); + IPath location = ExternalToolsUtil.getLocation(configuration); if (monitor.isCanceled()) { return; } // resolve working directory - IPath workingDirectory = ExternalToolsUtil.getWorkingDirectory(configuration, resourceContext); + IPath workingDirectory = ExternalToolsUtil.getWorkingDirectory(configuration); if (monitor.isCanceled()) { return; } // resolve arguments - String[] arguments = ExternalToolsUtil.getArguments(configuration, resourceContext); + String[] arguments = ExternalToolsUtil.getArguments(configuration); if (monitor.isCanceled()) { return; @@ -142,7 +135,7 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate { return; } - String[] envp = ExternalToolsUtil.getEnvironment(configuration, resourceContext); + String[] envp = VariableUtil.getEnvironment(configuration); if (monitor.isCanceled()) { return; @@ -173,7 +166,7 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate { if (ExternalToolsUtil.isBackground(configuration)) { // refresh resources after process finishes if (ExternalToolsUtil.getRefreshScope(configuration) != null) { - BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(configuration, process, resourceContext); + BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(configuration, process); refresher.startBackgroundRefresh(); } } else { @@ -190,7 +183,7 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate { } // refresh resources - ExternalToolsUtil.refreshResources(configuration, resourceContext, monitor); + ExternalToolsUtil.refreshResources(configuration, monitor); } } diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java index b4777f7d1..bb02d3952 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java @@ -13,8 +13,8 @@ package org.eclipse.ui.externaltools.internal.program.launchConfigurations; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.debug.ui.variables.IVariableConstants; -import org.eclipse.debug.ui.variables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.IVariableConstants; +import org.eclipse.debug.ui.launchVariables.VariableUtil; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsMainTab; import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; diff --git a/org.eclipse.ui.externaltools/plugin.xml b/org.eclipse.ui.externaltools/plugin.xml index d1788f47b..db9f00cd2 100644 --- a/org.eclipse.ui.externaltools/plugin.xml +++ b/org.eclipse.ui.externaltools/plugin.xml @@ -189,40 +189,40 @@ </extension> <!-- Variable Extensions --> - <extension point="org.eclipse.debug.ui.launchConfigurationVariables"> + <extension point="org.eclipse.debug.ui.contextLaunchVariables"> <variable - tag="build_type" + name="build_type" description="%build_type.description" expanderClass="org.eclipse.ui.externaltools.internal.variables.BuildTypeExpander"> </variable> </extension> <extension point="org.eclipse.ui.externaltools.refreshVariables"> <variable - tag="workspace" + name="workspace" description="%workspace.description" - expanderClass="org.eclipse.debug.ui.variables.WorkspaceExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.WorkspaceExpander"> </variable> <variable - tag="project" + name="project" description="%project.description" - expanderClass="org.eclipse.debug.ui.variables.ProjectExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.ProjectExpander"> </variable> <variable - tag="container" + name="container" description="%container.description" - expanderClass="org.eclipse.debug.ui.variables.ContainerExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.ContainerExpander"> </variable> <variable - tag="resource" + name="resource" description="%resource.description" - componentClass="org.eclipse.debug.ui.variables.ResourceComponent" - expanderClass="org.eclipse.debug.ui.variables.ResourceExpander"> + componentClass="org.eclipse.debug.ui.launchVariables.ResourceComponent" + expanderClass="org.eclipse.debug.ui.launchVariables.ResourceExpander"> </variable> <variable - tag="working_set" + name="working_set" description="%working_set.description" - componentClass="org.eclipse.debug.ui.variables.WorkingSetComponent" - expanderClass="org.eclipse.debug.ui.variables.WorkingSetExpander"> + componentClass="org.eclipse.debug.ui.launchVariables.WorkingSetComponent" + expanderClass="org.eclipse.debug.ui.launchVariables.WorkingSetExpander"> </variable> </extension> |