Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2008-11-05 12:11:27 -0500
committerDarin Wright2008-11-05 12:11:27 -0500
commit3c51ff888064c1069a57348d548508d1c45c80be (patch)
treed1b255bf033bf5ee0abbf856908a0eb4bb75fea3 /org.eclipse.debug.core
parent9006bce22a5549e203793b58911983f378fb5149 (diff)
downloadeclipse.platform.debug-3c51ff888064c1069a57348d548508d1c45c80be.tar.gz
eclipse.platform.debug-3c51ff888064c1069a57348d548508d1c45c80be.tar.xz
eclipse.platform.debug-3c51ff888064c1069a57348d548508d1c45c80be.zip
Bug 252992 - Move {workspace_loc} to debug.core plug-in
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.java25
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.properties11
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/WorkspaceResolver.java58
-rw-r--r--org.eclipse.debug.core/plugin.properties4
-rw-r--r--org.eclipse.debug.core/plugin.xml5
6 files changed, 105 insertions, 3 deletions
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index fadb3bb0f..072b5d5f0 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
-Bundle-Version: 3.4.0.qualifier
+Bundle-Version: 3.4.1.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
@@ -15,7 +15,8 @@ Export-Package: org.eclipse.debug.core,
org.eclipse.debug.internal.core;x-friends:="org.eclipse.debug.ui",
org.eclipse.debug.internal.core.commands;x-friends:="org.eclipse.debug.ui",
org.eclipse.debug.internal.core.sourcelookup;x-friends:="org.eclipse.debug.ui",
- org.eclipse.debug.internal.core.sourcelookup.containers;x-friends:="org.eclipse.debug.ui"
+ org.eclipse.debug.internal.core.sourcelookup.containers;x-friends:="org.eclipse.debug.ui",
+ org.eclipse.debug.internal.core.variables;x-internal:=true
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.3.0,4.0.0)";visibility:=reexport,
org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.java
new file mode 100644
index 000000000..45ac19264
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.debug.internal.core.variables;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.debug.internal.core.variables.Messages"; //$NON-NLS-1$
+ public static String WorkspaceResolver_0;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.properties
new file mode 100644
index 000000000..7d94b7d73
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/Messages.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2008 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
+###############################################################################
+WorkspaceResolver_0=Variable references non-existent resource : {0}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/WorkspaceResolver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/WorkspaceResolver.java
new file mode 100644
index 000000000..86abb50f1
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/WorkspaceResolver.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.debug.internal.core.variables;
+
+import java.io.File;
+import java.net.URI;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.variables.*;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Resolves the <code>${workspace_loc}</code> variable. The variable resolves to the
+ * location of the workspace. If an argument is provided, it is interpreted as a
+ * workspace relative path to a specific resource.
+ */
+public final class WorkspaceResolver 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 {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource;
+
+ if (argument == null) {
+ resource = root;
+ } else {
+ resource = root.findMember(new Path(argument));
+ }
+
+ if (resource != null && resource.exists()) {
+ URI uri = resource.getLocationURI();
+
+ if (uri != null) {
+ File file = EFS.getStore(uri).toLocalFile(EFS.NONE, null);
+
+ if (file != null) {
+ return file.getAbsolutePath();
+ }
+ }
+ }
+
+ String expression = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression(variable.getName(), argument);
+ String message = NLS.bind(Messages.WorkspaceResolver_0, expression);
+
+ throw new CoreException(new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IResourceStatus.RESOURCE_NOT_FOUND, message, null));
+ }
+}
diff --git a/org.eclipse.debug.core/plugin.properties b/org.eclipse.debug.core/plugin.properties
index 732d0f776..f3a194c97 100644
--- a/org.eclipse.debug.core/plugin.properties
+++ b/org.eclipse.debug.core/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
+# Copyright (c) 2000, 2008 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
@@ -51,3 +51,5 @@ containerName.workspace = Workspace
containerDescription.workspace = All projects in the workspace
containerName.default = Default
containerDescription.default = Default source lookup path
+
+workspace_loc.description=Returns the absolute file system path of the workspace root. When an argument is specified, the absolute file system path of the resource identified by a workspace relative path is returned.
diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml
index e9ded979a..1affad73a 100644
--- a/org.eclipse.debug.core/plugin.xml
+++ b/org.eclipse.debug.core/plugin.xml
@@ -97,6 +97,11 @@
name="system_property"
resolver="org.eclipse.debug.internal.core.SystemPropertyResolver"
description="%system_property.description">
+ </variable>
+ <variable
+ description="%workspace_loc.description"
+ name="workspace_loc"
+ resolver="org.eclipse.debug.internal.core.variables.WorkspaceResolver">
</variable>
</extension>

Back to the top