Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2010-08-26 15:13:25 +0000
committerMarkus Schorn2010-08-26 15:13:25 +0000
commitc718906f1f1b50a265f54fcfef1bd26297567613 (patch)
treeb12e7c176627caf6ed119301b04bbff9160552c7
parentc5d41b0e4560892328b8efe060eed010a9e8727b (diff)
downloadorg.eclipse.cdt-c718906f1f1b50a265f54fcfef1bd26297567613.tar.gz
org.eclipse.cdt-c718906f1f1b50a265f54fcfef1bd26297567613.tar.xz
org.eclipse.cdt-c718906f1f1b50a265f54fcfef1bd26297567613.zip
Bug 323659: Resource lookup with overlapping content types.
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/resources/ResourceLookupTree.java44
1 files changed, 23 insertions, 21 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/resources/ResourceLookupTree.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/resources/ResourceLookupTree.java
index ed0f6f58b93..1bc29c1256a 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/resources/ResourceLookupTree.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/resources/ResourceLookupTree.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2008, 2010 Wind River Systems, Inc. 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
@@ -355,31 +355,35 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
final IContentTypeManager ctm= Platform.getContentTypeManager();
final IContentType[] ctts= ctm.getAllContentTypes();
- Set<String> result= new HashSet<String>();
- outer: for (IContentType ctt : ctts) {
+
+ Set<String> cdtExtensions= new HashSet<String>();
+ for (IContentType ctt : ctts) {
IContentType basedOn= ctt;
while (basedOn != null) {
- if (cdtContentTypes.contains(basedOn.getId()))
- continue outer;
+ if (cdtContentTypes.contains(basedOn.getId())) {
+ addFileSpecs(ctt, cdtExtensions);
+ break;
+ }
basedOn= basedOn.getBaseType();
}
- // this is a non-cdt content type
- addFileSpecs(ctt, result);
}
- fCDTProjectExtensions= new Extensions(result, true);
+ fDefaultExtensions= new Extensions(cdtExtensions, false);
- result= new HashSet<String>();
- for (IContentType ctt : ctts) {
+ Set<String> nonCDTExtensions= new HashSet<String>();
+ outer: for (IContentType ctt : ctts) {
IContentType basedOn= ctt;
while (basedOn != null) {
- if (cdtContentTypes.contains(basedOn.getId())) {
- addFileSpecs(ctt, result);
- break;
- }
+ if (cdtContentTypes.contains(basedOn.getId()))
+ continue outer;
basedOn= basedOn.getBaseType();
}
+ // this is a non-cdt content type
+ addFileSpecs(ctt, nonCDTExtensions);
}
- fDefaultExtensions= new Extensions(result, false);
+ // Bug 323659: In case there is another content type for a cdt file-extension we need
+ // to remove it.
+ nonCDTExtensions.removeAll(cdtExtensions);
+ fCDTProjectExtensions= new Extensions(nonCDTExtensions, true);
}
}
@@ -831,10 +835,9 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
public void dump() {
List<String> lines= new ArrayList<String>();
synchronized (fLock) {
- for (Iterator<Object> iterator = fNodeMap.values().iterator(); iterator.hasNext();) {
- Node[] nodes= convert(iterator.next());
- for (int i = 0; i < nodes.length; i++) {
- final Node node = nodes[i];
+ for (Object object : fNodeMap.values()) {
+ Node[] nodes= convert(object);
+ for (final Node node : nodes) {
if (node == null) {
break;
}
@@ -844,8 +847,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
}
Collections.sort(lines);
System.out.println("Dumping files:");
- for (Iterator<String> iterator = lines.iterator(); iterator.hasNext();) {
- String line = iterator.next();
+ for (String line : lines) {
System.out.println(line);
}
System.out.flush();

Back to the top