Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2009-10-08 14:22:04 -0400
committerDarin Wright2009-10-08 14:22:04 -0400
commitdd1751fd5b5a875951312bc9577d631c05ee9328 (patch)
tree1c982d6731131001f49f95b1f1647f938c941044 /org.eclipse.core.externaltools
parentc865d177f5dfce78436070d214cb86c213e19d15 (diff)
downloadeclipse.platform.debug-dd1751fd5b5a875951312bc9577d631c05ee9328.tar.gz
eclipse.platform.debug-dd1751fd5b5a875951312bc9577d631c05ee9328.tar.xz
eclipse.platform.debug-dd1751fd5b5a875951312bc9577d631c05ee9328.zip
Bug 264338 - External tool builder fails in headless mode because of dependencies to UI
Diffstat (limited to 'org.eclipse.core.externaltools')
-rw-r--r--org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs25
-rw-r--r--org.eclipse.core.externaltools/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.core.externaltools/build.properties4
-rw-r--r--org.eclipse.core.externaltools/plugin.properties5
-rw-r--r--org.eclipse.core.externaltools/plugin.xml32
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java118
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java243
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java89
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java274
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java30
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties23
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java207
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java341
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java290
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java24
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties13
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java410
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java25
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties13
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java60
20 files changed, 2171 insertions, 65 deletions
diff --git a/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs b/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs
new file mode 100644
index 000000000..189611f2b
--- /dev/null
+++ b/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,25 @@
+#Wed Oct 07 13:13:28 CDT 2009
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=1
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=1
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=1
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/org.eclipse.core.externaltools/META-INF/MANIFEST.MF b/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
index ca8926d5a..71d29195a 100644
--- a/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
+++ b/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
@@ -1,13 +1,17 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.externaltools
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.core.externaltools;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.core.internal.externaltools.ExternalToolsCore
+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)"
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
-Export-Package: org.eclipse.core.internal.externaltools;x-internal:=true
+Export-Package: org.eclipse.core.externaltools.internal;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools",
+ org.eclipse.core.externaltools.internal.launchConfigurations;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools",
+ org.eclipse.core.externaltools.internal.model;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools",
+ org.eclipse.core.externaltools.internal.registry;x-friends:="org.eclipse.ui.externaltools"
diff --git a/org.eclipse.core.externaltools/build.properties b/org.eclipse.core.externaltools/build.properties
index 34d2e4d2d..0dc34f783 100644
--- a/org.eclipse.core.externaltools/build.properties
+++ b/org.eclipse.core.externaltools/build.properties
@@ -1,4 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/org.eclipse.core.externaltools/plugin.properties b/org.eclipse.core.externaltools/plugin.properties
index 84bc0ec20..f2df1a6c0 100644
--- a/org.eclipse.core.externaltools/plugin.properties
+++ b/org.eclipse.core.externaltools/plugin.properties
@@ -10,4 +10,7 @@
###############################################################################
pluginName=External Tools Headless Support
-providerName=Eclipse.org \ No newline at end of file
+providerName=Eclipse.org
+
+Program.externalTools = Program
+Builder.externalTools = Integrated External Tool Builder \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/plugin.xml b/org.eclipse.core.externaltools/plugin.xml
new file mode 100644
index 000000000..a5f8d7c8c
--- /dev/null
+++ b/org.eclipse.core.externaltools/plugin.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ name="%Program.externalTools"
+ delegate="org.eclipse.core.externaltools.internal.launchConfigurations.ProgramLaunchDelegate"
+ category="org.eclipse.ui.externaltools"
+ modes="run"
+ id="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+ </launchConfigurationType>
+ <launchConfigurationType
+ name="%Program.externalTools"
+ delegate="org.eclipse.core.externaltools.internal.launchConfigurations.ProgramLaunchDelegate"
+ category="org.eclipse.ui.externaltools.builder"
+ modes="run"
+ id="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ id="org.eclipse.ui.externaltools.ExternalToolBuilder"
+ name="%Builder.externalTools"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ isConfigurable= "true">
+ <run
+ class="org.eclipse.core.externaltools.internal.model.ExternalToolBuilder">
+ </run>
+ </builder>
+ </extension>
+</plugin>
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
new file mode 100644
index 000000000..e14df9960
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ *******************************************************************************/
+package org.eclipse.core.externaltools.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Controls the plug-in life cycle
+ */
+public class ExternalToolsCore extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$
+
+ private static final String EMPTY_STRING= ""; //$NON-NLS-1$
+
+ /**
+ * Status code indicating an unexpected internal error.
+ * @since 2.1
+ */
+ public static final int INTERNAL_ERROR = 120;
+
+ // The shared instance
+ private static ExternalToolsCore plugin;
+
+ /**
+ * The constructor
+ */
+ public ExternalToolsCore() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ExternalToolsCore getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Logs the specified throwable with this plug-in's 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$
+ log(status);
+ }
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @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) {
+ message= EMPTY_STRING;
+ }
+ return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception);
+ }
+
+ /**
+ * Returns a new <code>CoreException</code> for this plug-in
+ */
+ public static CoreException newError(String message, Throwable exception) {
+ return new CoreException(new Status(IStatus.ERROR,
+ IExternalToolConstants.PLUGIN_ID, 0, message, exception));
+ }
+
+}
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
new file mode 100644
index 000000000..7a42d0b8d
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 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
+ *******************************************************************************/
+
+package org.eclipse.core.externaltools.internal;
+/**
+ * Defines the constants available for client use.
+ * <p>
+ * This interface is not intended to be extended or implemented by clients.
+ * </p>
+ */
+public interface IExternalToolConstants {
+ /**
+ * 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>).
+ */
+ public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$;
+
+ // ------- Extensions Points -------
+ /**
+ * Extension point to declare the launch configuration type that should be
+ * created when duplicating an existing configuration as a project builder.
+ */
+ public static final String EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS = "configurationDuplicationMaps"; //$NON-NLS-1$
+ // ------- Refresh Variables -------
+ /**
+ * Variable that expands to the workspace root object (value <code>workspace</code>).
+ */
+ public static final String VAR_WORKSPACE = "workspace"; //$NON-NLS-1$
+ /**
+ * Variable that expands to the project resource (value <code>project</code>).
+ */
+ public static final String VAR_PROJECT = "project"; //$NON-NLS-1$
+ /**
+ * Variable that expands to the container resource (value <code>container</code>).
+ */
+ public static final String VAR_CONTAINER = "container"; //$NON-NLS-1$
+ /**
+ * Variable that expands to a resource (value <code>resource</code>).
+ */
+ public static final String VAR_RESOURCE = "resource"; //$NON-NLS-1$
+ /**
+ * Variable that expands to the working set object (value <code>working_set</code>).
+ */
+ public static final String VAR_WORKING_SET = "working_set"; //$NON-NLS-1$
+ // ------- Tool Types -------
+ /**
+ * 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$;
+
+ // ------- Build Types -------
+ /**
+ * Build type indicating an incremental project build request for
+ * the external tool running as a builder (value <code>incremental</code>).
+ */
+ public static final String BUILD_TYPE_INCREMENTAL = "incremental"; //$NON-NLS-1$
+
+ /**
+ * Build type indicating a full project build request for
+ * the external tool running as a builder (value <code>full</code>).
+ */
+ public static final String BUILD_TYPE_FULL = "full"; //$NON-NLS-1$
+
+ /**
+ * Build type indicating an automatic project build request for
+ * 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>).
+ */
+ public static final String BUILD_TYPE_CLEAN = "clean"; //$NON-NLS-1$
+
+ /**
+ * Build type indicating no project build request for
+ * the external tool running as a builder (value <code>none</code>).
+ */
+ public static final String BUILD_TYPE_NONE = "none"; //$NON-NLS-1$
+
+ // ------- Images -------
+
+ /**
+ * Main tab image.
+ */
+ public static final String IMG_TAB_MAIN = UI_PLUGIN_ID + ".IMG_TAB_MAIN"; //$NON-NLS-1$
+
+ /**
+ * Build tab image
+ */
+ public static final String IMG_TAB_BUILD = UI_PLUGIN_ID + ".IMG_TAB_BUILD"; //$NON-NLS-1$
+
+ // ------- Launch configuration types --------
+ /**
+ * 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$
+
+ // ------- Launch configuration category --------
+ /**
+ * Identifier for external tools launch configuration category. Launch
+ * configuration types for external tools that appear in the external tools
+ * launch configuration dialog should belong to this category.
+ */
+ public static final String ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools"; //$NON-NLS-1$
+ /**
+ * Identifier for external tools launch configuration builders category.
+ * Launch configuration types that can be added as project builders should
+ * belong to this category.
+ */
+ public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools.builder"; //$NON-NLS-1$
+
+ // ------- Launch configuration groups --------
+ /**
+ * Identifier for external tools launch configuration group. The external
+ * tools launch configuration group corresponds to the external tools
+ * category in run mode.
+ */
+ public static final String ID_EXTERNAL_TOOLS_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup"; //$NON-NLS-1$
+ /**
+ * Identifier for external tools launch configuration group
+ */
+ public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup.builder"; //$NON-NLS-1$
+
+ // ------- Common External Tool Launch Configuration Attributes -------
+
+ /**
+ * Boolean attribute indicating if external tool output should be captured.
+ * Default value is <code>false</code>.
+ * @deprecated since 3.1 Replaced by <code>org.eclipse.debug.core.DebugPlugin.ATTR_CAPTURE_OUTPUT</code>
+ */
+ 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
+ * is <code>null</code>. Encoding is tool specific.
+ */
+ public static final String ATTR_LOCATION = UI_PLUGIN_ID + ".ATTR_LOCATION"; //$NON-NLS-1$
+
+ /**
+ * Boolean attribute indicating if the user should be prompted for
+ * arguments before running a tool. Default value is <code>false</code>.
+ * 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
+ * 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>.
+ */
+ public static final String ATTR_SHOW_CONSOLE = UI_PLUGIN_ID + ".ATTR_SHOW_CONSOLE"; //$NON-NLS-1$
+
+ /**
+ * String attribute containing the arguments that should be passed to the
+ * tool. Default value is <code>null</code>, and encoding is tool specific.
+ */
+ public static final String ATTR_TOOL_ARGUMENTS = UI_PLUGIN_ID + ".ATTR_TOOL_ARGUMENTS"; //$NON-NLS-1$
+
+ /**
+ * String attribute identifying the working directory of an external tool.
+ * Default value is <code>null</code>, which indicates a default working
+ * 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
+ */
+ 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.
+ */
+ public static final int ERR_INTERNAL_ERROR = 150;
+
+ /**
+ * String attribute identifying a non-external tool builder launch configuration that is disabled
+ * 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
+ * @since 3.1
+ */
+ public static final String ATTR_TRIGGERS_CONFIGURED = UI_PLUGIN_ID + ".ATTR_TRIGGERS_CONFIGURED"; //$NON-NLS-1$
+
+ /**
+ * String attribute identifying the build scope for a launch configuration.
+ * <code>null</code> indicates the default workspace build.
+ */
+ 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
+ * considered when computing the projects to build. Default value is
+ * <code>true</code>.
+ */
+ public static final String ATTR_INCLUDE_REFERENCED_PROJECTS = UI_PLUGIN_ID + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$
+}
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
new file mode 100644
index 000000000..de772967d
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 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
+ *******************************************************************************/
+package org.eclipse.core.externaltools.internal.launchConfigurations;
+
+
+import org.eclipse.core.externaltools.internal.ExternalToolsCore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.RefreshUtil;
+import org.eclipse.debug.core.model.IProcess;
+
+/**
+ * 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
+ * process terminates.
+ */
+ public void startBackgroundRefresh() {
+ synchronized (fProcess) {
+ if (fProcess.isTerminated()) {
+ refresh();
+ } else {
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
+ */
+ public void handleDebugEvents(DebugEvent[] events) {
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event = events[i];
+ if (event.getSource() == fProcess && event.getKind() == DebugEvent.TERMINATE) {
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ refresh();
+ break;
+ }
+ }
+ }
+
+ /**
+ * Submits a job to do the refresh
+ */
+ protected void refresh() {
+ Job job= new Job(ExternalToolsProgramMessages.BackgroundResourceRefresher_0) {
+ public IStatus run(IProgressMonitor monitor) {
+ try {
+ RefreshUtil.refreshResources(fConfiguration, monitor);
+ } catch (CoreException e) {
+ ExternalToolsCore.log(e);
+ return e.getStatus();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+}
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java
new file mode 100644
index 000000000..aba44bbcd
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 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
+ * Keith Seitz (keiths@redhat.com) - Bug 27243 (environment variables contribution)
+ * dakshinamurthy.karra@gmail.com - bug 165371
+ *******************************************************************************/
+package org.eclipse.core.externaltools.internal.launchConfigurations;
+
+
+import java.io.File;
+
+import org.eclipse.core.externaltools.internal.ExternalToolsCore;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.RefreshUtil;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Utilities for external tool launch configurations.
+ * <p>
+ * This class it not intended to be instantiated.
+ * </p>
+ */
+public class ExternalToolsCoreUtil {
+
+ /**
+ * Throws a core exception with an error status object built from
+ * the given message, lower level exception, and error code.
+ * @param message the status message
+ * @param exception lower level exception associated with the
+ * error, or <code>null</code> if none
+ * @param code error code
+ */
+ protected static void abort(String message, Throwable exception, int code) throws CoreException {
+ throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception));
+ }
+
+ /**
+ * Expands and returns the location attribute of the given launch
+ * configuration. The location is
+ * verified to point to an existing file, in the local file system.
+ *
+ * @param configuration launch configuration
+ * @return an absolute path to a file in the local file system
+ * @throws CoreException if unable to retrieve the associated launch
+ * configuration attribute, if unable to resolve any variables, or if the
+ * resolved location does not point to an existing file in the local file
+ * system
+ */
+ public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException {
+ String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null);
+ if (location == null) {
+ abort(NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_Location_not_specified_by__0__1, new String[] { configuration.getName()}), null, 0);
+ } else {
+ String expandedLocation = getStringVariableManager().performStringSubstitution(location);
+ if (expandedLocation == null || expandedLocation.length() == 0) {
+ String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()});
+ abort(msg, null, 0);
+ } else {
+ File file = new File(expandedLocation);
+ if (file.isFile()) {
+ return new Path(expandedLocation);
+ }
+
+ String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()});
+ abort(msg, null, 0);
+ }
+ }
+ // execution will not reach here
+ return null;
+ }
+
+ /**
+ * Returns a boolean specifying whether or not output should be captured for
+ * the given configuration
+ *
+ * @param configuration the configuration from which the value will be
+ * extracted
+ * @return boolean specifying whether or not output should be captured
+ * @throws CoreException if unable to access the associated attribute
+ */
+ public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
+ }
+
+ /**
+ * Expands and returns the working directory attribute of the given launch
+ * configuration. Returns <code>null</code> if a working directory is not
+ * specified. If specified, the working is verified to point to an existing
+ * directory in the local file system.
+ *
+ * @param configuration launch configuration
+ * @return an absolute path to a directory in the local file system, or
+ * <code>null</code> if unspecified
+ * @throws CoreException if unable to retrieve the associated launch
+ * configuration attribute, if unable to resolve any variables, or if the
+ * resolved location does not point to an existing directory in the local
+ * file system
+ */
+ public static IPath getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
+ String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null);
+ if (location != null) {
+ String expandedLocation = getStringVariableManager().performStringSubstitution(location);
+ if (expandedLocation.length() > 0) {
+ File path = new File(expandedLocation);
+ if (path.isDirectory()) {
+ return new Path(expandedLocation);
+ }
+ String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidDirectory__0_, new Object[] { expandedLocation, configuration.getName()});
+ abort(msg, null, 0);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Expands and returns the arguments attribute of the given launch
+ * configuration. Returns <code>null</code> if arguments are not specified.
+ *
+ * @param configuration launch configuration
+ * @return an array of resolved arguments, or <code>null</code> if
+ * unspecified
+ * @throws CoreException if unable to retrieve the associated launch
+ * configuration attribute, or if unable to resolve any variables
+ */
+ public static String[] getArguments(ILaunchConfiguration configuration) throws CoreException {
+ String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null);
+ if (args != null) {
+ String expanded = getStringVariableManager().performStringSubstitution(args);
+ return parseStringIntoList(expanded);
+ }
+ return null;
+ }
+
+ private static IStringVariableManager getStringVariableManager() {
+ return VariablesPlugin.getDefault().getStringVariableManager();
+ }
+
+ /**
+ * Returns whether the given launch configuration is enabled. This property
+ * is intended only to apply to external tool builder configurations and
+ * determines whether the project builder will launch the configuration
+ * when it builds.
+ *
+ * @param configuration the configuration for which the enabled state should
+ * be determined.
+ * @return whether the given configuration is enabled to be run when a build occurs.
+ * @throws CoreException if unable to access the associated attribute
+ */
+ public static boolean isBuilderEnabled(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_ENABLED, true);
+ }
+
+ /**
+ * Returns the collection of resources for the build scope as specified by the given launch configuration.
+ *
+ * @param configuration launch configuration
+ * @throws CoreException if an exception occurs while retrieving the resources
+ */
+ public static IResource[] getResourcesForBuildScope(ILaunchConfiguration configuration) throws CoreException {
+ String scope = configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String) null);
+ if (scope == null) {
+ return null;
+ }
+
+ return RefreshUtil.toResources(scope);
+ }
+
+ /**
+ * Parses the argument text into an array of individual
+ * strings using the space character as the delimiter.
+ * An individual argument containing spaces must have a
+ * double quote (") at the start and end. Two double
+ * quotes together is taken to mean an embedded double
+ * quote in the argument text.
+ *
+ * @param arguments the arguments as one string
+ * @return the array of arguments
+ */
+ public static String[] parseStringIntoList(String arguments) {
+ if (arguments == null || arguments.length() == 0) {
+ return new String[0];
+ }
+ String[] res= DebugPlugin.parseArguments(arguments);
+ return res;
+ }
+ /**
+ * Returns a collection of projects referenced by a build scope attribute.
+ *
+ * @return collection of projects referred to by configuration
+ */
+ public static IProject[] getBuildProjects(ILaunchConfiguration configuration, String buildScopeId) {
+
+ String scope = null;
+ String id = buildScopeId ;
+ if (id == null) {
+ id = IExternalToolConstants.ATTR_BUILD_SCOPE ;
+ }
+ try {
+ scope = configuration.getAttribute(id, (String)null);
+ } catch (CoreException e) {
+ return null;
+ }
+ if (scope == null) {
+ return null;
+ }
+ if (scope.startsWith("${projects:")) { //$NON-NLS-1$
+ String pathString = scope.substring(11, scope.length() - 1);
+ if (pathString.length() > 1) {
+ String[] names = pathString.split(","); //$NON-NLS-1$
+ IProject[] projects = new IProject[names.length];
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (int i = 0; i < names.length; i++) {
+ projects[i] = root.getProject(names[i]);
+ }
+ return projects;
+ }
+ } else if (scope.equals("${project}")) { //$NON-NLS-1$
+ if(configuration.getFile()!=null)
+ return new IProject[]{((IResource)configuration.getFile()).getProject()};
+ }
+ return new IProject[0];
+ }
+
+ /**
+ * Whether referenced projects should be considered when building. Only valid
+ * when a set of projects is to be built.
+ *
+ * @param configuration
+ * @return whether referenced projects should be considerd when building
+ * @throws CoreException if unable to access the associated attribute
+ */
+ public static boolean isIncludeReferencedProjects(ILaunchConfiguration configuration, String includeReferencedProjectsId) throws CoreException {
+ String id = includeReferencedProjectsId;
+ if (id == null) {
+ id = IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS ;
+ }
+ return configuration.getAttribute(id, true);
+ }
+
+ /**
+ * Returns whether the given external builder configuration should build asynchronously.
+ *
+ * @param configuration the configuration
+ * @return whether the configuration is configured to build asynchronously
+ */
+ public static boolean isAsynchronousBuild(ILaunchConfiguration configuration) {
+ boolean launchInBackground= false;
+ try {
+ launchInBackground= configuration.getAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
+ } catch (CoreException ce) {
+ ExternalToolsCore.log(ce);
+ }
+ return launchInBackground;
+ }
+}
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java
new file mode 100644
index 000000000..889fe2b12
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java
@@ -0,0 +1,30 @@
+/**********************************************************************
+ * Copyright (c) 2000, 2009 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 - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.core.externaltools.internal.launchConfigurations;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ExternalToolsProgramMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsProgramMessages";//$NON-NLS-1$
+
+ public static String BackgroundResourceRefresher_0;
+
+ public static String ProgramLaunchDelegate_3;
+ public static String ProgramLaunchDelegate_4;
+
+ public static String ExternalToolsUtil_Location_not_specified_by__0__1;
+ public static String ExternalToolsUtil_invalidLocation__0_;
+ public static String ExternalToolsUtil_invalidDirectory__0_;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ExternalToolsProgramMessages.class);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties
new file mode 100644
index 000000000..cd07b549a
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2000, 2009 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
+###############################################################################
+
+BackgroundResourceRefresher_0=Refreshing resources...
+
+ProgramLaunchDelegate_Workbench_Closing_1=Workbench Closing
+ProgramLaunchDelegate_The_workbench_is_exiting=The workbench is exiting and a program launched from an external tool appears to still be running. These programs will be terminated when the workbench exits. It is recommended that you exit any external programs launched from the workbench before you proceed.\n\nClick OK to continue exiting the workbench.
+ProgramLaunchDelegate_3=Running {0}...
+ProgramLaunchDelegate_4=An IProcess could not be created for the launch
+
+ProgramMainTab_Select=&Select a program:
+
+ExternalToolsUtil_Location_not_specified_by__0__1=Location not specified by {0}
+ExternalToolsUtil_invalidLocation__0_ = The file does not exist for the external tool named {0}.
+ExternalToolsUtil_invalidDirectory__0_ = The working directory {0} does not exist for the external tool named {1}. \ No newline at end of file
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
new file mode 100644
index 000000000..635f340fd
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 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
+ * Keith Seitz (keiths@redhat.com) - environment variables contribution (Bug 27243)
+ * dakshinamurthy.karra@gmail.com - bug 165371
+ *******************************************************************************/
+package org.eclipse.core.externaltools.internal.launchConfigurations;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.RefreshUtil;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Launch delegate for a program.
+ */
+public class ProgramLaunchDelegate extends LaunchConfigurationDelegate {
+
+ /**
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration,
+ * java.lang.String, org.eclipse.debug.core.ILaunch,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void launch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ // resolve location
+ IPath location = ExternalToolsCoreUtil.getLocation(configuration);
+
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ // resolve working directory
+ IPath workingDirectory = ExternalToolsCoreUtil
+ .getWorkingDirectory(configuration);
+
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ // resolve arguments
+ String[] arguments = ExternalToolsCoreUtil.getArguments(configuration);
+
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ int cmdLineLength = 1;
+ if (arguments != null) {
+ cmdLineLength += arguments.length;
+ }
+ String[] cmdLine = new String[cmdLineLength];
+ cmdLine[0] = location.toOSString();
+ if (arguments != null) {
+ System.arraycopy(arguments, 0, cmdLine, 1, arguments.length);
+ }
+
+ File workingDir = null;
+ if (workingDirectory != null) {
+ workingDir = workingDirectory.toFile();
+ }
+
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ String[] envp = DebugPlugin.getDefault().getLaunchManager()
+ .getEnvironment(configuration);
+
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ Process p = DebugPlugin.exec(cmdLine, workingDir, envp);
+ IProcess process = null;
+
+ // add process type to process attributes
+ Map processAttributes = new HashMap();
+ String programName = location.lastSegment();
+ String extension = location.getFileExtension();
+ if (extension != null) {
+ programName = programName.substring(0, programName.length()
+ - (extension.length() + 1));
+ }
+ programName = programName.toLowerCase();
+ processAttributes.put(IProcess.ATTR_PROCESS_TYPE, programName);
+
+ if (p != null) {
+ monitor.beginTask(NLS.bind(
+ ExternalToolsProgramMessages.ProgramLaunchDelegate_3,
+ new String[] { configuration.getName() }),
+ IProgressMonitor.UNKNOWN);
+ process = DebugPlugin.newProcess(launch, p, location.toOSString(),
+ processAttributes);
+ }
+ if (p == null || process == null) {
+ if (p != null)
+ p.destroy();
+ throw new CoreException(new Status(IStatus.ERROR,
+ IExternalToolConstants.PLUGIN_ID,
+ IExternalToolConstants.ERR_INTERNAL_ERROR,
+ ExternalToolsProgramMessages.ProgramLaunchDelegate_4, null));
+ }
+ process.setAttribute(IProcess.ATTR_CMDLINE,
+ generateCommandLine(cmdLine));
+
+// if (launchManager.isLaunchInBackground(configuration)) {
+// // refresh resources after process finishes
+// if (launchManager.getRefreshScope(configuration) != null) {
+// BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(
+// configuration, process);
+// refresher.startBackgroundRefresh();
+// }
+// } else {
+ // wait for process to exit
+ while (!process.isTerminated()) {
+ try {
+ if (monitor.isCanceled()) {
+ process.terminate();
+ break;
+ }
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ // refresh resources
+ RefreshUtil.refreshResources(configuration, monitor);
+// }
+ }
+
+ private String generateCommandLine(String[] commandLine) {
+ if (commandLine.length < 1)
+ return ""; //$NON-NLS-1$
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < commandLine.length; i++) {
+ buf.append(' ');
+ char[] characters = commandLine[i].toCharArray();
+ StringBuffer command = new StringBuffer();
+ boolean containsSpace = false;
+ for (int j = 0; j < characters.length; j++) {
+ char character = characters[j];
+ if (character == '\"') {
+ command.append('\\');
+ } else if (character == ' ') {
+ containsSpace = true;
+ }
+ command.append(character);
+ }
+ if (containsSpace) {
+ buf.append('\"');
+ buf.append(command);
+ buf.append('\"');
+ } else {
+ buf.append(command);
+ }
+ }
+ return buf.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder
+ * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
+ */
+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration,
+ String mode) throws CoreException {
+ IProject[] projects = ExternalToolsCoreUtil.getBuildProjects(
+ configuration, null);
+ if (projects == null) {
+ return null;
+ }
+ boolean isRef = ExternalToolsCoreUtil.isIncludeReferencedProjects(
+ configuration, null);
+ if (isRef) {
+ return computeReferencedBuildOrder(projects);
+ }
+ return computeBuildOrder(projects);
+ }
+}
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
new file mode 100644
index 000000000..12cdff95f
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 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
+ *******************************************************************************/
+package org.eclipse.core.externaltools.internal.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+
+/**
+ * Utility methods for working with external tool project builders.
+ */
+public class BuilderCoreUtils {
+
+ public static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$
+
+ /**
+ * Constant used to find a builder using the 3.0-interim format
+ */
+ public static final String BUILDER_FOLDER_NAME = ".externalToolBuilders"; //$NON-NLS-1$
+ /**
+ * Constant used to represent the current project in the 3.0-final format.
+ */
+ public static final String PROJECT_TAG = "<project>"; //$NON-NLS-1$
+
+ public static final String VERSION_1_0 = "1.0"; //$NON-NLS-1$
+ public static final String VERSION_2_1 = "2.1"; //$NON-NLS-1$
+ // The format shipped up to and including Eclipse 3.0 RC1
+ public static final String VERSION_3_0_interim = "3.0.interim"; //$NON-NLS-1$
+ // The format shipped in Eclipse 3.0 final
+ public static final String VERSION_3_0_final = "3.0"; //$NON-NLS-1$
+
+ private static final String BUILD_TYPE_SEPARATOR = ","; //$NON-NLS-1$
+ private static final int[] DEFAULT_BUILD_TYPES = new int[] {
+ IncrementalProjectBuilder.INCREMENTAL_BUILD,
+ IncrementalProjectBuilder.FULL_BUILD };
+
+ /**
+ * 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);
+ if (configHandle == null) {
+ // Probably an old-style (Eclipse 1.0 or 2.0) external tool. Try to
+ // migrate.
+ version[0] = VERSION_1_0;
+ return ExternalToolMigration.configFromArgumentMap(commandArgs);
+ }
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfiguration configuration = null;
+ if (configHandle.startsWith(PROJECT_TAG)) {
+ version[0] = VERSION_3_0_final;
+ IPath path = new Path(configHandle);
+ IFile file = project.getFile(path.removeFirstSegments(1));
+ if (file.exists()) {
+ configuration = manager.getLaunchConfiguration(file);
+ }
+ } else {
+ // Try treating the handle as a file name.
+ // This is the format used in 3.0 RC1.
+ IPath path = new Path(BUILDER_FOLDER_NAME).append(configHandle);
+ IFile file = project.getFile(path);
+ if (file.exists()) {
+ version[0] = VERSION_3_0_interim;
+ configuration = manager.getLaunchConfiguration(file);
+ } else {
+ try {
+ // Treat the configHandle as a memento. This is the format
+ // used in Eclipse 2.1.
+ configuration = manager
+ .getLaunchConfiguration(configHandle);
+ } catch (CoreException e) {
+ }
+ if (configuration != null) {
+ version[0] = VERSION_2_1;
+ }
+ }
+ }
+ return configuration;
+ }
+
+ public static void configureTriggers(ILaunchConfiguration config,
+ ICommand newCommand) throws CoreException {
+ newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, false);
+ newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD,
+ false);
+ newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
+ newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false);
+ String buildKinds = config.getAttribute(
+ IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null);
+ int[] triggers = BuilderCoreUtils.buildTypesToArray(buildKinds);
+ for (int i = 0; i < triggers.length; i++) {
+ switch (triggers[i]) {
+ case IncrementalProjectBuilder.FULL_BUILD:
+ newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD,
+ true);
+ break;
+ case IncrementalProjectBuilder.INCREMENTAL_BUILD:
+ newCommand.setBuilding(
+ IncrementalProjectBuilder.INCREMENTAL_BUILD, true);
+ break;
+ case IncrementalProjectBuilder.AUTO_BUILD:
+ newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD,
+ true);
+ break;
+ case IncrementalProjectBuilder.CLEAN_BUILD:
+ newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD,
+ true);
+ break;
+ }
+ }
+ if (!config.getAttribute(
+ IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) {
+ ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
+ copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED,
+ true);
+ copy.doSave();
+ }
+ }
+
+ /**
+ * Returns whether the given configuration is an "unmigrated" builder.
+ * Unmigrated builders are external tools that are stored in an old format
+ * but have not been migrated by the user. Old format builders are always
+ * 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
+ */
+ public static boolean isUnmigratedConfig(ILaunchConfiguration config) {
+ return config.isWorkingCopy()
+ && ((ILaunchConfigurationWorkingCopy) config).getOriginal() == null;
+ }
+
+ /**
+ * 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;
+ 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
+ // arguments.
+ // The goal here is to not change the storage format of old,
+ // unedited builders.
+ ICommand[] commands = project.getDescription().getBuildSpec();
+ for (int i = 0; i < commands.length; i++) {
+ ICommand projectCommand = commands[i];
+ String name = ExternalToolMigration
+ .getNameFromCommandArgs(projectCommand.getArguments());
+ if (name != null && name.equals(config.getName())) {
+ args = projectCommand.getArguments();
+ break;
+ }
+ }
+ } else {
+ if (config instanceof ILaunchConfigurationWorkingCopy) {
+ ILaunchConfigurationWorkingCopy workingCopy = (ILaunchConfigurationWorkingCopy) config;
+ if (workingCopy.getOriginal() != null) {
+ config = workingCopy.getOriginal();
+ }
+ }
+ args = new HashMap();
+ // 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));
+ args.put(LAUNCH_CONFIG_HANDLE, buffer.toString());
+ }
+ command.setBuilderName(ExternalToolBuilder.ID);
+ command.setArguments(args);
+ return command;
+ }
+
+ /**
+ * Returns the folder where project builders should be stored or
+ * <code>null</code> if the folder could not be created
+ */
+ public static IFolder getBuilderFolder(IProject project, boolean create) {
+ IFolder folder = project.getFolder(BUILDER_FOLDER_NAME);
+ if (!folder.exists() && create) {
+ try {
+ folder.create(true, true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+ return folder;
+ }
+
+ /**
+ * Migrates the launch configuration working copy, which is based on an old-
+ * style external tool builder, to a new, saved launch configuration. The
+ * returned launch configuration will contain the same attributes as the
+ * given working copy with the exception of the configuration name, which
+ * 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.
+ * @return ILaunchConfiguration a new, saved launch configuration whose
+ * attributes match those of the given working copy as well as
+ * possible
+ * @throws CoreException
+ * if an exception occurs while attempting to save the new
+ * launch configuration
+ */
+ public static ILaunchConfiguration migrateBuilderConfiguration(
+ IProject project, ILaunchConfigurationWorkingCopy workingCopy)
+ throws CoreException {
+ workingCopy.setContainer(getBuilderFolder(project, true));
+ // Before saving, make sure the name is valid
+ String name = workingCopy.getName();
+ name = name.replace('/', '.');
+ if (name.charAt(0) == ('.')) {
+ name = name.substring(1);
+ }
+ IStatus status = ResourcesPlugin.getWorkspace().validateName(name,
+ IResource.FILE);
+ if (!status.isOK()) {
+ name = "ExternalTool"; //$NON-NLS-1$
+ }
+ name = DebugPlugin.getDefault().getLaunchManager()
+ .generateUniqueLaunchConfigurationNameFrom(name);
+ workingCopy.rename(name);
+ return workingCopy.doSave();
+ }
+
+ /**
+ * 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.
+ */
+ public static int[] buildTypesToArray(String buildTypes) {
+ if (buildTypes == null || buildTypes.length() == 0) {
+ return DEFAULT_BUILD_TYPES;
+ }
+
+ int count = 0;
+ boolean incremental = false;
+ boolean full = false;
+ boolean auto = false;
+ boolean clean = false;
+
+ StringTokenizer tokenizer = new StringTokenizer(buildTypes,
+ BUILD_TYPE_SEPARATOR);
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ if (IExternalToolConstants.BUILD_TYPE_INCREMENTAL.equals(token)) {
+ if (!incremental) {
+ incremental = true;
+ count++;
+ }
+ } else if (IExternalToolConstants.BUILD_TYPE_FULL.equals(token)) {
+ if (!full) {
+ full = true;
+ count++;
+ }
+ } else if (IExternalToolConstants.BUILD_TYPE_AUTO.equals(token)) {
+ if (!auto) {
+ auto = true;
+ count++;
+ }
+ } else if (IExternalToolConstants.BUILD_TYPE_CLEAN.equals(token)) {
+ if (!clean) {
+ clean = true;
+ count++;
+ }
+ }
+ }
+
+ int[] results = new int[count];
+ count = 0;
+ if (incremental) {
+ results[count] = IncrementalProjectBuilder.INCREMENTAL_BUILD;
+ count++;
+ }
+ if (full) {
+ results[count] = IncrementalProjectBuilder.FULL_BUILD;
+ count++;
+ }
+ if (auto) {
+ results[count] = IncrementalProjectBuilder.AUTO_BUILD;
+ count++;
+ }
+ if (clean) {
+ results[count] = IncrementalProjectBuilder.CLEAN_BUILD;
+ count++;
+ }
+
+ return results;
+ }
+}
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
new file mode 100644
index 000000000..244a833f6
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 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
+ * Matthew Conway - Bug 175186
+ *******************************************************************************/
+package org.eclipse.core.externaltools.internal.model;
+
+
+import java.util.Map;
+
+import org.eclipse.core.externaltools.internal.ExternalToolsCore;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil;
+import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Bundle;
+
+/**
+ * This project builder implementation will run an external tool during the
+ * build process.
+ */
+public final class ExternalToolBuilder extends IncrementalProjectBuilder {
+ private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor {
+ private boolean[] fTrueChange;
+ private IgnoreTeamPrivateChanges(boolean[] trueChange) {
+ super();
+ fTrueChange= trueChange;
+ }
+ public boolean visit(IResourceDelta visitDelta) throws CoreException {
+ IResource resource= visitDelta.getResource();
+ if (resource instanceof IFile) {
+ fTrueChange[0]= true;
+ return false;
+ }
+ return true;
+ }
+ }
+
+ 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 {
+ 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);
+ }
+ IProject[] projectsWithinScope= null;
+ IResource[] resources = ExternalToolsCoreUtil.getResourcesForBuildScope(config);
+ if (resources != null) {
+ projectsWithinScope= new IProject[resources.length];
+ for (int i = 0; i < resources.length; i++) {
+ projectsWithinScope[i]= resources[i].getProject();
+ }
+ }
+ boolean kindCompatible= commandConfiguredForKind(config, kind);
+ if (kindCompatible && configEnabled(config)) {
+ doBuildBasedOnScope(resources, kind, config, monitor);
+ }
+
+ return projectsWithinScope;
+ }
+
+ private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) {
+ try {
+ if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
+ ICommand command= getCommand();
+ //adapt the builder command to make use of the 3.1 support for setting command build kinds
+ //this will only happen once for builder/command defined before the support existed
+ BuilderCoreUtils.configureTriggers(config, command);
+ IProjectDescription desc= getProject().getDescription();
+ ICommand[] commands= desc.getBuildSpec();
+ int index= getBuilderCommandIndex(commands, command);
+ if (index != -1) {
+ commands[index]= command;
+ desc.setBuildSpec(commands);
+ getProject().setDescription(desc, null);
+ ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy();
+ copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
+ copy.doSave();
+ }
+ return command.isBuilding(kind);
+ }
+ } catch (CoreException e) {
+ ExternalToolsCore.log(e);
+ return true;
+ }
+ return true;
+ }
+
+ private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) {
+ Map commandArgs= command.getArguments();
+ if (commandArgs == null) {
+ return -1;
+ }
+ String handle= (String) 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();
+ if (buildSpecArgs != null) {
+ String buildSpecHandle= (String) buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE);
+ if (handle.equals(buildSpecHandle)) {
+ return i;
+ }
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns whether the given builder config is enabled or not.
+ *
+ * @param config the config to examine
+ * @return whether the config is enabled
+ */
+ private boolean configEnabled(ILaunchConfiguration config) {
+ try {
+ return ExternalToolsCoreUtil.isBuilderEnabled(config);
+ } catch (CoreException e) {
+ ExternalToolsCore.log(e);
+ }
+ return true;
+ }
+
+ private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+ boolean buildForChange = true;
+ if (kind != FULL_BUILD) { //scope not applied for full builds
+ if (resources != null && resources.length > 0) {
+ buildForChange = buildScopeIndicatesBuild(resources);
+ }
+ }
+
+ if (buildForChange) {
+ launchBuild(kind, config, monitor);
+ }
+ }
+
+ private void launchBuild(int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+ monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()}));
+ buildStarted(kind);
+ // The default value for "launch in background" is true in debug core. If
+ // the user doesn't go through the UI, the new attribute won't be set. This means
+ // that existing Ant builders will try to run in the background (and likely conflict with
+ // each other) without migration.
+ config= ExternalToolMigration.migrateRunInBackground(config);
+ config.launch(ILaunchManager.RUN_MODE, monitor);
+ buildEnded();
+ }
+
+ /**
+ * 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() {
+ return buildProject;
+ }
+
+ /**
+ * 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
+ */
+ private void buildStarted(int buildKind) {
+ switch (buildKind) {
+ case IncrementalProjectBuilder.INCREMENTAL_BUILD :
+ buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL;
+ buildDelta = getDelta(getProject());
+ break;
+ case IncrementalProjectBuilder.FULL_BUILD :
+ buildType = IExternalToolConstants.BUILD_TYPE_FULL;
+ break;
+ case IncrementalProjectBuilder.AUTO_BUILD :
+ buildType = IExternalToolConstants.BUILD_TYPE_AUTO;
+ buildDelta = getDelta(getProject());
+ break;
+ case IncrementalProjectBuilder.CLEAN_BUILD :
+ buildType = IExternalToolConstants.BUILD_TYPE_CLEAN;
+ break;
+ default :
+ buildType = IExternalToolConstants.BUILD_TYPE_NONE;
+ break;
+ }
+ buildProject= getProject();
+ }
+
+ /**
+ * Clears the current build kind, build project and build delta when a build finishes.
+ */
+ private void buildEnded() {
+ buildType= IExternalToolConstants.BUILD_TYPE_NONE;
+ 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) {
+ final boolean[] trueChange= new boolean[1];
+ trueChange[0]= false;
+ try {
+ change.accept(new IgnoreTeamPrivateChanges(trueChange));
+ } 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 {
+ 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, monitor);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java
new file mode 100644
index 000000000..9e38b5041
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java
@@ -0,0 +1,24 @@
+/**********************************************************************
+ * Copyright (c) 2000, 2009 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 - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.core.externaltools.internal.model;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ExternalToolsModelMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.model.ExternalToolsModelMessages";//$NON-NLS-1$
+
+ public static String ExternalToolBuilder_Running__0_____1;
+ public static String ExternalToolBuilder_0;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ExternalToolsModelMessages.class);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties
new file mode 100644
index 000000000..0f16fe71a
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2000, 2009 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
+###############################################################################
+
+ExternalToolBuilder_Running__0_____1=Running {0}...
+ExternalToolBuilder_0=The builder launch configuration could not be found.
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
new file mode 100644
index 000000000..a06bc8782
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java
@@ -0,0 +1,410 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 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
+ *******************************************************************************/
+package org.eclipse.core.externaltools.internal.registry;
+
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.externaltools.internal.ExternalToolsCore;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.RefreshUtil;
+
+
+/**
+ * Responsible reading an old external tool format and creating
+ * and migrating it to create a new external tool.
+ */
+public final class ExternalToolMigration {
+ /**
+ * Structure to represent a variable definition within a
+ * source string.
+ */
+ public static final class VariableDefinition {
+ /**
+ * Index in the source text where the variable started
+ * 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
+ * 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.
+ */
+ private VariableDefinition() {
+ 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$
+
+ /**
+ * External tool type for Ant build files (value <code>antBuildType</code>).
+ */
+ public static final String TOOL_TYPE_ANT_BUILD = "antBuildType"; //$NON-NLS-1$;
+ /**
+ * Ant builder launch configuration type identifier. Ant project builders
+ * 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$;
+
+ /**
+ * String attribute indicating the Ant targets to execute. Default value is
+ * <code>null</code> which indicates that the default target is to be
+ * executed. Format is a comma separated listing of targets.
+ * NOTE: This value is copied here from org.eclipse.ant.ui.internal.IAntLaunchConfigurationConstants.
+ * Ant no longer resides in External Tools and this plug-in. This value is kept here only
+ * for migration.
+ */
+ public static final String ATTR_ANT_TARGETS = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$
+
+ /*
+ * 2.0 External Tool Tags
+ */
+ public static final String TAG_TOOL_TYPE = "!{tool_type}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_NAME = "!{tool_name}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_LOCATION = "!{tool_loc}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_ARGUMENTS = "!{tool_args}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_DIRECTORY = "!{tool_dir}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_REFRESH = "!{tool_refresh}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_SHOW_LOG = "!{tool_show_log}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_BUILD_TYPES = "!{tool_build_types}"; //$NON-NLS-1$
+ public static final String TAG_TOOL_BLOCK = "!{tool_block}"; //$NON-NLS-1$
+
+ // Known kind of tools
+ private static final String TOOL_TYPE_ANT = "org.eclipse.ui.externaltools.type.ant"; //$NON-NLS-1$
+ private static final String TOOL_TYPE_PROGRAM = "org.eclipse.ui.externaltools.type.program"; //$NON-NLS-1$
+
+ /*
+ * 2.1 External Tool Keys
+ */
+ public static final String TAG_TYPE = "type"; //$NON-NLS-1$
+ public static final String TAG_NAME = "name"; //$NON-NLS-1$
+ public static final String TAG_LOCATION = "location"; //$NON-NLS-1$
+ public static final String TAG_WORK_DIR = "workDirectory"; //$NON-NLS-1$
+ public static final String TAG_CAPTURE_OUTPUT = "captureOutput"; //$NON-NLS-1$
+ public static final String TAG_SHOW_CONSOLE = "showConsole"; //$NON-NLS-1$
+ public static final String TAG_RUN_BKGRND = "runInBackground"; //$NON-NLS-1$
+ public static final String TAG_PROMPT_ARGS = "promptForArguments"; //$NON-NLS-1$
+ public static final String TAG_ARGS = "arguments"; //$NON-NLS-1$
+ public static final String TAG_REFRESH_SCOPE = "refreshScope"; //$NON-NLS-1$
+ public static final String TAG_REFRESH_RECURSIVE = "refreshRecursive"; //$NON-NLS-1$
+ public static final String TAG_RUN_BUILD_KINDS = "runForBuildKinds"; //$NON-NLS-1$
+ public static final String TAG_EXTRA_ATTR = "extraAttribute"; //$NON-NLS-1$
+ public static final String TAG_VERSION = "version"; //$NON-NLS-1$
+
+ private static final String EXTRA_ATTR_SEPARATOR = "="; //$NON-NLS-1$
+
+ private static final String VERSION_21 = "2.1"; //$NON-NLS-1$;
+
+ private static final String TRUE = "true"; //$NON-NLS-1$
+ private static final String FALSE = "false"; //$NON-NLS-1$
+
+ /**
+ * Allows no instances.
+ */
+ private ExternalToolMigration() {
+ super();
+ }
+
+ /**
+ * Returns a launch configuration working copy from the argument map or
+ * <code>null</code> if the given map cannot be interpreted as a 2.0 or 2.1
+ * 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);
+ 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);
+
+ 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(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_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);
+ if (args != null) {
+ config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, args);
+ }
+
+ String extraAttributes = (String) 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())
+ break;
+ String value = tokenizer.nextToken();
+ if (key.equals(RUN_TARGETS_ATTRIBUTE)) {
+ // 2.1 implementation only defined 1 "extra attribute"
+ config.setAttribute(ATTR_ANT_TARGETS, value);
+ }
+ }
+ }
+ return config;
+ }
+
+ /**
+ * Creates an external tool from the map.
+ */
+ public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(Map args) {
+ // Update the type...
+ String type = (String) args.get(TAG_TOOL_TYPE);
+ if (TOOL_TYPE_ANT.equals(type)) {
+ type = TOOL_TYPE_ANT_BUILD;
+ } else if (TOOL_TYPE_PROGRAM.equals(type)){
+ type = IExternalToolConstants.TOOL_TYPE_PROGRAM;
+ } else {
+ return null;
+ }
+
+ String name = (String) 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);
+ config.setAttribute(IExternalToolConstants.ATTR_LOCATION, location);
+
+ // Update the refresh scope...
+ String refresh = (String) args.get(TAG_TOOL_REFRESH);
+ if (refresh != null) {
+ VariableDefinition varDef = extractVariableDefinition(refresh, 0);
+ if ("none".equals(varDef.name)) { //$NON-NLS-1$
+ refresh = null;
+ }
+ config.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, refresh);
+ }
+
+ // Update the arguments
+ String arguments = (String) 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();
+ StringBuffer buffer = new StringBuffer();
+ VariableDefinition varDef = extractVariableDefinition(arguments, start);
+ while (varDef.end != -1) {
+ if ("ant_target".equals(varDef.name) && varDef.argument != null) { //$NON-NLS-1$
+ targets.add(varDef.argument);
+ buffer.append(arguments.substring(start, varDef.start));
+ } else {
+ buffer.append(arguments.substring(start, varDef.end));
+ }
+ start = varDef.end;
+ varDef = extractVariableDefinition(arguments, start);
+ }
+ 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);
+ if (target != null && target.length() > 0) {
+ buffer.append(target);
+ buffer.append(","); //$NON-NLS-1$
+ }
+ }
+ targetNames = buffer.toString();
+ }
+ if (targetNames != null && targetNames.length() > 0) {
+ config.setAttribute(ATTR_ANT_TARGETS, targetNames);
+ }
+ }
+ config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
+
+ // Collect the rest of the information
+ 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);
+ 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));
+ return config;
+ }
+
+ /**
+ * Returns a new working copy with the given external tool name and external
+ * tool type or <code>null</code> if no config could be created.
+ */
+ private static ILaunchConfigurationWorkingCopy newConfig(String type, String name) {
+ if (type == null || name == null) {
+ return null;
+ }
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType configType;
+ if (TOOL_TYPE_ANT_BUILD.equals(type)) {
+ configType = manager.getLaunchConfigurationType(ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE);
+ } else if (IExternalToolConstants.TOOL_TYPE_PROGRAM.equals(type)) {
+ configType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE);
+ } else {
+ return null;
+ }
+ try {
+ if (configType != null) {
+ return configType.newInstance(null, name);
+ }
+ } catch (CoreException e) {
+ ExternalToolsCore.log(e);
+ }
+ 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);
+ if (name == null) {
+ name= (String) 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
+ */
+ public static ILaunchConfiguration migrateRunInBackground(ILaunchConfiguration config) {
+ String noValueFlag= "NoValue"; //$NON-NLS-1$
+ String attr= null;
+ try {
+ attr = config.getAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, noValueFlag);
+ } catch (CoreException e) {
+ // Exception will occur if the attribute is already set because the attribute is actually a boolean.
+ // No migration necessary.
+ return config;
+ }
+ if (noValueFlag.equals(attr)) {
+ //the old constant
+ String ATTR_RUN_IN_BACKGROUND= IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_RUN_IN_BACKGROUND"; //$NON-NLS-1$
+ boolean runInBackground= false;
+ try {
+ runInBackground = config.getAttribute(ATTR_RUN_IN_BACKGROUND, runInBackground);
+ } catch (CoreException e) {
+ ExternalToolsCore.log(ExternalToolsMigrationMessages.ExternalToolMigration_37, e);
+ }
+ try {
+ ILaunchConfigurationWorkingCopy workingCopy= config.getWorkingCopy();
+ workingCopy.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, runInBackground);
+ config= 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);
+ if (varDef.start < 0){
+ return varDef;
+ }
+ start = varDef.start + VAR_TAG_START.length();
+
+ int end = text.indexOf(VAR_TAG_END, start);
+ if (end < 0) {
+ return varDef;
+ }
+ varDef.end = end + VAR_TAG_END.length();
+ if (end == start) {
+ return varDef;
+ }
+
+ int mid = text.indexOf(VAR_TAG_SEP, start);
+ if (mid < 0 || mid > end) {
+ varDef.name = text.substring(start, end);
+ } else {
+ if (mid > start) {
+ varDef.name = text.substring(start, mid);
+ }
+ mid = mid + VAR_TAG_SEP.length();
+ if (mid < end) {
+ varDef.argument = text.substring(mid, end);
+ }
+ }
+
+ return varDef;
+ }
+}
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java
new file mode 100644
index 000000000..3e5fa46f7
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java
@@ -0,0 +1,25 @@
+/**********************************************************************
+ * Copyright (c) 2000, 2009 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 - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.core.externaltools.internal.registry;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ExternalToolsMigrationMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.registry.launchConfigurations.ExternalToolsUIMessages";//$NON-NLS-1$
+
+ public static String ExternalToolMigration_37;
+ public static String ExternalToolMigration_38;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME,
+ ExternalToolsMigrationMessages.class);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties
new file mode 100644
index 000000000..1e18e673e
--- /dev/null
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2000, 2009 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
+###############################################################################
+
+ExternalToolMigration_37=An exception occurred accessing external tool\'s \"run in background\" attribute
+ExternalToolMigration_38=An exception occurred attempting to migrate external tool\'s \"run in background\" attribute
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java b/org.eclipse.core.externaltools/src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java
deleted file mode 100644
index c2b1ae5e3..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/internal/externaltools/ExternalToolsCore.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- *******************************************************************************/
-package org.eclipse.core.internal.externaltools;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * Controls the plug-in life cycle
- */
-public class ExternalToolsCore extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$
-
- // The shared instance
- private static ExternalToolsCore plugin;
-
- /**
- * The constructor
- */
- public ExternalToolsCore() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ExternalToolsCore getDefault() {
- return plugin;
- }
-
-}

Back to the top