1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-03-18 07:34:11 -04:00
commit eeee4f767a
15 changed files with 197 additions and 198 deletions

View file

@ -248,7 +248,7 @@
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage" category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
class="org.eclipse.cdt.internal.autotools.ui.preferences.AutotoolsPreferencePage" class="org.eclipse.cdt.internal.autotools.ui.preferences.AutotoolsPreferencePage"
id="org.eclipse.cdt.autotools.ui.preferences1" id="org.eclipse.cdt.autotools.ui.preferences1"
name="%PreferencAutotools.name"> name="%PreferenceAutotools.name">
</page> </page>
<page <page
category="org.eclipse.cdt.autotools.ui.preferences1" category="org.eclipse.cdt.autotools.ui.preferences1"

View file

@ -33,7 +33,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
* See bugzilla * See bugzilla
*/ */
public class FilesOnReindexTests extends PDOMTestBase { public class FilesOnReindexTests extends PDOMTestBase {
protected ICProject project; protected ICProject project;
protected IIndex pdom; protected IIndex pdom;
@ -72,7 +71,7 @@ public class FilesOnReindexTests extends PDOMTestBase {
void performAssertions(IFile file) throws CoreException { void performAssertions(IFile file) throws CoreException {
IIndex index = CCorePlugin.getIndexManager().getIndex(project); IIndex index = CCorePlugin.getIndexManager().getIndex(project);
assertNotNull(index.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file))); assertTrue(index.getFiles(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file)).length != 0);
IBinding[] bs = index.findBindings(Pattern.compile("C"), true, IndexFilter.ALL, new NullProgressMonitor()); IBinding[] bs = index.findBindings(Pattern.compile("C"), true, IndexFilter.ALL, new NullProgressMonitor());
assertEquals(1, bs.length); assertEquals(1, bs.length);

View file

@ -108,14 +108,14 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.utils.spawner, org.eclipse.cdt.utils.spawner,
org.eclipse.cdt.utils.xcoff, org.eclipse.cdt.utils.xcoff,
org.eclipse.cdt.utils.xcoff.parser org.eclipse.cdt.utils.xcoff.parser
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", Require-Bundle: org.eclipse.core.contenttype;bundle-version="[3.3.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.contenttype;bundle-version="[3.3.0,4.0.0)",
org.eclipse.text;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.core.filebuffers;bundle-version="[3.2.0,4.0.0)", org.eclipse.core.filebuffers;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)", org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0" org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
org.eclipse.text;bundle-version="[3.2.0,4.0.0)",
com.ibm.icu;bundle-version="4.4.2"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.ibm.icu.text

View file

@ -447,14 +447,14 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException { Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException {
TranslationUnitInfo unitInfo = (TranslationUnitInfo) info; TranslationUnitInfo unitInfo = (TranslationUnitInfo) info;
// generate structure // Generate structure
this.parse(newElements, pm); this.parse(newElements, pm);
// ///////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////
if (isWorkingCopy()) { if (isWorkingCopy()) {
ITranslationUnit original = ((IWorkingCopy)this).getOriginalElement(); ITranslationUnit original = ((IWorkingCopy)this).getOriginalElement();
// might be IResource.NULL_STAMP if original does not exist // Might be IResource.NULL_STAMP if original does not exist
IResource r = original.getResource(); IResource r = original.getResource();
if (r != null && r instanceof IFile) { if (r != null && r instanceof IFile) {
unitInfo.fTimestamp = ((IFile) r).getModificationStamp(); unitInfo.fTimestamp = ((IFile) r).getModificationStamp();
@ -499,7 +499,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} else { } else {
workingCopy= new WorkingCopy(getParent(), getLocationURI(), getContentTypeId(), factory); workingCopy= new WorkingCopy(getParent(), getLocationURI(), getContentTypeId(), factory);
} }
// open the working copy now to ensure contents are that of the current state of this element // Open the working copy now to ensure contents are that of the current state of this element
workingCopy.open(monitor); workingCopy.open(monitor);
return workingCopy; return workingCopy;
} }
@ -541,7 +541,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return null; return null;
} }
// create a new info and make it the current info // Create a new info and make it the current info
// (this will remove the info and its children just before storing the new infos) // (this will remove the info and its children just before storing the new infos)
CModelManager manager = CModelManager.getDefault(); CModelManager manager = CModelManager.getDefault();
boolean hadTemporaryCache = manager.hasTemporaryCache(); boolean hadTemporaryCache = manager.hasTemporaryCache();
@ -555,7 +555,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements = manager.getTemporaryCache(); Map<ICElement, CElementInfo> newElements = manager.getTemporaryCache();
openWhenClosed(info, monitor); openWhenClosed(info, monitor);
if (newElements.get(this) == null) { if (newElements.get(this) == null) {
// close any buffer that was opened for the new elements // Close any buffer that was opened for the new elements
Iterator<ICElement> iterator = newElements.keySet().iterator(); Iterator<ICElement> iterator = newElements.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ICElement element = iterator.next(); ICElement element = iterator.next();
@ -593,13 +593,13 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
@Override @Override
protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException { protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException {
// create buffer - translation units only use default buffer factory // Create buffer - translation units only use default buffer factory
BufferManager bufManager = getBufferManager(); BufferManager bufManager = getBufferManager();
IBuffer buffer = getBufferFactory().createBuffer(this); IBuffer buffer = getBufferFactory().createBuffer(this);
if (buffer == null) if (buffer == null)
return null; return null;
// set the buffer source // Set the buffer source
if (buffer.getCharacters() == null) { if (buffer.getCharacters() == null) {
IResource resource = this.getResource(); IResource resource = this.getResource();
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
@ -620,10 +620,10 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
} }
// add buffer to buffer cache // Add buffer to buffer cache
bufManager.addBuffer(buffer); bufManager.addBuffer(buffer);
// listen to buffer changes // Listen to buffer changes
buffer.addBufferChangedListener(this); buffer.addBufferChangedListener(this);
return buffer; return buffer;
@ -889,6 +889,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
private static final int[] CTX_LINKAGES= { ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID }; private static final int[] CTX_LINKAGES= { ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID };
public IIndexFile[] getContextToHeader(IIndex index, int style) { public IIndexFile[] getContextToHeader(IIndex index, int style) {
if (index != null && (style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) { if (index != null && (style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) {
try { try {

View file

@ -1671,9 +1671,8 @@ public class CPPSemantics {
dtor.accept(visitor); dtor.accept(visitor);
} }
break; break;
case eEnumeration:
case eClassType: default:
case eTemplateDeclaration:
break; break;
} }
} }
@ -1696,7 +1695,7 @@ public class CPPSemantics {
IASTFunctionDeclarator declarator = functionDef.getDeclarator(); IASTFunctionDeclarator declarator = functionDef.getDeclarator();
if (!((ICPPASTDeclSpecifier) declSpec).isFriend()) { if (!((ICPPASTDeclSpecifier) declSpec).isFriend()) {
// check the function itself // Check the function itself
IASTName declName = ASTQueries.findInnermostDeclarator(declarator).getName(); IASTName declName = ASTQueries.findInnermostDeclarator(declarator).getName();
ASTInternal.addName(scope, declName); ASTInternal.addName(scope, declName);
} }
@ -1710,21 +1709,22 @@ public class CPPSemantics {
declSpec.accept(visitor); declSpec.accept(visitor);
declarator.accept(visitor); declarator.accept(visitor);
break; break;
case eClassType:
case eTemplateDeclaration: default:
case eEnumeration:
break; break;
} }
} }
} }
/** /**
* Perform lookup in nominated namespaces that appear in the given scope. For unqualified lookups the method assumes * Perform lookup in nominated namespaces that appear in the given scope. For unqualified
* that transitive directives have been stored in the lookup-data. For qualified lookups the transitive directives * lookups the method assumes that transitive directives have been stored in the lookup-data.
* are considered if the lookup of the original directive returns empty. * For qualified lookups the transitive directives are considered if the lookup of the original
* directive returns empty.
* @param fileSet * @param fileSet
*/ */
private static void lookupInNominated(LookupData data, IIndexFileSet fileSet, ICPPNamespaceScope scope) throws DOMException { private static void lookupInNominated(LookupData data, IIndexFileSet fileSet,
ICPPNamespaceScope scope) throws DOMException {
List<ICPPNamespaceScope> allNominated= data.usingDirectives.remove(scope); List<ICPPNamespaceScope> allNominated= data.usingDirectives.remove(scope);
while (allNominated != null) { while (allNominated != null) {
for (ICPPNamespaceScope nominated : allNominated) { for (ICPPNamespaceScope nominated : allNominated) {
@ -1740,9 +1740,9 @@ public class CPPSemantics {
found = true; found = true;
} }
// in the qualified lookup we have to nominate the transitive directives only when // In the qualified lookup we have to nominate the transitive directives only when
// the lookup did not succeed. In the qualified case this is done earlier, when the directive // the lookup did not succeed. In the qualified case this is done earlier, when
// is encountered. // the directive is encountered.
if (!found && data.qualified() && !data.contentAssist) { if (!found && data.qualified() && !data.contentAssist) {
if (data.tu != null) { if (data.tu != null) {
data.tu.handleAdditionalDirectives(nominated); data.tu.handleAdditionalDirectives(nominated);
@ -1753,7 +1753,7 @@ public class CPPSemantics {
} }
} }
} }
// retry with transitive directives that may have been nominated in a qualified lookup // Retry with transitive directives that may have been nominated in a qualified lookup
allNominated= data.usingDirectives.remove(scope); allNominated= data.usingDirectives.remove(scope);
} }
} }
@ -1778,11 +1778,11 @@ public class CPPSemantics {
return null; return null;
} }
// bug 238180 // Bug 238180
if (candidate instanceof ICPPClassTemplatePartialSpecialization) if (candidate instanceof ICPPClassTemplatePartialSpecialization)
return null; return null;
// specialization is selected during instantiation // Specialization is selected during instantiation
if (candidate instanceof ICPPTemplateInstance) if (candidate instanceof ICPPTemplateInstance)
candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding(); candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding();
@ -1829,7 +1829,7 @@ public class CPPSemantics {
int pointOfDecl= -1; int pointOfDecl= -1;
if (obj instanceof ICPPInternalBinding) { if (obj instanceof ICPPInternalBinding) {
ICPPInternalBinding cpp = (ICPPInternalBinding) obj; ICPPInternalBinding cpp = (ICPPInternalBinding) obj;
// for bindings in global or namespace scope we don't know whether there is a // For bindings in global or namespace scope we don't know whether there is a
// previous declaration in one of the skipped header files. For bindings that // previous declaration in one of the skipped header files. For bindings that
// are likely to be redeclared we need to assume that there is a declaration // are likely to be redeclared we need to assume that there is a declaration
// in one of the headers. // in one of the headers.
@ -1865,7 +1865,8 @@ public class CPPSemantics {
if (pointOfDecl < 0 && nd != null) { if (pointOfDecl < 0 && nd != null) {
ASTNodeProperty prop = nd.getPropertyInParent(); ASTNodeProperty prop = nd.getPropertyInParent();
if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) { if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) {
// point of declaration for a name is immediately after its complete declarator and before its initializer // Point of declaration for a name is immediately after its complete declarator
// and before its initializer.
IASTDeclarator dtor = (IASTDeclarator)((nd instanceof IASTDeclarator) ? nd : nd.getParent()); IASTDeclarator dtor = (IASTDeclarator)((nd instanceof IASTDeclarator) ? nd : nd.getParent());
while (dtor.getParent() instanceof IASTDeclarator) while (dtor.getParent() instanceof IASTDeclarator)
dtor = (IASTDeclarator) dtor.getParent(); dtor = (IASTDeclarator) dtor.getParent();
@ -1875,7 +1876,8 @@ public class CPPSemantics {
else else
pointOfDecl = ((ASTNode) dtor).getOffset() + ((ASTNode) dtor).getLength(); pointOfDecl = ((ASTNode) dtor).getOffset() + ((ASTNode) dtor).getLength();
} else if (prop == IASTEnumerator.ENUMERATOR_NAME) { } else if (prop == IASTEnumerator.ENUMERATOR_NAME) {
// point of declaration for an enumerator is immediately after it enumerator-definition // Point of declaration for an enumerator is immediately after it
// enumerator-definition
IASTEnumerator enumtor = (IASTEnumerator) nd.getParent(); IASTEnumerator enumtor = (IASTEnumerator) nd.getParent();
if (enumtor.getValue() != null) { if (enumtor.getValue() != null) {
ASTNode exp = (ASTNode) enumtor.getValue(); ASTNode exp = (ASTNode) enumtor.getValue();
@ -1906,7 +1908,7 @@ public class CPPSemantics {
} else if (cpp instanceof ICompositeType || cpp instanceof IEnumeration) { } else if (cpp instanceof ICompositeType || cpp instanceof IEnumeration) {
IScope scope= cpp.getScope(); IScope scope= cpp.getScope();
if (!(scope instanceof ICPPBlockScope) && scope instanceof ICPPNamespaceScope) { if (!(scope instanceof ICPPBlockScope) && scope instanceof ICPPNamespaceScope) {
// if this is not the definition, it may be found in a header. (bug 229571) // If this is not the definition, it may be found in a header. (bug 229571)
if (cpp.getDefinition() == null) { if (cpp.getDefinition() == null) {
return true; return true;
} }
@ -1956,7 +1958,7 @@ public class CPPSemantics {
continue; continue;
} }
// select among those bindings that have been created without problems. // Select among those bindings that have been created without problems.
if (temp instanceof IProblemBinding) if (temp instanceof IProblemBinding)
continue; continue;
@ -1984,7 +1986,7 @@ public class CPPSemantics {
fns = new ObjectSet<ICPPFunction>(2); fns = new ObjectSet<ICPPFunction>(2);
fns.put((ICPPFunction) temp); fns.put((ICPPFunction) temp);
} else if (temp instanceof IType) { } else if (temp instanceof IType) {
// specializations are selected during instantiation // Specializations are selected during instantiation
if (temp instanceof ICPPClassTemplatePartialSpecialization) if (temp instanceof ICPPClassTemplatePartialSpecialization)
continue; continue;
if (temp instanceof ICPPTemplateInstance) { if (temp instanceof ICPPTemplateInstance) {
@ -2213,7 +2215,7 @@ public class CPPSemantics {
return -1; // function from ast return -1; // function from ast
} }
} }
// everything is from the index // Everything is from the index
if (!isReachableFromAst(data.tu, obj)) { if (!isReachableFromAst(data.tu, obj)) {
return -1; // obj not reachable return -1; // obj not reachable
} }

View file

@ -2125,7 +2125,7 @@ public class CPPVisitor extends ASTQueries {
} }
IType type = expr.getExpressionType(); IType type = expr.getExpressionType();
if (spec.getType() == IASTSimpleDeclSpecifier.t_decltype) { if (spec.getType() == IASTSimpleDeclSpecifier.t_decltype) {
switch((expr).getValueCategory()) { switch (expr.getValueCategory()) {
case XVALUE: case XVALUE:
type= new CPPReferenceType(type, true); type= new CPPReferenceType(type, true);
break; break;

View file

@ -208,7 +208,7 @@ public class PDOM extends PlatformObject implements IPDOM {
* #114.0# - Partial specializations for class template specializations, bug 332884. * #114.0# - Partial specializations for class template specializations, bug 332884.
* - Corrected signatures for function templates, bug 335062. <<CDT 8.0>> * - Corrected signatures for function templates, bug 335062. <<CDT 8.0>>
* *
* CDT 8.1 development (versions not supported on teh 8.0.x branch) * CDT 8.1 development (versions not supported on the 8.0.x branch)
* 120.0 - Enumerators in global index, bug 356235 * 120.0 - Enumerators in global index, bug 356235
* 120.1 - Specializations of using declarations, bug 357293. * 120.1 - Specializations of using declarations, bug 357293.
* 121.0 - Multiple variants of included header file, bug 197989. * 121.0 - Multiple variants of included header file, bug 197989.
@ -469,6 +469,7 @@ public class PDOM extends PlatformObject implements IPDOM {
public int compare(long record) throws CoreException { public int compare(long record) throws CoreException {
return 0; return 0;
} }
@Override @Override
public boolean visit(long record) throws CoreException { public boolean visit(long record) throws CoreException {
PDOMFile file = PDOMFile.recreateFile(PDOM.this, record); PDOMFile file = PDOMFile.recreateFile(PDOM.this, record);

View file

@ -10,19 +10,17 @@
* Andrew Ferguson (Symbian) - Provide B-tree deletion routine * Andrew Ferguson (Symbian) - Provide B-tree deletion routine
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.db; package org.eclipse.cdt.internal.core.pdom.db;
import com.ibm.icu.text.MessageFormat;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import com.ibm.icu.text.MessageFormat;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
*
*/ */
public class BTree { public class BTree {
// Constants for internal deletion routine (see deleteImp doc) // Constants for internal deletion routine (see deleteImp doc)
@ -113,10 +111,10 @@ public class BTree {
// if this node is full (last record isn't null), split it // if this node is full (last record isn't null), split it
if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) { if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) {
long median = getRecord(chunk, node, MEDIAN_RECORD); long median = getRecord(chunk, node, MEDIAN_RECORD);
if (median == record) if (median == record) {
// found it, never mind // found it, never mind
return median; return median;
else { } else {
// split it // split it
// create the new node and move the larger records over // create the new node and move the larger records over
long newnode = allocateNode(); long newnode = allocateNode();
@ -171,16 +169,13 @@ public class BTree {
long checkRec= getRecord(chunk, node, middle); long checkRec= getRecord(chunk, node, middle);
if (checkRec == 0) { if (checkRec == 0) {
upper= middle; upper= middle;
} } else {
else {
int compare= cmp.compare(checkRec, record); int compare= cmp.compare(checkRec, record);
if (compare > 0) { if (compare > 0) {
upper= middle; upper= middle;
} } else if (compare < 0) {
else if (compare < 0) {
lower= middle + 1; lower= middle + 1;
} } else {
else {
// found it, no insert, just return the record // found it, no insert, just return the record
return record; return record;
} }
@ -561,13 +556,11 @@ public class BTree {
long checkRec = getRecord(chunk, node, middle); long checkRec = getRecord(chunk, node, middle);
if (checkRec == 0) { if (checkRec == 0) {
upper= middle; upper= middle;
} } else {
else {
int compare= visitor.compare(checkRec); int compare= visitor.compare(checkRec);
if (compare >= 0) { if (compare >= 0) {
upper= middle; upper= middle;
} } else {
else {
lower= middle + 1; lower= middle + 1;
} }
} }
@ -584,8 +577,7 @@ public class BTree {
if (compare > 0) { if (compare > 0) {
// start point is to the left // start point is to the left
return accept(getChild(chunk, node, i), visitor); return accept(getChild(chunk, node, i), visitor);
} } else if (compare == 0) {
else if (compare == 0) {
if (!accept(getChild(chunk, node, i), visitor)) if (!accept(getChild(chunk, node, i), visitor))
return false; return false;
if (!visitor.visit(record)) if (!visitor.visit(record))

View file

@ -16,6 +16,7 @@ import java.io.OutputStream;
import java.util.Properties; import java.util.Properties;
import org.eclipse.cdt.internal.core.Cygwin; import org.eclipse.cdt.internal.core.Cygwin;
import org.eclipse.cdt.internal.core.Messages;
import org.eclipse.cdt.internal.core.ProcessClosure; import org.eclipse.cdt.internal.core.ProcessClosure;
import org.eclipse.cdt.utils.PathUtil; import org.eclipse.cdt.utils.PathUtil;
import org.eclipse.cdt.utils.spawner.EnvironmentReader; import org.eclipse.cdt.utils.spawner.EnvironmentReader;
@ -25,6 +26,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
@ -125,8 +127,10 @@ public class CommandLauncher implements ICommandLauncher {
/** /**
* Parse array of "ENV=value" pairs to Properties. * Parse array of "ENV=value" pairs to Properties.
*/ */
private Properties parseEnv(String[] env) { private void parseEnvironment(String[] env) {
Properties envProperties = new Properties(); fEnvironment = null;
if (env != null) {
fEnvironment = new Properties();
for (String envStr : env) { for (String envStr : env) {
// Split "ENV=value" and put in Properties // Split "ENV=value" and put in Properties
int pos = envStr.indexOf('='); int pos = envStr.indexOf('=');
@ -134,9 +138,9 @@ public class CommandLauncher implements ICommandLauncher {
pos = envStr.length(); pos = envStr.length();
String key = envStr.substring(0, pos); String key = envStr.substring(0, pos);
String value = envStr.substring(pos + 1); String value = envStr.substring(pos + 1);
envProperties.put(key, value); fEnvironment.put(key, value);
}
} }
return envProperties;
} }
/** /**
@ -160,10 +164,11 @@ public class CommandLauncher implements ICommandLauncher {
*/ */
@Override @Override
public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, IProgressMonitor monitor) throws CoreException { public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, IProgressMonitor monitor) throws CoreException {
parseEnvironment(env);
String envPathValue = (String) getEnvironment().get(PATH_ENV);
Boolean isFound = null; Boolean isFound = null;
String command = commandPath.toOSString(); String command = commandPath.toOSString();
String envPathValue = (String) getEnvironment().get(PATH_ENV);
try {
fCommandArgs = constructCommandArray(command, args); fCommandArgs = constructCommandArray(command, args);
if (Platform.getOS().equals(Platform.OS_WIN32)) { if (Platform.getOS().equals(Platform.OS_WIN32)) {
// Handle cygwin link // Handle cygwin link
@ -178,9 +183,9 @@ public class CommandLauncher implements ICommandLauncher {
} }
} }
fEnvironment = parseEnv(env);
File dir = workingDirectory != null ? workingDirectory.toFile() : null; File dir = workingDirectory != null ? workingDirectory.toFile() : null;
try {
fProcess = ProcessFactory.getFactory().exec(fCommandArgs, env, dir); fProcess = ProcessFactory.getFactory().exec(fCommandArgs, env, dir);
fCommandArgs[0] = command; // to print original command on the console fCommandArgs[0] = command; // to print original command on the console
fErrorMessage = ""; //$NON-NLS-1$ fErrorMessage = ""; //$NON-NLS-1$
@ -201,8 +206,8 @@ public class CommandLauncher implements ICommandLauncher {
envPathValue = System.getenv(PATH_ENV); envPathValue = System.getenv(PATH_ENV);
} }
errorMessage = errorMessage + NEWLINE errorMessage = errorMessage + NEWLINE
+ "Error: Program \"" + command + "\" not found in PATH" + NEWLINE + NLS.bind(Messages.CommandLauncher_ProgramNotFoundInPath, command) + NEWLINE
+ "PATH=[" + envPathValue + "]" + NEWLINE; + "PATH=[" + envPathValue + "]" + NEWLINE; //$NON-NLS-1$ //$NON-NLS-2$
} }
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
fProcess = null; fProcess = null;
@ -258,7 +263,7 @@ public class CommandLauncher implements ICommandLauncher {
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
closure.terminate(); closure.terminate();
state = COMMAND_CANCELED; state = COMMAND_CANCELED;
setErrorMessage(CCorePlugin.getResourceString("CommandLauncher.error.commandCanceled")); //$NON-NLS-1$ setErrorMessage(Messages.CommandLauncher_CommandCancelled);
} }
try { try {

View file

@ -26,8 +26,6 @@ CoreModel.PathEntry.DuplicateEntry= Duplicate path entries found ({0}), path: [{
CoreModel.PathEntry.NestedEntry= Nested path entries CoreModel.PathEntry.NestedEntry= Nested path entries
CoreModel.PathEntry.InvalidPathEntry= Invalid path CoreModel.PathEntry.InvalidPathEntry= Invalid path
CommandLauncher.error.commandCanceled=Command canceled
CCProjectNature.exception.noNature=Project must have a cnature CCProjectNature.exception.noNature=Project must have a cnature
CCorePlugin.exception.noBinaryFormat=No Binary Format CCorePlugin.exception.noBinaryFormat=No Binary Format

View file

@ -16,6 +16,8 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.messages"; //$NON-NLS-1$ private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.messages"; //$NON-NLS-1$
public static String Util_unexpectedError; public static String Util_unexpectedError;
public static String Addr_valueOutOfRange; public static String Addr_valueOutOfRange;
public static String CommandLauncher_CommandCancelled;
public static String CommandLauncher_ProgramNotFoundInPath;
public static String convention_illegalIdentifier; public static String convention_illegalIdentifier;
public static String convention_invalid; public static String convention_invalid;
public static String convention_reservedKeyword; public static String convention_reservedKeyword;

View file

@ -47,6 +47,8 @@ convention_enum_invalidName= Enum name is invalid
Util_unexpectedError=Unexpected error Util_unexpectedError=Unexpected error
Addr_valueOutOfRange=Address is outside valid range. Addr_valueOutOfRange=Address is outside valid range.
CommandLauncher_CommandCancelled=Command canceled
CommandLauncher_ProgramNotFoundInPath=Error: Program "{0}" not found in PATH
XmlUtil_InternalErrorLoading=Internal error while trying to load XML document XmlUtil_InternalErrorLoading=Internal error while trying to load XML document
XmlUtil_InternalErrorSerializing=Internal error while trying to serialize XML Document. XmlUtil_InternalErrorSerializing=Internal error while trying to serialize XML Document.

View file

@ -43,7 +43,6 @@ import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexFile;
@ -133,13 +132,11 @@ public class BaseUITestCase extends BaseTestCase {
continue; continue;
index.acquireReadLock(); index.acquireReadLock();
try { try {
IIndexFile pfile= index.getFile(ILinkage.CPP_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file)); IIndexFile[] indexFiles= index.getFiles(IndexLocationFactory.getWorkspaceIFL(file));
if (pfile != null && pfile.getTimestamp() >= file.getLocalTimeStamp()) { for (IIndexFile indexFile : indexFiles) {
if (indexFile != null && indexFile.getTimestamp() >= file.getLocalTimeStamp()) {
return; return;
} }
pfile= index.getFile(ILinkage.C_LINKAGE_ID, IndexLocationFactory.getWorkspaceIFL(file));
if (pfile != null && pfile.getTimestamp() >= file.getLocalTimeStamp()) {
return;
} }
} finally { } finally {
index.releaseReadLock(); index.releaseReadLock();

View file

@ -96,26 +96,26 @@ Export-Package: org.eclipse.cdt.internal.corext;x-internal:=true,
org.eclipse.cdt.ui.wizards, org.eclipse.cdt.ui.wizards,
org.eclipse.cdt.ui.wizards.conversion, org.eclipse.cdt.ui.wizards.conversion,
org.eclipse.cdt.utils.ui.controls org.eclipse.cdt.utils.ui.controls
Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)", Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)", org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)", org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)", org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0", org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0", org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0",
org.eclipse.ui.navigator.resources;bundle-version="3.3.100" org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.navigator.resources;bundle-version="3.3.100",
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
com.ibm.icu;bundle-version="4.4.2"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.ibm.icu.text