Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2004-05-05 14:56:45 +0000
committerDarin Wright2004-05-05 14:56:45 +0000
commitb958572b41e8207612364baac67e1a957546e59a (patch)
treead5b613cd6fc66510295f82c30e7c815a0b8d8f3 /org.eclipse.core.variables/src
parent16100a5e5022863cffac0123dc61c0921039d330 (diff)
downloadeclipse.platform.debug-b958572b41e8207612364baac67e1a957546e59a.tar.gz
eclipse.platform.debug-b958572b41e8207612364baac67e1a957546e59a.tar.xz
eclipse.platform.debug-b958572b41e8207612364baac67e1a957546e59a.zip
Bug 57333 - Provide API to specify whether a substitution variable supports arguments
Diffstat (limited to 'org.eclipse.core.variables/src')
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java15
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties1
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java13
3 files changed, 26 insertions, 3 deletions
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java
index bf16e73a8..e897fc555 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java
@@ -11,7 +11,6 @@
package org.eclipse.core.internal.variables;
import java.text.MessageFormat;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
@@ -34,6 +33,12 @@ public class DynamicVariable extends StringVariable implements IDynamicVariable
* @see org.eclipse.debug.internal.core.stringsubstitution.IContextVariable#getValue(java.lang.String)
*/
public String getValue(String argument) throws CoreException {
+ if (!supportsArgument()) {
+ // check for an argument - not supported
+ if (argument != null && argument.length() > 0) {
+ throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, MessageFormat.format(VariablesMessages.getString("DynamicVariable.0"), new String[]{argument, getName()}), null)); //$NON-NLS-1$
+ }
+ }
if (fResolver == null) {
String name = getConfigurationElement().getAttribute("resolver"); //$NON-NLS-1$
if (name == null) {
@@ -60,4 +65,12 @@ public class DynamicVariable extends StringVariable implements IDynamicVariable
super(name, description, configurationElement);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.core.variables.IDynamicVariable#supportsArgument()
+ */
+ public boolean supportsArgument() {
+ String arg = getConfigurationElement().getAttribute("supportsArgument"); //$NON-NLS-1$
+ return arg == null || arg.equals("true"); //$NON-NLS-1$
+ }
+
}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties
index 35e75ac06..7113d132a 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties
@@ -15,3 +15,4 @@ StringSubstitutionEngine.4=Variable {0} does not accept arguments
StringVariableManager.26=Variables with the specified names are already registered.
StringVariableManager.27=Variable named {0} already registered
+DynamicVariable.0=Unsupported argument {0} specified for variable {1}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java
index a78704bf1..5614d911d 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java
@@ -22,8 +22,9 @@ import org.eclipse.core.runtime.CoreException;
* <extension point="org.eclipse.core.variables.dynamicVariables">
* <variable
* name="resource_name"
- * expanderClass="com.example.ResourceNameExpander"
- * description="The name of the selected resource">
+ * resolver="com.example.ResourceNameResolver"
+ * description="The name of the selected resource"
+ * supportsArgument="false">
* </variable>
* </extension>
* </pre>
@@ -44,4 +45,12 @@ public interface IDynamicVariable extends IStringVariable {
* @throws CoreException if unable to resolve a value for this variable
*/
public String getValue(String argument) throws CoreException;
+
+ /**
+ * Returns whether this variable supports an argument, as specified
+ * by this variable's extension definition in plug-in XML.
+ *
+ * @return whether this variable supports an argument
+ */
+ public boolean supportsArgument();
}

Back to the top