Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Swanson2005-03-23 20:01:11 -0500
committerDarin Swanson2005-03-23 20:01:11 -0500
commitf1f465a9dcb7072a9770498fbd7d8b56ec449e64 (patch)
tree64b9988dc21404a0c557f670ae03b6fcaf3a91e9 /org.eclipse.ui.externaltools
parent8e5284e369cda4b756e18ec8261187a62655ddc9 (diff)
downloadeclipse.platform.debug-f1f465a9dcb7072a9770498fbd7d8b56ec449e64.tar.gz
eclipse.platform.debug-f1f465a9dcb7072a9770498fbd7d8b56ec449e64.tar.xz
eclipse.platform.debug-f1f465a9dcb7072a9770498fbd7d8b56ec449e64.zip
Bug 83738 - Allow unqualified tool name in location field for External Tools
Diffstat (limited to 'org.eclipse.ui.externaltools')
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java52
-rw-r--r--org.eclipse.ui.externaltools/plugin.properties1
-rw-r--r--org.eclipse.ui.externaltools/plugin.xml8
3 files changed, 60 insertions, 1 deletions
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
new file mode 100644
index 000000000..8a298e3e2
--- /dev/null
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 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.variables;
+
+import java.io.File;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+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;
+
+public class SystemPathResolver implements IDynamicVariableResolver {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String)
+ */
+ 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, "External tool not specified", null)); //$NON-NLS-1$
+ }
+ Map map= DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved();
+ String path= (String) map.get("Path"); //$NON-NLS-1$
+ if (path == null) {
+ return argument;
+ }
+ StringTokenizer tokenizer= new StringTokenizer(path, File.pathSeparator);
+ while (tokenizer.hasMoreTokens()) {
+ String pathElement= tokenizer.nextToken();
+ File pathElementFile= new File(pathElement);
+ if (pathElementFile.isDirectory()) {
+ File toolFile= new File(pathElementFile, argument);
+ if (toolFile.exists()) {
+ return toolFile.getAbsolutePath();
+ }
+ }
+ }
+ return argument;
+ }
+}
diff --git a/org.eclipse.ui.externaltools/plugin.properties b/org.eclipse.ui.externaltools/plugin.properties
index 2827e2dad..96dbc9f27 100644
--- a/org.eclipse.ui.externaltools/plugin.properties
+++ b/org.eclipse.ui.externaltools/plugin.properties
@@ -14,6 +14,7 @@ Plugin.providerName = Eclipse.org
build_type.description= Returns the type of build being performed - "incremental", "full", "auto", or "none".
build_project.description= Returns the absolute file system path of the project currently being built, or the absolute file system path of the resource identified by an optional argument interpreted as a path relative to the project currently being built.
+system_path.description= Returns the absolute file system path of the external tool. Resolved by finding the first occurrence of the named tool based on the system path specification. The tool name argument must be supplied.
ExtPoint.configurationDuplicationMaps = Launch Configuration Duplication Maps
ExtPoint.toolTypes = External Tool Types
diff --git a/org.eclipse.ui.externaltools/plugin.xml b/org.eclipse.ui.externaltools/plugin.xml
index cb727fd1c..3c53a57c2 100644
--- a/org.eclipse.ui.externaltools/plugin.xml
+++ b/org.eclipse.ui.externaltools/plugin.xml
@@ -206,7 +206,13 @@
name="build_project"
resolver="org.eclipse.ui.externaltools.internal.variables.BuildProjectResolver"
description="%build_project.description">
- </variable>
+ </variable>
+ <variable
+ name="system_path"
+ resolver="org.eclipse.ui.externaltools.internal.variables.SystemPathResolver"
+ description="%system_path.description"
+ supportsArgument="true">
+ </variable>
</extension>
<extension

Back to the top