1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

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
This commit is contained in:
Alain Magloire 2005-03-18 20:25:58 +00:00
parent 1abc733bc1
commit f328f854fc
6 changed files with 68 additions and 4 deletions

View file

@ -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 2005-03-14 Alain Magloire
Fix NPEs: PathEntryManager should be created first, since it will Fix NPEs: PathEntryManager should be created first, since it will
be use by other components. be use by other components.

View file

@ -67,3 +67,5 @@ cHeaderName=C Header File
cxxSourceName=C++ Source File cxxSourceName=C++ Source File
cxxHeaderName=C++ Header File cxxHeaderName=C++ Header File
asmSourceName=Assembly Source File asmSourceName=Assembly Source File
cdt_pathentry_var.description=CDT PathEntry Variable

View file

@ -20,6 +20,7 @@
<import plugin="org.eclipse.team.core"/> <import plugin="org.eclipse.team.core"/>
<import plugin="org.eclipse.core.runtime"/> <import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.text"/> <import plugin="org.eclipse.text"/>
<import plugin="org.eclipse.core.variables"/>
</requires> </requires>
<!-- =================================================================================== --> <!-- =================================================================================== -->
@ -536,4 +537,16 @@
</indexer> </indexer>
</extension> </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> </plugin>

View file

@ -63,3 +63,4 @@ Util.error.cannotRun=Cannot run
Util.unknownName=unknown C++ encoded name Util.unknownName=unknown C++ encoded name
Util.unknownFormat=Unknown debug format Util.unknownFormat=Unknown debug format
PathEntryVariableResolver.0=CDT PathEntry variable not specified

View file

@ -238,9 +238,12 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
if (inMacro) { if (inMacro) {
inMacro = false; inMacro = false;
String p = param.toString(); String p = param.toString();
String v = getValue(p).toPortableString(); IPath path = getValue(p);
if (v != null) { if (path != null) {
sb.append(v); String v = path.toPortableString();
if (v != null) {
sb.append(v);
}
} }
param.setLength(0); param.setLength(0);
/* Skip the trailing } */ /* Skip the trailing } */

View file

@ -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();
}
}