diff options
author | Alain Magloire | 2005-03-18 20:25:58 +0000 |
---|---|---|
committer | Alain Magloire | 2005-03-18 20:25:58 +0000 |
commit | f328f854fc67d80981b6b5ee605ef52f892774df (patch) | |
tree | c5f1d8b958dddade18692fb2c46cfdb933fc6a55 | |
parent | 1abc733bc14f9e68f39445fa53404597948910e0 (diff) | |
download | org.eclipse.cdt-f328f854fc67d80981b6b5ee605ef52f892774df.tar.gz org.eclipse.cdt-f328f854fc67d80981b6b5ee605ef52f892774df.tar.xz org.eclipse.cdt-f328f854fc67d80981b6b5ee605ef52f892774df.zip |
2005-03-18 Alain Magloire
Export the PathEntry Variable to the outside world.
* src/org/eclipse/cdt/internal/core/CCorePluginResources.properties
* src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java
* src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java
* plugin.properties
* plugin.xml
6 files changed, 68 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index 8556f9641ea..4366792419b 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,11 @@ +2005-03-18 Alain Magloire + Export the PathEntry Variable to the outside world. + * src/org/eclipse/cdt/internal/core/CCorePluginResources.properties + * src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java + * src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java + * plugin.properties + * plugin.xml + 2005-03-14 Alain Magloire Fix NPEs: PathEntryManager should be created first, since it will be use by other components. diff --git a/core/org.eclipse.cdt.core/plugin.properties b/core/org.eclipse.cdt.core/plugin.properties index f8474bb44f6..b9c32f4fbfa 100644 --- a/core/org.eclipse.cdt.core/plugin.properties +++ b/core/org.eclipse.cdt.core/plugin.properties @@ -67,3 +67,5 @@ cHeaderName=C Header File cxxSourceName=C++ Source File cxxHeaderName=C++ Header File asmSourceName=Assembly Source File + +cdt_pathentry_var.description=CDT PathEntry Variable
\ No newline at end of file diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml index 37c883d92b5..25557ba14a8 100644 --- a/core/org.eclipse.cdt.core/plugin.xml +++ b/core/org.eclipse.cdt.core/plugin.xml @@ -20,6 +20,7 @@ <import plugin="org.eclipse.team.core"/> <import plugin="org.eclipse.core.runtime"/> <import plugin="org.eclipse.text"/> + <import plugin="org.eclipse.core.variables"/> </requires> <!-- =================================================================================== --> @@ -535,5 +536,17 @@ id="org.eclipse.cdt.core.originalsourceindexer"> </indexer> </extension> - + +<!-- =================================================================================== --> +<!-- Dynamic Variables --> +<!-- =================================================================================== --> + <extension + point="org.eclipse.core.variables.dynamicVariables"> + <variable + name="cdt_pathentry_var" + resolver="org.eclipse.cdt.internal.core.PathEntryVariableResolver" + description="%cdt_pathentry_var.description"> + </variable> + </extension> + </plugin> diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties index dc2c9271a73..b92ff400549 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties @@ -63,3 +63,4 @@ Util.error.cannotRun=Cannot run Util.unknownName=unknown C++ encoded name Util.unknownFormat=Unknown debug format +PathEntryVariableResolver.0=CDT PathEntry variable not specified diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java index 0b21188a4d9..25b5ec5bad7 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableManager.java @@ -238,9 +238,12 @@ public class PathEntryVariableManager implements IPathEntryVariableManager { if (inMacro) { inMacro = false; String p = param.toString(); - String v = getValue(p).toPortableString(); - if (v != null) { - sb.append(v); + IPath path = getValue(p); + if (path != null) { + String v = path.toPortableString(); + if (v != null) { + sb.append(v); + } } param.setLength(0); /* Skip the trailing } */ diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java new file mode 100644 index 00000000000..9420e8ba553 --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/PathEntryVariableResolver.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.internal.core; + + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.resources.IPathEntryVariableManager; +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; + +public class PathEntryVariableResolver implements IDynamicVariableResolver { + + public PathEntryVariableResolver() { + super(); + } + + public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { + if (argument == null) { + throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR, CCorePlugin.getResourceString("PathEntryVariableResolver.0"), null)); //$NON-NLS-1$ + } + IPathEntryVariableManager manager = CCorePlugin.getDefault().getPathEntryVariableManager(); + return manager.getValue(argument).toString(); + } + +} |