diff options
author | Mike Rennie | 2013-07-31 16:44:16 +0000 |
---|---|---|
committer | Mike Rennie | 2013-07-31 16:44:16 +0000 |
commit | d975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch) | |
tree | c7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.core.externaltools | |
parent | 4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff) | |
download | eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.gz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.xz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.zip |
Bug 352626 - Move platform debug to Java 1.6 BREE
Diffstat (limited to 'org.eclipse.core.externaltools')
10 files changed, 205 insertions, 192 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; - } + } } |