diff options
author | Jared Burns | 2003-05-23 15:25:34 +0000 |
---|---|---|
committer | Jared Burns | 2003-05-23 15:25:34 +0000 |
commit | d65e3ecbf9ec95beaba16f5a95b42f467b788f02 (patch) | |
tree | 0e71826bcf82d770cbdf49afb797d61c4a8a532d | |
parent | 66874a2dadc13b5b1e0a7b2ce7634c431affbeb3 (diff) | |
download | eclipse.platform.debug-d65e3ecbf9ec95beaba16f5a95b42f467b788f02.tar.gz eclipse.platform.debug-d65e3ecbf9ec95beaba16f5a95b42f467b788f02.tar.xz eclipse.platform.debug-d65e3ecbf9ec95beaba16f5a95b42f467b788f02.zip |
Bug 37241 - Support for core variables
53 files changed, 406 insertions, 230 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 f67aa12cf..9a8309a5c 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,6 +30,8 @@ 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.ContextLaunchVariableRegistry; +import org.eclipse.debug.core.variables.IContextLaunchVariableRegistry; import org.eclipse.debug.core.variables.ISimpleVariableRegistry; import org.eclipse.debug.internal.core.BreakpointManager; import org.eclipse.debug.internal.core.DebugCoreMessages; @@ -117,7 +119,15 @@ public class DebugPlugin extends Plugin { * * @since 3.0 */ - public static final String EXTENSION_POINT_SIMPLE_LAUNCH_VARIABLES= "simpleLaunchVariables"; //$NON-NLS-1$ + public static final String EXTENSION_POINT_SIMPLE_LAUNCH_VARIABLES= "simpleLaunchVariables"; //$NON-NLS-1$ + + /** + * Simple identifier constant (value <code>"contextLaunchVariables"</code>) for the + * context launch variables extension point. + * + * @since 3.0 + */ + public static final String EXTENSION_POINT_CONTEXT_LAUNCH_VARIABLES = "contextLaunchVariables"; //$NON-NLS-1$ /** * Status code indicating an unexpected internal error. @@ -157,9 +167,14 @@ public class DebugPlugin extends Plugin { private LaunchManager fLaunchManager; /** - * The singleton variable registry. + * The singleton simple variable registry. */ - private SimpleVariableRegistry fVariableRegistry; + private SimpleVariableRegistry fSimpleVariableRegistry; + + /** + * The singleton context variable registry. + */ + private IContextLaunchVariableRegistry fContextVariableRegistry; /** * The collection of debug event listeners. @@ -353,10 +368,20 @@ public class DebugPlugin extends Plugin { * @return the registry of simple launch variables */ public ISimpleVariableRegistry getSimpleVariableRegistry() { - if (fVariableRegistry == null) { - fVariableRegistry = new SimpleVariableRegistry(); + if (fSimpleVariableRegistry == null) { + fSimpleVariableRegistry = new SimpleVariableRegistry(); + } + return fSimpleVariableRegistry; + } + + /** + * Returns the registry of context launch variables. + */ + public IContextLaunchVariableRegistry getContextVariableRegistry() { + if (fContextVariableRegistry == null) { + fContextVariableRegistry = new ContextLaunchVariableRegistry(); } - return fVariableRegistry; + return fContextVariableRegistry; } /** @@ -448,8 +473,8 @@ public class DebugPlugin extends Plugin { if (fEventListeners != null) { fEventListeners.removeAll(); } - if (fVariableRegistry != null) { - fVariableRegistry.storeVariables(); + if (fSimpleVariableRegistry != null) { + fSimpleVariableRegistry.storeVariables(); } setDefault(null); ResourcesPlugin.getWorkspace().removeSaveParticipant(this); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariable.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ContextLaunchVariable.java index c5c14d8a4..fecd7d22a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariable.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ContextLaunchVariable.java @@ -8,26 +8,18 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.core.variables; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; -import org.eclipse.jface.resource.JFaceColors; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; +import org.eclipse.debug.core.DebugPlugin; /** * Abtract representation of launch configuration variables. * @since 3.0 */ public class ContextLaunchVariable implements IContextLaunchVariable { - private static final IVariableComponent defaultComponent = new DefaultVariableComponent(false); private String tag; private String description; @@ -74,27 +66,12 @@ public class ContextLaunchVariable implements IContextLaunchVariable { try { return element.createExecutableExtension(attributeName); } catch (CoreException e) { - DebugUIPlugin.log(e.getStatus()); + DebugPlugin.log(e.getStatus()); return null; } } /** - * @see IContextLaunchVariable#getComponent() - */ - public final IVariableComponent getComponent() { - String className = element.getAttribute(ContextLaunchVariableRegistry.TAG_COMPONENT_CLASS); - if (className == null || className.trim().length() == 0) - return defaultComponent; - - Object component = createObject(ContextLaunchVariableRegistry.TAG_COMPONENT_CLASS); - if (component == null) - return new DefaultVariableComponent(true); - else - return (IVariableComponent)component; - } - - /** * @see IContextLaunchVariable#getDescription() */ public final String getDescription() { @@ -107,41 +84,4 @@ public class ContextLaunchVariable implements IContextLaunchVariable { public final String getName() { return tag; } - - - /** - * Default variable component implementation which does not - * allow variable value editing visually. - */ - protected static final class DefaultVariableComponent extends AbstractVariableComponent { - private boolean showError = false; - private Label message = null; - - public DefaultVariableComponent(boolean showError) { - super(); - this.showError = showError; - } - - /* (non-Javadoc) - * Method declared on IVariableComponent. - */ - public Control getControl() { - return message; - } - - /* (non-Javadoc) - * Method declared on IVariableComponent. - */ - public void createContents(Composite parent, String varTag, IVariableComponentContainer page) { - container= page; - if (showError) { - message = new Label(parent, SWT.NONE); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - message.setLayoutData(data); - message.setFont(parent.getFont()); - message.setText(LaunchConfigurationsMessages.getString("LaunchConfigurationVariable.Problem_displaying_UI")); //$NON-NLS-1$ - message.setForeground(JFaceColors.getErrorText(message.getDisplay())); - } - } - } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariableRegistry.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ContextLaunchVariableRegistry.java index 22cc0de08..817de14bf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContextLaunchVariableRegistry.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ContextLaunchVariableRegistry.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.core.variables; import java.util.SortedMap; @@ -21,13 +21,13 @@ import org.eclipse.core.runtime.IPluginRegistry; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.core.DebugPlugin; /** * Registry for context launch variables. * @since 3.0 */ -public class ContextLaunchVariableRegistry { +public class ContextLaunchVariableRegistry implements IContextLaunchVariableRegistry { // Format of the variable extension points // <extension point="org.eclipse.debug.ui.launchConfigurationVariables> // <variable @@ -45,10 +45,8 @@ public class ContextLaunchVariableRegistry { protected static final String TAG_VARIABLE = "variable"; //$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$ - /** * Sorted map of variables where the key is the variable tag * and the value is the corresponding variable. @@ -65,7 +63,7 @@ public class ContextLaunchVariableRegistry { protected String pluginId; public ContextLaunchVariableRegistry() { - this(DebugUIPlugin.getUniqueIdentifier(), IVariableConstants.EXTENSION_POINT_CONTEXT_LAUNCH_VARIABLES); + this(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_CONTEXT_LAUNCH_VARIABLES); } /** @@ -81,27 +79,26 @@ public class ContextLaunchVariableRegistry { * Returns the variable for the specified tag, or * <code>null</code> if none found. */ - protected final IContextLaunchVariable findVariable(String tag) { + private final IContextLaunchVariable findVariable(String tag) { return (IContextLaunchVariable) variables.get(tag); } /** * Returns the number of variables in the registry. */ - public final int getVariableCount() { + private final int getVariableCount() { return variables.size(); } - /** - * Returns the variable for the given tag or <code>null</code> if none. + * @see IContextLaunchVariableRegistry#getVariable(String) */ public IContextLaunchVariable getVariable(String tag) { return findVariable(tag); } /** - * Returns the list of argument variables in the registry. + * @see IContextLaunchVariableRegistry#getVariables() */ public IContextLaunchVariable[] getVariables() { IContextLaunchVariable[] results = new ContextLaunchVariable[getVariableCount()]; @@ -130,15 +127,15 @@ public class ContextLaunchVariableRegistry { boolean valid = true; if (tag == null || tag.length() == 0) { valid = false; - DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Missing tag attribute value for variable element.", null)); //$NON-NLS-1$ + DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, "Missing tag attribute value for variable element.", null)); //$NON-NLS-1$ } if (description == null || description.length() == 0) { valid = false; - DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Missing description attribute value for variable element.", null)); //$NON-NLS-1$ + DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, "Missing description attribute value for variable element.", null)); //$NON-NLS-1$ } if (className == null || className.length() == 0) { valid = false; - DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Missing expander class attribute value for variable element.", null)); //$NON-NLS-1$ + DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, "Missing expander class attribute value for variable element.", null)); //$NON-NLS-1$ } if (valid) @@ -152,7 +149,7 @@ public class ContextLaunchVariableRegistry { /** * Creates a new variable from the specified information. */ - protected IContextLaunchVariable newVariable(String tag, String description, IConfigurationElement element) { + private 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/launchVariables/DefaultVariableExpander.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/DefaultVariableExpander.java index ba46a0093..ca6c5d995 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/DefaultVariableExpander.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/DefaultVariableExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.core.variables; import java.text.MessageFormat; @@ -17,8 +17,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; +import org.eclipse.debug.core.DebugPlugin; /** * Default variable expander implementation. Does nothing. @@ -41,7 +40,7 @@ public class DefaultVariableExpander implements IVariableExpander { * @see IVariableExpander#getResources(String, String, ExpandVariableContext) */ public IResource[] getResources(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$ + throwExpansionException(varTag, MessageFormat.format("No expander class defined for the variable {0}", new String[] {varTag})); return null; } @@ -49,7 +48,7 @@ public class DefaultVariableExpander implements IVariableExpander { * @see IVariableExpander#getText(String, String, ExpandVariableContext) */ public String getText(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$ + throwExpansionException(varTag, MessageFormat.format("No expander class defined for the variable {0}", new String[] {varTag})); return null; } @@ -58,7 +57,7 @@ public class DefaultVariableExpander implements IVariableExpander { * while expanding the given variable tag. */ public static void throwExpansionException(String varTag, String reason) throws CoreException { - throw new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, MessageFormat.format(LaunchConfigurationsMessages.getString("DefaultVariableExpander.An_error_occurred_attempting_to_expand_the_variable_{0}._{1}_4"), new String[] {varTag, reason}), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, MessageFormat.format("An error occurred attempting to expand the variable {0}. {1}", new String[] {varTag, reason}), null)); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ExpandVariableContext.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ExpandVariableContext.java index cac6976e2..d7974407b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ExpandVariableContext.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/ExpandVariableContext.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.core.variables; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextLaunchVariable.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IContextLaunchVariable.java index ab6d56727..efa51e514 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextLaunchVariable.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IContextLaunchVariable.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.core.variables; /** * @since 3.0 @@ -17,12 +17,7 @@ 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(); + public IVariableExpander getExpander(); /** * Returns the variable's description or <code>null</code> if none * is specified. diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IContextLaunchVariableRegistry.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IContextLaunchVariableRegistry.java new file mode 100644 index 000000000..e847f819d --- /dev/null +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IContextLaunchVariableRegistry.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * 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 IContextLaunchVariableRegistry { + /** + * Returns the variable for the given tag or <code>null</code> if none. + */ + public abstract IContextLaunchVariable getVariable(String tag); + /** + * Returns the list of argument variables in the registry. + */ + public abstract IContextLaunchVariable[] getVariables(); +}
\ No newline at end of file diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableExpander.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IVariableExpander.java index 730309287..30343379c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableExpander.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/IVariableExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.core.variables; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableUtil.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/VariableUtil.java index f8787a472..f6c873bf6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableUtil.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/variables/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.launchVariables; +package org.eclipse.debug.core.variables; import java.text.MessageFormat; import java.util.ArrayList; @@ -19,13 +19,11 @@ import java.util.List; import java.util.Map; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; 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 @@ -46,6 +44,13 @@ public class VariableUtil { */ private static final char ARG_DELIMITER = ' '; //$NON-NLS-1$ private static final char ARG_DBL_QUOTE = '"'; //$NON-NLS-1$ + /** + * 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 = DebugPlugin.getUniqueIdentifier() + ".environmentVariables"; //$NON-NLS-1$ /** * Structure to represent a variable definition within a @@ -163,18 +168,19 @@ public class VariableUtil { * Expands all the variables found in the given string. * * @param argument the string whose variables should be expanded - * @param context the context to use for expanding variables + * @param context the context to use for expanding variables or + * <code>null</code> if none. * @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 expandVariables(String argument, MultiStatus status) { + public static String expandVariables(String argument, MultiStatus status, ExpandVariableContext context) { StringBuffer buffer = new StringBuffer(); int start = 0; 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$ + status.merge(newErrorStatus(MessageFormat.format("Invalid variable format: {0}", new String[] {argument.substring(varDef.start)}), null)); return null; } // Copy text between start and variable. @@ -183,12 +189,15 @@ public class VariableUtil { } start = varDef.end; // Look up the context variable if it exists - ContextLaunchVariableRegistry registry = DebugUIPlugin.getDefault().getContextVariableRegistry(); + IContextLaunchVariableRegistry registry = DebugPlugin.getDefault().getContextVariableRegistry(); IContextLaunchVariable contextVariable = registry.getVariable(varDef.name); if (contextVariable != null) { String text = null; + if (context == null) { + context= new ExpandVariableContext(null); + } try { - text= contextVariable.getExpander().getText(varDef.name, varDef.argument, VariableContextManager.getDefault().getVariableContext()); + text= contextVariable.getExpander().getText(varDef.name, varDef.argument, context); } catch (CoreException exception) { status.merge(exception.getStatus()); return null; @@ -198,7 +207,7 @@ public class VariableUtil { // 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$ + status.merge(newErrorStatus(MessageFormat.format("The variable named \"{0}\" does not exist.", new Object[] {varDef.name}), null)); return null; } buffer.append(simpleVariable.getText()); @@ -219,11 +228,12 @@ public class VariableUtil { * Process.exec) in which variable expansion has been performed. * * @param envMap Map of all the environment variables (key=name,value=value) - * @param context the context used to expand the variable + * @param context the context used to expand the variable or <code>null</code> + * if none. * @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, MultiStatus status) { + public static String[] expandEnvironment(Map envMap, MultiStatus status, ExpandVariableContext context) { String[] vars = null; if (envMap != null && envMap.size() > 0) { Map.Entry e; @@ -232,7 +242,7 @@ public class VariableUtil { int i = 0; while (iter.hasNext()) { e = (Map.Entry) iter.next(); - vars[i++] = (String) e.getKey() + '=' + expandVariables((String) e.getValue(), status); + vars[i++] = (String) e.getKey() + '=' + expandVariables((String) e.getValue(), status, context); } } return vars; @@ -251,14 +261,14 @@ public class VariableUtil { * @return the list of individual arguments where some elements in the * list maybe <code>null</code> if problems expanding variable(s). */ - public static String[] expandStrings(String sourceString, MultiStatus status) { + public static String[] expandStrings(String sourceString, MultiStatus status, ExpandVariableContext context) { if (sourceString == null || sourceString.length() == 0) { return new String[0]; } String[] argList = parseStringIntoList(sourceString); for (int i = 0; i < argList.length; i++) { - argList[i] = expandVariables(argList[i], status); + argList[i] = expandVariables(argList[i], status, context); } return argList; @@ -362,22 +372,23 @@ public class VariableUtil { * * @param configuration launch configuration * @param context context used to expand environment variable values + * or <code>null</code> if none * @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); + public static String[] getEnvironment(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { + Map envMap = configuration.getAttribute(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); + MultiStatus status = new MultiStatus(DebugPlugin.getUniqueIdentifier(), 0, "Could not resolve environment.", null); + String[] expandedEnvironment = VariableUtil.expandEnvironment(envMap, status, context); 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)); + String message = MessageFormat.format("Invalid environment specified for the launch configuration named {0}.", new Object[] { configuration.getName()}); + throw new CoreException(newErrorStatus(message, null)); } } else { throw new CoreException(status); @@ -385,5 +396,9 @@ public class VariableUtil { } return null; } + + public static IStatus newErrorStatus(String message, Throwable exception) { + return new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, message, exception); + } } 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 index fd9b90ed2..d76670d7f 100644 --- 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 @@ -143,7 +143,7 @@ public class SimpleVariableRegistry implements ISimpleVariableRegistry { 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$ + DebugPlugin.logMessage(MessageFormat.format("Failed to load launch variable initializer: {0}", new String[] {element.getAttribute(ATTR_INITIALIZER_CLASS)}), e); //$NON-NLS-1$ } } String initialValue= element.getAttribute(ATTR_INITIAL_VALUE); diff --git a/org.eclipse.debug.core/plugin.properties b/org.eclipse.debug.core/plugin.properties index 082258cef..2b7fc17b2 100644 --- a/org.eclipse.debug.core/plugin.properties +++ b/org.eclipse.debug.core/plugin.properties @@ -19,4 +19,5 @@ statusHandlerExtensionPointName=Status Handler sourceLocatorsExtensionPointName=Source Locator launchModesExtensionPointName=Launch Modes launchDelegatesExtensionPointName=Launch Delegates -simpleLaunchVariablesName=Simple Launch Configuration Variables
\ No newline at end of file +simpleLaunchVariablesName=Simple Launch Configuration Variables +contextLaunchVariablesName=Context Launch Variables
\ No newline at end of file diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml index c8b1a5fd6..cdc6e1c0c 100644 --- a/org.eclipse.debug.core/plugin.xml +++ b/org.eclipse.debug.core/plugin.xml @@ -28,6 +28,7 @@ <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"/> + <extension-point id="contextLaunchVariables" name="%contextLaunchVariablesName" scheme="schema/contextLaunchVariables.exsd"/> <!-- Extensions --> <extension diff --git a/org.eclipse.debug.ui/schema/contextLaunchVariables.exsd b/org.eclipse.debug.core/schema/contextLaunchVariables.exsd index 6885b8299..563a14d21 100644 --- a/org.eclipse.debug.ui/schema/contextLaunchVariables.exsd +++ b/org.eclipse.debug.core/schema/contextLaunchVariables.exsd @@ -54,20 +54,13 @@ </documentation> </annotation> </attribute> - <attribute name="description" type="string"> + <attribute name="description" type="string" use="required"> <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> diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 7a3602119..195a078b1 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 -ContextLaunchVariablesName=Context Launch Variables +LaunchVariableComponentsName=Launch Variable Components LaunchConfigurationTypeImageExtensionName=Launch Configuration Type Image LaunchConfigurationTypePropertyPage.name=Launch Configuration Type LaunchConfigurationTypesPreferencePage.name=Launch Configuration Types diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 5b5b66d16..9b138eb73 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -30,8 +30,8 @@ <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="contextLaunchVariables" name="%ContextLaunchVariablesName" scheme="schema/contextLaunchVariables.exsd"/> <extension-point id="variablesContentProviders" name="%VariablesContentProvidersName"/> + <extension-point id="launchVariableComponents" name="%LaunchVariableComponentsName"/> <!-- Extensions --> <extension @@ -1194,73 +1194,82 @@ </keyBinding> </extension> <!-- Context Variable Extensions --> + <extension + point="org.eclipse.debug.ui.launchVariableComponents"> + <component + variableName="resource_path" + componentClass="org.eclipse.debug.ui.launchVariables.components.SpecificFileResourceComponent"> + </component> + <component + variableName="resource_loc" + componentClass="org.eclipse.debug.ui.launchVariables.components.SpecificFileResourceComponent"> + </component> + </extension> <extension - point="org.eclipse.debug.ui.contextLaunchVariables"> + point="org.eclipse.debug.core.contextLaunchVariables"> <variable name="workspace_loc" - expanderClass="org.eclipse.debug.ui.launchVariables.WorkspaceExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.WorkspaceExpander" description="%workspace_loc.description"> </variable> <variable name="project_loc" - expanderClass="org.eclipse.debug.ui.launchVariables.ProjectExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ProjectExpander" description="%project_loc.description"> </variable> <variable name="project_path" - expanderClass="org.eclipse.debug.ui.launchVariables.ProjectExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ProjectExpander" description="%project_path.description"> </variable> <variable name="project_name" - expanderClass="org.eclipse.debug.ui.launchVariables.ProjectNameExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ProjectNameExpander" description="%project_name.description"> </variable> <variable name="resource_loc" - componentClass="org.eclipse.debug.ui.launchVariables.SpecificFileResourceComponent" - expanderClass="org.eclipse.debug.ui.launchVariables.ResourceExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ResourceExpander" description="%resource_loc.description"> </variable> <variable name="resource_path" - componentClass="org.eclipse.debug.ui.launchVariables.SpecificFileResourceComponent" - expanderClass="org.eclipse.debug.ui.launchVariables.ResourceExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ResourceExpander" description="%resource_path.description"> </variable> <variable name="resource_name" - expanderClass="org.eclipse.debug.ui.launchVariables.ResourceNameExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ResourceNameExpander" description="%resource_name.description"> </variable> <variable name="container_loc" - expanderClass="org.eclipse.debug.ui.launchVariables.ContainerExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ContainerExpander" description="%container_loc.description"> </variable> <variable name="container_path" - expanderClass="org.eclipse.debug.ui.launchVariables.ContainerExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ContainerExpander" description="%container_path.description"> </variable> <variable name="container_name" - expanderClass="org.eclipse.debug.ui.launchVariables.ContainerNameExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ContainerNameExpander" description="%container_name.description"> </variable> <variable name="string_prompt" - expanderClass="org.eclipse.debug.ui.launchVariables.StringPromptExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.StringPromptExpander" description="%string_prompt.description"> </variable> <variable name="file_prompt" - expanderClass="org.eclipse.debug.ui.launchVariables.FilePromptExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.FilePromptExpander" description="%file_prompt.description"> </variable> <variable name="folder_prompt" - expanderClass="org.eclipse.debug.ui.launchVariables.FolderPromptExpander" + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.FolderPromptExpander" description="%folder_prompt.description"> </variable> </extension> 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 2225775ae..af814ab8c 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 @@ -43,13 +43,14 @@ import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; import org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager; +import org.eclipse.debug.internal.ui.launchVariables.ContextVariableComponentManager; import org.eclipse.debug.internal.ui.preferences.DebugActionGroupsManager; import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; 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.launchVariables.ContextLaunchVariableRegistry; +import org.eclipse.debug.ui.launchVariables.IContextVariableComponentManager; import org.eclipse.debug.ui.launchVariables.VariableContextManager; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; @@ -118,10 +119,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { private VariablesContentProviderManager fVariablesContentProviderManager; - /** - * Collection of launch configuration variables - */ - private ContextLaunchVariableRegistry contextLaunchVariableRegistry; + private ContextVariableComponentManager fVariableComponentManager; /** * Returns whether the debug UI plug-in is in trace @@ -165,6 +163,13 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { return fVariablesContentProviderManager; } + public IContextVariableComponentManager getVariableComponentManager() { + if (fVariableComponentManager == null) { + fVariableComponentManager = new ContextVariableComponentManager(); + } + return fVariableComponentManager; + } + /** * Returns the singleton instance of the debug plugin. */ @@ -198,16 +203,6 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { } return fLaunchConfigurationManager; } - - /** - * Returns the registry of context launch variables. - */ - public ContextLaunchVariableRegistry getContextVariableRegistry() { - if (contextLaunchVariableRegistry == null) { - contextLaunchVariableRegistry = new ContextLaunchVariableRegistry(); - } - return contextLaunchVariableRegistry; - } public static IWorkbenchWindow getActiveWorkbenchWindow() { return getDefault().getWorkbench().getActiveWorkbenchWindow(); 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 05abf2a34..fc39440b1 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 @@ -129,15 +129,7 @@ WorkingSetExpander.2=Unable to restore working set - no factory ID. WorkingSetExpander.3=Unable to restore working set - cannot instantiate factory: WorkingSetExpander.4=Unable to restore working set - cannot instantiate working set: WorkingSetExpander.5=Unable to restore working set - element is not an IWorkingSet: -DefaultVariableExpander.No_expander_class_defined_for_the_variable_{0}_1=No expander class defined for the variable {0} -DefaultVariableExpander.An_error_occurred_attempting_to_expand_the_variable_{0}._{1}_4=An error occurred attempting to expand the variable {0}. {1} ProjectNameExpander.No_resource_selected._1=No resource selected. -VariableUtil.Invalid_variable_format__{0}_1=Invalid variable format: {0} -VariableUtil.The_variable_named_____{0}_____does_not_exist._2=The variable named \'\'{0}\'\' does not exist. -VariableUtil.Invalid_variable_format__{0}_3=Invalid variable format: {0} -VariableUtil.The_variable_named_____{0}_____does_not_exist._4=The variable named \'\'{0}\'\' does not exist. 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/launchVariables/ContextVariableComponentManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchVariables/ContextVariableComponentManager.java new file mode 100644 index 000000000..239d36237 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchVariables/ContextVariableComponentManager.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.internal.ui.launchVariables; + +import java.text.MessageFormat; +import java.util.HashMap; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.launchVariables.IVariableComponent; +import org.eclipse.debug.ui.launchVariables.IContextVariableComponentManager; + +public class ContextVariableComponentManager implements IContextVariableComponentManager { + + private HashMap fVariableMap= new HashMap(); + private static final IVariableComponent defaultComponent = new DefaultVariableComponent(false); + + private static final String ELEMENT_COMPONENT= "component"; //$NON-NLS-1$ + private static final String ATTR_VARIABLE_NAME= "variableName"; //$NON-NLS-1$ + private static final String ATTR_COMPONENT_CLASS= "componentClass"; //$NON-NLS-1$ + + public ContextVariableComponentManager() { + loadComponentExtensions(); + } + + public IVariableComponent getComponent(String variableName) { + Object object= fVariableMap.get(variableName); + IVariableComponent component= defaultComponent; + if (object instanceof IVariableComponent) { + component= (IVariableComponent) object; + } else if (object instanceof IConfigurationElement) { + IConfigurationElement element= (IConfigurationElement) object; + if (element.getAttribute(ATTR_COMPONENT_CLASS) != null) { + try { + component= (IVariableComponent) element.createExecutableExtension(ATTR_COMPONENT_CLASS); + } catch (CoreException e) { + component= new DefaultVariableComponent(true); + DebugUIPlugin.log(DebugUIPlugin.newErrorStatus(MessageFormat.format("Failed to load variable component for {0}", new String[] {element.getAttribute(ATTR_VARIABLE_NAME)}), e)); //$NON-NLS-1$ + } + } + fVariableMap.put(variableName, component); + } + return component; + } + + public void loadComponentExtensions() { + IExtensionPoint point= DebugUIPlugin.getDefault().getDescriptor().getExtensionPoint(IDebugUIConstants.EXTENSION_POINT_LAUNCH_VARIABLE_COMPONENTS); + IConfigurationElement elements[]= point.getConfigurationElements(); + for (int i = 0; i < elements.length; i++) { + IConfigurationElement element = elements[i]; + if (!element.getName().equals(ELEMENT_COMPONENT)) { + DebugUIPlugin.logErrorMessage(MessageFormat.format("Invalid variable component extension found: {0}", new String[] {element.getDeclaringExtension().getLabel()})); //$NON-NLS-1$ + continue; + } + String variableName= element.getAttribute(ATTR_VARIABLE_NAME); + if (variableName == null) { + DebugUIPlugin.logErrorMessage(MessageFormat.format("Invalid variable component extension found: {0}", new String[] {element.getDeclaringExtension().getLabel()})); //$NON-NLS-1$ + continue; + } + if (element.getAttribute(ATTR_COMPONENT_CLASS) == null) { + DebugUIPlugin.logErrorMessage(MessageFormat.format("Invalid variable component extension found. No component specified for {0}", new String[] {variableName})); //$NON-NLS-1$ + continue; + } + fVariableMap.put(variableName, element); + } + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchVariables/DefaultVariableComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchVariables/DefaultVariableComponent.java new file mode 100644 index 000000000..8df92dcb4 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchVariables/DefaultVariableComponent.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * 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.launchVariables; + +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; +import org.eclipse.debug.ui.launchVariables.IVariableComponentContainer; +import org.eclipse.debug.ui.launchVariables.components.AbstractVariableComponent; +import org.eclipse.jface.resource.JFaceColors; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; + +/** + * Default variable component implementation which does not + * allow variable value editing visually. + */ +final class DefaultVariableComponent extends AbstractVariableComponent { + private boolean showError = false; + private Label message = null; + + public DefaultVariableComponent(boolean showError) { + super(); + this.showError = showError; + } + + /* (non-Javadoc) + * Method declared on IVariableComponent. + */ + public Control getControl() { + return message; + } + + /* (non-Javadoc) + * Method declared on IVariableComponent. + */ + public void createContents(Composite parent, String varTag, IVariableComponentContainer page) { + container= page; + if (showError) { + message = new Label(parent, SWT.NONE); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + message.setLayoutData(data); + message.setFont(parent.getFont()); + message.setText(LaunchConfigurationsMessages.getString("LaunchConfigurationVariable.Problem_displaying_UI")); //$NON-NLS-1$ + message.setForeground(JFaceColors.getErrorText(message.getDisplay())); + } + } +}
\ No newline at end of file diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java index 03aca0d37..7da1c8f0f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.variables.VariableUtil; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; import org.eclipse.jface.viewers.ColumnLayoutData; @@ -117,7 +118,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { ILaunchConfiguration config = (ILaunchConfiguration) inputElement; Map m; try { - m = config.getAttribute(IDebugUIConstants.ATTR_ENVIRONMENT_VARIABLES, (Map) null); + m = config.getAttribute(VariableUtil.ATTR_ENVIRONMENT_VARIABLES, (Map) null); } catch (CoreException e) { DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Error reading configuration", e)); //$NON-NLS-1$ return elements; @@ -359,9 +360,9 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { map.put(var.getName(), var.getValue()); } if (map.size() == 0) { - configuration.setAttribute(IDebugUIConstants.ATTR_ENVIRONMENT_VARIABLES, (Map) null); + configuration.setAttribute(VariableUtil.ATTR_ENVIRONMENT_VARIABLES, (Map) null); } else { - configuration.setAttribute(IDebugUIConstants.ATTR_ENVIRONMENT_VARIABLES, map); + configuration.setAttribute(VariableUtil.ATTR_ENVIRONMENT_VARIABLES, map); } } 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 dfde75b3a..b8d63f457 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 @@ -769,6 +769,14 @@ public interface IDebugUIConstants { * * @since 3.0 */ - public static final String EXTENSION_POINT_VARIABLES_CONTENT_PROVIDERS = "variablesContentProviders"; //$NON-NLS-1$ + public static final String EXTENSION_POINT_VARIABLES_CONTENT_PROVIDERS = "variablesContentProviders"; //$NON-NLS-1$ + + /** + * Launch variable components extension point identifier (value + * <code>"launchVariableComponents"</code>). The launch variable + * components extension point specifies an <code>IVariableComponent</code> + * for an <code>IContextLaunchVariable</code>. + */ + public static final String EXTENSION_POINT_LAUNCH_VARIABLE_COMPONENTS = "launchVariableComponents"; //$NON-NLS-1$ } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextVariableComponentManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextVariableComponentManager.java new file mode 100644 index 000000000..7244e93ef --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IContextVariableComponentManager.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * 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; + +public interface IContextVariableComponentManager { + public IVariableComponent getComponent(String variableName); +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableConstants.java index 9eb4fc1cf..bfa21a8f6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/IVariableConstants.java @@ -76,11 +76,6 @@ 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>contextLaunchVariables</code>). - */ - public static final String EXTENSION_POINT_CONTEXT_LAUNCH_VARIABLES = "contextLaunchVariables"; //$NON-NLS-1$ - /** * XML tag used to designate the root of the persisted IWorkingSet */ public static final String TAG_LAUNCH_CONFIGURATION_WORKING_SET= "launchConfigurationWorkingSet"; //$NON-NLS-1$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/LaunchConfigurationVariableForm.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/LaunchConfigurationVariableForm.java index 63ba55d4d..a6430a971 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/LaunchConfigurationVariableForm.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/LaunchConfigurationVariableForm.java @@ -11,6 +11,8 @@ package org.eclipse.debug.ui.launchVariables; +import org.eclipse.debug.core.variables.*; +import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.KeyAdapter; @@ -159,9 +161,10 @@ public class LaunchConfigurationVariableForm { * can be layout properly. */ private void createVariableComponents() { + IContextVariableComponentManager manager = DebugUIPlugin.getDefault().getVariableComponentManager(); for (int i = 0; i < variables.length; i++) { IContextLaunchVariable var = variables[i]; - components[i] = var.getComponent(); + components[i] = manager.getComponent(var.getName()); components[i].createContents(variableComposite, var.getName(), dialogPage); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableContextManager.java index b61bd4692..133d4eaae 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableContextManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableContextManager.java @@ -12,6 +12,7 @@ package org.eclipse.debug.ui.launchVariables; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.debug.core.variables.*; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IEditorInput; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableSelectionDialog.java index f888f64d0..bc401bbc0 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableSelectionDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/VariableSelectionDialog.java @@ -10,7 +10,8 @@ *******************************************************************************/ package org.eclipse.debug.ui.launchVariables; -import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.variables.IContextLaunchVariable; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; import org.eclipse.jface.dialogs.IMessageProvider; @@ -44,7 +45,7 @@ public class VariableSelectionDialog extends SelectionDialog { protected Control createDialogArea(Composite parent) { // Create the dialog area Composite composite= (Composite)super.createDialogArea(parent); - IContextLaunchVariable[] variables= DebugUIPlugin.getDefault().getContextVariableRegistry().getVariables(); + IContextLaunchVariable[] variables= DebugPlugin.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/launchVariables/AbstractVariableComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/AbstractVariableComponent.java index 4a1fcaf51..de11b7574 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/AbstractVariableComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/AbstractVariableComponent.java @@ -8,8 +8,11 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.components; +import org.eclipse.debug.core.variables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.IVariableComponent; +import org.eclipse.debug.ui.launchVariables.IVariableComponentContainer; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/ResourceComponent.java index 002d6359d..470a4f18e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/ResourceComponent.java @@ -8,12 +8,13 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.components; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; +import org.eclipse.debug.ui.launchVariables.IVariableComponentContainer; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFileResourceComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/SpecificFileResourceComponent.java index 2fe0b69ec..9f8fdcc8c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFileResourceComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/SpecificFileResourceComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.components; import org.eclipse.core.resources.IResource; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFolderResourceComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/SpecificFolderResourceComponent.java index 7da720ae7..3e2667a8b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/SpecificFolderResourceComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/SpecificFolderResourceComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.components; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkingSetComponent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/WorkingSetComponent.java index 44340ec3c..853edd3d0 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkingSetComponent.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/components/WorkingSetComponent.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.components; import java.io.IOException; import java.io.StringWriter; @@ -16,6 +16,9 @@ import java.io.StringWriter; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; +import org.eclipse.debug.ui.launchVariables.IVariableComponentContainer; +import org.eclipse.debug.ui.launchVariables.IVariableConstants; +import org.eclipse.debug.ui.launchVariables.expanders.*; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.wizard.WizardDialog; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ContainerExpander.java index 9c5d6e836..a855b80a2 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ContainerExpander.java @@ -8,10 +8,11 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import org.eclipse.core.resources.IResource; +import org.eclipse.debug.core.variables.ExpandVariableContext; /** * Expands a resource's container type variable into the desired diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerNameExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ContainerNameExpander.java index 32888c66c..496bbb6bf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ContainerNameExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ContainerNameExpander.java @@ -8,12 +8,14 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.variables.*; +import org.eclipse.debug.core.variables.ExpandVariableContext; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/FilePromptExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/FilePromptExpander.java index e43a04bf4..f37d330a7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/FilePromptExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/FilePromptExpander.java @@ -9,7 +9,7 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; 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/launchVariables/FolderPromptExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/FolderPromptExpander.java index 15b1f5f19..1cec82386 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/FolderPromptExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/FolderPromptExpander.java @@ -9,7 +9,7 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; 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/ProjectExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ProjectExpander.java index 332e4e824..eef0be9bd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ProjectExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ProjectExpander.java @@ -8,10 +8,11 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import org.eclipse.core.resources.IResource; +import org.eclipse.debug.core.variables.ExpandVariableContext; /** * Expands a resource's project type variable into the desired diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ProjectNameExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ProjectNameExpander.java index f21234d45..1730c86ed 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ProjectNameExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ProjectNameExpander.java @@ -8,11 +8,13 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.variables.*; +import org.eclipse.debug.core.variables.ExpandVariableContext; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/PromptExpanderBase.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/PromptExpanderBase.java index 0e4a4fba9..45c09ab9a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/PromptExpanderBase.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/PromptExpanderBase.java @@ -9,11 +9,13 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import java.text.MessageFormat; import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.variables.*; +import org.eclipse.debug.core.variables.ExpandVariableContext; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ResourceExpander.java index 56ad1bd8a..a05bcd801 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ResourceExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import org.eclipse.core.resources.IResource; @@ -16,7 +16,10 @@ import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; +import org.eclipse.debug.core.variables.*; +import org.eclipse.debug.core.variables.ExpandVariableContext; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; +import org.eclipse.debug.ui.launchVariables.IVariableConstants; /** * Expands a resource type variable into the desired diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceNameExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ResourceNameExpander.java index f680575ee..7a9d367a0 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/ResourceNameExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/ResourceNameExpander.java @@ -8,10 +8,12 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.variables.*; +import org.eclipse.debug.core.variables.ExpandVariableContext; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/StringPromptExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/StringPromptExpander.java index 187595a6e..0effbf36d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/StringPromptExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/StringPromptExpander.java @@ -9,7 +9,7 @@ * Matt Conway - initial implementation * IBM Corporation - integration and code cleanup *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; 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/launchVariables/WorkingSetExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/WorkingSetExpander.java index f7235aaa8..11cd85c13 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkingSetExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/WorkingSetExpander.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import java.io.StringReader; import java.text.MessageFormat; @@ -16,8 +16,11 @@ import java.text.MessageFormat; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.debug.core.variables.*; +import org.eclipse.debug.core.variables.ExpandVariableContext; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsMessages; +import org.eclipse.debug.ui.launchVariables.IVariableConstants; import org.eclipse.ui.IElementFactory; import org.eclipse.ui.IWorkingSet; import org.eclipse.ui.WorkbenchException; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkspaceExpander.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/WorkspaceExpander.java index 15dfce7e1..818122903 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/WorkspaceExpander.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/launchVariables/expanders/WorkspaceExpander.java @@ -8,10 +8,11 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.debug.ui.launchVariables; +package org.eclipse.debug.ui.launchVariables.expanders; import org.eclipse.core.resources.IResource; +import org.eclipse.debug.core.variables.ExpandVariableContext; /** * Expands a workspace variable into the desired 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 5f85f57a5..f66bd692f 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 @@ -15,10 +15,10 @@ import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.variables.VariableUtil; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.debug.ui.launchVariables.IVariableComponentContainer; -import org.eclipse.debug.ui.launchVariables.VariableUtil; -import org.eclipse.debug.ui.launchVariables.WorkingSetComponent; +import org.eclipse.debug.ui.launchVariables.components.WorkingSetComponent; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; 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 03bb5ff0d..2da085c34 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 @@ -21,13 +21,12 @@ 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.IContextLaunchVariableRegistry; import org.eclipse.debug.core.variables.ISimpleVariableRegistry; -import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.core.variables.VariableUtil; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; 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; @@ -444,7 +443,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa if (variable.name == null || variable.name.length() == 0) { return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.No_variable_specified"); //$NON-NLS-1$ } - ContextLaunchVariableRegistry contextVariableRegistry = DebugUIPlugin.getDefault().getContextVariableRegistry(); + IContextLaunchVariableRegistry contextVariableRegistry = DebugPlugin.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$ 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 fe38eb911..9e0684cbc 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 @@ -14,11 +14,11 @@ package org.eclipse.ui.externaltools.internal.launchConfigurations; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.variables.IContextLaunchVariable; +import org.eclipse.debug.core.variables.VariableUtil; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -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; 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 727329968..a71786a43 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,9 +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.launchVariables.IContextLaunchVariable; +import org.eclipse.debug.core.variables.IContextLaunchVariable; +import org.eclipse.debug.core.variables.VariableUtil; 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; @@ -82,7 +82,7 @@ public class ExternalToolsUtil { 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.expandVariables(location, status); + String expandedLocation = VariableUtil.expandVariables(location, status, VariableContextManager.getDefault().getVariableContext()); 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$ @@ -137,7 +137,7 @@ public class ExternalToolsUtil { 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.expandVariables(location, status); + String expandedLocation = VariableUtil.expandVariables(location, status, VariableContextManager.getDefault().getVariableContext()); if (status.isOK()) { if (expandedLocation != null && expandedLocation.length() > 0) { File path = new File(expandedLocation); @@ -171,7 +171,7 @@ public class ExternalToolsUtil { 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.expandStrings(args, status); + String[] expandedArgs = VariableUtil.expandStrings(args, status, VariableContextManager.getDefault().getVariableContext()); if (status.isOK()) { return expandedArgs; } else { 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 dc44ea47f..14b6f66ee 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.core.variables.VariableUtil; import org.eclipse.debug.ui.launchVariables.IVariableConstants; -import org.eclipse.debug.ui.launchVariables.VariableUtil; import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; /** 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 8fee23eeb..34e107161 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.launchVariables.DefaultVariableExpander; -import org.eclipse.debug.ui.launchVariables.ExpandVariableContext; +import org.eclipse.debug.core.variables.DefaultVariableExpander; +import org.eclipse.debug.core.variables.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 6a94c9308..a984ef386 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,7 +10,7 @@ *******************************************************************************/ package org.eclipse.ui.externaltools.internal.variables; -import org.eclipse.debug.ui.launchVariables.ContextLaunchVariableRegistry; +import org.eclipse.debug.core.variables.ContextLaunchVariableRegistry; import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; /** 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 3ed2c2c42..c9c88a08d 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,7 +26,8 @@ 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.debug.core.variables.VariableUtil; +import org.eclipse.debug.ui.launchVariables.VariableContextManager; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.IWindowListener; import org.eclipse.ui.IWorkbenchWindow; @@ -135,7 +136,7 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate { return; } - String[] envp = VariableUtil.getEnvironment(configuration); + String[] envp = VariableUtil.getEnvironment(configuration, VariableContextManager.getDefault().getVariableContext()); if (monitor.isCanceled()) { return; 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 bb02d3952..73f87958f 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.core.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 db9f00cd2..01bec7694 100644 --- a/org.eclipse.ui.externaltools/plugin.xml +++ b/org.eclipse.ui.externaltools/plugin.xml @@ -200,31 +200,39 @@ <variable name="workspace" description="%workspace.description" - expanderClass="org.eclipse.debug.ui.launchVariables.WorkspaceExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.WorkspaceExpander"> </variable> <variable name="project" description="%project.description" - expanderClass="org.eclipse.debug.ui.launchVariables.ProjectExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ProjectExpander"> </variable> <variable name="container" description="%container.description" - expanderClass="org.eclipse.debug.ui.launchVariables.ContainerExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ContainerExpander"> </variable> <variable name="resource" description="%resource.description" - componentClass="org.eclipse.debug.ui.launchVariables.ResourceComponent" - expanderClass="org.eclipse.debug.ui.launchVariables.ResourceExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.ResourceExpander"> </variable> <variable name="working_set" description="%working_set.description" - componentClass="org.eclipse.debug.ui.launchVariables.WorkingSetComponent" - expanderClass="org.eclipse.debug.ui.launchVariables.WorkingSetExpander"> + expanderClass="org.eclipse.debug.ui.launchVariables.expanders.WorkingSetExpander"> </variable> </extension> + <extension point="org.eclipse.debug.ui.launchVariableComponents"> + <component + variableName="resource" + componentClass="org.eclipse.debug.ui.launchVariables.components.ResourceComponent"> + </component> + <component + variableName="working_set" + componentClass="org.eclipse.debug.ui.launchVariables.components.WorkingSetComponent"> + </component> + </extension> <extension point = "org.eclipse.debug.core.launchConfigurationComparators"> <launchConfigurationComparator |