diff options
author | Mike Rennie | 2013-07-31 16:44:16 +0000 |
---|---|---|
committer | Mike Rennie | 2013-07-31 16:44:16 +0000 |
commit | d975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch) | |
tree | c7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.core.variables | |
parent | 4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff) | |
download | eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.gz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.xz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.zip |
Bug 352626 - Move platform debug to Java 1.6 BREE
Diffstat (limited to 'org.eclipse.core.variables')
11 files changed, 233 insertions, 200 deletions
diff --git a/org.eclipse.core.variables/.classpath b/org.eclipse.core.variables/.classpath index ce7393340..ad32c83a7 100644 --- a/org.eclipse.core.variables/.classpath +++ b/org.eclipse.core.variables/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs index 5d7a22fe3..74c3aeb02 100644 --- a/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs @@ -14,17 +14,17 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning @@ -33,9 +33,9 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=error org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore @@ -53,10 +53,10 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public @@ -65,7 +65,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore @@ -78,11 +78,11 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=error org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore @@ -91,18 +91,18 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning @@ -119,9 +119,9 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING diff --git a/org.eclipse.core.variables/META-INF/MANIFEST.MF b/org.eclipse.core.variables/META-INF/MANIFEST.MF index feba5d297..31a058637 100644 --- a/org.eclipse.core.variables/META-INF/MANIFEST.MF +++ b/org.eclipse.core.variables/META-INF/MANIFEST.MF @@ -10,4 +10,4 @@ Export-Package: org.eclipse.core.internal.variables;x-internal:=true, org.eclipse.core.variables Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/org.eclipse.core.variables/build.properties b/org.eclipse.core.variables/build.properties index 87f2d7f26..6795a29e7 100644 --- a/org.eclipse.core.variables/build.properties +++ b/org.eclipse.core.variables/build.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2012 IBM Corporation and others. +# Copyright (c) 2000, 2013 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java index f53bf67e1..386426a94 100644 --- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java +++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,27 +21,27 @@ import org.eclipse.osgi.util.NLS; * Implementation of a value variable. */ public class ContributedValueVariable extends StringVariable implements IValueVariable { - + /** - * Variable value or <code>null</code> if none + * Variable value or <code>null</code> if none */ private String fValue; - + /** * Whether this variable's value has been initialized */ private boolean fInitialized = false; - + /** * Whether this variable is read only. If true, users cannot change the value. */ private boolean fReadOnly; - + /** * Constructs a new value variable with the given name, description, read only * property and associated configuration element. The value will be initialized * from the configuration element the first time getValue() is called. - * + * * @param name variable name * @param description variable description or <code>null</code> * @param readOnly whether the variable should be a read only variable @@ -51,10 +51,11 @@ public class ContributedValueVariable extends StringVariable implements IValueVa super(name, description, configurationElement); fReadOnly = readOnly; } - + /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#setValue(java.lang.String) */ + @Override public void setValue(String value) { if (!isReadOnly() || !isInitialized()){ fValue = value; @@ -62,10 +63,11 @@ public class ContributedValueVariable extends StringVariable implements IValueVa StringVariableManager.getDefault().notifyChanged(this); } } - + /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#getValue() */ + @Override public String getValue() { if (!isInitialized()) { initialize(); @@ -111,14 +113,14 @@ public class ContributedValueVariable extends StringVariable implements IValueVa * <li>its configuration element's initializer</li> * </ul> * @return whether this variable has been initialized with a value - */ + */ protected boolean isInitialized() { return fInitialized; - } - + } + /** * Sets whether this variable has been initialized with a value. - * + * * @param initialized whether this variable has been initialized */ protected void setInitialized(boolean initialized) { @@ -128,6 +130,7 @@ public class ContributedValueVariable extends StringVariable implements IValueVa /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#isReadOnly() */ + @Override public boolean isReadOnly() { return fReadOnly; } @@ -135,6 +138,7 @@ public class ContributedValueVariable extends StringVariable implements IValueVa /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#isContributed() */ + @Override public boolean isContributed() { return getConfigurationElement() != null; } 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 8f18a3ad1..ef6783fa9 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 @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -23,7 +23,7 @@ import org.eclipse.osgi.util.NLS; * Dynamic variable */ public class DynamicVariable extends StringVariable implements IDynamicVariable { - + /** * Resolver, or <code>null</code> until needed */ @@ -32,11 +32,12 @@ public class DynamicVariable extends StringVariable implements IDynamicVariable /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IContextVariable#getValue(java.lang.String) */ + @Override 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, NLS.bind(VariablesMessages.DynamicVariable_0, new String[]{argument, getName()}), null)); + throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.DynamicVariable_0, new String[]{argument, getName()}), null)); } } if (fResolver == null) { @@ -60,7 +61,7 @@ public class DynamicVariable extends StringVariable implements IDynamicVariable /** * Constructs a new context variable. - * + * * @param name variable name * @param description variable description or <code>null</code> * @param configurationElement configuration element @@ -72,9 +73,10 @@ public class DynamicVariable extends StringVariable implements IDynamicVariable /* (non-Javadoc) * @see org.eclipse.core.variables.IDynamicVariable#supportsArgument() */ + @Override public boolean supportsArgument() { String arg = getConfigurationElement().getAttribute("supportsArgument"); //$NON-NLS-1$ return arg == null || Boolean.valueOf(arg).booleanValue(); } - + } diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java index ac5e100d8..b8e0bb3ae 100644 --- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java +++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2006, 2013 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Bjorn Freeman-Benson - initial API and implementation @@ -23,17 +23,18 @@ import org.eclipse.osgi.service.datalocation.Location; /** * Resolver for ${eclipse_home} - * + * * @since 3.2 */ public class EclipseHomeVariableResolver implements IDynamicVariableResolver { - public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { + @Override + public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { Location installLocation = Platform.getInstallLocation(); if (installLocation != null) { URL url = installLocation.getURL(); if (url != null) { - + // Try to convert the URL to an OS string, to be consistent with // how other variables, like ${workspace_loc} resolve. See // ResourceResolver.translateToValue(). [bugzilla 263535] diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java index 07e8c1769..ce098e850 100644 --- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java +++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -12,9 +12,9 @@ package org.eclipse.core.internal.variables; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Stack; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -28,52 +28,52 @@ import org.eclipse.osgi.util.NLS; * Performs string substitution for context and value variables. */ public class StringSubstitutionEngine { - + // delimiters private static final String VARIABLE_START = "${"; //$NON-NLS-1$ - private static final char VARIABLE_END = '}'; - private static final char VARIABLE_ARG = ':'; + private static final char VARIABLE_END = '}'; + private static final char VARIABLE_ARG = ':'; // parsing states private static final int SCAN_FOR_START = 0; private static final int SCAN_FOR_END = 1; - + /** * Resulting string */ private StringBuffer fResult; - + /** * Whether substitutions were performed */ private boolean fSubs; - + /** * Stack of variables to resolve */ - private Stack fStack; - + private Stack<VariableReference> fStack; + class VariableReference { - + // the text inside the variable reference private StringBuffer fText; - + public VariableReference() { fText = new StringBuffer(); } - + public void append(String text) { fText.append(text); } - + public String getText() { return fText.toString(); } - + } - + /** * Performs recursive string substitution and returns the resulting string. - * + * * @param expression expression to resolve * @param reportUndefinedVariables whether to report undefined variables as an error * @param resolveVariables if the variables should be resolved during the substitution @@ -85,34 +85,31 @@ public class StringSubstitutionEngine { */ public String performStringSubstitution(String expression, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException { substitute(expression, reportUndefinedVariables, resolveVariables, manager); - List resolvedVariableSets = new ArrayList(); + List<HashSet<String>> resolvedVariableSets = new ArrayList<HashSet<String>>(); while (fSubs) { - HashSet resolved = substitute(fResult.toString(), reportUndefinedVariables, true, manager); - + HashSet<String> resolved = substitute(fResult.toString(), reportUndefinedVariables, true, manager); for(int i=resolvedVariableSets.size()-1; i>=0; i--) { - - HashSet prevSet = (HashSet)resolvedVariableSets.get(i); - + HashSet<String> prevSet = resolvedVariableSets.get(i); if (prevSet.equals(resolved)) { - HashSet conflictingSet = new HashSet(); - for (; i<resolvedVariableSets.size(); i++) - conflictingSet.addAll((HashSet)resolvedVariableSets.get(i)); - + HashSet<String> conflictingSet = new HashSet<String>(); + for (; i<resolvedVariableSets.size(); i++) { + conflictingSet.addAll(resolvedVariableSets.get(i)); + } StringBuffer problemVariableList = new StringBuffer(); - for (Iterator it=conflictingSet.iterator(); it.hasNext(); ) { - problemVariableList.append(it.next().toString()); + for (String string : conflictingSet) { + problemVariableList.append(string); problemVariableList.append(", "); //$NON-NLS-1$ } problemVariableList.setLength(problemVariableList.length()-2); //truncate the last ", " - throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.REFERENCE_CYCLE_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{problemVariableList.toString()}), null)); - } - } - - resolvedVariableSets.add(resolved); + throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.REFERENCE_CYCLE_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{problemVariableList.toString()}), null)); + } + } + + resolvedVariableSets.add(resolved); } return fResult.toString(); } - + /** * Performs recursive string validation to ensure that all of the variables * contained in the expression exist @@ -124,11 +121,11 @@ public class StringSubstitutionEngine { public void validateStringVariables(String expression, IStringVariableManager manager) throws CoreException { performStringSubstitution(expression, true, false, manager); } - + /** * Makes a substitution pass of the given expression returns a Set of the variables that were resolved in this * pass - * + * * @param expression source expression * @param reportUndefinedVariables whether to report undefined variables as an error * @param resolveVariables whether to resolve the value of any variables @@ -136,12 +133,12 @@ public class StringSubstitutionEngine { * @return the set of {@link String}s resolved from the given expression * @exception CoreException if unable to resolve a variable */ - private HashSet substitute(String expression, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException { + private HashSet<String> substitute(String expression, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException { fResult = new StringBuffer(expression.length()); - fStack = new Stack(); + fStack = new Stack<VariableReference>(); fSubs = false; - - HashSet resolvedVariables = new HashSet(); + + HashSet<String> resolvedVariables = new HashSet<String>(); int pos = 0; int state = SCAN_FOR_START; @@ -158,7 +155,7 @@ public class StringSubstitutionEngine { pos = start + 2; state = SCAN_FOR_END; - fStack.push(new VariableReference()); + fStack.push(new VariableReference()); } else { // done - no more variables fResult.append(expression.substring(pos)); @@ -171,7 +168,7 @@ public class StringSubstitutionEngine { int end = expression.indexOf(VARIABLE_END, pos); if (end < 0) { // variables are not completed - VariableReference tos = (VariableReference)fStack.peek(); + VariableReference tos = fStack.peek(); tos.append(expression.substring(pos)); pos = expression.length(); } else { @@ -179,18 +176,18 @@ public class StringSubstitutionEngine { // start of a nested variable int length = start - pos; if (length > 0) { - VariableReference tos = (VariableReference)fStack.peek(); + VariableReference tos = fStack.peek(); tos.append(expression.substring(pos, start)); } pos = start + 2; - fStack.push(new VariableReference()); + fStack.push(new VariableReference()); } else { // end of variable reference - VariableReference tos = (VariableReference)fStack.pop(); - String substring = expression.substring(pos, end); + VariableReference tos = fStack.pop(); + String substring = expression.substring(pos, end); tos.append(substring); resolvedVariables.add(substring); - + pos = end + 1; String value= resolve(tos, reportUndefinedVariables, resolveVariables, manager); if (value == null) { @@ -202,35 +199,37 @@ public class StringSubstitutionEngine { state = SCAN_FOR_START; } else { // append to previous variable - tos = (VariableReference)fStack.peek(); + tos = fStack.peek(); tos.append(value); } } } break; + default: + break; } } // process incomplete variable references while (!fStack.isEmpty()) { - VariableReference tos = (VariableReference)fStack.pop(); + VariableReference tos = fStack.pop(); if (fStack.isEmpty()) { fResult.append(VARIABLE_START); fResult.append(tos.getText()); } else { - VariableReference var = (VariableReference)fStack.peek(); + VariableReference var = fStack.peek(); var.append(VARIABLE_START); var.append(tos.getText()); } } - + return resolvedVariables; } /** * Resolve and return the value of the given variable reference, - * possibly <code>null</code>. - * + * possibly <code>null</code>. + * * @param var the {@link VariableReference} to try and resolve * @param reportUndefinedVariables whether to report undefined variables as * an error @@ -249,7 +248,7 @@ public class StringSubstitutionEngine { pos++; if (pos < text.length()) { arg = text.substring(pos); - } + } } else { name = text; } @@ -259,30 +258,30 @@ public class StringSubstitutionEngine { if (dynamicVariable == null) { // no variables with the given name if (reportUndefinedVariables) { - throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_3, new String[]{name}), null)); - } + throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_3, new String[]{name}), null)); + } // leave as is return getOriginalVarText(var); - } - + } + if (resolveVariables) { fSubs = true; return dynamicVariable.getValue(arg); - } + } //leave as is return getOriginalVarText(var); - } - + } + if (arg == null) { if (resolveVariables) { fSubs = true; return valueVariable.getValue(); - } + } //leave as is return getOriginalVarText(var); - } + } // error - an argument specified for a value variable - throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{valueVariable.getName()}), null)); + throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{valueVariable.getName()}), null)); } private String getOriginalVarText(VariableReference var) { diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java index c819bd1a1..e87c86c1f 100644 --- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java +++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,17 +18,17 @@ import org.eclipse.core.variables.IValueVariable; * Common implementation of context and value variables */ public abstract class StringVariable implements IStringVariable { - + /** * Variable name */ private String fName; - + /** * Variable description, or <code>null</code> */ private String fDescription; - + /** * Configuration element associated with this variable, or <code>null</code> */ @@ -36,7 +36,7 @@ public abstract class StringVariable implements IStringVariable { /** * Constructs a new variable with the given name, description and configuration element. - * + * * @param name variable name * @param description variable description, or <code>null</code> * @param configurationElement configuration element or <code>null</code> @@ -46,10 +46,11 @@ public abstract class StringVariable implements IStringVariable { fDescription = description; fConfigurationElement = configurationElement; } - + /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariable#getName() */ + @Override public String getName() { return fName; } @@ -57,20 +58,21 @@ public abstract class StringVariable implements IStringVariable { /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariable#getDescription() */ + @Override public String getDescription() { return fDescription; } - + /** * Returns the configuration element associated with this variable, or <code>null</code> * if none. - * + * * @return configuration element or <code>null</code> */ protected IConfigurationElement getConfigurationElement() { return fConfigurationElement; } - + /** * @see IValueVariable#setDescription(String) * @param description the new description to set for the variable diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java index e3e643d6e..09668bad7 100644 --- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java +++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -59,43 +59,43 @@ import org.w3c.dom.NodeList; import org.xml.sax.helpers.DefaultHandler; /** - * Singleton string variable manager. + * Singleton string variable manager. */ public class StringVariableManager implements IStringVariableManager, IPreferenceChangeListener { - + /** * Dynamic variables - maps variable names to variables. */ - private Map fDynamicVariables; - + private Map<String, IDynamicVariable> fDynamicVariables; + /** * Value variables - maps variable names to variables. */ - private Map fValueVariables; - + private Map<String, IStringVariable> fValueVariables; + /** * Variable listeners */ private ListenerList fListeners; - + // notifications private static final int ADDED = 0; private static final int CHANGED = 1; private static final int REMOVED = 2; - + /** * Singleton variable manager. */ - private static StringVariableManager fgManager; - + private static StringVariableManager fgManager; + // true during internal updates indicates that change notification // should be suppressed/ignored. private boolean fInternalChange = false; - + // Variable extension point constants private static final String ATTR_NAME= "name"; //$NON-NLS-1$ private static final String ATTR_DESCRIPTION="description"; //$NON-NLS-1$ - private static final String ATTR_READ_ONLY="readOnly"; //$NON-NLS-1$ + private static final String ATTR_READ_ONLY="readOnly"; //$NON-NLS-1$ // Persisted variable XML constants private static final String VALUE_VARIABLES_TAG= "valueVariables"; //$NON-NLS-1$ private static final String VALUE_VARIABLE_TAG= "valueVariable"; //$NON-NLS-1$ @@ -107,21 +107,22 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc private static final String TRUE_VALUE= "true"; //$NON-NLS-1$ private static final String FALSE_VALUE= "false"; //$NON-NLS-1$ // preference store key for value variables - private static final String PREF_VALUE_VARIABLES= VariablesPlugin.getUniqueIdentifier() + ".valueVariables"; //$NON-NLS-1$ - + private static final String PREF_VALUE_VARIABLES= VariablesPlugin.getUniqueIdentifier() + ".valueVariables"; //$NON-NLS-1$ + /** * Notifies a string variable listener in a safe runnable to handle * exceptions. */ class StringVariableNotifier implements ISafeRunnable { - + private IValueVariableListener fListener; private int fType; private IValueVariable[] fVariables; - + /** * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) */ + @Override public void handleException(Throwable exception) { IStatus status = new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, "An exception occurred during string variable change notification", exception); //$NON-NLS-1$ VariablesPlugin.log(status); @@ -130,6 +131,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /** * @see org.eclipse.core.runtime.ISafeRunnable#run() */ + @Override public void run() throws Exception { switch (fType) { case ADDED: @@ -141,12 +143,14 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc case CHANGED: fListener.variablesChanged(fVariables); break; - } + default: + break; + } } /** * Notifies the given listener of the add/change/remove - * + * * @param variables the {@link IValueVariable}s to notify about * @param update the type of change */ @@ -157,26 +161,26 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc for (int i= 0; i < copiedListeners.length; i++) { fListener = (IValueVariableListener)copiedListeners[i]; SafeRunner.run(this); - } + } fVariables = null; fListener = null; - // persist variables whenever there is an add/change/remove - storeValueVariables(); + // persist variables whenever there is an add/change/remove + storeValueVariables(); } - } - + } + /** * Returns a new notifier. - * + * * @return a new notifier */ private StringVariableNotifier getNotifier() { return new StringVariableNotifier(); } - + /** * Returns the default string variable manager - * + * * @return string variable manager */ public static StringVariableManager getDefault() { @@ -185,13 +189,13 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc } return fgManager; } - + /** - * Constructs a new string variable manager. + * Constructs a new string variable manager. */ private StringVariableManager() { fListeners = new ListenerList(); - } + } /** * Load contributed variables and persisted variables @@ -199,8 +203,8 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc private synchronized void initialize() { if (fDynamicVariables == null) { fInternalChange = true; - fDynamicVariables = new HashMap(5); - fValueVariables = new HashMap(5); + fDynamicVariables = new HashMap<String, IDynamicVariable>(5); + fValueVariables = new HashMap<String, IStringVariable>(5); loadContributedValueVariables(); loadPersistedValueVariables(); loadDynamicVariables(); @@ -208,7 +212,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc fInternalChange = false; } } - + /** * Loads contributed dynamic variables */ @@ -249,7 +253,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc } String description= element.getAttribute(ATTR_DESCRIPTION); boolean isReadOnly = TRUE_VALUE.equals(element.getAttribute(ATTR_READ_ONLY)); - + IValueVariable variable = new ContributedValueVariable(name, description, isReadOnly, element); Object old = fValueVariables.put(name, variable); if (old != null) { @@ -258,12 +262,12 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(), oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null); } - } + } } /** * Loads persisted value variables from the preference store. This is done after - * loading value variables from the extension point. If a persisted variable has the + * loading value variables from the extension point. If a persisted variable has the * same name as a extension contributed variable the variable's value will be set to * the persisted value unless either a) The persisted value is <code>null</code>, or * b) the variable is read-only. @@ -301,7 +305,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc String value= element.getAttribute(VALUE_TAG); String description= element.getAttribute(DESCRIPTION_TAG); boolean readOnly= TRUE_VALUE.equals(element.getAttribute(READ_ONLY_TAG)); - + IValueVariable existing = getValueVariable(name); if (existing == null){ ValueVariable variable = new ValueVariable(name, description, readOnly, value); @@ -313,39 +317,43 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc VariablesPlugin.logMessage("Invalid variable entry encountered while loading value variables. Variable name is null.", null); //$NON-NLS-1$ } } - } + } } - + /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getVariables() */ + @Override public synchronized IStringVariable[] getVariables() { initialize(); - List list = new ArrayList(fDynamicVariables.size() + fValueVariables.size()); + List<IStringVariable> list = new ArrayList<IStringVariable>(fDynamicVariables.size() + fValueVariables.size()); list.addAll(fDynamicVariables.values()); list.addAll(fValueVariables.values()); - return (IStringVariable[]) list.toArray(new IStringVariable[list.size()]); + return list.toArray(new IStringVariable[list.size()]); } /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getValueVariables() */ + @Override public synchronized IValueVariable[] getValueVariables() { initialize(); - return (IValueVariable[]) fValueVariables.values().toArray(new IValueVariable[fValueVariables.size()]); + return fValueVariables.values().toArray(new IValueVariable[fValueVariables.size()]); } /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getDynamicVariables() */ + @Override public synchronized IDynamicVariable[] getDynamicVariables() { initialize(); - return (IDynamicVariable[]) fDynamicVariables.values().toArray(new IDynamicVariable[fDynamicVariables.size()]); + return fDynamicVariables.values().toArray(new IDynamicVariable[fDynamicVariables.size()]); } /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#performStringSubstitution(java.lang.String) */ + @Override public String performStringSubstitution(String expression) throws CoreException { return performStringSubstitution(expression, true); } @@ -353,28 +361,31 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#newValueVariable(java.lang.String, java.lang.String) */ + @Override public IValueVariable newValueVariable(String name, String description) { return newValueVariable(name, description, false, null); } - + /* (non-Javadoc) * @see org.eclipse.core.variables.IStringVariableManager#newValueVariable(java.lang.String, java.lang.String, boolean, java.lang.String) */ + @Override public IValueVariable newValueVariable(String name, String description, boolean readOnly, String value) { return new ValueVariable(name, description, readOnly, value); } - + /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#addVariables(org.eclipse.debug.internal.core.stringsubstitution.IValueVariable[]) */ + @Override public synchronized void addVariables(IValueVariable[] variables) throws CoreException { initialize(); - MultiStatus status = new MultiStatus(VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, VariablesMessages.StringVariableManager_26, null); + MultiStatus status = new MultiStatus(VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, VariablesMessages.StringVariableManager_26, null); for (int i = 0; i < variables.length; i++) { IValueVariable variable = variables[i]; if (getValueVariable(variable.getName()) != null) { - status.add(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringVariableManager_27, new String[]{variable.getName()}), null)); - } + status.add(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringVariableManager_27, new String[]{variable.getName()}), null)); + } } if (status.isOK()) { for (int i = 0; i < variables.length; i++) { @@ -392,9 +403,10 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#removeVariables(org.eclipse.debug.internal.core.stringsubstitution.IValueVariable[]) */ + @Override public synchronized void removeVariables(IValueVariable[] variables) { initialize(); - List removed = new ArrayList(variables.length); + List<IValueVariable> removed = new ArrayList<IValueVariable>(variables.length); for (int i = 0; i < variables.length; i++) { IValueVariable variable = variables[i]; if (fValueVariables.remove(variable.getName()) != null) { @@ -402,21 +414,23 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc } } if (removed.size() > 0) { - getNotifier().notify((IValueVariable[])removed.toArray(new IValueVariable[removed.size()]), REMOVED); + getNotifier().notify(removed.toArray(new IValueVariable[removed.size()]), REMOVED); } } /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getDynamicVariable(java.lang.String) */ + @Override public synchronized IDynamicVariable getDynamicVariable(String name) { initialize(); - return (IDynamicVariable) fDynamicVariables.get(name); + return fDynamicVariables.get(name); } /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getValueVariable(java.lang.String) */ + @Override public synchronized IValueVariable getValueVariable(String name) { initialize(); return (IValueVariable) fValueVariables.get(name); @@ -426,6 +440,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#addValueVariableListener(org.eclipse.debug.internal.core.stringsubstitution.IValueVariableListener) */ + @Override public void addValueVariableListener(IValueVariableListener listener) { fListeners.add(listener); } @@ -433,13 +448,14 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#removeValueVariableListener(org.eclipse.debug.internal.core.stringsubstitution.IValueVariableListener) */ + @Override public void removeValueVariableListener(IValueVariableListener listener) { fListeners.remove(listener); } - + /** * Returns a memento representing the value variables currently registered. - * + * * @return memento representing the value variables currently registered * @throws IOException if an I/O exception occurs while creating the XML. * @throws ParserConfigurationException if an I/O exception occurs while creating the XML. @@ -454,7 +470,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc for (int i = 0; i < variables.length; i++) { IValueVariable variable = variables[i]; if (!variable.isReadOnly()){ - // don't persist read-only variables or un-initialized contributed variables + // don't persist read-only variables or un-initialized contributed variables if (!variable.isContributed() || ((ContributedValueVariable)variable).isInitialized()) { Element element= document.createElement(VALUE_VARIABLE_TAG); element.setAttribute(NAME_TAG, variable.getName()); @@ -473,18 +489,18 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc } return serializeDocument(document); } - + private Document getDocument() throws ParserConfigurationException { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); Document doc =docBuilder.newDocument(); return doc; } - + /** * Serializes a XML document into a string - encoded in UTF8 format, * with platform line separators. - * + * * @param doc document to serialize * @return the document as a string * @throws TransformerException if an unrecoverable error occurs during the serialization @@ -492,22 +508,22 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc */ private String serializeDocument(Document doc) throws TransformerException, UnsupportedEncodingException { ByteArrayOutputStream s= new ByteArrayOutputStream(); - + TransformerFactory factory= TransformerFactory.newInstance(); Transformer transformer= factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ - + DOMSource source= new DOMSource(doc); StreamResult outputTarget= new StreamResult(s); transformer.transform(source, outputTarget); - - return s.toString("UTF8"); //$NON-NLS-1$ + + return s.toString("UTF8"); //$NON-NLS-1$ } - + /** * Saves the value variables currently registered in the - * preference store. + * preference store. */ private synchronized void storeValueVariables() { String variableString= ""; //$NON-NLS-1$ @@ -539,7 +555,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /** * Fire a change notification for the given variable. - * + * * @param variable the variable that has changed */ protected void notifyChanged(IValueVariable variable) { @@ -550,11 +566,12 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc getNotifier().notify(new IValueVariable[]{variable}, CHANGED); } } - } + } /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#generateVariableExpression(java.lang.String, java.lang.String) */ + @Override public String generateVariableExpression(String varName, String arg) { StringBuffer buffer = new StringBuffer(); buffer.append("${"); //$NON-NLS-1$ @@ -566,10 +583,11 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc buffer.append("}"); //$NON-NLS-1$ return buffer.toString(); } - + /* (non-Javadoc) * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#performStringSubstitution(java.lang.String, boolean) */ + @Override public String performStringSubstitution(String expression, boolean reportUndefinedVariables) throws CoreException { return new StringSubstitutionEngine().performStringSubstitution(expression, reportUndefinedVariables, true, this); } @@ -577,6 +595,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /* (non-Javadoc) * @see org.eclipse.core.variables.IStringVariableManager#validateStringVariables(java.lang.String) */ + @Override public void validateStringVariables(String expression) throws CoreException { new StringSubstitutionEngine().validateStringVariables(expression, this); } @@ -584,7 +603,8 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /* (non-Javadoc) * @see org.eclipse.core.variables.IStringVariableManager#getContributingPluginId(org.eclipse.core.variables.IStringVariable) */ - public String getContributingPluginId(IStringVariable variable) { + @Override + public String getContributingPluginId(IStringVariable variable) { if (variable instanceof StringVariable) { return ((StringVariable) variable).getConfigurationElement().getContributor().getName(); } @@ -594,6 +614,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc /* (non-Javadoc) * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent) */ + @Override public void preferenceChange(PreferenceChangeEvent event) { if (PREF_VALUE_VARIABLES.equals(event.getKey())) { synchronized (this) { diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java index 3bac3d076..b10b82a6c 100644 --- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java +++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,21 +16,21 @@ import org.eclipse.core.variables.IValueVariable; * Implementation of a value variable. */ public class ValueVariable extends StringVariable implements IValueVariable { - + /** - * Variable value or <code>null</code> if none + * Variable value or <code>null</code> if none */ private String fValue; - + /** * Whether this variable is read only. If true, users cannot change the value. */ private boolean fReadOnly; - + /** * Constructs a new value variable with the given name, description, read only * property and string value. Value can be null. - * + * * @param name variable name * @param description variable description or <code>null</code> * @param readOnly whether the variable should be a read only variable @@ -41,20 +41,22 @@ public class ValueVariable extends StringVariable implements IValueVariable { fReadOnly = readOnly; fValue = value; } - + /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#setValue(java.lang.String) */ + @Override public void setValue(String value) { if (!isReadOnly()){ fValue = value; StringVariableManager.getDefault().notifyChanged(this); } } - + /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#getValue() */ + @Override public String getValue() { return fValue; } @@ -62,13 +64,15 @@ public class ValueVariable extends StringVariable implements IValueVariable { /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#isReadOnly() */ + @Override public boolean isReadOnly() { return fReadOnly; } - + /* (non-Javadoc) * @see org.eclipse.core.variables.IValueVariable#isContributed() */ + @Override public boolean isContributed() { return false; } |