mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 323659: Resource lookup with overlapping content types.
This commit is contained in:
parent
b25a75fc64
commit
97c334a819
1 changed files with 25 additions and 23 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -355,7 +355,21 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
|
|
||||||
final IContentTypeManager ctm= Platform.getContentTypeManager();
|
final IContentTypeManager ctm= Platform.getContentTypeManager();
|
||||||
final IContentType[] ctts= ctm.getAllContentTypes();
|
final IContentType[] ctts= ctm.getAllContentTypes();
|
||||||
Set<String> result= new HashSet<String>();
|
|
||||||
|
Set<String> cdtExtensions= new HashSet<String>();
|
||||||
|
for (IContentType ctt : ctts) {
|
||||||
|
IContentType basedOn= ctt;
|
||||||
|
while (basedOn != null) {
|
||||||
|
if (cdtContentTypes.contains(basedOn.getId())) {
|
||||||
|
addFileSpecs(ctt, cdtExtensions);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
basedOn= basedOn.getBaseType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fDefaultExtensions= new Extensions(cdtExtensions, false);
|
||||||
|
|
||||||
|
Set<String> nonCDTExtensions= new HashSet<String>();
|
||||||
outer: for (IContentType ctt : ctts) {
|
outer: for (IContentType ctt : ctts) {
|
||||||
IContentType basedOn= ctt;
|
IContentType basedOn= ctt;
|
||||||
while (basedOn != null) {
|
while (basedOn != null) {
|
||||||
|
@ -364,22 +378,12 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
basedOn= basedOn.getBaseType();
|
basedOn= basedOn.getBaseType();
|
||||||
}
|
}
|
||||||
// this is a non-cdt content type
|
// this is a non-cdt content type
|
||||||
addFileSpecs(ctt, result);
|
addFileSpecs(ctt, nonCDTExtensions);
|
||||||
}
|
}
|
||||||
fCDTProjectExtensions= new Extensions(result, true);
|
// Bug 323659: In case there is another content type for a cdt file-extension we need
|
||||||
|
// to remove it.
|
||||||
result= new HashSet<String>();
|
nonCDTExtensions.removeAll(cdtExtensions);
|
||||||
for (IContentType ctt : ctts) {
|
fCDTProjectExtensions= new Extensions(nonCDTExtensions, true);
|
||||||
IContentType basedOn= ctt;
|
|
||||||
while (basedOn != null) {
|
|
||||||
if (cdtContentTypes.contains(basedOn.getId())) {
|
|
||||||
addFileSpecs(ctt, result);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
basedOn= basedOn.getBaseType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fDefaultExtensions= new Extensions(result, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,10 +835,9 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
public void dump() {
|
public void dump() {
|
||||||
List<String> lines= new ArrayList<String>();
|
List<String> lines= new ArrayList<String>();
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
for (Iterator<Object> iterator = fNodeMap.values().iterator(); iterator.hasNext();) {
|
for (Object object : fNodeMap.values()) {
|
||||||
Node[] nodes= convert(iterator.next());
|
Node[] nodes= convert(object);
|
||||||
for (int i = 0; i < nodes.length; i++) {
|
for (final Node node : nodes) {
|
||||||
final Node node = nodes[i];
|
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -844,8 +847,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
}
|
}
|
||||||
Collections.sort(lines);
|
Collections.sort(lines);
|
||||||
System.out.println("Dumping files:");
|
System.out.println("Dumping files:");
|
||||||
for (Iterator<String> iterator = lines.iterator(); iterator.hasNext();) {
|
for (String line : lines) {
|
||||||
String line = iterator.next();
|
|
||||||
System.out.println(line);
|
System.out.println(line);
|
||||||
}
|
}
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
|
|
Loading…
Add table
Reference in a new issue