diff options
1014 files changed, 22787 insertions, 17400 deletions
diff --git a/org.eclipse.core.externaltools/.classpath b/org.eclipse.core.externaltools/.classpath index 2fbb7a23e..ad32c83a7 100644 --- a/org.eclipse.core.externaltools/.classpath +++ b/org.eclipse.core.externaltools/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <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"/> diff --git a/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs index 5d7a22fe3..74c3aeb02 100644 --- a/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.core.externaltools/.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.externaltools/META-INF/MANIFEST.MF b/org.eclipse.core.externaltools/META-INF/MANIFEST.MF index 1ecf7ced9..180170a8a 100644 --- a/org.eclipse.core.externaltools/META-INF/MANIFEST.MF +++ b/org.eclipse.core.externaltools/META-INF/MANIFEST.MF @@ -6,10 +6,10 @@ Bundle-SymbolicName: org.eclipse.core.externaltools;singleton:=true Bundle-Version: 1.0.300.qualifier Bundle-Activator: org.eclipse.core.externaltools.internal.ExternalToolsCore Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.6.0,4.0.0)", - org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)", + org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)", + org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)", org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)" -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName Export-Package: org.eclipse.core.externaltools.internal;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools,org.eclipse.ant.ui", diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java index b0e2bf115..8bc56c98a 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -23,16 +23,16 @@ public class ExternalToolsCore extends Plugin { // The plug-in ID public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$ - + /** * Status code indicating an unexpected internal error. * @since 2.1 */ - public static final int INTERNAL_ERROR = 120; + public static final int INTERNAL_ERROR = 120; // The shared instance private static ExternalToolsCore plugin; - + /** * The constructor */ @@ -43,6 +43,7 @@ public class ExternalToolsCore extends Plugin { * (non-Javadoc) * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) */ + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; @@ -52,6 +53,7 @@ public class ExternalToolsCore extends Plugin { * (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); @@ -65,11 +67,11 @@ public class ExternalToolsCore extends Plugin { public static ExternalToolsCore getDefault() { return plugin; } - + /** * Logs the specified throwable with this plug-in's log. - * - * @param t throwable to log + * + * @param t throwable to log */ public static void log(Throwable t) { IStatus status= new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, "Error logged from Ant UI: ", t); //$NON-NLS-1$ @@ -78,33 +80,33 @@ public class ExternalToolsCore extends Plugin { /** * Logs the specified status with this plug-in's log. - * - * @param status status + * + * @param status status */ public static void log(IStatus status) { getDefault().getLog().log(status); } - + /** * Writes the message to the plug-in's log - * + * * @param message the text to write to the log */ public static void log(String message, Throwable exception) { IStatus status = newErrorStatus(message, exception); log(status); } - + /** * Returns a new <code>IStatus</code> for this plug-in */ public static IStatus newErrorStatus(String message, Throwable exception) { if (message == null) { - return new Status(IStatus.ERROR, PLUGIN_ID, 0, IExternalToolConstants.EMPTY_STRING, exception); - } + return new Status(IStatus.ERROR, PLUGIN_ID, 0, IExternalToolConstants.EMPTY_STRING, exception); + } return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception); } - + /** * Returns a new <code>CoreException</code> for this plug-in */ diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java index b276e212b..fda6c2310 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.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 * dakshinamurthy.karra@gmail.com - bug 165371 @@ -18,19 +18,19 @@ package org.eclipse.core.externaltools.internal; * </p> */ public interface IExternalToolConstants { - + /** * Constant for the empty {@link String} - * + * * @since org.eclipse.core.externaltools 1.0.100 */ public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - + /** * Plug-in identifier for external tools UI (value <code>org.eclipse.ui.externaltools</code>). */ public static final String UI_PLUGIN_ID = "org.eclipse.ui.externaltools"; //$NON-NLS-1$; - + /** * Plug-in identifier for external tools core (value <code>org.eclipse.core.externaltools</code>). */ @@ -59,7 +59,7 @@ public interface IExternalToolConstants { public static final String VAR_WORKING_SET = "working_set"; //$NON-NLS-1$ // ------- Tool Types ------- /** - * External tool type for programs such as executables, batch files, + * External tool type for programs such as executables, batch files, * shell scripts, etc (value <code>programType</code>). */ public static final String TOOL_TYPE_PROGRAM = "programType"; //$NON-NLS-1$; @@ -82,7 +82,7 @@ public interface IExternalToolConstants { * the external tool running as a builder (value <code>auto</code>). */ public static final String BUILD_TYPE_AUTO = "auto"; //$NON-NLS-1$ - + /** * Build type indicating a clean project build request for * the external tool running as a builder (value <code>clean</code>). @@ -100,13 +100,13 @@ public interface IExternalToolConstants { * Program launch configuration type identifier. */ public static final String ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"; //$NON-NLS-1$ - + /** * Program builder launch configuration type identifier. Program project * builders are of this type. */ - public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"; //$NON-NLS-1$ - + public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"; //$NON-NLS-1$ + // ------- Launch configuration category -------- /** * Identifier for external tools launch configuration category. Launch @@ -128,6 +128,7 @@ public interface IExternalToolConstants { * Default value is <code>false</code>. * @deprecated since 3.1 Replaced by <code>org.eclipse.debug.core.DebugPlugin.ATTR_CAPTURE_OUTPUT</code> */ + @Deprecated public static final String ATTR_CAPTURE_OUTPUT = UI_PLUGIN_ID + ".ATTR_CAPTURE_OUTPUT"; //$NON-NLS-1$ /** * String attribute identifying the location of an external. Default value @@ -141,20 +142,20 @@ public interface IExternalToolConstants { * THIS ATTRIBUTE IS NOT USED. */ public static final String ATTR_PROMPT_FOR_ARGUMENTS = UI_PLUGIN_ID + ".ATTR_PROMPT_FOR_ARGUMENTS"; //$NON-NLS-1$ - + /** - * String attribute identifying the scope of resources that should trigger an + * String attribute identifying the scope of resources that should trigger an * external tool to run. Default value is <code>null</code> * indicating that the builder will be triggered for all changes. */ public static final String ATTR_BUILDER_SCOPE = UI_PLUGIN_ID + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$ - + /** * String attribute containing an array of build kinds for which an * external tool builder should be run. */ public static final String ATTR_RUN_BUILD_KINDS = UI_PLUGIN_ID + ".ATTR_RUN_BUILD_KINDS"; //$NON-NLS-1$ - + /** * Boolean attribute indicating if the console should be shown on external * tool output. Default value is <code>false</code>. @@ -173,21 +174,21 @@ public interface IExternalToolConstants { * directory, which is tool specific. */ public static final String ATTR_WORKING_DIRECTORY = UI_PLUGIN_ID + ".ATTR_WORKING_DIRECTORY"; //$NON-NLS-1$ - + /** * String attribute identifying whether an external tool builder configuration * is enabled. The default value is <code>true</code>, which indicates * that the configuration will be executed as appropriate by the builder. */ public static final String ATTR_BUILDER_ENABLED = UI_PLUGIN_ID + ".ATTR_BUILDER_ENABLED"; //$NON-NLS-1$ - + /** * Boolean attribute identifying whether an external tool launcher should execute * synchronously (value <code>false</code>) or asynchronously (value <code>true</code>). - * Default value is + * Default value is */ public static final String ATTR_LAUNCH_IN_BACKGROUND = "org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND"; //$NON-NLS-1$ - + /** * Status code indicating an unexpected internal error. */ @@ -198,7 +199,7 @@ public interface IExternalToolConstants { * The value is the name of the disabled builder. */ public static final String ATTR_DISABLED_BUILDER = UI_PLUGIN_ID + ".ATTR_DISABLED_BUILDER"; //$NON-NLS-1$ - + /** * boolean attribute identifying that an external tool builder has been configured for triggering * using the <code>ICommand.setBuilding(int)</code> mechanism @@ -213,7 +214,7 @@ public interface IExternalToolConstants { public static final String ATTR_BUILD_SCOPE = UI_PLUGIN_ID + ".ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE"; //$NON-NLS-1$ /** - * Attribute identifier specifying whether referenced projects should be + * Attribute identifier specifying whether referenced projects should be * considered when computing the projects to build. Default value is * <code>true</code>. */ diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java index de772967d..4ab5d4d0e 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 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 *******************************************************************************/ @@ -25,21 +25,21 @@ import org.eclipse.debug.core.RefreshUtil; import org.eclipse.debug.core.model.IProcess; /** - * Refreshes resources as specified by a launch configuration, when + * Refreshes resources as specified by a launch configuration, when * an associated process terminates. */ public class BackgroundResourceRefresher implements IDebugEventSetListener { private ILaunchConfiguration fConfiguration; private IProcess fProcess; - - - + + + public BackgroundResourceRefresher(ILaunchConfiguration configuration, IProcess process) { fConfiguration = configuration; fProcess = process; } - + /** * If the process has already terminated, resource refreshing is done * immediately in the current thread. Otherwise, refreshing is done when the @@ -54,10 +54,11 @@ public class BackgroundResourceRefresher implements IDebugEventSetListener { } } } - + /* (non-Javadoc) * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) */ + @Override public void handleDebugEvents(DebugEvent[] events) { for (int i = 0; i < events.length; i++) { DebugEvent event = events[i]; @@ -68,19 +69,20 @@ public class BackgroundResourceRefresher implements IDebugEventSetListener { } } } - + /** * Submits a job to do the refresh */ protected void refresh() { Job job= new Job(ExternalToolsProgramMessages.BackgroundResourceRefresher_0) { + @Override public IStatus run(IProgressMonitor monitor) { try { RefreshUtil.refreshResources(fConfiguration, monitor); } catch (CoreException e) { ExternalToolsCore.log(e); return e.getStatus(); - } + } return Status.OK_STATUS; } }; diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java index 022279070..0086da7e6 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.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 @@ -35,7 +35,7 @@ import org.eclipse.osgi.util.NLS; * Launch delegate for a program. */ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { - + /** * Launch configuration attribute - a boolean value indicating whether a * configuration should be launched in the background. Default value is <code>true</code>. @@ -51,6 +51,7 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { * java.lang.String, org.eclipse.debug.core.ILaunch, * org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { @@ -110,7 +111,7 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { IProcess process = null; // add process type to process attributes - Map processAttributes = new HashMap(); + Map<String, String> processAttributes = new HashMap<String, String>(); String programName = location.lastSegment(); String extension = location.getFileExtension(); if (extension != null) { @@ -125,12 +126,12 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { ExternalToolsProgramMessages.ProgramLaunchDelegate_3, new String[] { configuration.getName() }), IProgressMonitor.UNKNOWN); - process = DebugPlugin.newProcess(launch, p, location.toOSString(), - processAttributes); + process = DebugPlugin.newProcess(launch, p, location.toOSString(), processAttributes); } if (p == null || process == null) { - if (p != null) + if (p != null) { p.destroy(); + } throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, @@ -165,8 +166,9 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { } private String generateCommandLine(String[] commandLine) { - if (commandLine.length < 1) + if (commandLine.length < 1) { return IExternalToolConstants.EMPTY_STRING; + } StringBuffer buf = new StringBuffer(); for (int i = 0; i < commandLine.length; i++) { buf.append(' '); @@ -195,11 +197,12 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { /* * (non-Javadoc) - * + * * @see * org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) */ + @Override protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException { IProject[] projects = ExternalToolsCoreUtil.getBuildProjects( @@ -214,14 +217,15 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { } return computeBuildOrder(projects); } - + /* * (non-Javadoc) - * + * * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#saveBeforeLaunch - * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, + * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, * org.eclipse.core.runtime.IProgressMonitor) */ + @Override protected boolean saveBeforeLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { if (IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java index d8e7d750b..28f8070cc 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.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 @@ -41,7 +41,7 @@ public class BuilderCoreUtils { public static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$ /** * Constant added to the build command to determine if we are doing an incremental build after a clean - * + * * @since 3.7 */ public static final String INC_CLEAN = "incclean"; //$NON-NLS-1$ @@ -71,15 +71,14 @@ public class BuilderCoreUtils { * Returns a launch configuration from the given ICommand arguments. If the * given arguments are from an old-style external tool, an unsaved working * copy will be created from the arguments and returned. - * + * * @param commandArgs * the builder ICommand arguments * @return a launch configuration, a launch configuration working copy, or * <code>null</code> if not possible. */ - public static ILaunchConfiguration configFromBuildCommandArgs( - IProject project, Map commandArgs, String[] version) { - String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE); + public static ILaunchConfiguration configFromBuildCommandArgs(IProject project, Map<String, String> commandArgs, String[] version) { + String configHandle = commandArgs.get(LAUNCH_CONFIG_HANDLE); if (configHandle == null) { // Probably an old-style (Eclipse 1.0 or 2.0) external tool. Try to // migrate. @@ -143,12 +142,14 @@ public class BuilderCoreUtils { case IncrementalProjectBuilder.CLEAN_BUILD: newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true); break; + default: + break; } } if(!isfull && isinc) { - Map args = newCommand.getArguments(); + Map<String, String> args = newCommand.getArguments(); if(args == null) { - args = new HashMap(); + args = new HashMap<String, String>(); } newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true); args.put(INC_CLEAN, Boolean.TRUE.toString()); @@ -168,7 +169,7 @@ public class BuilderCoreUtils { * translated into launch config working copies in memory, but they're not * considered "migrated" until the config has been saved and the project * spec updated. - * + * * @param config * the config to examine * @return whether the given config represents an unmigrated builder @@ -181,12 +182,11 @@ public class BuilderCoreUtils { /** * Converts the given config to a build command which is stored in the given * command. - * + * * @return the configured build command */ - public static ICommand toBuildCommand(IProject project, - ILaunchConfiguration config, ICommand command) throws CoreException { - Map args = null; + public static ICommand toBuildCommand(IProject project, ILaunchConfiguration config, ICommand command) throws CoreException { + Map<String, String> args = null; if (isUnmigratedConfig(config)) { // This config represents an old external tool builder that hasn't // been edited. Try to find the old ICommand and reuse the @@ -204,20 +204,20 @@ public class BuilderCoreUtils { } } } else { + ILaunchConfiguration temp = config; if (config instanceof ILaunchConfigurationWorkingCopy) { ILaunchConfigurationWorkingCopy workingCopy = (ILaunchConfigurationWorkingCopy) config; if (workingCopy.getOriginal() != null) { - config = workingCopy.getOriginal(); + temp = workingCopy.getOriginal(); } } - args = new HashMap(); + args = new HashMap<String, String>(); // Launch configuration builders are stored with a project-relative // path StringBuffer buffer = new StringBuffer(PROJECT_TAG); // Append the project-relative path (workspace path minus first // segment) - buffer.append('/').append( - config.getFile().getFullPath().removeFirstSegments(1)); + buffer.append('/').append(temp.getFile().getFullPath().removeFirstSegments(1)); args.put(LAUNCH_CONFIG_HANDLE, buffer.toString()); } command.setBuilderName(ExternalToolBuilder.ID); @@ -249,7 +249,7 @@ public class BuilderCoreUtils { * may be changed during the migration. The name of the configuration will * only be changed if the current name is not a valid name for a saved * config. - * + * * @param workingCopy * the launch configuration containing attributes from an * old-style project builder. @@ -282,7 +282,7 @@ public class BuilderCoreUtils { /** * Converts the build types string into an array of build kinds. - * + * * @param buildTypes * the string of built types to convert * @return the array of build kinds. diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java index dd809de7f..548058711 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.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 @@ -37,7 +37,7 @@ import org.osgi.framework.Bundle; /** * This project builder implementation will run an external tool during the - * build process. + * build process. */ public final class ExternalToolBuilder extends IncrementalProjectBuilder { private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor { @@ -46,6 +46,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { super(); fTrueChange= trueChange; } + @Override public boolean visit(IResourceDelta visitDelta) throws CoreException { IResource resource= visitDelta.getResource(); if (resource instanceof IFile) { @@ -59,18 +60,19 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { public static final String ID = "org.eclipse.ui.externaltools.ExternalToolBuilder"; //$NON-NLS-1$; private static String buildType = IExternalToolConstants.BUILD_TYPE_NONE; - + private static IProject buildProject= null; private static IResourceDelta buildDelta= null; - + /* (non-Javadoc) * @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) */ - protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { + @Override + protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException { if (ExternalToolsCore.getDefault().getBundle().getState() != Bundle.ACTIVE) { return null; } - + ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]); if (config == null) { throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null); @@ -87,7 +89,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { if (kindCompatible && configEnabled(config)) { doBuildBasedOnScope(resources, kind, config, args, monitor); } - + return projectsWithinScope; } @@ -117,22 +119,22 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { } return true; } - + private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) { - Map commandArgs= command.getArguments(); + Map<String, String> commandArgs = command.getArguments(); if (commandArgs == null) { return -1; } - String handle= (String) commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); + String handle= commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); if (handle == null) { return -1; } for (int i = 0; i < buildSpec.length; ++i) { ICommand buildSpecCommand= buildSpec[i]; if (ID.equals(buildSpecCommand.getBuilderName())) { - Map buildSpecArgs= buildSpecCommand.getArguments(); + Map<String, String> buildSpecArgs = buildSpecCommand.getArguments(); if (buildSpecArgs != null) { - String buildSpecHandle= (String) buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); + String buildSpecHandle= buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); if (handle.equals(buildSpecHandle)) { return i; } @@ -144,7 +146,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { /** * Returns whether the given builder config is enabled or not. - * + * * @param config the config to examine * @return whether the config is enabled */ @@ -157,7 +159,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { return true; } - private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, Map args, IProgressMonitor monitor) throws CoreException { + private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, Map<String, String> args, IProgressMonitor monitor) throws CoreException { boolean buildForChange = true; if (kind != FULL_BUILD) { //scope not applied for full builds if (resources != null && resources.length > 0) { @@ -169,8 +171,8 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { launchBuild(kind, config, args, monitor); } } - - private void launchBuild(int kind, ILaunchConfiguration config, Map args, IProgressMonitor monitor) throws CoreException { + + private void launchBuild(int kind, ILaunchConfiguration config, Map<String, String> args, IProgressMonitor monitor) throws CoreException { monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()})); buildStarted(kind, args); // The default value for "launch in background" is true in debug core. If @@ -185,17 +187,17 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { /** * Returns the build type being performed if the * external tool is being run as a project builder. - * + * * @return one of the <code>IExternalToolConstants.BUILD_TYPE_*</code> constants. */ public static String getBuildType() { return buildType; } - + /** * Returns the project that is being built and has triggered the current external * tool builder. <code>null</code> is returned if no build is currently occurring. - * + * * @return project being built or <code>null</code>. */ public static IProject getBuildProject() { @@ -205,19 +207,19 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { /** * Returns the <code>IResourceDelta</code> that is being built and has triggered the current external * tool builder. <code>null</code> is returned if no build is currently occurring. - * + * * @return resource delta for the build or <code>null</code> */ public static IResourceDelta getBuildDelta() { return buildDelta; } - + /** * Stores the currently active build kind and build project when a build begins * @param buildKind * @param args the arguments passed into the builder */ - private void buildStarted(int buildKind, Map args) { + private void buildStarted(int buildKind, Map<String, String> args) { switch (buildKind) { case IncrementalProjectBuilder.INCREMENTAL_BUILD : buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; @@ -245,7 +247,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { } buildProject= getProject(); } - + /** * Clears the current build kind, build project and build delta when a build finishes. */ @@ -254,14 +256,14 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { buildProject= null; buildDelta= null; } - + private boolean buildScopeIndicatesBuild(IResource[] resources) { for (int i = 0; i < resources.length; i++) { IResourceDelta delta = getDelta(resources[i].getProject()); if (delta == null) { //project just added to the workspace..no previous build tree return true; - } + } IPath path= resources[i].getProjectRelativePath(); IResourceDelta change= delta.findMember(path); if (change != null) { @@ -272,26 +274,27 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { } catch (CoreException e) { ExternalToolsCore.log("Internal error resolving changed resources during build", e); //$NON-NLS-1$ } - + return trueChange[0]; //filtered out team private changes } } return false; } - - protected void clean(IProgressMonitor monitor) throws CoreException { + + @Override + protected void clean(IProgressMonitor monitor) throws CoreException { ICommand command= getCommand(); ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]); if (!configEnabled(config)) { return; } - + if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { //old behavior super.clean(monitor); return; } - + launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, null, monitor); } }
\ No newline at end of file diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java index a06bc8782..a1b2fe933 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 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 *******************************************************************************/ @@ -38,31 +38,31 @@ public final class ExternalToolMigration { public static final class VariableDefinition { /** * Index in the source text where the variable started - * or <code>-1</code> if no valid variable start tag + * or <code>-1</code> if no valid variable start tag * identifier found. */ public int start = -1; - + /** * Index in the source text of the character following - * the end of the variable or <code>-1</code> if no + * the end of the variable or <code>-1</code> if no * valid variable end tag found. */ public int end = -1; - + /** * The variable's name found in the source text, or * <code>null</code> if no valid variable found. */ public String name = null; - + /** * The variable's argument found in the source text, or * <code>null</code> if no valid variable found or if * the variable did not specify an argument */ public String argument = null; - + /** * Create an initialized variable definition. */ @@ -70,14 +70,14 @@ public final class ExternalToolMigration { super(); } } - + /** * Variable tag indentifiers */ private static final String VAR_TAG_START = "${"; //$NON-NLS-1$ private static final String VAR_TAG_END = "}"; //$NON-NLS-1$ - private static final String VAR_TAG_SEP = ":"; //$NON-NLS-1$ - + private static final String VAR_TAG_SEP = ":"; //$NON-NLS-1$ + /** * External tool type for Ant build files (value <code>antBuildType</code>). */ @@ -87,7 +87,7 @@ public final class ExternalToolMigration { * are of this type. */ public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntBuilderLaunchConfigurationType"; //$NON-NLS-1$ - + public static final String RUN_TARGETS_ATTRIBUTE = TOOL_TYPE_ANT_BUILD + ".runTargets"; //$NON-NLS-1$; /** @@ -99,7 +99,7 @@ public final class ExternalToolMigration { * for migration. */ public static final String ATTR_ANT_TARGETS = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$ - + /* * 2.0 External Tool Tags */ @@ -155,46 +155,47 @@ public final class ExternalToolMigration { * branch external tool. The returned working copy will be unsaved and its * location will be set to the metadata area. */ - public static ILaunchConfigurationWorkingCopy configFromArgumentMap(Map args) { - String version = (String) args.get(TAG_VERSION); + public static ILaunchConfigurationWorkingCopy configFromArgumentMap(Map<String, String> args) { + String version = args.get(TAG_VERSION); if (VERSION_21.equals(version)) { return configFrom21ArgumentMap(args); } return configFrom20ArgumentMap(args); } - public static ILaunchConfigurationWorkingCopy configFrom21ArgumentMap(Map commandArgs) { - String name = (String) commandArgs.get(TAG_NAME); - String type = (String) commandArgs.get(TAG_TYPE); - + public static ILaunchConfigurationWorkingCopy configFrom21ArgumentMap(Map<String, String> commandArgs) { + String name = commandArgs.get(TAG_NAME); + String type = commandArgs.get(TAG_TYPE); + ILaunchConfigurationWorkingCopy config = newConfig(type, name); if (config == null) { return null; } - - config.setAttribute(IExternalToolConstants.ATTR_LOCATION, (String) commandArgs.get(TAG_LOCATION)); - config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) commandArgs.get(TAG_WORK_DIR)); + + config.setAttribute(IExternalToolConstants.ATTR_LOCATION, commandArgs.get(TAG_LOCATION)); + config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, commandArgs.get(TAG_WORK_DIR)); config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(commandArgs.get(TAG_CAPTURE_OUTPUT))); config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(commandArgs.get(TAG_SHOW_CONSOLE))); config.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, TRUE.equals(commandArgs.get(TAG_RUN_BKGRND))); config.setAttribute(IExternalToolConstants.ATTR_PROMPT_FOR_ARGUMENTS, TRUE.equals(commandArgs.get(TAG_PROMPT_ARGS))); - config.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, (String) commandArgs.get(TAG_REFRESH_SCOPE)); + config.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, commandArgs.get(TAG_REFRESH_SCOPE)); config.setAttribute(RefreshUtil.ATTR_REFRESH_RECURSIVE, TRUE.equals(commandArgs.get(TAG_REFRESH_RECURSIVE))); - config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) commandArgs.get(TAG_RUN_BUILD_KINDS)); - - String args = (String) commandArgs.get(TAG_ARGS); + config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, commandArgs.get(TAG_RUN_BUILD_KINDS)); + + String args = commandArgs.get(TAG_ARGS); if (args != null) { config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, args); } - String extraAttributes = (String) commandArgs.get(TAG_EXTRA_ATTR); + String extraAttributes = commandArgs.get(TAG_EXTRA_ATTR); if (extraAttributes != null) { StringTokenizer tokenizer = new StringTokenizer(extraAttributes, EXTRA_ATTR_SEPARATOR); while (tokenizer.hasMoreTokens()) { String key = tokenizer.nextToken(); - if (!tokenizer.hasMoreTokens()) + if (!tokenizer.hasMoreTokens()) { break; + } String value = tokenizer.nextToken(); if (key.equals(RUN_TARGETS_ATTRIBUTE)) { // 2.1 implementation only defined 1 "extra attribute" @@ -208,9 +209,9 @@ public final class ExternalToolMigration { /** * Creates an external tool from the map. */ - public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(Map args) { + public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(Map<String, String> args) { // Update the type... - String type = (String) args.get(TAG_TOOL_TYPE); + String type = args.get(TAG_TOOL_TYPE); if (TOOL_TYPE_ANT.equals(type)) { type = TOOL_TYPE_ANT_BUILD; } else if (TOOL_TYPE_PROGRAM.equals(type)){ @@ -219,19 +220,19 @@ public final class ExternalToolMigration { return null; } - String name = (String) args.get(TAG_TOOL_NAME); - + String name = args.get(TAG_TOOL_NAME); + ILaunchConfigurationWorkingCopy config = newConfig(type, name); if (config == null) { return null; } // Update the location... - String location = (String) args.get(TAG_TOOL_LOCATION); + String location = args.get(TAG_TOOL_LOCATION); config.setAttribute(IExternalToolConstants.ATTR_LOCATION, location); // Update the refresh scope... - String refresh = (String) args.get(TAG_TOOL_REFRESH); + String refresh = args.get(TAG_TOOL_REFRESH); if (refresh != null) { VariableDefinition varDef = extractVariableDefinition(refresh, 0); if ("none".equals(varDef.name)) { //$NON-NLS-1$ @@ -241,12 +242,12 @@ public final class ExternalToolMigration { } // Update the arguments - String arguments = (String) args.get(TAG_TOOL_ARGUMENTS); + String arguments = args.get(TAG_TOOL_ARGUMENTS); if (type.equals(TOOL_TYPE_ANT_BUILD)) { String targetNames = null; if (arguments != null) { int start = 0; - ArrayList targets = new ArrayList(); + ArrayList<String> targets = new ArrayList<String>(); StringBuffer buffer = new StringBuffer(); VariableDefinition varDef = extractVariableDefinition(arguments, start); while (varDef.end != -1) { @@ -261,10 +262,10 @@ public final class ExternalToolMigration { } buffer.append(arguments.substring(start, arguments.length())); arguments = buffer.toString(); - + buffer.setLength(0); for (int i = 0; i < targets.size(); i++) { - String target = (String) targets.get(i); + String target = targets.get(i); if (target != null && target.length() > 0) { buffer.append(target); buffer.append(","); //$NON-NLS-1$ @@ -282,12 +283,12 @@ public final class ExternalToolMigration { config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG))); config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG))); config.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, FALSE.equals(args.get(TAG_TOOL_BLOCK))); - String buildKinds= (String) args.get(TAG_TOOL_BUILD_TYPES); + String buildKinds= args.get(TAG_TOOL_BUILD_TYPES); if (buildKinds != null) { buildKinds= buildKinds.replace(';', ','); // Replace the old separator with the new } config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buildKinds); - config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) args.get(TAG_TOOL_DIRECTORY)); + config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, args.get(TAG_TOOL_DIRECTORY)); return config; } @@ -317,23 +318,23 @@ public final class ExternalToolMigration { } return null; } - + /** * Returns the tool name extracted from the given command argument map. * Extraction is attempted using 2.0 and 2.1 external tool formats. */ - public static String getNameFromCommandArgs(Map commandArgs) { - String name= (String) commandArgs.get(TAG_NAME); + public static String getNameFromCommandArgs(Map<String, String> commandArgs) { + String name= commandArgs.get(TAG_NAME); if (name == null) { - name= (String) commandArgs.get(TAG_TOOL_NAME); + name= commandArgs.get(TAG_TOOL_NAME); } return name; } - + /** * Migrate the old RUN_IN_BACKGROUND launch config attribute to the new * LAUNCH_IN_BACKGROUND attribute provided by the debug ui plugin. - * + * * @param config the config to migrate * @return the migrated config */ @@ -359,52 +360,52 @@ public final class ExternalToolMigration { try { ILaunchConfigurationWorkingCopy workingCopy= config.getWorkingCopy(); workingCopy.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, runInBackground); - config= workingCopy.doSave(); + return workingCopy.doSave(); } catch (CoreException e) { ExternalToolsCore.log(ExternalToolsMigrationMessages.ExternalToolMigration_38, e); } } return config; } - + /** * Extracts a variable name and argument from the given string. - * + * * @param text the source text to parse for a variable tag * @param start the index in the string to start the search * @return the variable definition */ public static VariableDefinition extractVariableDefinition(String text, int start) { VariableDefinition varDef = new VariableDefinition(); - - varDef.start = text.indexOf(VAR_TAG_START, start); + int strt = start; + varDef.start = text.indexOf(VAR_TAG_START, strt); if (varDef.start < 0){ return varDef; } - start = varDef.start + VAR_TAG_START.length(); - - int end = text.indexOf(VAR_TAG_END, start); + strt = varDef.start + VAR_TAG_START.length(); + + int end = text.indexOf(VAR_TAG_END, strt); if (end < 0) { return varDef; } varDef.end = end + VAR_TAG_END.length(); - if (end == start) { + if (end == strt) { return varDef; } - - int mid = text.indexOf(VAR_TAG_SEP, start); + + int mid = text.indexOf(VAR_TAG_SEP, strt); if (mid < 0 || mid > end) { - varDef.name = text.substring(start, end); + varDef.name = text.substring(strt, end); } else { - if (mid > start) { - varDef.name = text.substring(start, mid); + if (mid > strt) { + varDef.name = text.substring(strt, mid); } mid = mid + VAR_TAG_SEP.length(); if (mid < end) { varDef.argument = text.substring(mid, end); } } - + return varDef; - } + } } 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; } diff --git a/org.eclipse.debug.core/.classpath b/org.eclipse.debug.core/.classpath index 3138d4b81..220a8bfaf 100644 --- a/org.eclipse.debug.core/.classpath +++ b/org.eclipse.debug.core/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="core"/> - <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="core"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs index 5d7a22fe3..74c3aeb02 100644 --- a/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.debug.core/.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.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF index 35399581e..dc97a26a0 100644 --- a/org.eclipse.debug.core/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true -Bundle-Version: 3.8.100.qualifier +Bundle-Version: 3.9.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.debug.core.DebugPlugin Bundle-Vendor: %providerName @@ -18,10 +18,10 @@ Export-Package: org.eclipse.debug.core, org.eclipse.debug.internal.core.sourcelookup.containers;x-friends:="org.eclipse.debug.ui", org.eclipse.debug.internal.core.variables;x-friends:="org.eclipse.debug.ui,org.eclipse.jdt.debug.ui" Require-Bundle: org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)";visibility:=reexport, - org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)", + org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)", org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)" Bundle-ActivationPolicy: lazy Import-Package: com.ibm.icu.text -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java index 1c867f7c8..4bf262163 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 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 @@ -28,7 +28,7 @@ import org.eclipse.debug.internal.core.DebugCoreMessages; * down order - that is, parents are created before children. * Termination events are guaranteed to occur in a bottom up order - * that is, children before parents. However, termination events are not guaranteed - * for all elements that are created. That is, terminate events can be coalesced - a + * for all elements that are created. That is, terminate events can be coalesced - a * terminate event for a parent signals that all children have been terminated. * </p> * <p> @@ -135,15 +135,15 @@ import org.eclipse.debug.internal.core.DebugCoreMessages; * <li><code>IValue</code> - no events are specified for values. * </li> * </ul> - * + * */ public final class DebugEvent extends EventObject { - + /** * All objects that can be serialized should have a stable serialVersionUID */ private static final long serialVersionUID = 1L; - + /** * Resume event kind. */ @@ -163,19 +163,19 @@ public final class DebugEvent extends EventObject { * Terminate event kind. */ public static final int TERMINATE= 0x0008; - + /** * Change event kind. */ public static final int CHANGE= 0x0010; - + /** * Model specific event kind. The detail codes * for a model specific event are client defined. - * + * * @since 2.1.2 */ - public static final int MODEL_SPECIFIC= 0x0020; + public static final int MODEL_SPECIFIC= 0x0020; /** * Step start detail. Indicates a thread was resumed by a step @@ -183,47 +183,47 @@ public final class DebugEvent extends EventObject { * @since 2.0 */ public static final int STEP_INTO= 0x0001; - + /** * Step start detail. Indicates a thread was resumed by a step * over action. * @since 2.0 */ public static final int STEP_OVER= 0x0002; - + /** * Step start detail. Indicates a thread was resumed by a step * return action. * @since 2.0 */ - public static final int STEP_RETURN= 0x0004; + public static final int STEP_RETURN= 0x0004; /** * Step end detail. Indicates a thread was suspended due * to the completion of a step action. */ public static final int STEP_END= 0x0008; - + /** * Breakpoint detail. Indicates a thread was suspended by * a breakpoint. */ public static final int BREAKPOINT= 0x0010; - + /** * Client request detail. Indicates a thread was suspended due * to a client request. */ public static final int CLIENT_REQUEST= 0x0020; - + /** * Evaluation detail. Indicates that a thread was resumed or * suspended to perform an expression evaluation. - * + * * @since 2.0 */ public static final int EVALUATION = 0x0040; - + /** * Evaluation detail. Indicates that a thread was resumed or * suspended to perform an implicit expression evaluation. @@ -231,35 +231,35 @@ public final class DebugEvent extends EventObject { * as an indirect result of a user action. * Clients may use this detail event to decide whether or not * to alert the user that an evaluation is taking place.. - * + * * @since 2.0 */ public static final int EVALUATION_IMPLICIT = 0x0080; /** - * State change detail. Indicates the state of a single + * State change detail. Indicates the state of a single * debug element has changed. Only valid for <code>CHANGE</code> * events. - * + * * @since 2.0 */ public static final int STATE = 0x0100; - + /** * Content change detail. Indicates the content of a debug element * (and potentially its children) has changed. Only valid for * <code>CHANGE</code> events. - * + * * @since 2.0 */ - public static final int CONTENT = 0x0200; - + public static final int CONTENT = 0x0200; + /** * Constant indicating that the kind or detail of a debug * event is unspecified. */ public static final int UNSPECIFIED = 0; - + /** * The kind of event - one of the kind constants defined by * this class. @@ -271,14 +271,14 @@ public final class DebugEvent extends EventObject { * this class. */ private int fDetail= UNSPECIFIED; - + /** * Client defined data field. - * + * * @since 2.1.2 */ private Object fData = null; - + /** * Constructs a new debug event of the given kind with a detail code of * <code>UNSPECIFIED</code>. @@ -302,10 +302,12 @@ public final class DebugEvent extends EventObject { */ public DebugEvent(Object eventSource, int kind, int detail) { super(eventSource); - if ((kind & (RESUME | SUSPEND | CREATE | TERMINATE | CHANGE | MODEL_SPECIFIC)) == 0) - throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_kind); - if (kind != MODEL_SPECIFIC && detail != UNSPECIFIED && (detail & (STEP_END | STEP_INTO | STEP_OVER | STEP_RETURN | BREAKPOINT | CLIENT_REQUEST |EVALUATION | EVALUATION_IMPLICIT | STATE | CONTENT)) == 0) - throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_detail); + if ((kind & (RESUME | SUSPEND | CREATE | TERMINATE | CHANGE | MODEL_SPECIFIC)) == 0) { + throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_kind); + } + if (kind != MODEL_SPECIFIC && detail != UNSPECIFIED && (detail & (STEP_END | STEP_INTO | STEP_OVER | STEP_RETURN | BREAKPOINT | CLIENT_REQUEST |EVALUATION | EVALUATION_IMPLICIT | STATE | CONTENT)) == 0) { + throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_detail); + } fKind= kind; fDetail= detail; } @@ -323,19 +325,19 @@ public final class DebugEvent extends EventObject { /** * Returns this event's kind - one of the kind constants defined by this class. - * + * * @return the kind code */ public int getKind() { return fKind; } - + /** * Returns whether this event's detail indicates the * beginning of a step event. This event's detail is one * of <code>STEP_INTO</code>, <code>STEP_OVER</code>, or * <code>STEP_RETURN</code>. - * + * * @return whether this event's detail indicates the beginning * of a step event. * @since 2.0 @@ -343,42 +345,43 @@ public final class DebugEvent extends EventObject { public boolean isStepStart() { return (getDetail() & (STEP_INTO | STEP_OVER | STEP_RETURN)) > 0; } - + /** * Returns whether this event's detail indicates an * evaluation. This event's detail is one * of <code>EVALUATION</code>, or <code>EVALUATION_IMPLICIT</code>. - * + * * @return whether this event's detail indicates an evaluation. * @since 2.0 */ public boolean isEvaluation() { return (getDetail() & (EVALUATION | EVALUATION_IMPLICIT)) > 0; - } - + } + /** * Sets this event's application defined data. - * + * * @param data application defined data * @since 2.1.2 */ public void setData(Object data) { fData = data; } - + /** * Returns this event's application defined data, or <code>null</code> if none - * + * * @return application defined data, or <code>null</code> if none * @since 2.1.2 */ public Object getData() { return fData; } - + /** * @see java.lang.Object#toString() */ + @Override public String toString() { StringBuffer buf = new StringBuffer("DebugEvent["); //$NON-NLS-1$ if (getSource() != null) { @@ -399,7 +402,7 @@ public final class DebugEvent extends EventObject { break; case SUSPEND: buf.append("SUSPEND"); //$NON-NLS-1$ - break; + break; case CHANGE: buf.append("CHANGE"); //$NON-NLS-1$ break; @@ -409,6 +412,8 @@ public final class DebugEvent extends EventObject { case MODEL_SPECIFIC: buf.append("MODEL_SPECIFIC"); //$NON-NLS-1$ break; + default: + break; } buf.append(", "); //$NON-NLS-1$ switch (getDetail()) { @@ -435,13 +440,13 @@ public final class DebugEvent extends EventObject { break; case EVALUATION_IMPLICIT: buf.append("EVALUATION_IMPLICIT"); //$NON-NLS-1$ - break; + break; case STATE: buf.append("STATE"); //$NON-NLS-1$ - break; + break; case CONTENT: buf.append("CONTENT"); //$NON-NLS-1$ - break; + break; case UNSPECIFIED: buf.append("UNSPECIFIED"); //$NON-NLS-1$ break; 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 5e814fea9..44b3e4adc 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 @@ -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 @@ -92,7 +92,7 @@ import com.ibm.icu.text.MessageFormat; * @noextend This class is not intended to be sub-classed by clients. */ public class DebugPlugin extends Plugin { - + /** * Unique identifier constant (value <code>"org.eclipse.debug.core"</code>) * for the Debug Core plug-in. @@ -102,63 +102,63 @@ public class DebugPlugin extends Plugin { /** * Simple identifier constant (value <code>"launchConfigurationTypes"</code>) * for the launch configuration types extension point. - * + * * @since 2.0 */ - public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES= "launchConfigurationTypes"; //$NON-NLS-1$ - + public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES= "launchConfigurationTypes"; //$NON-NLS-1$ + /** * Simple identifier constant (value <code>"launchConfigurationComparators"</code>) * for the launch configuration comparators extension point. - * + * * @since 2.0 */ - public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS= "launchConfigurationComparators"; //$NON-NLS-1$ - + public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS= "launchConfigurationComparators"; //$NON-NLS-1$ + /** * Simple identifier constant (value <code>"breakpoints"</code>) for the * breakpoints extension point. - * + * * @since 2.0 */ public static final String EXTENSION_POINT_BREAKPOINTS= "breakpoints"; //$NON-NLS-1$ - + /** * Simple identifier constant (value <code>"statusHandlers"</code>) for the * status handlers extension point. - * + * * @since 2.0 */ - public static final String EXTENSION_POINT_STATUS_HANDLERS= "statusHandlers"; //$NON-NLS-1$ + public static final String EXTENSION_POINT_STATUS_HANDLERS= "statusHandlers"; //$NON-NLS-1$ /** * Simple identifier constant (value <code>"sourceLocators"</code>) for the * source locators extension point. - * + * * @since 2.0 */ - public static final String EXTENSION_POINT_SOURCE_LOCATORS= "sourceLocators"; //$NON-NLS-1$ - + public static final String EXTENSION_POINT_SOURCE_LOCATORS= "sourceLocators"; //$NON-NLS-1$ + /** * Simple identifier constant (value <code>"launchModes"</code>) for the * source modes extension point. - * + * * @since 3.0 */ - public static final String EXTENSION_POINT_LAUNCH_MODES= "launchModes"; //$NON-NLS-1$ - + public static final String EXTENSION_POINT_LAUNCH_MODES= "launchModes"; //$NON-NLS-1$ + /** * Simple identifier constant (value <code>"launchDelegates"</code>) for the * launch delegates extension point. - * + * * @since 3.0 */ public static final String EXTENSION_POINT_LAUNCH_DELEGATES= "launchDelegates"; //$NON-NLS-1$ - + /** * Simple identifier constant (value <code>"processFactories"</code>) for the * process factories extension point. - * + * * @since 3.0 */ public static final String EXTENSION_POINT_PROCESS_FACTORIES = "processFactories"; //$NON-NLS-1$ @@ -166,62 +166,62 @@ public class DebugPlugin extends Plugin { /** * Simple identifier constant (value <code>"logicalStructureTypes"</code>) for the * logical structure types extension point. - * + * * @since 3.0 */ public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES = "logicalStructureTypes"; //$NON-NLS-1$ - + /** * Simple identifier constant (value <code>"logicalStructureProviders"</code>) for the * logical structure types extension point. - * + * * @since 3.1 */ public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS = "logicalStructureProviders"; //$NON-NLS-1$ - + /** * Simple identifier constant (value <code>"sourceContainerTypes"</code>) for the * source container types extension point. - * + * * @since 3.0 - */ + */ public static final String EXTENSION_POINT_SOURCE_CONTAINER_TYPES = "sourceContainerTypes"; //$NON-NLS-1$ /** * Simple identifier constant (value <code>"sourcePathComputers"</code>) for the * source path computers extension point. - * + * * @since 3.0 - */ + */ public static final String EXTENSION_POINT_SOURCE_PATH_COMPUTERS = "sourcePathComputers"; //$NON-NLS-1$ - + /** * Simple identifier constant for the launch options extension point - * + * * @since 3.3 */ public static final String EXTENSION_POINT_LAUNCH_OPTIONS = "launchOptions"; //$NON-NLS-1$ - + /** * Simple identifier constant for the breakpoint import participant extension point - * + * * @since 3.5 */ public static final String EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS = "breakpointImportParticipants"; //$NON-NLS-1$ - + /** * Status code indicating an unexpected error. - * + * * @since 3.4 */ - public static final int ERROR = 125; - + public static final int ERROR = 125; + /** - * Status code indicating an unexpected internal error. Internal errors + * Status code indicating an unexpected internal error. Internal errors * should never be displayed to the user in dialogs or status text. * Internal error messages are not translated. */ - public static final int INTERNAL_ERROR = 120; + public static final int INTERNAL_ERROR = 120; /** * Status code indicating that the Eclipse runtime does not support @@ -234,7 +234,7 @@ public class DebugPlugin extends Plugin { * </p> */ public static final int ERR_WORKING_DIRECTORY_NOT_SUPPORTED = 115; - + /** * The launch configuration attribute that designates the process factory ID * for the process factory to be used when creating a new process as a result of launching @@ -242,46 +242,46 @@ public class DebugPlugin extends Plugin { * @since 3.0 */ public static final String ATTR_PROCESS_FACTORY_ID = "process_factory_id"; //$NON-NLS-1$ - + /** * The launch attribute that designates whether or not it's associated * launch should capture output. Value is a string representing a boolean - * <code>true</code> or <code>false</code>. When unspecified, the default * value is considered <code>true</code>. - * + * * @since 3.1 */ public static final String ATTR_CAPTURE_OUTPUT = PI_DEBUG_CORE + ".capture_output"; //$NON-NLS-1$ - + /** * The launch attribute that stores the time stamp of when a launch configuration was * launched. Value is {@link Long#toString(long)} of {@link System#currentTimeMillis()}. - * + * * @since 3.6 */ public static final String ATTR_LAUNCH_TIMESTAMP = PI_DEBUG_CORE + ".launch.timestamp"; //$NON-NLS-1$ - + /** * This launch attribute designates the encoding to be used by the console * associated with the launch. * <p> - * For release 3.3, the system encoding is used when unspecified. Since 3.4, + * For release 3.3, the system encoding is used when unspecified. Since 3.4, * the inherited encoding is used when unspecified. See {@link ILaunchManager} for a * description in <code>getEncoding(ILaunchConfiguration)</code>. * </p> * <p> - * Value of this constant is the same as the value of the old + * Value of this constant is the same as the value of the old * <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code> constant for backward * compatibility. * </p> * @since 3.3 */ public static final String ATTR_CONSOLE_ENCODING = "org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING"; //$NON-NLS-1$ - + /** * Boolean preference key (value <code>org.eclipse.debug.core.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE</code>) that controls * whether to delete associated configurations when a project is deleted. Default value is <code>false</code>. - * + * * @since 3.7 */ public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = PI_DEBUG_CORE + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE"; //$NON-NLS-1$ @@ -290,7 +290,7 @@ public class DebugPlugin extends Plugin { * Deleted breakpoint marker attribute (value * <code>"org.eclipse.debug.core.breakpointIsDeleted"</code>). The attribute is a * <code>boolean</code> corresponding to the deleted state of a breakpoint. - * + * * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean) * @since 3.7 */ @@ -305,7 +305,7 @@ public class DebugPlugin extends Plugin { /** * Attribute key for the path of the working directory for an {@link IProcess} - * + * * @see IProcess * @since 3.8 */ @@ -313,7 +313,7 @@ public class DebugPlugin extends Plugin { /** * Attribute key for path of the executable that launched an {@link IProcess} - * + * * @see IProcess * @since 3.8 */ @@ -328,11 +328,11 @@ public class DebugPlugin extends Plugin { * The singleton breakpoint manager. */ private BreakpointManager fBreakpointManager; - + /** * The singleton expression manager. */ - private ExpressionManager fExpressionManager; + private ExpressionManager fExpressionManager; /** * The singleton launch manager. @@ -344,12 +344,12 @@ public class DebugPlugin extends Plugin { * @since 3.1 */ private MemoryBlockManager fMemoryBlockManager; - + /** * The collection of debug event listeners. */ private ListenerList fEventListeners = new ListenerList(); - + /** * Event filters, or <code>null</code> if none. */ @@ -360,20 +360,20 @@ public class DebugPlugin extends Plugin { * down. */ private boolean fShuttingDown= false; - + /** * Table of status handlers. Keys are {plug-in identifier, status code} * pairs, and values are associated <code>IConfigurationElement</code>s. */ - private HashMap fStatusHandlers = null; - + private HashMap<StatusHandlerKey, IConfigurationElement> fStatusHandlers = null; + /** * Map of process factories. Keys are process factory IDs * and values are associated <code>IConfigurationElement</code>s. * @since 3.0 */ - private HashMap fProcessFactories = null; - + private HashMap<String, IConfigurationElement> fProcessFactories = null; + /** * Mode constants for the event notifier */ @@ -383,11 +383,11 @@ public class DebugPlugin extends Plugin { /** * Queue of debug events to fire to listeners and asynchronous runnables to execute * in the order received. - * + * * @since 3.1 */ - private List fEventQueue = new ArrayList(); - + private List<Object> fEventQueue = new ArrayList<Object>(); + /** * Job to fire events to listeners. * @since 3.1 @@ -396,11 +396,11 @@ public class DebugPlugin extends Plugin { /** * Event dispatch job. Processes event queue of debug events and runnables. - * + * * @since 3.1 */ class EventDispatchJob extends Job { - + EventNotifier fNotifier = new EventNotifier(); AsynchRunner fRunner = new AsynchRunner(); @@ -408,15 +408,16 @@ public class DebugPlugin extends Plugin { * Creates a new event dispatch job. */ public EventDispatchJob() { - super(DebugCoreMessages.DebugPlugin_1); + super(DebugCoreMessages.DebugPlugin_1); setPriority(Job.INTERACTIVE); setSystem(true); } /* (non-Javadoc) * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) */ - protected IStatus run(IProgressMonitor monitor) { - + @Override + protected IStatus run(IProgressMonitor monitor) { + while (!fEventQueue.isEmpty()) { Object next = null; synchronized (fEventQueue) { @@ -432,44 +433,46 @@ public class DebugPlugin extends Plugin { } return Status.OK_STATUS; } - + /* (non-Javadoc) * @see org.eclipse.core.runtime.jobs.Job#shouldRun() */ - public boolean shouldRun() { + @Override + public boolean shouldRun() { return shouldSchedule(); } /* (non-Javadoc) * @see org.eclipse.core.internal.jobs.InternalJob#shouldSchedule() */ - public boolean shouldSchedule() { + @Override + public boolean shouldSchedule() { return !(isShuttingDown() || fEventListeners.isEmpty()); } - + } /** * Returns the singleton instance of the debug plug-in. - * + * * @return the debug plug-in */ public static DebugPlugin getDefault() { return fgDebugPlugin; } - + /** * Sets the singleton instance of the debug plug-in. - * + * * @param plugin the debug plug-in, or <code>null</code> * when shutting down */ private static void setDefault(DebugPlugin plugin) { fgDebugPlugin = plugin; } - + /** * Convenience method which returns the unique identifier of this plug-in. - * + * * @return debug plug-in identifier */ public static String getUniqueIdentifier() { @@ -479,7 +482,7 @@ public class DebugPlugin extends Plugin { /** * Constructs the debug plug-in. * <p> - * An instance of this plug-in runtime class is automatically created + * An instance of this plug-in runtime class is automatically created * when the facilities provided by this plug-in are required. * <b>Clients must never explicitly instantiate a plug-in runtime class.</b> * </p> @@ -488,7 +491,7 @@ public class DebugPlugin extends Plugin { super(); setDefault(this); } - + /** * Adds the given listener to the collection of registered debug * event listeners. Has no effect if an identical listener is already @@ -499,33 +502,34 @@ public class DebugPlugin extends Plugin { */ public void addDebugEventListener(IDebugEventSetListener listener) { fEventListeners.add(listener); - } - + } + /** * Notifies all registered debug event set listeners of the given * debug events. Events which are filtered by a registered debug event * filter are not fired. - * + * * @param events array of debug events to fire * @see IDebugEventFilter * @see IDebugEventSetListener * @since 2.0 */ public void fireDebugEventSet(DebugEvent[] events) { - if (isShuttingDown() || events == null || fEventListeners.isEmpty()) + if (isShuttingDown() || events == null || fEventListeners.isEmpty()) { return; + } synchronized (fEventQueue) { fEventQueue.add(events); } fEventDispatchJob.schedule(); } - + /** * Asynchronously executes the given runnable in a separate * thread, after debug event dispatch has completed. If debug * events are not currently being dispatched, the runnable is * scheduled to run in a separate thread immediately. - * + * * @param r runnable to execute asynchronously * @since 2.1 */ @@ -535,7 +539,7 @@ public class DebugPlugin extends Plugin { } fEventDispatchJob.schedule(); } - + /** * Returns the breakpoint manager. * @@ -548,7 +552,7 @@ public class DebugPlugin extends Plugin { } return fBreakpointManager; } - + /** * Returns the launch manager. * @@ -561,7 +565,7 @@ public class DebugPlugin extends Plugin { } return fLaunchManager; } - + /** * Returns the memory block manager. * @return the memory block manager. @@ -574,7 +578,7 @@ public class DebugPlugin extends Plugin { } return fMemoryBlockManager; } - + /** * Returns the status handler registered for the given * status, or <code>null</code> if none. @@ -593,21 +597,21 @@ public class DebugPlugin extends Plugin { if (fStatusHandlers == null) { initializeStatusHandlers(); } - IConfigurationElement config = (IConfigurationElement)fStatusHandlers.get(key); + IConfigurationElement config = fStatusHandlers.get(key); if (config != null) { try { Object handler = config.createExecutableExtension(IConfigurationElementConstants.CLASS); if (handler instanceof IStatusHandler) { return (IStatusHandler)handler; } - invalidStatusHandler(null, MessageFormat.format("Registered status handler {0} does not implement required interface IStatusHandler.", new String[] {config.getDeclaringExtension().getUniqueIdentifier()})); //$NON-NLS-1$ + invalidStatusHandler(null, MessageFormat.format("Registered status handler {0} does not implement required interface IStatusHandler.", new Object[] { config.getDeclaringExtension().getUniqueIdentifier() })); //$NON-NLS-1$ } catch (CoreException e) { log(e); } } return null; - } - + } + /** * Returns the expression manager. * @@ -620,8 +624,8 @@ public class DebugPlugin extends Plugin { fExpressionManager = new ExpressionManager(); } return fExpressionManager; - } - + } + /** * Removes the given listener from the collection of registered debug * event listeners. Has no effect if an identical listener is not already @@ -632,15 +636,16 @@ public class DebugPlugin extends Plugin { */ public void removeDebugEventListener(IDebugEventSetListener listener) { fEventListeners.remove(listener); - } + } /* (non-Javadoc) * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ + @Override public void stop(BundleContext context) throws Exception { try { setShuttingDown(true); - + if (fLaunchManager != null) { fLaunchManager.shutdown(); } @@ -650,10 +655,10 @@ public class DebugPlugin extends Plugin { if (fMemoryBlockManager != null) { fMemoryBlockManager.shutdown(); } - + fEventListeners.clear(); fEventFilters.clear(); - + SourceLookupUtils.shutdown(); Preferences.savePreferences(DebugPlugin.getUniqueIdentifier()); ResourcesPlugin.getWorkspace().removeSaveParticipant(getUniqueIdentifier()); @@ -662,23 +667,28 @@ public class DebugPlugin extends Plugin { setDefault(null); } } - + /* (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) */ + @Override public void start(BundleContext context) throws Exception { super.start(context); new DebugOptions(context); ResourcesPlugin.getWorkspace().addSaveParticipant(getUniqueIdentifier(), new ISaveParticipant() { + @Override public void saving(ISaveContext saveContext) throws CoreException { if (fExpressionManager != null) { fExpressionManager.storeWatchExpressions(); } Preferences.savePreferences(DebugPlugin.getUniqueIdentifier()); - } + } + @Override public void rollback(ISaveContext saveContext) {} + @Override public void prepareToSave(ISaveContext saveContext) throws CoreException {} + @Override public void doneSaving(ISaveContext saveContext) {} }); //command adapters @@ -692,7 +702,7 @@ public class DebugPlugin extends Plugin { manager.registerAdapters(actionFactory, ITerminate.class); manager.registerAdapters(actionFactory, ILaunch.class); manager.registerAdapters(actionFactory, IProcess.class); - manager.registerAdapters(actionFactory, IDebugElement.class); + manager.registerAdapters(actionFactory, IDebugElement.class); } /** @@ -715,7 +725,7 @@ public class DebugPlugin extends Plugin { public static IProcess newProcess(ILaunch launch, Process process, String label) { return newProcess(launch, process, label, null); } - + /** * Creates and returns a new process representing the given * <code>java.lang.Process</code>. A streams proxy is created @@ -737,7 +747,7 @@ public class DebugPlugin extends Plugin { * @see IProcessFactory * @since 2.1 */ - public static IProcess newProcess(ILaunch launch, Process process, String label, Map attributes) { + public static IProcess newProcess(ILaunch launch, Process process, String label, Map<String, String> attributes) { ILaunchConfiguration config= launch.getLaunchConfiguration(); String processFactoryID= null; if (config != null) { @@ -751,7 +761,7 @@ public class DebugPlugin extends Plugin { if (plugin.fProcessFactories == null) { plugin.initializeProcessFactories(); } - IConfigurationElement element= (IConfigurationElement) plugin.fProcessFactories.get(processFactoryID); + IConfigurationElement element= plugin.fProcessFactories.get(processFactoryID); if (element == null) { return null; } @@ -763,56 +773,56 @@ public class DebugPlugin extends Plugin { return null; } return processFactory.newProcess(launch, process, label, attributes); - } + } return new RuntimeProcess(launch, process, label, attributes); - } - + } + /** * Returns any logical structure types that have been contributed for the given * value. - * + * * @param value the value for which logical structure types have been requested * @return logical structure types that have been contributed for the given * value, possibly an empty collection - * + * * @since 3.0 */ public static ILogicalStructureType[] getLogicalStructureTypes(IValue value) { return LogicalStructureManager.getDefault().getLogicalStructureTypes(value); } - + /** * Returns the default logical structure type among the given combination of * logical structure types, or <code>null</code> if none. When the given combination * of logical structure type is applicable for a value, the default logical structure * type is used to display a value. - * + * * @param types a combination of structures applicable to a value * @return the default structure that should be used to display the value * or <code>null</code> if none - * + * * @since 3.1 */ public static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types) { return LogicalStructureManager.getDefault().getSelectedStructureType(types); } - + /** * Sets the default logical structure type among the given combination of logical structure * types. The logical structure types provided should all be applicable to a single * value. Specifying <code>null</code> indicates there is no default logical structure * for the given combination of types. - * + * * @param types a combination of logical structure types applicable to a value * @param def the default logical structure among the given combination of types * or <code>null</code> if none - * + * * @since 3.1 */ public static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def) { LogicalStructureManager.getDefault().setEnabledType(types, def); } - + /** * Convenience method that performs a runtime exec on the given command line * in the context of the specified working directory, and returns the @@ -820,14 +830,14 @@ public class DebugPlugin extends Plugin { * specification of a working directory, the status handler for error code * <code>ERR_WORKING_DIRECTORY_NOT_SUPPORTED</code> is queried to see if the * exec should be re-executed without specifying a working directory. - * + * * @param cmdLine the command line * @param workingDirectory the working directory, or <code>null</code> * @return the resulting process or <code>null</code> if the exec is * canceled * @exception CoreException if the exec fails * @see Runtime - * + * * @since 2.1 */ public static Process exec(String[] cmdLine, File workingDirectory) throws CoreException { @@ -841,7 +851,7 @@ public class DebugPlugin extends Plugin { * specification of a working directory, the status handler for error code * <code>ERR_WORKING_DIRECTORY_NOT_SUPPORTED</code> is queried to see if the * exec should be re-executed without specifying a working directory. - * + * * @param cmdLine the command line * @param workingDirectory the working directory, or <code>null</code> * @param envp the environment variables set in the process, or <code>null</code> @@ -849,7 +859,7 @@ public class DebugPlugin extends Plugin { * canceled * @exception CoreException if the exec fails * @see Runtime - * + * * @since 3.0 */ public static Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException { @@ -861,13 +871,13 @@ public class DebugPlugin extends Plugin { p= Runtime.getRuntime().exec(cmdLine, envp, workingDirectory); } } catch (IOException e) { - Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e); + Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e); throw new CoreException(status); } catch (NoSuchMethodError e) { - //attempting launches on 1.2.* - no ability to set working directory - IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERR_WORKING_DIRECTORY_NOT_SUPPORTED, DebugCoreMessages.DebugPlugin_Eclipse_runtime_does_not_support_working_directory_2, e); + //attempting launches on 1.2.* - no ability to set working directory + IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERR_WORKING_DIRECTORY_NOT_SUPPORTED, DebugCoreMessages.DebugPlugin_Eclipse_runtime_does_not_support_working_directory_2, e); IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(status); - + if (handler != null) { Object result = handler.handleStatus(status, null); if (result instanceof Boolean && ((Boolean)result).booleanValue()) { @@ -877,67 +887,67 @@ public class DebugPlugin extends Plugin { } return p; } - + /** - * Returns whether this plug-in is in the process of + * Returns whether this plug-in is in the process of * being shutdown. - * - * @return whether this plug-in is in the process of + * + * @return whether this plug-in is in the process of * being shutdown */ private boolean isShuttingDown() { return fShuttingDown; } - + /** - * Sets whether this plug-in is in the process of + * Sets whether this plug-in is in the process of * being shutdown. - * - * @param value whether this plug-in is in the process of + * + * @param value whether this plug-in is in the process of * being shutdown */ private void setShuttingDown(boolean value) { fShuttingDown = value; } - + /** * Returns the collection of debug event listeners registered * with this plug-in. - * + * * @return list of registered debug event listeners, instances * of <code>IDebugEventSetListeners</code> */ private Object[] getEventListeners() { return fEventListeners.getListeners(); } - + /** * Adds the given debug event filter to the registered * event filters. Has no effect if an identical filter * is already registered. - * + * * @param filter debug event filter * @since 2.0 */ public void addDebugEventFilter(IDebugEventFilter filter) { fEventFilters.add(filter); } - + /** * Removes the given debug event filter from the registered * event filters. Has no effect if an identical filter * is not already registered. - * + * * @param filter debug event filter * @since 2.0 */ public void removeDebugEventFilter(IDebugEventFilter filter) { fEventFilters.remove(filter); - } - + } + /** * Logs the given message if in debug mode. - * + * * @param message the message to log * @since 2.0 */ @@ -945,10 +955,10 @@ public class DebugPlugin extends Plugin { if (getDefault().isDebugging()) { // this message is intentionally not externalized, as an exception may // be due to the resource bundle itself - log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_2, new String[] {message}), null)); + log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_2, new Object[] { message }), null)); } } - + /** * Logs the given message with this plug-in's log and the given * throwable or <code>null</code> if none. @@ -958,41 +968,41 @@ public class DebugPlugin extends Plugin { public static void logMessage(String message, Throwable throwable) { log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, message, throwable)); } - + /** * Logs the specified status with this plug-in's log. - * + * * @param status status to log * @since 2.0 */ public static void log(IStatus status) { getDefault().getLog().log(status); } - + /** * Logs the specified throwable with this plug-in's log. - * - * @param t throwable to log + * + * @param t throwable to log * @since 2.0 */ public static void log(Throwable t) { IStatus status= new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_3, t); log(status); } - + /** * Register status handlers. - * + * */ private void initializeStatusHandlers() { IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.PI_DEBUG_CORE, EXTENSION_POINT_STATUS_HANDLERS); IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); - fStatusHandlers = new HashMap(infos.length); + fStatusHandlers = new HashMap<StatusHandlerKey, IConfigurationElement>(infos.length); for (int i= 0; i < infos.length; i++) { IConfigurationElement configurationElement = infos[i]; String id = configurationElement.getAttribute("plugin"); //$NON-NLS-1$ String code = configurationElement.getAttribute("code"); //$NON-NLS-1$ - + if (id != null && code != null) { try { StatusHandlerKey key = new StatusHandlerKey(id, Integer.parseInt(code)); @@ -1005,17 +1015,17 @@ public class DebugPlugin extends Plugin { // invalid status handler invalidStatusHandler(null, configurationElement.getAttribute("id")); //$NON-NLS-1$ } - } + } } - + /** * Register process factories. - * + * */ private void initializeProcessFactories() { IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.PI_DEBUG_CORE, EXTENSION_POINT_PROCESS_FACTORIES); IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); - fProcessFactories = new HashMap(infos.length); + fProcessFactories = new HashMap<String, IConfigurationElement>(infos.length); for (int i= 0; i < infos.length; i++) { IConfigurationElement configurationElement = infos[i]; String id = configurationElement.getAttribute("id"); //$NON-NLS-1$ @@ -1025,32 +1035,35 @@ public class DebugPlugin extends Plugin { } else { // invalid process factory String badDefiner= infos[i].getContributor().getName(); - log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, new String[] {badDefiner, id}), null)); + log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, new Object[] { + badDefiner, id }), null)); } - } + } } - + private void invalidStatusHandler(Exception e, String id) { - log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_5, new String[] {id}), e)); + log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_5, new Object[] { id }), e)); } - + /** * Key for status handler extensions - a plug-in identifier/code pair */ class StatusHandlerKey { - + String fPluginId; int fCode; - + StatusHandlerKey(String pluginId, int code) { fPluginId = pluginId; fCode = code; } - + + @Override public int hashCode() { return fPluginId.hashCode() + fCode; } - + + @Override public boolean equals(Object obj) { if (obj instanceof StatusHandlerKey) { StatusHandlerKey s = (StatusHandlerKey)obj; @@ -1062,67 +1075,73 @@ public class DebugPlugin extends Plugin { /** * Executes runnables after event dispatch is complete. - * + * * @since 3.0 */ class AsynchRunner implements ISafeRunnable { - + private Runnable fRunnable = null; - + void async(Runnable runnable) { fRunnable = runnable; SafeRunner.run(this); fRunnable = null; - + } /* (non-Javadoc) * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) */ + @Override public void handleException(Throwable exception) { - IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_6, exception); + IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_6, exception); log(status); } /* (non-Javadoc) * @see org.eclipse.core.runtime.ISafeRunnable#run() */ + @Override public void run() throws Exception { fRunnable.run(); } } - + /** * Filters and dispatches events in a safe runnable to handle any * exceptions. */ class EventNotifier implements ISafeRunnable { - + private DebugEvent[] fEvents; private IDebugEventSetListener fListener; private IDebugEventFilter fFilter; private int fMode; - + /** * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) */ + @Override public void handleException(Throwable exception) { switch (fMode) { case NOTIFY_FILTERS: - IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_7, exception); + IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_7, exception); log(status); break; - case NOTIFY_EVENTS: - status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_8, exception); + case NOTIFY_EVENTS: + status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_8, exception); log(status); break; + default: + break; } } /** * @see org.eclipse.core.runtime.ISafeRunnable#run() */ + @Override public void run() throws Exception { switch (fMode) { case NOTIFY_FILTERS: @@ -1131,13 +1150,15 @@ public class DebugPlugin extends Plugin { case NOTIFY_EVENTS: fListener.handleDebugEvents(fEvents); break; + default: + break; } } - + /** * Filter and dispatch the given events. If an exception occurs in one * listener, events are still fired to subsequent listeners. - * + * * @param events debug events */ void dispatch(DebugEvent[] events) { @@ -1151,9 +1172,9 @@ public class DebugPlugin extends Plugin { if (fEvents == null || fEvents.length == 0) { return; } - } - } - + } + } + fMode = NOTIFY_EVENTS; Object[] listeners= getEventListeners(); if (DebugOptions.DEBUG_EVENTS) { @@ -1162,19 +1183,19 @@ public class DebugPlugin extends Plugin { } } for (int i= 0; i < listeners.length; i++) { - fListener = (IDebugEventSetListener)listeners[i]; + fListener = (IDebugEventSetListener)listeners[i]; SafeRunner.run(this); } fEvents = null; fFilter = null; - fListener = null; + fListener = null; } } /** * Creates and returns a new XML document. - * + * * @return a new XML document * @throws CoreException if unable to create a new document * @since 3.0 @@ -1184,13 +1205,13 @@ public class DebugPlugin extends Plugin { return LaunchManager.getDocument(); } catch (ParserConfigurationException e) { abort("Unable to create new XML document.", e); //$NON-NLS-1$ - } + } return null; - } - + } + /** * Serializes the given XML document into a string. - * + * * @param document XML document to serialize * @return a string representing the given document * @throws CoreException if unable to serialize the document @@ -1210,7 +1231,7 @@ public class DebugPlugin extends Plugin { /** * Parses the given string representing an XML document, returning its * root element. - * + * * @param document XML document as a string * @return the document's root element * @throws CoreException if unable to parse the document @@ -1219,7 +1240,7 @@ public class DebugPlugin extends Plugin { public static Element parseDocument(String document) throws CoreException { Element root = null; InputStream stream = null; - try{ + try{ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); stream = new ByteArrayInputStream(document.getBytes("UTF8")); //$NON-NLS-1$ @@ -1232,7 +1253,7 @@ public class DebugPlugin extends Plugin { abort("Unable to parse XML document.", e); //$NON-NLS-1$ } catch (IOException e) { abort("Unable to parse XML document.", e); //$NON-NLS-1$ - } finally { + } finally { try{ if (stream != null) { stream.close(); @@ -1240,13 +1261,13 @@ public class DebugPlugin extends Plugin { } catch(IOException e) { abort("Unable to parse XML document.", e); //$NON-NLS-1$ } - } + } return root; - } - + } + /** * Throws an exception with the given message and underlying exception. - * + * * @param message error message * @param exception underlying exception, or <code>null</code> * @throws CoreException if a problem is encountered @@ -1255,10 +1276,10 @@ public class DebugPlugin extends Plugin { IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, message, exception); throw new CoreException(status); } - + private static String[] parseArgumentsWindows(String args) { // see http://msdn.microsoft.com/en-us/library/a1y7w461.aspx - List result= new ArrayList(); + List<String> result = new ArrayList<String>(); final int DEFAULT= 0; final int ARG= 1; @@ -1279,16 +1300,18 @@ public class DebugPlugin extends Plugin { buf.append('\\'); } if (backslashes == 1) { - if (state == DEFAULT) + if (state == DEFAULT) { state= ARG; + } buf.append('"'); backslashes= 0; continue; } // else fall through to switch } else { // false alarm, treat passed backslashes literally... - if (state == DEFAULT) + if (state == DEFAULT) { state= ARG; + } for (; backslashes > 0; backslashes--) { buf.append('\\'); } @@ -1316,7 +1339,7 @@ public class DebugPlugin extends Plugin { buf.append(ch); } break; - + case IN_DOUBLE_QUOTE: if (ch == '"') { if (i + 1 < len && args.charAt(i + 1) == '"') { @@ -1342,21 +1365,22 @@ public class DebugPlugin extends Plugin { throw new IllegalStateException(); } } - if (buf.length() > 0 || state != DEFAULT) + if (buf.length() > 0 || state != DEFAULT) { result.add(buf.toString()); + } - return (String[]) result.toArray(new String[result.size()]); + return result.toArray(new String[result.size()]); } - + private static String[] parseArgumentsImpl(String args) { // man sh, see topic QUOTING - List result= new ArrayList(); - + List<String> result = new ArrayList<String>(); + final int DEFAULT= 0; final int ARG= 1; final int IN_DOUBLE_QUOTE= 2; final int IN_SINGLE_QUOTE= 3; - + int state= DEFAULT; StringBuffer buf= new StringBuffer(); int len= args.length(); @@ -1389,7 +1413,7 @@ public class DebugPlugin extends Plugin { buf.append(ch); } break; - + case IN_DOUBLE_QUOTE: if (ch == '"') { state= ARG; @@ -1401,7 +1425,7 @@ public class DebugPlugin extends Plugin { buf.append(ch); } break; - + case IN_SINGLE_QUOTE: if (ch == '\'') { state= ARG; @@ -1409,36 +1433,39 @@ public class DebugPlugin extends Plugin { buf.append(ch); } break; - + default: throw new IllegalStateException(); } } - if (buf.length() > 0 || state != DEFAULT) + if (buf.length() > 0 || state != DEFAULT) { result.add(buf.toString()); - - return (String[]) result.toArray(new String[result.size()]); + } + + return result.toArray(new String[result.size()]); } - + /** * Parses the given command line into separate arguments that can be passed to * <code>DebugPlugin.exec(String[], File)</code>. Embedded quotes and slashes * are escaped. - * + * * @param args command line arguments as a single string * @return individual arguments * @since 3.1 */ public static String[] parseArguments(String args) { - if (args == null) + if (args == null) { return new String[0]; - - if (Constants.OS_WIN32.equals(Platform.getOS())) + } + + if (Constants.OS_WIN32.equals(Platform.getOS())) { return parseArgumentsWindows(args); - + } + return parseArgumentsImpl(args); - } - + } + /** * Renders the given array of strings into a single command line. * <p> @@ -1446,7 +1473,7 @@ public class DebugPlugin extends Plugin { * with the offsets of the start positions of arguments 1 to * <code>arguments.length - 1</code>, as rendered in the resulting string. * </p> - * + * * @param arguments * the command line arguments * @param segments @@ -1460,9 +1487,10 @@ public class DebugPlugin extends Plugin { StringBuffer buf = new StringBuffer(); int count = arguments.length; for (int i = 0; i < count; i++) { - if (i > 0) + if (i > 0) { buf.append(' '); - + } + boolean containsSpace = false; char[] characters = arguments[i].toCharArray(); for (int j = 0; j < characters.length; j++) { @@ -1473,7 +1501,7 @@ public class DebugPlugin extends Plugin { break; } } - + int backslashes = 0; for (int j = 0; j < characters.length; j++) { char ch = characters[j]; @@ -1506,7 +1534,7 @@ public class DebugPlugin extends Plugin { } else if (characters.length == 0) { buf.append("\"\""); //$NON-NLS-1$ } - + if (segments != null && i < count - 1) { segments[i] = buf.length() + 1; } @@ -1516,8 +1544,8 @@ public class DebugPlugin extends Plugin { /** * Sets whether step filters should be applied to step commands. This - * setting is a global option applied to all registered debug targets. - * + * setting is a global option applied to all registered debug targets. + * * @param useStepFilters whether step filters should be applied to step * commands * @since 3.3 @@ -1526,10 +1554,10 @@ public class DebugPlugin extends Plugin { public static void setUseStepFilters(boolean useStepFilters) { getStepFilterManager().setUseStepFilters(useStepFilters); } - + /** * Returns whether step filters are applied to step commands. - * + * * @return whether step filters are applied to step commands * @since 3.3 * @see org.eclipse.debug.core.model.IStepFilters @@ -1537,30 +1565,30 @@ public class DebugPlugin extends Plugin { */ public static boolean isUseStepFilters() { return getStepFilterManager().isUseStepFilters(); - } - + } + /** * Returns the step filter manager. - * + * * @return step filter manager */ private static StepFilterManager getStepFilterManager() { return ((LaunchManager)getDefault().getLaunchManager()).getStepFilterManager(); } - + /** * Returns an adapter of the specified type for the given object or <code>null</code> * if none. The object itself is returned if it is an instance of the specified type. * If the object is adaptable and does not subclass <code>PlatformObject</code>, and * does not provide the specified adapter directly, the platform's adapter manager * is consulted for an adapter. - * + * * @param element element to retrieve adapter for * @param type adapter type * @return adapter or <code>null</code> * @since 3.4 */ - public static Object getAdapter(Object element, Class type) { + public static Object getAdapter(Object element, Class<?> type) { Object adapter = null; if (element != null) { if (type.isInstance(element)) { @@ -1579,9 +1607,9 @@ public class DebugPlugin extends Plugin { } } } - return adapter; - } - + return adapter; + } + } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java index a5cb36658..020ca26cf 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.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 @@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IProgressMonitor; /** * A launch configuration describes how to launch an application. * Each launch configuration is an instance of a type of launch - * configuration as described by a launch configuration type + * configuration as described by a launch configuration type * extension. Each launch configuration has a launch configuration * delegate which performs the actual launching of a * configuration. @@ -61,45 +61,45 @@ import org.eclipse.core.runtime.IProgressMonitor; * @noextend This interface is not intended to be extended by clients. */ public interface ILaunchConfiguration extends IAdaptable { - + /** * The file extension for launch configuration files * (value <code>"launch"</code>). */ public static final String LAUNCH_CONFIGURATION_FILE_EXTENSION = "launch"; //$NON-NLS-1$ - + /** * Launch configuration attribute storing an identifier of * a persistable source locator extension. When this attribute is * specified, a new source locator will be created automatically and * associated with the launch for this configuration. - * + * * @see org.eclipse.debug.core.model.IPersistableSourceLocator */ public static final String ATTR_SOURCE_LOCATOR_ID = DebugPlugin.getUniqueIdentifier() + ".source_locator_id"; //$NON-NLS-1$ - + /** - * Launch configuration attribute storing a memento of a + * Launch configuration attribute storing a memento of a * source locator. When this attribute is specified in * conjunction with a source locator id, the source locator * created for a launch will be initialized with this memento. * When not specified, but a source locator id is specified, * the source locator will be initialized to default values. - * + * * @see org.eclipse.debug.core.model.IPersistableSourceLocator */ public static final String ATTR_SOURCE_LOCATOR_MEMENTO = DebugPlugin.getUniqueIdentifier() + ".source_locator_memento"; //$NON-NLS-1$ - + /** - * Returns whether the contents of this launch configuration are + * Returns whether the contents of this launch configuration are * equal to the contents of the given launch configuration. - * + * * @param configuration launch configuration * @return whether the contents of this launch configuration are equal to the contents * of the specified launch configuration. */ public boolean contentsEqual(ILaunchConfiguration configuration); - + /** * Returns a copy of this launch configuration, as a * working copy, with the specified name. The new @@ -108,7 +108,7 @@ public interface ILaunchConfiguration extends IAdaptable { * will return <code>null</code> for <code>getOriginal()</code>). * When the working copy is saved it will not affect this * launch configuration. - * + * * @param name the name of the copy * @return a copy of this launch configuration * @exception CoreException if this method fails. Reasons include: @@ -119,12 +119,12 @@ public interface ILaunchConfiguration extends IAdaptable { * @see ILaunchConfigurationWorkingCopy#getOriginal() */ public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException; - + /** * Deletes this launch configuration. This configuration's underlying * storage is deleted. Has no effect if this configuration * does not exist. - * + * * @exception CoreException if this method fails. Reasons include: * <ul> * <li>An exception occurs while deleting this configuration's @@ -132,18 +132,18 @@ public interface ILaunchConfiguration extends IAdaptable { * </ul> */ public void delete() throws CoreException; - + /** * Returns whether this launch configuration's underlying * storage exists. This is a handle-only method. - * + * * @return whether this launch configuration's underlying * storage exists */ public boolean exists(); - + /** - * Returns the boolean-valued attribute with the given name. + * Returns the boolean-valued attribute with the given name. * Returns the given default value if the attribute is undefined. * * @param attributeName the name of the attribute @@ -158,9 +158,9 @@ public interface ILaunchConfiguration extends IAdaptable { * </ul> */ public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException; - + /** - * Returns the integer-valued attribute with the given name. + * Returns the integer-valued attribute with the given name. * Returns the given default value if the attribute is undefined. * * @param attributeName the name of the attribute @@ -175,9 +175,9 @@ public interface ILaunchConfiguration extends IAdaptable { * </ul> */ public int getAttribute(String attributeName, int defaultValue) throws CoreException; - + /** - * Returns the <code>java.util.List</code>-valued attribute with the given name. + * Returns the <code>java.util.List</code>-valued attribute with the given name. * Returns the given default value if the attribute is undefined. * * @param attributeName the name of the attribute @@ -191,10 +191,10 @@ public interface ILaunchConfiguration extends IAdaptable { * have a List value</li> * </ul> */ - public List getAttribute(String attributeName, List defaultValue) throws CoreException; - + public List<String> getAttribute(String attributeName, List<String> defaultValue) throws CoreException; + /** - * Returns the <code>java.util.Set</code>-valued attribute with the given name. + * Returns the <code>java.util.Set</code>-valued attribute with the given name. * Returns the given default value if the attribute is undefined. * * @param attributeName the name of the attribute @@ -207,13 +207,13 @@ public interface ILaunchConfiguration extends IAdaptable { * <li>An attribute with the given name exists, but does not * have a List value</li> * </ul> - * + * * @since 3.3 */ - public Set getAttribute(String attributeName, Set defaultValue) throws CoreException; - + public Set<String> getAttribute(String attributeName, Set<String> defaultValue) throws CoreException; + /** - * Returns the <code>java.util.Map</code>-valued attribute with the given name. + * Returns the <code>java.util.Map</code>-valued attribute with the given name. * Returns the given default value if the attribute is undefined. * * @param attributeName the name of the attribute @@ -227,10 +227,10 @@ public interface ILaunchConfiguration extends IAdaptable { * have a Map value</li> * </ul> */ - public Map getAttribute(String attributeName, Map defaultValue) throws CoreException; - + public Map<String, String> getAttribute(String attributeName, Map<String, String> defaultValue) throws CoreException; + /** - * Returns the string-valued attribute with the given name. + * Returns the string-valued attribute with the given name. * Returns the given default value if the attribute is undefined. * * @param attributeName the name of the attribute @@ -245,7 +245,7 @@ public interface ILaunchConfiguration extends IAdaptable { * </ul> */ public String getAttribute(String attributeName, String defaultValue) throws CoreException; - + /** * Returns a map containing the attributes in this launch configuration. * Returns an empty map if this configuration has no attributes. @@ -259,12 +259,12 @@ public interface ILaunchConfiguration extends IAdaptable { * @exception CoreException unable to generate/retrieve an attribute map * @since 2.1 */ - public Map getAttributes() throws CoreException; - + public Map<String, Object> getAttributes() throws CoreException; + /** * Returns this launch configuration's type's category, or <code>null</code> * if unspecified. This is a handle-only method. - * + * * @return this launch configuration's type's category, or <code>null</code> * @exception CoreException if this method fails. Reasons include: * <ul> @@ -273,18 +273,18 @@ public interface ILaunchConfiguration extends IAdaptable { * @since 2.1 */ public String getCategory() throws CoreException; - + /** * Returns the file this launch configuration is stored * in, or <code>null</code> if this configuration is stored * locally with the workspace. This is a handle-only method. - * + * * @return the file this launch configuration is stored * in, or <code>null</code> if this configuration is stored * locally with the workspace */ public IFile getFile(); - + /** * Returns the location of this launch configuration as a * path in the local file system or <code>null</code> if it cannot @@ -294,7 +294,7 @@ public interface ILaunchConfiguration extends IAdaptable { * launch configuration is stored in the workspace as an {@link IFile} in * an external file system ({@link EFS}). * </p> - * + * * @return the location of this launch configuration as a * path file system or <code>null</code> if it cannot be mapped * to a location in the local file system. Since 3.5, this method @@ -302,44 +302,45 @@ public interface ILaunchConfiguration extends IAdaptable { * @deprecated Since a launch configuration does not need to be stored in the local * file system, this attribute should no longer be used to identify a launch configuration. */ + @Deprecated public IPath getLocation(); - + /** * Returns the resources this launch configuration is associated with or <code>null</code> * if none. Clients contributing launch configuration types are responsible for maintaining * resource mappings as appropriate. - * + * * @return the resources this launch configuration is associated with or <code>null</code> * @throws CoreException unable to get the mapped resource * @since 3.2 */ public IResource[] getMappedResources() throws CoreException; - + /** * Returns a memento for this launch configuration, or <code>null</code> * if unable to generate a memento for this configuration. A memento * can be used to re-create a launch configuration, via the * launch manager. - * + * * @return a memento for this configuration * @see ILaunchManager#getLaunchConfiguration(String) * @exception CoreException if an exception occurs generating this - * launch configuration's memento + * launch configuration's memento */ public String getMemento() throws CoreException; - + /** * Returns the name of this launch configuration. This is * a handle-only method. - * + * * @return the name of this launch configuration */ - public String getName(); - + public String getName(); + /** * Returns the launch modes that have been set on this configuration. * An empty set is returned if no specific launch modes have been set - * on a launch configuration. + * on a launch configuration. * <p> * Setting launch modes on a configuration allows a launch to be * performed in mixed mode - for example, debug and profile at the @@ -349,24 +350,24 @@ public interface ILaunchConfiguration extends IAdaptable { * @exception CoreException if an exception occurs retrieving modes * @since 3.3 */ - public Set getModes() throws CoreException; - + public Set<String> getModes() throws CoreException; + /** * Returns the preferred launch delegate that has been set on this * configuration or <code>null</code> if one is not specified. - * + * * @param modes mode set for which a preferred delegate has been requested - * @return this configuration's preferred launch delegate for the specified mode set, or + * @return this configuration's preferred launch delegate for the specified mode set, or * <code>null</code> if one is not specified * @exception CoreException if an exception occurs retrieving preferred delegate * @since 3.3 */ - public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException; - + public ILaunchDelegate getPreferredDelegate(Set<String> modes) throws CoreException; + /** * Returns the type of this launch configuration. This is a * handle-only method. - * + * * @return the type of this launch configuration * @exception CoreException if this method fails. Reasons include: * <ul> @@ -374,22 +375,22 @@ public interface ILaunchConfiguration extends IAdaptable { * </ul> * @see ILaunchConfigurationType */ - public ILaunchConfigurationType getType() throws CoreException; - + public ILaunchConfigurationType getType() throws CoreException; + /** * Returns a working copy of this launch configuration. - * Since 3.3, if this method is called on a working copy, a nested working + * Since 3.3, if this method is called on a working copy, a nested working * copy is created (a working copy of a working copy). * Changes to the working copy will be applied to this - * launch configuration when saved, or to the parent working copy. + * launch configuration when saved, or to the parent working copy. * The working copy will refer to this launch configuration as its original * launch configuration, or the working copy it was created from. * <p> * When a working copy (B) is created from a working copy (A), the newly * created working copy (B) is initialized with the attributes from * the first working copy (A). Whenever a working copy is saved, it is written - * back to the working copy from which it was created: in this example working - * copy B will write back to working copy A, and A will write back to the + * back to the working copy from which it was created: in this example working + * copy B will write back to working copy A, and A will write back to the * original launch configuration. * </p> * @return a working copy of this launch configuration, or a nested working copy if called @@ -402,49 +403,49 @@ public interface ILaunchConfiguration extends IAdaptable { * @see ILaunchConfigurationWorkingCopy#getOriginal() */ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException; - + /** * Returns whether this configuration contains an attribute with the given name. - * + * * @param attributeName the name of the attribute * @return true if this configuration has the specified attribute false otherwise * @throws CoreException if unable to retrieve attributes - * + * * @since 3.4 */ public boolean hasAttribute(String attributeName) throws CoreException; - + /** * Returns whether this launch configuration is stored * locally within the workspace. This is a handle-only method. - * + * * @return whether this launch configuration is stored * locally with the workspace */ public boolean isLocal(); - + /** * Returns whether this launch configuration is a candidate for migration. - * + * * @return whether this launch configuration is a candidate for migration * @throws CoreException if a problem is encountered * @see ILaunchConfigurationMigrationDelegate * @since 3.2 */ public boolean isMigrationCandidate() throws CoreException ; - + /** * Returns whether this launch configuration is a working * copy. Launch configurations which return <code>true</code> - * to this method can be safely cast to + * to this method can be safely cast to * <code>org.eclipse.debug.core.ILaunchConfigurationWorkingCopy</code>. * This is a handle-only method. - * + * * @return whether this launch configuration is a working * copy */ public boolean isWorkingCopy(); - + /** * Launches this configuration in the specified mode by delegating to * this configuration's launch configuration delegate, and returns the @@ -457,9 +458,9 @@ public interface ILaunchConfiguration extends IAdaptable { * defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>. * @param monitor progress monitor, or <code>null</code>. A cancelable progress monitor is provided by the Job * framework. It should be noted that the setCanceled(boolean) method should never be called on the provided - * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor - * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag - * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started. + * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor + * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag + * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started. * @return the resulting launch * @exception CoreException if this method fails. Reasons include:<ul> * <li>unable to instantiate the underlying launch configuration delegate</li> @@ -467,7 +468,7 @@ public interface ILaunchConfiguration extends IAdaptable { * </ul> */ public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException; - + /** * Launches this configuration in the specified mode by delegating to * this configuration's launch configuration delegate, and returns the @@ -502,16 +503,16 @@ public interface ILaunchConfiguration extends IAdaptable { * defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>. * @param monitor progress monitor, or <code>null</code>. A cancelable progress monitor is provided by the Job * framework. It should be noted that the setCanceled(boolean) method should never be called on the provided - * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor - * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag - * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started. + * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor + * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag + * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started. * @param build whether the workspace should be built before the launch * @return resulting launch * @throws CoreException if an exception occurs during the launch sequence * @since 3.0 */ - public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException; - + public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException; + /** * Launches this configuration in the specified mode by delegating to * this configuration's launch configuration delegate, and returns the @@ -550,9 +551,9 @@ public interface ILaunchConfiguration extends IAdaptable { * defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>. * @param monitor progress monitor, or <code>null</code>. A cancelable progress monitor is provided by the Job * framework. It should be noted that the setCanceled(boolean) method should never be called on the provided - * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor - * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag - * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started. + * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor + * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag + * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started. * @param build whether the workspace should be built before the launch * @param register whether to register the resulting launch with the launch manager * @return resulting launch @@ -560,7 +561,7 @@ public interface ILaunchConfiguration extends IAdaptable { * @since 3.1 */ public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException; - + /** * Migrates this launch configuration to be compatible with current tooling. * Has no effect if this configuration is not a candidate for migration. @@ -570,11 +571,11 @@ public interface ILaunchConfiguration extends IAdaptable { * @see ILaunchConfigurationMigrationDelegate */ public void migrate() throws CoreException; - + /** * Returns whether this launch configuration supports the * specified mode. This is a handle-only method. - * + * * @param mode a mode in which a configuration can be launched, one of * the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or * <code>DEBUG_MODE</code>. @@ -586,14 +587,14 @@ public interface ILaunchConfiguration extends IAdaptable { * </ul> */ public boolean supportsMode(String mode) throws CoreException; - + /** * Returns whether this launch configuration is read-only. * A read-only configuration cannot be modified. - * + * * @return whether this configuration is read-only - * + * * @since 3.3 */ - public boolean isReadOnly(); + public boolean isReadOnly(); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java index 375dc34ca..cd78a8ca4 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.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 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.debug.core; - + import java.util.Set; import org.eclipse.core.resources.IContainer; @@ -29,7 +29,7 @@ import org.eclipse.debug.core.sourcelookup.ISourcePathComputer; * type extension. * <pre> * <extension point="org.eclipse.debug.core.launchConfigurationTypes"> - * <launchConfigurationType + * <launchConfigurationType * id="com.example.ExampleIdentifier" * delegate="com.example.ExampleLaunchConfigurationDelegate" * modes="run, debug" @@ -81,47 +81,48 @@ import org.eclipse.debug.core.sourcelookup.ISourcePathComputer; * @noextend This interface is not intended to be extended by clients. */ public interface ILaunchConfigurationType extends IAdaptable { - + /** * Returns the attribute with the given name, as specified by this launch * configuration type's extension definition, or <code>null</code> if * unspecified. - * + * * @param attributeName attribute name * @return the specified extension attribute, or <code>null</code> * @since 2.1 */ public String getAttribute(String attributeName); - + /** * Returns this launch configuration type's category, or <code>null</code> * if unspecified. This corresponds to the category attribute specified in * the extension definition. - * + * * @return this launch configuration type's category, or <code>null</code> * @since 2.1 */ public String getCategory(); - + /** * Returns the launch configuration delegate for launch * configurations of this type, for <code>run</code> mode. * The first time this method is called, the delegate is instantiated. - * + * * @return launch configuration delegate * @exception CoreException if unable to instantiate the * delegate * @deprecated use <code>getDelegate(String)</code> to specify mode - */ + */ + @Deprecated public ILaunchConfigurationDelegate getDelegate() throws CoreException; - + /** * Returns the launch configuration delegate for launch * configurations of this type, for the specified mode. The first time * this method is called for a mode, the delegate is instantiated. * Launch delegates may be contributed to a launch configuration type * via the extension point <code>org.eclipse.debug.core.launchDelegates</code> - * + * * @param mode launch mode * @return launch configuration delegate * @exception CoreException if unable to instantiate the @@ -129,84 +130,85 @@ public interface ILaunchConfigurationType extends IAdaptable { * @since 3.0 * @deprecated since 3.3, the method <code>getDelegates(Set)</code> should be used * instead, as there can be more than one capable delegate per mode or combination - * of modes - */ + * of modes + */ + @Deprecated public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException; - + /** * Returns the delegates capable of launching in the specified modes, possibly * an empty set. - * + * * @param modes set of launch modes * @return the <code>ILaunchDelegate</code>s capable of launching * in the specified modes or an empty collection if none * @throws CoreException if a problem is encountered * @since 3.3 */ - public ILaunchDelegate[] getDelegates(Set modes) throws CoreException; - + public ILaunchDelegate[] getDelegates(Set<String> modes) throws CoreException; + /** * Returns the preferred launch delegate for this type in the specified mode combination * or <code>null</code> if there is no preferred delegate. - * + * * @param modes the set of modes to support * @return the preferred delegate or <code>null</code> if none * @throws CoreException if a problem is encountered - * + * * @since 3.3 */ - public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException; - + public ILaunchDelegate getPreferredDelegate(Set<String> modes) throws CoreException; + /** * Sets the preferred launch delegate for this type in the specified mode combination. * Specify <code>null</code> as a preferred delegate to remove any preferred delegate * setting for this launch configuration type. - * + * * @param modes launch mode combination * @param delegate preferred launch delegate or <code>null</code> * @throws CoreException if a problem is encountered - * + * * @since 3.3 */ - public void setPreferredDelegate(Set modes, ILaunchDelegate delegate) throws CoreException; - + public void setPreferredDelegate(Set<String> modes, ILaunchDelegate delegate) throws CoreException; + /** * Returns whether this launch configuration supports the specified launch * mode combination. - * + * * @param modes launch mode combination * @return whether the launch mode combination is supported * @since 3.3 */ - public boolean supportsModeCombination(Set modes); - + public boolean supportsModeCombination(Set<String> modes); + /** * Returns the unique identifier for this type of launch configuration - * + * * @return the unique identifier for this type of launch configuration */ public String getIdentifier(); - + /** * Returns the name of this type of launch configuration. - * + * * @return the name of this type of launch configuration */ public String getName(); - + /** * Returns the identifier of the plug-in that contributes this launch configuration type. - * + * * @return the identifier of the plug-in that contributes this launch configuration type * @since 3.0 */ public String getPluginIdentifier(); - + /** * Returns the identifier of the persistable source locator registered with * this launch configurations type, or <code>null</code> if unspecified. * A source locator can be specified by a launch configuration type or - * launch delegate extension's <code>sourceLocatorId</code> attribute. + * launch delegate extension's <code>sourceLocatorId</code> attribute. * <p> * Only one source locator should be provided per launch configuration type * and its launch delegates. @@ -216,7 +218,7 @@ public interface ILaunchConfigurationType extends IAdaptable { * @since 3.0 */ public String getSourceLocatorId(); - + /** * Returns the source path computer registered with this launch configuration * type or <code>null</code> if unspecified. A source path computer can be @@ -224,52 +226,53 @@ public interface ILaunchConfigurationType extends IAdaptable { * <code>sourcePathComputerId</code> attribute. * <p> * Only one source path computer should be provided per launch configuration type - * and its launch delegates. + * and its launch delegates. * </p> * @return the source path computer registered with this launch configuration * type or <code>null</code> if unspecified * @since 3.0 */ - public ISourcePathComputer getSourcePathComputer(); - + public ISourcePathComputer getSourcePathComputer(); + /** * Returns all of the registered supported modes for this launch configuration type. * This method does not return null. - * + * * <p> * The returned set does not convey any mode combination capability nor does it describe how or what the type can launch, all this method does is return - * a set of strings of all the modes in some way associated with this type + * a set of strings of all the modes in some way associated with this type * </p> - * + * * @return the set of all supported modes * @since 3.2 - * + * * @deprecated Since 3.3 all modes are provided as sets and not individual strings. The method <code>getSupportedModeCombinations</code> * should be used instead to retrieve the complete listing of supported modes and their allowable combinations. */ - public Set getSupportedModes(); - + @Deprecated + public Set<String> getSupportedModes(); + /** * Returns a <code>java.util.Set</code> of <code>java.util.Set</code>s containing all of the * supported launch mode combinations for this type. - * + * * @return a set of sets of all the supported mode combinations supported by this type - * + * * @since 3.3 */ - public Set getSupportedModeCombinations(); - + public Set<Set<String>> getSupportedModeCombinations(); + /** * Returns whether this launch configuration type is public. Public configuration * types are available for use by the user, for example, the user can create new * configurations based on public types through the UI. Private types are not - * accessible in this way, but are still available through the methods on + * accessible in this way, but are still available through the methods on * <code>ILaunchManager</code>. - * + * * @return whether this launch configuration type is public. */ public boolean isPublic(); - + /** * Returns a new launch configuration working copy of this type, * that resides in the specified container, with the given name. @@ -291,11 +294,11 @@ public interface ILaunchConfigurationType extends IAdaptable { * reason */ public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) throws CoreException; - + /** * Returns whether this type of launch configuration supports * the specified mode. - * + * * @param mode a mode in which a configuration can be launched, one of * the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or * <code>DEBUG_MODE</code>. @@ -303,10 +306,10 @@ public interface ILaunchConfigurationType extends IAdaptable { * specified mode */ public boolean supportsMode(String mode); - + /** * Returns the name of the plug-in that contributed this launch configuration type. - * + * * @return name of contributing plug-in * @since 3.3 */ diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java index a7ffcb85a..b46e3747b 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 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 @@ -44,16 +44,16 @@ import org.eclipse.core.runtime.IAdaptable; * @noextend This interface is not intended to be extended by clients. */ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, IAdaptable { - + /** * Returns whether this configuration has been modified * since it was last saved or created. - * + * * @return whether this configuration has been modified * since it was last saved or created */ public boolean isDirty(); - + /** * Saves this working copy to its underlying file and returns * a handle to the resulting launch configuration. @@ -65,19 +65,19 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * effecting the original launch configuration. * </p> * @return handle to saved launch configuration - * @exception CoreException if an exception occurs while + * @exception CoreException if an exception occurs while * writing this configuration to its underlying file. */ public ILaunchConfiguration doSave() throws CoreException; - + /** - * Sets the integer-valued attribute with the given name. + * Sets the integer-valued attribute with the given name. * * @param attributeName the name of the attribute, cannot be <code>null</code> * @param value the value */ public void setAttribute(String attributeName, int value); - + /** * Sets the String-valued attribute with the given name. * If the value is <code>null</code>, the attribute is removed from @@ -87,7 +87,7 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * @param value the value, or <code>null</code> if the attribute is to be undefined */ public void setAttribute(String attributeName, String value); - + /** * Sets the <code>java.util.List</code>-valued attribute with the given name. * The specified List <em>must</em> contain only String-valued entries. @@ -97,8 +97,8 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * @param attributeName the name of the attribute, cannot be <code>null</code> * @param value the value, or <code>null</code> if the attribute is to be undefined */ - public void setAttribute(String attributeName, List value); - + public void setAttribute(String attributeName, List<String> value); + /** * Sets the <code>java.util.Map</code>-valued attribute with the given name. * The specified Map <em>must</em> contain only String keys and String values. @@ -108,8 +108,8 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * @param attributeName the name of the attribute, cannot be <code>null</code> * @param value the value, or <code>null</code> if the attribute is to be undefined */ - public void setAttribute(String attributeName, Map value); - + public void setAttribute(String attributeName, Map<String, String> value); + /** * Sets the <code>java.util.Set</code>-valued attribute with the given name. * The specified Set <em>must</em> contain only String values. @@ -120,25 +120,25 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * @param value the value, or <code>null</code> if the attribute is to be undefined * @since 3.6 */ - public void setAttribute(String attributeName, Set value); - + public void setAttribute(String attributeName, Set<String> value); + /** - * Sets the boolean-valued attribute with the given name. + * Sets the boolean-valued attribute with the given name. * * @param attributeName the name of the attribute, cannot be <code>null</code> * @param value the value */ - public void setAttribute(String attributeName, boolean value); - + public void setAttribute(String attributeName, boolean value); + /** * Returns the original launch configuration this working copy * was created from or <code>null</code> if this is a new * working copy created from a launch configuration type. - * + * * @return the original launch configuration, or <code>null</code> */ public ILaunchConfiguration getOriginal(); - + /** * Renames this launch configuration to the specified name. * The new name cannot be <code>null</code>. Has no effect if the name @@ -146,11 +146,11 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * on an existing launch configuration, this will cause * the underlying launch configuration file to be renamed when * this working copy is saved. - * - * @param name the new name for this configuration + * + * @param name the new name for this configuration */ - public void rename(String name); - + public void rename(String name); + /** * Sets the container this launch configuration will be stored * in when saved. When set to <code>null</code>, this configuration @@ -168,13 +168,13 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * The original file associated with this configuration in * the workspace will be deleted. * </p> - * + * * @param container the container in which to store this * launch configuration, or <code>null</code> if this * configuration is to be stored locally */ - public void setContainer(IContainer container); - + public void setContainer(IContainer container); + /** * Sets the attributes of this launch configuration to be the ones contained * in the given map. The values must be an instance of one of the following @@ -188,44 +188,46 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * Attribute names are not allowed to be <code>null</code> * @since 2.1 */ - public void setAttributes(Map attributes); - + public void setAttributes(Map<String, ? extends Object> attributes); + /** * Sets the resources associated with this launch configuration, possibly <code>null</code>. * Clients contributing launch configuration types are responsible for maintaining * resource mappings. - * + * * @param resources the resource to map to this launch configuration or <code>null</code> * @since 3.2 */ public void setMappedResources(IResource[] resources); - + /** - * Set the launch modes for this configuration. - * Over-writes existing launch modes. + * Set the launch modes for this configuration. Over-writes existing launch + * modes. * <p> - * Setting launch modes on a configuration allows the configuration to - * be launched in a mixed mode - for example, debug and profile. + * Setting launch modes on a configuration allows the configuration to be + * launched in a mixed mode - for example, <code>debug</code> and + * <code>profile</code>. * </p> - * @param modes launch mode identifiers to set on this configuration - * or <code>null</code> to clear mode settings - * + * + * @param modes launch mode identifiers to set on this configuration or + * <code>null</code> to clear mode settings + * * @since 3.3 */ - public void setModes(Set modes); - + public void setModes(Set<String> modes); + /** * Set the preferred launch delegates' id for the given mode set. Passing in <code>null</code> as a delegate * id will cause the mapping for the specified mode set (if any) to be removed. - * + * * @param modes the set of modes to set this delegate id for * @param delegateId the id of the delegate to associate as preferred for the specified mode set * or <code>null</code> to clear the setting - * + * * @since 3.3 */ - public void setPreferredLaunchDelegate(Set modes, String delegateId); - + public void setPreferredLaunchDelegate(Set<String> modes, String delegateId); + /** * Adds the specified launch modes to this configuration's settings. * <p> @@ -234,11 +236,11 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * </p> * @param modes launch mode identifiers to append to the current set of * launch modes set on this configuration - * + * * @since 3.3 */ - public void addModes(Set modes); - + public void addModes(Set<String> modes); + /** * Removes the specified launch modes from this configuration's settings. * <p> @@ -247,11 +249,11 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * </p> * @param modes launch mode identifiers to remove from the current set of * launch modes set on this configuration - * + * * @since 3.3 */ - public void removeModes(Set modes); - + public void removeModes(Set<String> modes); + /** * Removes the specified attribute from the this configuration and returns * the previous value associated with the specified attribute name, or <tt>null</tt> @@ -262,15 +264,15 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I * </p> * @param attributeName the name of the attribute to remove * @return previous value of the attribute or <code>null</code> - * + * * @since 3.4 */ public Object removeAttribute(String attributeName); - + /** * Returns the parent of this working copy or <code>null</code> if this working * copy is not a nested copy of another working copy. - * + * * @return parent or <code>null</code> * @since 3.3 */ diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java index b9af5cd34..8fda4c5aa 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * 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 @@ -19,7 +19,7 @@ import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; /** * A proxy to an {@link ILaunchConfigurationDelegate}. Represents a * launch delegate contributed to the <code>org.eclipse.debug.core.launchDelegates</code> - * extension point. + * extension point. * @since 3.3 * @noimplement This interface is not intended to be implemented by clients. * @noextend This interface is not intended to be extended by clients. @@ -28,65 +28,65 @@ public interface ILaunchDelegate { /** * Returns this delegate's unique identifier. - * + * * @return launch delegate identifier */ public String getId(); - + /** * Returns a human readable name for this launch delegate * or <code>null</code> if none. - * + * * @return name or <code>null</code> */ public String getName(); - + /** - * Returns a description of this launch delegate, or + * Returns a description of this launch delegate, or * <code>null</code> if none. - * + * * @return description or <code>null</code> */ public String getDescription(); - + /** * Returns the name of the plug-in that contributed this delegate. - * + * * @return contributor name */ public String getContributorName(); - + /** * Returns the underlying launch configuration. * Causes the delegate to be instantiated. - * + * * @return launch configuration delegate * @exception CoreException if unable to instantiate the delegate */ public ILaunchConfigurationDelegate getDelegate() throws CoreException; - + /** * Returns the complete set of launch modes supported by this delegate as a list of sets. * Each set contains one of more launch mode identifiers. When a set contains more than * one launch mode, it indicates that a mixed launch mode is supported. * If no modes are available an empty list is returned. - * + * * @return the complete set of launch modes this delegate supports */ - public List getModes(); - + public List<Set<String>> getModes(); + /** * Returns the id of the plug-in that contributed this launch delegate. - * + * * @return the id of the plug-in that contributed this launch delegate */ public String getPluginIdentifier(); - + /** - * Returns the specified perspective id for the given mode set, or null if one is not provided + * Returns the specified perspective id for the given mode set, or null if one is not provided * @param modes the set of modes to get the perspective id * @return the perspective id associated with the given mode set, or <code>null</code> if none provided */ - public String getPerspectiveId(Set modes); - + public String getPerspectiveId(Set<String> modes); + } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java index 4796bec88..534abe840 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.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 @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.debug.core; - + import java.util.Map; import org.eclipse.core.resources.IFile; @@ -43,43 +43,43 @@ public interface ILaunchManager { * A launch in a special profile mode (value <code>"profile"</code>). * @since 3.0 */ - public static final String PROFILE_MODE= "profile"; //$NON-NLS-1$ + public static final String PROFILE_MODE= "profile"; //$NON-NLS-1$ /** * Launch configuration attribute - a boolean value that indicates if the * launch configuration is 'private'. A private configuration is one that * does not appear in the user interface (launch history or the launch * configuration dialog). - * + * * @since 3.6 */ public static final String ATTR_PRIVATE = "org.eclipse.debug.ui.private"; //$NON-NLS-1$ - + /** * Launch configuration attribute name. The value is a map of environment * variables passed into Runtime.exec(...) when a launch configuration is launched. * Default value is <code>null</code> which indicates the default environment - * should be used. - * + * should be used. + * * @since 3.0 */ public static final String ATTR_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".environmentVariables"; //$NON-NLS-1$ - + /** * Launch configuration attribute name. The value is a boolean value specifying * whether the environment variables in a launch configuration * should be appended to the native environment (i.e. when <code>true</code>), * or if they should replace the environment (i.e. <code>false</code>). The * default value is <code>true</code>. - * - * @since 3.0 + * + * @since 3.0 */ - public static final String ATTR_APPEND_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".appendEnvironmentVariables"; //$NON-NLS-1$ - + public static final String ATTR_APPEND_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".appendEnvironmentVariables"; //$NON-NLS-1$ + /** * Adds the specified launch and notifies listeners. Has no * effect if an identical launch is already registered. - * + * * @param launch the launch to add * @since 2.0 */ @@ -89,19 +89,19 @@ public interface ILaunchManager { * of listeners notified when a launch configuration is * added, removed, or changed. Has no effect if the given listener * is already registered. - * + * * @param listener launch configuration listener * @since 2.0 */ - public void addLaunchConfigurationListener(ILaunchConfigurationListener listener); + public void addLaunchConfigurationListener(ILaunchConfigurationListener listener); /** * Adds the specified launch objects and notifies listeners. Has no * effect on identical launch objects already registered. - * + * * @param launches the launch objects to add * @since 2.1 */ - public void addLaunches(ILaunch[] launches); + public void addLaunches(ILaunch[] launches); /** * Adds the given listener to the collection of registered launch listeners. * Has no effect if an identical listener is already registered. @@ -109,7 +109,7 @@ public interface ILaunchManager { * @param listener the listener to register * @since 2.1 */ - public void addLaunchListener(ILaunchesListener listener); + public void addLaunchListener(ILaunchesListener listener); /** * Adds the given listener to the collection of registered launch listeners. * Has no effect if an identical listener is already registered. @@ -120,7 +120,7 @@ public interface ILaunchManager { /** * Return a String that can be used as the name of a launch configuration. The name * is guaranteed to be unique (no existing launch configurations will have this name). - * The name that is returned uses the <code>namePrefix</code> as a starting point. If + * The name that is returned uses the <code>namePrefix</code> as a starting point. If * there is no existing launch configuration with this name, then <code>namePrefix</code> * is returned. Otherwise, the value returned consists of the specified prefix plus * some suffix that guarantees uniqueness. @@ -129,20 +129,21 @@ public interface ILaunchManager { * @return launch configuration name * @since 2.0 * @deprecated since 3.6 clients should use the {@link #generateLaunchConfigurationName(String)} method which - * will perform validation of the name and correct unsupported name parts. + * will perform validation of the name and correct unsupported name parts. */ + @Deprecated public String generateUniqueLaunchConfigurationNameFrom(String namePrefix); - + /** * Returns a string that can be used as the name of a launch configuration. The name * is guaranteed to be unique (no existing launch configurations will have this name). - * The name that is returned uses the <code>namePrefix</code> as a starting point. If + * The name that is returned uses the <code>namePrefix</code> as a starting point. If * there is no existing launch configuration with this name, then <code>namePrefix</code> * is returned. Otherwise, the value returned consists of the specified prefix plus * some suffix that guarantees uniqueness. * <p> * If the name prefix does not pass name validation any illegal parts of the name will be removed - * during the name generation. Illegal characters will be replaced with '_' and illegal names will be + * during the name generation. Illegal characters will be replaced with '_' and illegal names will be * replaced with "_reserved_". * </p> * @param namePrefix the string that the returned name should begin with @@ -150,11 +151,11 @@ public interface ILaunchManager { * @since 3.6 */ public String generateLaunchConfigurationName(String namePrefix); - + /** - * Returns if the given name is valid or not. If an invalid name part is located + * Returns if the given name is valid or not. If an invalid name part is located * an {@link IllegalArgumentException} is thrown. - * + * * @param configname the name to check * @return true if the given name is valid or throws an exception if not, where an invalid name * is either a reserved system name (like 'aux' on Win 32) or the name contains invalid characters (like ':' or '/'). @@ -163,7 +164,7 @@ public interface ILaunchManager { * @since 3.6 */ public boolean isValidLaunchConfigurationName(String configname) throws IllegalArgumentException; - + /** * Returns the collection of debug targets currently registered with this * launch manager. @@ -171,11 +172,11 @@ public interface ILaunchManager { * @return an array of debug targets */ public IDebugTarget[] getDebugTargets(); - /** + /** * Returns an array of environment variables to be used when * launching the given configuration or <code>null</code> if unspecified. * Each entry is of the form "<code>var_name=value</code>". - * + * * @return an array of environment variables to use when launching the given * configuration or <code>null</code> if unspecified * @param configuration launch configuration @@ -187,9 +188,9 @@ public interface ILaunchManager { /** * This method returns the character encoding to use when launching the specified <code>ILaunchConfiguration</code>. * The returned encoding can be derived from one of three places in the following order: - * <ol> + * <ol> * <li>An attribute saved on the configuration itself (where no attribute means use the default encoding).</li> - * <li>The mapped resources for the configuration, in the event one of them has a specific encoding that + * <li>The mapped resources for the configuration, in the event one of them has a specific encoding that * is not the workspace default. If there are more than one mapped resource we optimistically ask only the first resource * for its encoding.</li> * <li>We ask the <code>ResourcesPlugin</code> for the workspace preference (which resolves back to the system @@ -198,26 +199,26 @@ public interface ILaunchManager { * @param configuration the <code>ILaunchConfiguration</code> to get the encoding for * @return the encoding to use when launching the specified <code>ILaunchConfiguration</code> * @throws CoreException if a problem is encountered - * + * * @since 3.4 */ public String getEncoding(ILaunchConfiguration configuration) throws CoreException; /** * Returns a handle to the launch configuration contained - * in the specified file. This method does not check if the specified <code>IFile</code> is + * in the specified file. This method does not check if the specified <code>IFile</code> is * a launch configuration file or that it exists in the local or * remote file system. - * + * * @param file launch configuration file * @return a handle to the launch configuration contained * in the specified file * @since 2.0 */ - public ILaunchConfiguration getLaunchConfiguration(IFile file); + public ILaunchConfiguration getLaunchConfiguration(IFile file); /** * Returns a handle to the launch configuration specified by * the given memento. The configuration may not exist. - * + * * @param memento launch configuration memento * @return a handle to the launch configuration specified by * the given memento @@ -229,15 +230,15 @@ public interface ILaunchManager { public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException; /** * Returns all launch configurations defined in the workspace. - * + * * @return all launch configurations defined in the workspace * @exception CoreException if an exception occurs retrieving configurations * @since 2.0 */ - public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException; + public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException; /** * Returns all launch configurations of the specified type defined in the workspace - * + * * @param type a launch configuration type * @return all launch configurations of the specified type defined in the workspace * @exception CoreException if an error occurs while retrieving @@ -245,63 +246,63 @@ public interface ILaunchManager { * @since 2.0 */ public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException; - + /** * Returns the launch configuration type extension with the specified * id, or <code>null</code> if it does not exist. - * + * * @param id unique identifier for a launch configuration type extension * @return the launch configuration type extension with the specified * id, or <code>null</code> if it does not exist * @since 2.0 */ public ILaunchConfigurationType getLaunchConfigurationType(String id); - + /** * Returns all defined launch configuration type extensions - * + * * @return all defined launch configuration type extensions * @since 2.0 */ public ILaunchConfigurationType[] getLaunchConfigurationTypes(); - + /** * Returns the collection of launches currently registered * with this launch manager. - * + * * @return an array of launches */ public ILaunch[] getLaunches(); - + /** * Returns the launch mode registered with the given mode identifier, * or <code>null</code> if none. - * + * * @param mode mode identifier * @return launch mode or <code>null</code> * @since 3.0 */ public ILaunchMode getLaunchMode(String mode); - + /** * Returns all registered launch modes. - * + * * @return all registered launch modes * @since 3.0 */ public ILaunchMode[] getLaunchModes(); - + /** * Returns a collection of launch configurations that required migration to be * compatible with current tooling. - * + * * @return a collection of launch configurations that required migration * @exception org.eclipse.core.runtime.CoreException if an exception occurs determining * migration candidates * @since 3.2 */ public ILaunchConfiguration[] getMigrationCandidates() throws CoreException; - + /** * When a launch configuration is created or moved, registered launch * configuration listeners (see <code>ILaunchConfigurationListener</code>) @@ -316,7 +317,7 @@ public interface ILaunchManager { * Renaming a configuration is considered the same as moving a * configuration. * </p> - * + * * @param addedConfiguration a launch configuration for which an add * notification is being broadcast * @return the launch configuration that the added launch configuration was @@ -325,7 +326,7 @@ public interface ILaunchManager { * @since 2.1 */ public ILaunchConfiguration getMovedFrom(ILaunchConfiguration addedConfiguration); - + /** * When a launch configuration is deleted or moved, registered launch * configuration listeners (see <code>ILaunchConfigurationListener</code>) @@ -348,8 +349,8 @@ public interface ILaunchManager { * result of a move * @since 2.1 */ - public ILaunchConfiguration getMovedTo(ILaunchConfiguration removedConfiguration); - + public ILaunchConfiguration getMovedTo(ILaunchConfiguration removedConfiguration); + /** * Returns the native system environment variables as a map of * variable names and values (Strings). @@ -357,19 +358,19 @@ public interface ILaunchManager { * Note that WIN32 system environment preserves * the case of variable names but is otherwise case insensitive. * Depending on what you intend to do with the environment, the - * lack of normalization may or may not be create problems. On + * lack of normalization may or may not be create problems. On * WIN32, this method normalizes mixed-case keys variable names * to upper case. Use {@link #getNativeEnvironmentCasePreserved()} * instead to get a WIN32 system environment where the keys are * the mixed-case variable names recorded by the OS. * </p> - * + * * @return the native system environment variables; on WIN32, mixed-case * variable names (keys) have been normalized to upper case * (key type: <code>String</code>; value type: <code>String</code>) * @since 3.0 - */ - public Map getNativeEnvironment(); + */ + public Map<String, String> getNativeEnvironment(); /** * Returns the native system environment variables as a map of @@ -379,18 +380,18 @@ public interface ILaunchManager { * the case of variable names but is otherwise case insensitive. * Depending on what you intend to do with the environment, the * lack of normalization may or may not be create problems. This - * method returns mixed-case keys using the variable names + * method returns mixed-case keys using the variable names * recorded by the OS. * Use {@link #getNativeEnvironment()} instead to get a WIN32 system * environment where all keys have been normalized to upper case. * </p> - * + * * @return the native system environment variables; on WIN32, mixed-case * variable names (keys) are returned without normalization * (key type: <code>String</code>; value type: <code>String</code>) * @since 3.1 - */ - public Map getNativeEnvironmentCasePreserved(); + */ + public Map<String, String> getNativeEnvironmentCasePreserved(); /** * Returns the collection of processes currently registered with this @@ -399,21 +400,21 @@ public interface ILaunchManager { * @return an array of processes */ public IProcess[] getProcesses(); - + /** * Returns the source container type extension registered with the * given unique identifier, or <code>null</code> if none. - * + * * @param id unique identifier of a source container type extension * @return the source container type extension registered with the * given unique identifier, or <code>null</code> if none * @since 3.0 */ public ISourceContainerType getSourceContainerType(String id); - + /** * Returns all registered source container type extensions. - * + * * @return all registered source container type extensions * @since 3.0 */ @@ -424,7 +425,7 @@ public interface ILaunchManager { * the given launch configuration, or <code>null</code> if a source path * computer has not been registered for the associated launch configuration * type. - * + * * @param configuration a launch configuration * @return a source path computer registered for the associated launch * configurations type, or <code>null</code> if unspecified @@ -433,43 +434,43 @@ public interface ILaunchManager { * @since 3.0 */ public ISourcePathComputer getSourcePathComputer(ILaunchConfiguration configuration) throws CoreException; - + /** * Returns the source path computer extension registered with the given * unique identifier, or <code>null</code> if none. - * + * * @param id source path computer identifier * @return the source path computer extension registered with the given * unique identifier, or <code>null</code> if none * @since 3.0 */ - public ISourcePathComputer getSourcePathComputer(String id); - + public ISourcePathComputer getSourcePathComputer(String id); + /** - * Return <code>true</code> if there is a launch configuration with the specified name, + * Return <code>true</code> if there is a launch configuration with the specified name, * <code>false</code> otherwise. - * + * * @return whether a launch configuration already exists with the given name * @param name the name of the launch configuration whose existence is being checked * @exception CoreException if unable to retrieve existing launch configuration names * @since 2.0 */ public boolean isExistingLaunchConfigurationName(String name) throws CoreException; - + /** * Returns whether the given launch is currently registered. - * + * * @param launch a launch * @return whether the launch is currently registered * @since 3.1 */ public boolean isRegistered(ILaunch launch); - + /** * Creates and returns a new source locator of the specified * type. - * - * @param identifier the identifier associated with a + * + * @param identifier the identifier associated with a * persistable source locator extension * @return a source locator * @exception CoreException if an exception occurs creating @@ -493,7 +494,7 @@ public interface ILaunchManager { * of listeners notified when a launch configuration is * added, removed, or changed. Has no effect if the given listener * is not already registered. - * + * * @param listener launch configuration listener * @since 2.0 */ @@ -508,7 +509,7 @@ public interface ILaunchManager { * @since 2.1 */ public void removeLaunches(ILaunch[] launches); - + /** * Removes the given listener from the collection of registered launch listeners. * Has no effect if an identical listener is not already registered. @@ -517,7 +518,7 @@ public interface ILaunchManager { * @since 2.1 */ public void removeLaunchListener(ILaunchesListener listener); - + /** * Removes the given listener from the collection of registered launch listeners. * Has no effect if an identical listener is not already registered. @@ -525,7 +526,7 @@ public interface ILaunchManager { * @param listener the listener to unregister */ public void removeLaunchListener(ILaunchListener listener); - + } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java index 802ffc917..d412ca9bb 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 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 *******************************************************************************/ @@ -47,7 +47,7 @@ import org.eclipse.debug.core.model.IProcess; */ public interface IProcessFactory { - + /** * Creates and returns a new process representing the given * <code>java.lang.Process</code>. A streams proxy is created @@ -62,5 +62,5 @@ public interface IProcessFactory { * @return the process * @see IProcess */ - public IProcess newProcess(ILaunch launch, Process process, String label, Map attributes); + public IProcess newProcess(ILaunch launch, Process process, String label, Map<String, String> attributes); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java index 2ce48cca6..8f54e9cbb 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 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 @@ -14,7 +14,6 @@ package org.eclipse.debug.core; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import org.eclipse.core.runtime.IStatus; @@ -38,16 +37,15 @@ import org.eclipse.debug.internal.core.LaunchManager; * @see ILaunch * @see ILaunchManager */ - public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILaunchListener, ILaunchConfigurationListener, IDebugEventSetListener { - + /** * The debug targets associated with this * launch (the primary target is the first one * in this collection), or empty if * there are no debug targets. */ - private List fTargets= new ArrayList(); + private List<IDebugTarget> fTargets = new ArrayList<IDebugTarget>(); /** * The configuration that was launched, or null. @@ -58,7 +56,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau * The system processes associated with * this launch, or empty if none. */ - private List fProcesses= new ArrayList(); + private List<IProcess> fProcesses = new ArrayList<IProcess>(); /** * The source locator to use in the debug session @@ -70,19 +68,19 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau * The mode this launch was launched in. */ private String fMode; - + /** * Table of client defined attributes */ - private HashMap fAttributes; - + private HashMap<String, String> fAttributes; + /** * Flag indicating that change notification should * be suppressed. <code>true</code> until this * launch has been initialized. */ private boolean fSuppressChange = true; - + /** * Constructs a launch with the specified attributes. * @@ -92,7 +90,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau * @param locator the source locator to use for this debug session, or * <code>null</code> if not supported */ - public Launch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) { + public Launch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) { fConfiguration = launchConfiguration; setSourceLocator(locator); fMode = mode; @@ -100,35 +98,32 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau getLaunchManager().addLaunchListener(this); getLaunchManager().addLaunchConfigurationListener(this); } - + /** * Registers debug event listener. */ private void addEventListener() { DebugPlugin.getDefault().addDebugEventListener(this); } - + /** * Removes debug event listener. */ private void removeEventListener() { DebugPlugin.getDefault().removeDebugEventListener(this); } - + /** * @see org.eclipse.debug.core.model.ITerminate#canTerminate() */ + @Override public boolean canTerminate() { - List processes = getProcesses0(); - for (int i = 0; i < processes.size(); i++) { - IProcess process = (IProcess)processes.get(i); + for (IProcess process : getProcesses0()) { if (process.canTerminate()) { return true; } } - List targets = getDebugTargets0(); - for (int i = 0; i < targets.size(); i++) { - IDebugTarget target = (IDebugTarget)targets.get(i); + for (IDebugTarget target : getDebugTargets0()) { if (target.canTerminate() || target.canDisconnect()) { return true; } @@ -139,8 +134,9 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau /** * @see ILaunch#getChildren() */ + @Override public Object[] getChildren() { - ArrayList children = new ArrayList(getDebugTargets0()); + ArrayList<Object> children = new ArrayList<Object>(getDebugTargets0()); children.addAll(getProcesses0()); return children.toArray(); } @@ -148,77 +144,76 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau /** * @see ILaunch#getDebugTarget() */ + @Override public IDebugTarget getDebugTarget() { if (!getDebugTargets0().isEmpty()) { - return (IDebugTarget)getDebugTargets0().get(0); + return getDebugTargets0().get(0); } return null; } - + /** * @see ILaunch#getProcesses() */ + @Override public IProcess[] getProcesses() { - return (IProcess[])getProcesses0().toArray(new IProcess[getProcesses0().size()]); + return getProcesses0().toArray(new IProcess[getProcesses0().size()]); } - + /** * Returns the processes associated with this * launch, in its internal form - a list. - * + * * @return list of processes */ - protected List getProcesses0() { + protected List<IProcess> getProcesses0() { return fProcesses; - } - + } + /** * @see ILaunch#getSourceLocator() */ + @Override public ISourceLocator getSourceLocator() { return fLocator; } - + /** * @see ILaunch#setSourceLocator(ISourceLocator) */ + @Override public void setSourceLocator(ISourceLocator sourceLocator) { fLocator = sourceLocator; - } + } /** * @see org.eclipse.debug.core.model.ITerminate#isTerminated() */ + @Override public boolean isTerminated() { if (getProcesses0().isEmpty() && getDebugTargets0().isEmpty()) { return false; } - - Iterator processes = getProcesses0().iterator(); - while (processes.hasNext()) { - IProcess process = (IProcess)processes.next(); + for (IProcess process : getProcesses0()) { if (!process.isTerminated()) { return false; } } - - Iterator targets = getDebugTargets0().iterator(); - while (targets.hasNext()) { - IDebugTarget target = (IDebugTarget)targets.next(); + for (IDebugTarget target : getDebugTargets0()) { if (!(target.isTerminated() || target.isDisconnected())) { return false; } } - return true; } /** * @see org.eclipse.debug.core.model.ITerminate#terminate() */ + @Override public void terminate() throws DebugException { - MultiStatus status= - new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugCoreMessages.Launch_terminate_failed, null); + MultiStatus status= + new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugCoreMessages.Launch_terminate_failed, null); //stop targets first to free up and sockets, etc held by the target // terminate or disconnect debug target if it is still alive IDebugTarget[] targets = getDebugTargets(); @@ -261,20 +256,22 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau IStatus[] children= status.getChildren(); if (children.length == 1) { throw new DebugException(children[0]); - } + } throw new DebugException(status); } /** * @see ILaunch#getLaunchMode() */ + @Override public String getLaunchMode() { return fMode; } - + /** * @see ILaunch#getLaunchConfiguration() */ + @Override public ILaunchConfiguration getLaunchConfiguration() { return fConfiguration; } @@ -282,43 +279,47 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau /** * @see ILaunch#setAttribute(String, String) */ + @Override public void setAttribute(String key, String value) { if (fAttributes == null) { - fAttributes = new HashMap(5); + fAttributes = new HashMap<String, String>(5); } - fAttributes.put(key, value); + fAttributes.put(key, value); } /** * @see ILaunch#getAttribute(String) */ + @Override public String getAttribute(String key) { if (fAttributes == null) { return null; } - return (String)fAttributes.get(key); + return fAttributes.get(key); } /** * @see ILaunch#getDebugTargets() */ + @Override public IDebugTarget[] getDebugTargets() { - return (IDebugTarget[])fTargets.toArray(new IDebugTarget[fTargets.size()]); + return fTargets.toArray(new IDebugTarget[fTargets.size()]); } - + /** * Returns the debug targets associated with this * launch, in its internal form - a list - * + * * @return list of debug targets */ - protected List getDebugTargets0() { + protected List<IDebugTarget> getDebugTargets0() { return fTargets; - } + } /** * @see ILaunch#addDebugTarget(IDebugTarget) */ + @Override public void addDebugTarget(IDebugTarget target) { if (target != null) { if (!getDebugTargets0().contains(target)) { @@ -328,21 +329,23 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } } } - + /** * @see ILaunch#removeDebugTarget(IDebugTarget) */ + @Override public void removeDebugTarget(IDebugTarget target) { if (target != null) { if (getDebugTargets0().remove(target)) { fireChanged(); } } - } - + } + /** * @see ILaunch#addProcess(IProcess) */ + @Override public void addProcess(IProcess process) { if (process != null) { if (!getProcesses0().contains(process)) { @@ -352,21 +355,22 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } } } - + /** * @see ILaunch#removeProcess(IProcess) */ + @Override public void removeProcess(IProcess process) { if (process != null) { if (getProcesses0().remove(process)) { fireChanged(); } } - } - + } + /** * Adds the given processes to this launch. - * + * * @param processes processes to add */ protected void addProcesses(IProcess[] processes) { @@ -377,7 +381,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } } } - + /** * Notifies listeners that this launch has changed. * Has no effect of this launch has not yet been @@ -402,84 +406,79 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } removeEventListener(); } - + /** * @see ILaunch#hasChildren() */ + @Override public boolean hasChildren() { return getProcesses0().size() > 0 || (getDebugTargets0().size() > 0); } - + /** - * Returns whether any processes or targets can be disconnected. + * Returns whether any processes or targets can be disconnected. * Ones that are already terminated or disconnected are ignored. - * + * * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect() */ + @Override public boolean canDisconnect() { - List processes = getProcesses0(); - for (int i = 0; i < processes.size(); i++) { - if (processes.get(i) instanceof IDisconnect) { - IDisconnect process = (IDisconnect)processes.get(i); - if (process.canDisconnect()) { - return true; - } - } - } - List targets = getDebugTargets0(); - for (int i = 0; i < targets.size(); i++) { - if ( ((IDebugTarget)targets.get(i)).canDisconnect() ) { - return true; - } - } + for (IProcess process : getProcesses0()) { + if (process instanceof IDisconnect) { + if (((IDisconnect) process).canDisconnect()) { + return true; + } + } + } + for (IDebugTarget target : getDebugTarg |