Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2009-10-08 18:44:15 +0000
committerDarin Wright2009-10-08 18:44:15 +0000
commit624aacadeeb71182500381aefb2d22e8f7c39ce3 (patch)
tree22badaad467fbed872b1a8a3143c75d2415e7572 /org.eclipse.ui.externaltools/External Tools Base
parentdd1751fd5b5a875951312bc9577d631c05ee9328 (diff)
downloadeclipse.platform.debug-624aacadeeb71182500381aefb2d22e8f7c39ce3.tar.gz
eclipse.platform.debug-624aacadeeb71182500381aefb2d22e8f7c39ce3.tar.xz
eclipse.platform.debug-624aacadeeb71182500381aefb2d22e8f7c39ce3.zip
Bug 264338 - External tool builder fails in headless mode because of dependencies to UI
Diffstat (limited to 'org.eclipse.ui.externaltools/External Tools Base')
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java49
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java23
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java7
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties6
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java5
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java78
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java232
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java288
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java3
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java139
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java231
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java2
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java411
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java13
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java9
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java7
25 files changed, 207 insertions, 1332 deletions
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
index 8c510ed7f..407484e19 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * 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
@@ -16,16 +16,15 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
@@ -41,7 +40,6 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.dialogs.ListSelectionDialog;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsImages;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
@@ -330,37 +328,9 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab {
* @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$
- IResource resource = DebugUITools.getSelectedResource();
- if (resource != null) {
- return new IProject[]{resource.getProject()};
- }
- }
- return new IProject[0];
+ return ExternalToolsCoreUtil.getBuildProjects(configuration,
+ buildScopeId);
+
}
/**
@@ -372,11 +342,8 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab {
* @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);
+ return ExternalToolsCoreUtil.isIncludeReferencedProjects(configuration,
+ includeReferencedProjectsId);
}
/**
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java
index 38f59a96c..5b0c0a46b 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * 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
@@ -12,6 +12,8 @@
package org.eclipse.ui.externaltools.internal.launchConfigurations;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -50,7 +52,6 @@ import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
import org.eclipse.ui.externaltools.internal.model.BuilderUtils;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.model.WorkbenchContentProvider;
@@ -358,7 +359,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
}
protected void updateRunInBackground(ILaunchConfiguration configuration) {
- fLaunchInBackgroundButton.setSelection(isLaunchInBackground(configuration));
+ fLaunchInBackgroundButton.setSelection(ExternalToolsCoreUtil.isAsynchronousBuild(configuration));
}
private void updateConsoleOutput(ILaunchConfiguration configuration) {
@@ -386,22 +387,6 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
fVariables.setEnabled(haveOutputFile);
fAppend.setEnabled(haveOutputFile);
}
-
- /**
- * Returns whether the given configuration should be run in the background.
- *
- * @param configuration the configuration
- * @return whether the configuration is configured to run in the background
- */
- public static boolean isLaunchInBackground(ILaunchConfiguration configuration) {
- boolean launchInBackground= false;
- try {
- launchInBackground= configuration.getAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ce);
- }
- return launchInBackground;
- }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
index f18bb254c..aab850c3b 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. This
+ * 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
@@ -48,11 +48,6 @@ public class ExternalToolsLaunchConfigurationMessages extends NLS {
public static String ExternalToolsBuildTab_8;
public static String ExternalToolsBuildTab_9;
-
- public static String ExternalToolsUtil_Location_not_specified_by__0__1;
- public static String ExternalToolsUtil_invalidLocation__0_;
- public static String ExternalToolsUtil_invalidDirectory__0_;
-
public static String ExternalToolsBuilderTab_Run_this_builder_for__1;
public static String ExternalToolsBuilderTab__Full_builds_2;
public static String ExternalToolsBuilderTab_Full;
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties
index 7e432a97c..9de69a4f7 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
+# 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
@@ -43,10 +43,6 @@ ExternalToolsBuildTab_7=Select &Projects:
ExternalToolsBuildTab_8=Build
ExternalToolsBuildTab_9=No projects specified
-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}.
-
ExternalToolsBuilderTab_Run_this_builder_for__1=Run the builder:
ExternalToolsBuilderTab__Full_builds_2=A&fter a \"Clean\"
ExternalToolsBuilderTab_Full=Runs on the first build that occurs after a clean.
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
index f9784bf1e..8274d95fc 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * 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
@@ -12,6 +12,8 @@ package org.eclipse.ui.externaltools.internal.launchConfigurations;
import java.io.File;
+
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -46,7 +48,6 @@ import org.eclipse.ui.dialogs.ContainerSelectionDialog;
import org.eclipse.ui.dialogs.ResourceSelectionDialog;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsImages;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
/**
* The external tools main tab allows the user to configure primary attributes
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java
index cbc763353..8f7a871b2 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * 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
@@ -13,21 +13,14 @@
package org.eclipse.ui.externaltools.internal.launchConfigurations;
-import java.io.File;
-
+import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil;
import org.eclipse.core.resources.IResource;
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.ui.RefreshTab;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
+import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
/**
* Utilities for external tool launch configurations.
@@ -47,7 +40,7 @@ public class ExternalToolsUtil {
* @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));
+ throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, code, message, exception));
}
/**
@@ -63,26 +56,7 @@ public class ExternalToolsUtil {
* system
*/
public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException {
- String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null);
- if (location == null) {
- abort(NLS.bind(ExternalToolsLaunchConfigurationMessages.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(ExternalToolsLaunchConfigurationMessages.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(ExternalToolsLaunchConfigurationMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()});
- abort(msg, null, 0);
- }
- }
- // execution will not reach here
- return null;
+ return ExternalToolsCoreUtil.getLocation(configuration);
}
/**
@@ -95,7 +69,7 @@ public class ExternalToolsUtil {
* @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);
+ return ExternalToolsCoreUtil.getCaptureOutput(configuration);
}
/**
@@ -113,19 +87,7 @@ public class ExternalToolsUtil {
* 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(ExternalToolsLaunchConfigurationMessages.ExternalToolsUtil_invalidDirectory__0_, new Object[] { expandedLocation, configuration.getName()});
- abort(msg, null, 0);
- }
- }
- return null;
+ return ExternalToolsCoreUtil.getWorkingDirectory(configuration);
}
/**
@@ -139,16 +101,7 @@ public class ExternalToolsUtil {
* 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();
+ return ExternalToolsCoreUtil.getArguments(configuration);
}
/**
@@ -163,7 +116,7 @@ public class ExternalToolsUtil {
* @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);
+ return ExternalToolsCoreUtil.isBuilderEnabled(configuration);
}
/**
@@ -173,12 +126,7 @@ public class ExternalToolsUtil {
* @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 RefreshTab.getRefreshResources(scope);
+ return ExternalToolsCoreUtil.getResourcesForBuildScope(configuration);
}
/**
@@ -193,11 +141,7 @@ public class ExternalToolsUtil {
* @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;
+ return ExternalToolsCoreUtil.parseStringIntoList(arguments);
}
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java
index 8a4a220bd..943f1e7cd 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * 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
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.ui.externaltools.internal.menu;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.debug.ui.actions.AbstractLaunchToolbarAction;
import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
/**
* This action delegate is responsible for producing the
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java
index 75b10bc2b..b79c845ac 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * 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
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.externaltools.internal.menu;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.debug.ui.actions.OpenLaunchDialogAction;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
/**
* Opens the launch config dialog on the external tools launch group.
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
index 6e8a3a2c5..454e5e5a6 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * 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
@@ -10,66 +10,33 @@
*******************************************************************************/
package org.eclipse.ui.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.model.BuilderCoreUtils;
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.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
-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.core.runtime.Platform;
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.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.externaltools.internal.registry.ExternalToolMigration;
/**
* Utility methods for working with external tool project builders.
*/
public class BuilderUtils {
-
- 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$
// Extension point constants.
- private static final String TAG_CONFIGURATION_MAP= "configurationMap"; //$NON-NLS-1$
- private static final String TAG_SOURCE_TYPE= "sourceType"; //$NON-NLS-1$
- private static final String TAG_BUILDER_TYPE= "builderType"; //$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};
+ private static final String TAG_CONFIGURATION_MAP = "configurationMap"; //$NON-NLS-1$
+ private static final String TAG_SOURCE_TYPE = "sourceType"; //$NON-NLS-1$
+ private static final String TAG_BUILDER_TYPE = "builderType"; //$NON-NLS-1$
/**
* Returns a launch configuration from the given ICommand arguments. If the
@@ -81,42 +48,7 @@ public class BuilderUtils {
* <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;
+ return BuilderCoreUtils.configFromBuildCommandArgs(project, commandArgs, version);
}
/**
@@ -144,33 +76,7 @@ public class BuilderUtils {
}
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= BuilderUtils.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();
- }
+ BuilderCoreUtils.configureTriggers(config, newCommand);
}
/**
@@ -184,7 +90,7 @@ public class BuilderUtils {
* @return whether the given config represents an unmigrated builder
*/
public static boolean isUnmigratedConfig(ILaunchConfiguration config) {
- return config.isWorkingCopy() && ((ILaunchConfigurationWorkingCopy) config).getOriginal() == null;
+ return BuilderCoreUtils.isUnmigratedConfig(config);
}
/**
@@ -194,37 +100,7 @@ public class BuilderUtils {
* @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;
+ return BuilderCoreUtils.toBuildCommand(project, config, command);
}
/**
@@ -233,7 +109,7 @@ public class BuilderUtils {
* if an extension has been specified to explicitly declare the mapping.
*/
public static ILaunchConfigurationType getConfigurationDuplicationType(ILaunchConfiguration config) throws CoreException {
- IExtensionPoint ep= Platform.getExtensionRegistry().getExtensionPoint(IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS);
+ IExtensionPoint ep= Platform.getExtensionRegistry().getExtensionPoint(ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS);
IConfigurationElement[] elements = ep.getConfigurationElements();
String sourceType= config.getType().getIdentifier();
String builderType= null;
@@ -258,15 +134,7 @@ public class BuilderUtils {
* <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;
+ return BuilderCoreUtils.getBuilderFolder(project, create);
}
/**
@@ -302,22 +170,9 @@ public class BuilderUtils {
* 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();
+ return BuilderCoreUtils.migrateBuilderConfiguration(project, workingCopy);
}
-
+
/**
* Converts the build types string into an array of
* build kinds.
@@ -326,61 +181,6 @@ public class BuilderUtils {
* @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;
- }
+ return BuilderCoreUtils.buildTypesToArray(buildTypes);
+ }
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java
deleted file mode 100644
index ba3a220eb..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 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.ui.externaltools.internal.model;
-
-
-import java.util.Map;
-
-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.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil;
-import org.eclipse.ui.externaltools.internal.registry.ExternalToolMigration;
-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 (ExternalToolsPlugin.getDefault().getBundle().getState() != Bundle.ACTIVE) {
- return null;
- }
-
- ILaunchConfiguration config= BuilderUtils.configFromBuildCommandArgs(getProject(), args, new String[1]);
- if (config == null) {
- throw ExternalToolsPlugin.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null);
- }
- IProject[] projectsWithinScope= null;
- IResource[] resources = ExternalToolsUtil.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
- BuilderUtils.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) {
- ExternalToolsPlugin.getDefault().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(BuilderUtils.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(BuilderUtils.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 ExternalToolsUtil.isBuilderEnabled(config);
- } catch (CoreException e) {
- ExternalToolsPlugin.getDefault().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) {
- ExternalToolsPlugin.getDefault().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= BuilderUtils.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.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java
index c45144dd2..3dca05fa9 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * 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
@@ -14,6 +14,7 @@ package org.eclipse.ui.externaltools.internal.model;
import java.net.MalformedURLException;
import java.net.URL;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java
index f68396435..3b66a05c5 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This
+ * 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
@@ -15,8 +15,6 @@ public class ExternalToolsModelMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.ui.externaltools.internal.model.ExternalToolsModelMessages";//$NON-NLS-1$
public static String ImageDescriptorRegistry_Allocating_image_for_wrong_display_1;
- public static String ExternalToolBuilder_Running__0_____1;
- public static String ExternalToolBuilder_0;
public static String BuilderUtils_5;
public static String BuilderUtils_6;
public static String BuilderUtils_7;
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties
index 528fcb2e1..cb3e2a61a 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsModelMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
+# 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
@@ -10,8 +10,6 @@
###############################################################################
ImageDescriptorRegistry_Allocating_image_for_wrong_display_1=Allocating image for wrong display
-ExternalToolBuilder_Running__0_____1=Running {0}...
-ExternalToolBuilder_0=The builder launch configuration could not be found.
BuilderUtils_5=Command Error
BuilderUtils_6=An error occurred while saving the build commands of the project
BuilderUtils_7=\ [Builder]
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java
index 130c6a6a7..f3b82cbdb 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * 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
@@ -10,19 +10,29 @@
*******************************************************************************/
package org.eclipse.ui.externaltools.internal.model;
-
import java.net.MalformedURLException;
import java.net.URL;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.runtime.CoreException;
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.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.externaltools.internal.program.launchConfigurations.ExternalToolsProgramMessages;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -30,15 +40,78 @@ import org.osgi.framework.BundleContext;
/**
* External tools plug-in class
*/
-public final class ExternalToolsPlugin extends AbstractUIPlugin {
+public final class ExternalToolsPlugin extends AbstractUIPlugin implements
+ ILaunchListener {
+
+ public static final String PLUGIN_ID = "org.eclipse.ui.externaltools"; //$NON-NLS-1$
+
/**
* Status representing no problems encountered during operation.
*/
- public static final IStatus OK_STATUS = new Status(IStatus.OK, IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
-
+ public static final IStatus OK_STATUS = new Status(IStatus.OK, PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+
private static ExternalToolsPlugin plugin;
-
- private static final String EMPTY_STRING= ""; //$NON-NLS-1$
+
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ private static IWindowListener fWindowListener;
+
+ private static ILaunchManager launchManager;
+
+ /**
+ * A window listener that warns the user about any running programs when the
+ * workbench closes. Programs are killed when the VM exits.
+ */
+ private class ProgramLaunchWindowListener implements IWindowListener {
+ public void windowActivated(IWorkbenchWindow window) {
+ }
+
+ public void windowDeactivated(IWorkbenchWindow window) {
+ }
+
+ public void windowClosed(IWorkbenchWindow window) {
+ IWorkbenchWindow windows[] = PlatformUI.getWorkbench()
+ .getWorkbenchWindows();
+ if (windows.length > 1) {
+ // There are more windows still open.
+ return;
+ }
+ ILaunchManager manager = DebugPlugin.getDefault()
+ .getLaunchManager();
+ ILaunchConfigurationType programType = manager
+ .getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE);
+ if (programType == null) {
+ return;
+ }
+ ILaunch launches[] = manager.getLaunches();
+ ILaunchConfigurationType configType;
+ ILaunchConfiguration config;
+ for (int i = 0; i < launches.length; i++) {
+ try {
+ config = launches[i].getLaunchConfiguration();
+ if (config == null) {
+ continue;
+ }
+ configType = config.getType();
+ } catch (CoreException e) {
+ continue;
+ }
+ if (configType.equals(programType)) {
+ if (!launches[i].isTerminated()) {
+ MessageDialog
+ .openWarning(
+ window.getShell(),
+ ExternalToolsProgramMessages.ProgramLaunchDelegate_Workbench_Closing_1,
+ ExternalToolsProgramMessages.ProgramLaunchDelegate_The_workbench_is_exiting);
+ break;
+ }
+ }
+ }
+ }
+
+ public void windowOpened(IWorkbenchWindow window) {
+ }
+ }
/**
* Create an instance of the External Tools plug-in.
@@ -63,14 +136,14 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin {
if (message == null) {
message= EMPTY_STRING;
}
- return new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, message, exception);
+ 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));
+ return new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception));
}
/**
@@ -164,4 +237,52 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin {
super.stop(context);
}
}
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ // Listen to launches to lazily create "launch processors"
+ launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches = launchManager.getLaunches();
+ if (launches.length > 0) {
+ if (fWindowListener == null) {
+ fWindowListener = new ProgramLaunchWindowListener();
+ PlatformUI.getWorkbench().addWindowListener(fWindowListener);
+ }
+ } else {
+ // if no launches, wait for first launch to initialize processors
+ launchManager.addLaunchListener(this);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch)
+ */
+ public void launchAdded(ILaunch launch) {
+ ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
+ try {
+ ILaunchConfigurationType launchConfigurationType = launchConfiguration.getType();
+ if (launchConfigurationType.getIdentifier().equals(
+ IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE)) {
+ if (fWindowListener == null) {
+ fWindowListener = new ProgramLaunchWindowListener();
+ PlatformUI.getWorkbench().addWindowListener(fWindowListener);
+ launchManager.removeLaunchListener(this);
+ }
+ }
+ } catch (CoreException e) {
+ log(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchListener#launchChanged(org.eclipse.debug.core.ILaunch)
+ */
+ public void launchChanged(ILaunch launch) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchListener#launchRemoved(org.eclipse.debug.core.ILaunch)
+ */
+ public void launchRemoved(ILaunch launch) {
+ }
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java
deleted file mode 100644
index 31de4e336..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 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.ui.externaltools.internal.model;
-
-/**
- * Defines the constants available for client use.
- * <p>
- * This interface is not intended to be extended or implemented by clients.
- * </p>
- */
-public interface IExternalToolConstants {
- /**
- * Plugin identifier for external tools (value <code>org.eclipse.ui.externaltools</code>).
- */
- public static final String PLUGIN_ID = "org.eclipse.ui.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 = PLUGIN_ID + ".IMG_TAB_MAIN"; //$NON-NLS-1$
-
- /**
- * Build tab image
- */
- public static final String IMG_TAB_BUILD = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = PLUGIN_ID + ".ATTR_BUILDER_ENABLED"; //$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 = 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 = 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 = 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 = PLUGIN_ID + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
index fea381648..346f60c85 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * 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
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java
deleted file mode 100644
index 8d4149518..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/registry/ExternalToolMigration.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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.ui.externaltools.internal.registry;
-
-
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-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.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.RefreshTab;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
-import org.eclipse.ui.externaltools.internal.ui.ExternalToolsUIMessages;
-
-/**
- * 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.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(IDebugUIConstants.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(RefreshTab.ATTR_REFRESH_SCOPE, (String) commandArgs.get(TAG_REFRESH_SCOPE));
- config.setAttribute(RefreshTab.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(RefreshTab.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(IDebugUIConstants.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) {
- ExternalToolsPlugin.getDefault().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(IDebugUIConstants.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.PLUGIN_ID + ".ATTR_RUN_IN_BACKGROUND"; //$NON-NLS-1$
- boolean runInBackground= false;
- try {
- runInBackground = config.getAttribute(ATTR_RUN_IN_BACKGROUND, runInBackground);
- } catch (CoreException e) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsUIMessages.ExternalToolMigration_37, e);
- }
- try {
- ILaunchConfigurationWorkingCopy workingCopy= config.getWorkingCopy();
- workingCopy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, runInBackground);
- config= workingCopy.doSave();
- } catch (CoreException e) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsUIMessages.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.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java
index 2b7fe0742..3d6dc5b61 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.ui.externaltools.internal.ui;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -23,7 +24,6 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
import org.eclipse.ui.externaltools.internal.ui.BuilderPropertyPage.ErrorConfig;
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
index 11dab4380..cbe01d51a 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
@@ -18,6 +18,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.externaltools.internal.model.BuilderCoreUtils;
+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -78,9 +81,7 @@ import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsM
import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsUtil;
import org.eclipse.ui.externaltools.internal.launchConfigurations.IgnoreWhiteSpaceComparator;
import org.eclipse.ui.externaltools.internal.model.BuilderUtils;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds;
import org.eclipse.ui.externaltools.internal.model.IPreferenceConstants;
import org.eclipse.ui.progress.IProgressService;
@@ -210,7 +211,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
for (int i = 0; i < commands.length; i++) {
String[] version= new String[] {""}; //$NON-NLS-1$
ILaunchConfiguration config = BuilderUtils.configFromBuildCommandArgs(project, commands[i].getArguments(), version);
- if (BuilderUtils.VERSION_2_1.equals(version[0])) {
+ if (BuilderCoreUtils.VERSION_2_1.equals(version[0])) {
// Storing the .project file of a project with 2.1 configs, will
// edit the file in a way that isn't backwards compatible.
projectNeedsMigration= true;
@@ -222,7 +223,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
if (shell == null) {
return;
}
- IStatus status = new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_Exists, new String[]{config.getName()}), null);
+ IStatus status = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_Exists, new String[]{config.getName()}), null);
ErrorDialog.openError(getShell(), ExternalToolsUIMessages.BuilderPropertyPage_errorTitle,
NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_External_Tool_Builder__0__Not_Added_2, new String[]{config.getName()}),
status);
@@ -232,7 +233,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
}
} else {
String builderID = commands[i].getBuilderName();
- if (builderID.equals(ExternalToolBuilder.ID) && commands[i].getArguments().get(BuilderUtils.LAUNCH_CONFIG_HANDLE) != null) {
+ if (builderID.equals(ExternalToolBuilder.ID) && commands[i].getArguments().get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE) != null) {
// An invalid external tool entry.
element= new ErrorConfig(commands[i]);
} else {
@@ -767,7 +768,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
if (e instanceof CoreException) {
status[0] = ((CoreException) e).getStatus();
} else {
- status[0] = new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsUIMessages.BuilderPropertyPage_statusMessage, e);
+ status[0] = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, ExternalToolsUIMessages.BuilderPropertyPage_statusMessage, e);
}
Display.getDefault().asyncExec(new Runnable() {
public void run() {
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java
index d07e86abc..e51a01194 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This
+ * 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
@@ -55,8 +55,6 @@ public class ExternalToolsUIMessages extends NLS {
public static String ExternalToolsPreferencePage_Prompt_before_migrating_3;
public static String ExternalToolsPreferencePage_1;
- public static String ExternalToolMigration_37;
- public static String ExternalToolMigration_38;
public static String EditCommandDialog_0;
public static String EditCommandDialog_1;
public static String EditCommandDialog_2;
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
index f5f0a1b53..ddb921b88 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
+# 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
@@ -50,8 +50,6 @@ ExternalToolsPreferencePage_External_tool_project_builders_migration_2=External
ExternalToolsPreferencePage_Prompt_before_migrating_3=&Confirm before migrating external tool project builders for edit
ExternalToolsPreferencePage_1=C&onfirm before migrating projects to the new format
-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
EditCommandDialog_0=Configure Builder
EditCommandDialog_1=Run this builder:
EditCommandDialog_2=After a "&Clean"
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
index 0670eda94..88960d6b3 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Matthew Conway and others.
+ * Copyright (c) 2007, 2009 Matthew Conway 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
@@ -13,13 +13,13 @@ package org.eclipse.ui.externaltools.internal.variables;
import java.util.LinkedHashSet;
import java.util.Set;
+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.core.variables.IDynamicVariableResolver;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder;
public class BuildFilesResolver implements IDynamicVariableResolver
{
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java
index 793cc52a3..e44873975 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.externaltools.internal.variables;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -19,8 +21,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.core.variables.IDynamicVariableResolver;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
+import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
public class BuildProjectResolver implements IDynamicVariableResolver {
@@ -48,7 +49,7 @@ public class BuildProjectResolver implements IDynamicVariableResolver {
* @throws CoreException
*/
protected void abort(String message, Throwable exception) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, message, exception));
+ throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, message, exception));
}
/**
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java
index c370724f0..64f8d47a1 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * 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
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.ui.externaltools.internal.variables;
+import org.eclipse.core.externaltools.internal.model.ExternalToolBuilder;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.core.variables.IDynamicVariableResolver;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder;
public class BuildTypeResolver implements IDynamicVariableResolver {
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java
index ddc8903e0..dbcfce370 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -15,13 +15,14 @@ import java.io.File;
import java.util.Map;
import java.util.StringTokenizer;
+import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.core.variables.IDynamicVariableResolver;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
+import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
public class SystemPathResolver implements IDynamicVariableResolver {
@@ -30,7 +31,7 @@ public class SystemPathResolver implements IDynamicVariableResolver {
*/
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
if (argument == null) {
- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null));
+ throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null));
}
Map map= DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment();
String path= (String) map.get("PATH"); //$NON-NLS-1$

Back to the top