mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fixes problem with binaries showing up multiple time in project view.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=183825
This commit is contained in:
parent
81bcb26800
commit
0a9f69a04c
5 changed files with 153 additions and 170 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2005 QNX Software Systems and others.
|
* Copyright (c) 2000, 2007 QNX Software Systems 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
|
||||||
|
@ -202,28 +202,19 @@ public class CContainer extends Openable implements ICContainer {
|
||||||
try {
|
try {
|
||||||
IResource[] resources = null;
|
IResource[] resources = null;
|
||||||
if (res instanceof IContainer) {
|
if (res instanceof IContainer) {
|
||||||
//System.out.println (" Resource: " +
|
|
||||||
// res.getFullPath().toOSString());
|
|
||||||
IContainer container = (IContainer) res;
|
IContainer container = (IContainer) res;
|
||||||
resources = container.members(false);
|
resources = container.members(false);
|
||||||
}
|
}
|
||||||
if (resources != null) {
|
if (resources != null) {
|
||||||
ICProject cproject = getCProject();
|
ICProject cproject = getCProject();
|
||||||
ISourceRoot sroot = getSourceRoot();
|
|
||||||
for (int i = 0; i < resources.length; i++) {
|
for (int i = 0; i < resources.length; i++) {
|
||||||
if (sroot.isOnSourceEntry(resources[i])) {
|
ICElement celement = computeChild(resources[i], cproject);
|
||||||
// Check for Valid C Element only.
|
if (celement != null) {
|
||||||
ICElement celement = computeChild(resources[i], cproject);
|
vChildren.add(celement);
|
||||||
if (celement != null) {
|
|
||||||
vChildren.add(celement);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
//System.out.println (e);
|
|
||||||
//CPlugin.log (e);
|
|
||||||
//e.printStackTrace();
|
|
||||||
throw new CModelException(e);
|
throw new CModelException(e);
|
||||||
}
|
}
|
||||||
info.setChildren(vChildren);
|
info.setChildren(vChildren);
|
||||||
|
@ -235,23 +226,35 @@ public class CContainer extends Openable implements ICContainer {
|
||||||
|
|
||||||
protected ICElement computeChild(IResource res, ICProject cproject) throws CModelException {
|
protected ICElement computeChild(IResource res, ICProject cproject) throws CModelException {
|
||||||
ICElement celement = null;
|
ICElement celement = null;
|
||||||
|
ISourceRoot sroot = getSourceRoot();
|
||||||
|
if (sroot == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
switch (res.getType()) {
|
switch (res.getType()) {
|
||||||
case IResource.FILE : {
|
case IResource.FILE: {
|
||||||
IFile file = (IFile) res;
|
IFile file = (IFile) res;
|
||||||
String id = CoreModel.getRegistedContentTypeId(file.getProject(), file.getName());
|
boolean checkBinary = true;
|
||||||
if (id != null) {
|
if (sroot.isOnSourceEntry(res)) {
|
||||||
celement = new TranslationUnit(this, file, id);
|
// Check for Valid C Element only.
|
||||||
} else if (cproject.isOnOutputEntry(file)) {
|
String id = CoreModel.getRegistedContentTypeId(file.getProject(), file.getName());
|
||||||
|
if (id != null) {
|
||||||
|
celement = new TranslationUnit(this, file, id);
|
||||||
|
checkBinary = false;
|
||||||
|
} else {
|
||||||
|
checkBinary = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (checkBinary && cproject.isOnOutputEntry(file)) {
|
||||||
IBinaryParser.IBinaryFile bin = factory.createBinaryFile(file);
|
IBinaryParser.IBinaryFile bin = factory.createBinaryFile(file);
|
||||||
if (bin != null) {
|
if (bin != null) {
|
||||||
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
||||||
celement = new Archive(this, file, (IBinaryArchive)bin);
|
celement = new Archive(this, file, (IBinaryArchive) bin);
|
||||||
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
ArchiveContainer vlib = (ArchiveContainer) cproject.getArchiveContainer();
|
||||||
vlib.addChild(celement);
|
vlib.addChild(celement);
|
||||||
} else {
|
} else {
|
||||||
celement = new Binary(this, file, (IBinaryObject)bin);
|
celement = new Binary(this, file, (IBinaryObject) bin);
|
||||||
if (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.SHARED) {
|
if (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.SHARED) {
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
BinaryContainer vbin = (BinaryContainer) cproject.getBinaryContainer();
|
||||||
vbin.addChild(celement);
|
vbin.addChild(celement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,8 +262,10 @@ public class CContainer extends Openable implements ICContainer {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IResource.FOLDER :
|
case IResource.FOLDER:
|
||||||
celement = new CContainer(this, res);
|
if (sroot.isOnSourceEntry(res) || cproject.isOnOutputEntry(res)) {
|
||||||
|
celement = new CContainer(this, res);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return celement;
|
return celement;
|
||||||
|
|
|
@ -68,7 +68,6 @@ public class CContainerInfo extends OpenableInfo {
|
||||||
resources = container.members(false);
|
resources = container.members(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IPathEntry[] entries = cproject.getResolvedPathEntries();
|
|
||||||
ICSourceEntry[] entries = null;
|
ICSourceEntry[] entries = null;
|
||||||
ICProjectDescription des = CProjectDescriptionManager.getInstance().getProjectDescription(cproject.getProject(), false);
|
ICProjectDescription des = CProjectDescriptionManager.getInstance().getProjectDescription(cproject.getProject(), false);
|
||||||
if(des != null){
|
if(des != null){
|
||||||
|
@ -85,21 +84,21 @@ public class CContainerInfo extends OpenableInfo {
|
||||||
case IResource.FOLDER: {
|
case IResource.FOLDER: {
|
||||||
// Check if the folder is not itself a sourceEntry.
|
// Check if the folder is not itself a sourceEntry.
|
||||||
IPath resourcePath = member.getFullPath();
|
IPath resourcePath = member.getFullPath();
|
||||||
if (cproject.isOnSourceRoot(member) || isSourceEntry(resourcePath, entries)) {
|
if (cproject.isOnSourceRoot(member) || isSourceEntry(resourcePath, entries)
|
||||||
|
|| cproject.isOnOutputEntry(member)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IResource.FILE: {
|
case IResource.FILE: {
|
||||||
String filename = member.getName();
|
String filename = member.getName();
|
||||||
if (CoreModel.isValidTranslationUnitName(cproject.getProject(), filename) &&
|
if (CoreModel.isValidTranslationUnitName(cproject.getProject(), filename)
|
||||||
root.isOnSourceEntry(member)) {
|
&& root.isOnSourceEntry(member)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (root.isOnSourceEntry(member)) {
|
if (cproject.isOnOutputEntry(member)
|
||||||
if (cproject.isOnOutputEntry(member) && CModelManager.getDefault().createBinaryFile((IFile)member) != null) {
|
&& CModelManager.getDefault().createBinaryFile((IFile) member) != null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,6 +249,10 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
return cModel.getCProject(project);
|
return cModel.getCProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isInContainerOnOutputPath(ICContainer root, IResource resource) {
|
||||||
|
return (root.getPath().isPrefixOf(resource.getFullPath()));
|
||||||
|
}
|
||||||
|
|
||||||
public ICContainer create(IFolder folder, ICProject cproject) {
|
public ICContainer create(IFolder folder, ICProject cproject) {
|
||||||
if (folder == null) {
|
if (folder == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -259,21 +263,24 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
ICContainer celement = null;
|
ICContainer celement = null;
|
||||||
IPath resourcePath = folder.getFullPath();
|
IPath resourcePath = folder.getFullPath();
|
||||||
try {
|
try {
|
||||||
ISourceRoot[] roots = cproject.getAllSourceRoots();
|
ICElement[] children = cproject.getChildren();
|
||||||
for (int i = 0; i < roots.length; ++i) {
|
for (int i = 0; i < children.length; ++i) {
|
||||||
ISourceRoot root = roots[i];
|
if (children[i] instanceof ICContainer) {
|
||||||
IPath rootPath = root.getPath();
|
ICContainer root = (ICContainer) children[i];
|
||||||
if (rootPath.equals(resourcePath)) {
|
IPath rootPath = root.getPath();
|
||||||
celement = root;
|
if (rootPath.equals(resourcePath)) {
|
||||||
break; // We are done.
|
celement = root;
|
||||||
} else if (root.isOnSourceEntry(folder)) {
|
break; // We are done.
|
||||||
IPath path = resourcePath.removeFirstSegments(rootPath.segmentCount());
|
} else if (root instanceof ISourceRoot && ((ISourceRoot)root).isOnSourceEntry(folder) || isInContainerOnOutputPath(root, folder)) {
|
||||||
String[] segments = path.segments();
|
IPath path = resourcePath.removeFirstSegments(rootPath.segmentCount());
|
||||||
ICContainer cfolder = root;
|
String[] segments = path.segments();
|
||||||
for (int j = 0; j < segments.length; j++) {
|
ICContainer cfolder = root;
|
||||||
cfolder = cfolder.getCContainer(segments[j]);
|
for (int j = 0; j < segments.length; j++) {
|
||||||
|
cfolder = cfolder.getCContainer(segments[j]);
|
||||||
|
}
|
||||||
|
celement = cfolder;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
celement = cfolder;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
|
@ -289,58 +296,40 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
if (cproject == null) {
|
if (cproject == null) {
|
||||||
cproject = create(file.getProject());
|
cproject = create(file.getProject());
|
||||||
}
|
}
|
||||||
boolean checkIfBinary = false;
|
|
||||||
ICElement celement = null;
|
ICElement celement = null;
|
||||||
try {
|
try {
|
||||||
ISourceRoot[] roots = cproject.getAllSourceRoots();
|
ICElement[] children = cproject.getChildren();
|
||||||
for (int i = 0; i < roots.length; ++i) {
|
for (int i = 0; i < children.length; ++i) {
|
||||||
ISourceRoot root = roots[i];
|
if (children[i] instanceof ICContainer) {
|
||||||
if (root.isOnSourceEntry(file)) {
|
ICContainer root = (ICContainer) children[i];
|
||||||
IPath rootPath = root.getPath();
|
if (root instanceof ISourceRoot && ((ISourceRoot)root).isOnSourceEntry(file) || isInContainerOnOutputPath(root, file)) {
|
||||||
IPath resourcePath = file.getFullPath();
|
IPath rootPath = root.getPath();
|
||||||
IPath path = resourcePath.removeFirstSegments(rootPath.segmentCount());
|
IPath resourcePath = file.getFullPath();
|
||||||
String fileName = path.lastSegment();
|
IPath path = resourcePath.removeFirstSegments(rootPath.segmentCount());
|
||||||
path = path.removeLastSegments(1);
|
String fileName = path.lastSegment();
|
||||||
String[] segments = path.segments();
|
path = path.removeLastSegments(1);
|
||||||
ICContainer cfolder = root;
|
String[] segments = path.segments();
|
||||||
for (int j = 0; j < segments.length; j++) {
|
ICContainer cfolder = root;
|
||||||
cfolder = cfolder.getCContainer(segments[j]);
|
for (int j = 0; j < segments.length; j++) {
|
||||||
}
|
cfolder = cfolder.getCContainer(segments[j]);
|
||||||
|
}
|
||||||
if (CoreModel.isValidTranslationUnitName(cproject.getProject(), fileName)) {
|
if (CoreModel.isValidTranslationUnitName(cproject.getProject(), fileName)) {
|
||||||
celement = cfolder.getTranslationUnit(fileName);
|
celement = cfolder.getTranslationUnit(fileName);
|
||||||
} else if (cproject.isOnOutputEntry(file)) {
|
} else if (cproject.isOnOutputEntry(file)) {
|
||||||
IBinaryFile bin = createBinaryFile(file);
|
IBinaryFile bin = createBinaryFile(file);
|
||||||
if (bin != null) {
|
if (bin != null) {
|
||||||
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
||||||
celement = new Archive(cfolder, file, (IBinaryArchive)bin);
|
celement = new Archive(cfolder, file, (IBinaryArchive) bin);
|
||||||
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
ArchiveContainer vlib = (ArchiveContainer) cproject.getArchiveContainer();
|
||||||
vlib.addChild(celement);
|
vlib.addChild(celement);
|
||||||
} else {
|
} else {
|
||||||
celement = new Binary(cfolder, file, (IBinaryObject)bin);
|
celement = new Binary(cfolder, file, (IBinaryObject) bin);
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
BinaryContainer vbin = (BinaryContainer) cproject.getBinaryContainer();
|
||||||
vbin.addChild(celement);
|
vbin.addChild(celement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkIfBinary = true;
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// try in the outputEntry and save in the container
|
|
||||||
// But do not create an ICElement since they are not in the Model per say
|
|
||||||
if (celement == null && !checkIfBinary && cproject.isOnOutputEntry(file)) {
|
|
||||||
IBinaryFile bin = createBinaryFile(file);
|
|
||||||
if (bin != null) {
|
|
||||||
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
|
||||||
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
|
||||||
celement = new Archive(vlib, file, (IBinaryArchive)bin);
|
|
||||||
vlib.addChild(celement);
|
|
||||||
} else {
|
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
|
||||||
celement = new Binary(vbin, file, (IBinaryObject)bin);
|
|
||||||
vbin.addChild(celement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,43 +351,16 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
}
|
}
|
||||||
ICElement celement = null;
|
ICElement celement = null;
|
||||||
try {
|
try {
|
||||||
ISourceRoot[] roots = cproject.getAllSourceRoots();
|
if (cproject.isOnOutputEntry(file)) {
|
||||||
for (int i = 0; i < roots.length; ++i) {
|
IPath resourcePath = file.getParent().getFullPath();
|
||||||
ISourceRoot root = roots[i];
|
ICElement cfolder = cproject.findElement(resourcePath);
|
||||||
if (root.isOnSourceEntry(file)) {
|
|
||||||
IPath rootPath = root.getPath();
|
|
||||||
IPath resourcePath = file.getFullPath();
|
|
||||||
IPath path = resourcePath.removeFirstSegments(rootPath.segmentCount());
|
|
||||||
path = path.removeLastSegments(1);
|
|
||||||
String[] segments = path.segments();
|
|
||||||
ICContainer cfolder = root;
|
|
||||||
for (int j = 0; j < segments.length; j++) {
|
|
||||||
cfolder = cfolder.getCContainer(segments[j]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
|
||||||
celement = new Archive(cfolder, file, (IBinaryArchive)bin);
|
|
||||||
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
|
||||||
vlib.addChild(celement);
|
|
||||||
} else {
|
|
||||||
celement = new Binary(cfolder, file, (IBinaryObject)bin);
|
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
|
||||||
vbin.addChild(celement);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// try in the outputEntry and save in the container
|
|
||||||
// But do not create a ICElement since they are not in the Model per say
|
|
||||||
if (celement == null) {
|
|
||||||
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
||||||
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
||||||
celement = new Archive(vlib, file, (IBinaryArchive)bin);
|
celement = new Archive(cfolder, file, (IBinaryArchive)bin);
|
||||||
vlib.addChild(celement);
|
vlib.addChild(celement);
|
||||||
} else {
|
} else {
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
||||||
celement = new Binary(vbin, file, (IBinaryObject)bin);
|
celement = new Binary(cfolder, file, (IBinaryObject)bin);
|
||||||
vbin.addChild(celement);
|
vbin.addChild(celement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,10 +156,7 @@ public class CProject extends Openable implements ICProject {
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||||
IIncludeEntry entry = (IIncludeEntry) entries[i];
|
IIncludeEntry entry = (IIncludeEntry) entries[i];
|
||||||
IIncludeReference inc = new IncludeReference(this, entry);
|
list.add(new IncludeReference(this, entry));
|
||||||
if (inc != null) {
|
|
||||||
list.add(inc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
incRefs = (IIncludeReference[]) list.toArray(new IIncludeReference[0]);
|
incRefs = (IIncludeReference[]) list.toArray(new IIncludeReference[0]);
|
||||||
|
@ -481,15 +478,14 @@ public class CProject extends Openable implements ICProject {
|
||||||
* @see org.eclipse.cdt.core.model.ICProject#getSourceRoots()
|
* @see org.eclipse.cdt.core.model.ICProject#getSourceRoots()
|
||||||
*/
|
*/
|
||||||
public ISourceRoot[] getSourceRoots() throws CModelException {
|
public ISourceRoot[] getSourceRoots() throws CModelException {
|
||||||
Object[] children;
|
Object[] children = getChildren();
|
||||||
int length;
|
ArrayList result = new ArrayList(children.length);
|
||||||
|
for (int i = 0; i < children.length; i++) {
|
||||||
children = getChildren();
|
if (children[i] instanceof ISourceRoot) {
|
||||||
length = children.length;
|
result.add(children[i]);
|
||||||
ISourceRoot[] roots = new ISourceRoot[length];
|
}
|
||||||
System.arraycopy(children, 0, roots, 0, length);
|
}
|
||||||
|
return (ISourceRoot[]) result.toArray(new ISourceRoot[result.size()]);
|
||||||
return roots;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -588,7 +584,7 @@ public class CProject extends Openable implements ICProject {
|
||||||
try {
|
try {
|
||||||
IResource res = getResource();
|
IResource res = getResource();
|
||||||
if (res != null && res.isAccessible()) {
|
if (res != null && res.isAccessible()) {
|
||||||
validInfo = computeSourceRoots(info, res);
|
validInfo = computeChildren(info, res);
|
||||||
} else {
|
} else {
|
||||||
throw newNotPresentException();
|
throw newNotPresentException();
|
||||||
}
|
}
|
||||||
|
@ -613,29 +609,57 @@ public class CProject extends Openable implements ICProject {
|
||||||
if(entries != null){
|
if(entries != null){
|
||||||
ArrayList list = new ArrayList(entries.length);
|
ArrayList list = new ArrayList(entries.length);
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
// if (entries[i].getEntryKind() == IPathEntry.CDT_SOURCE) {
|
ICSourceEntry sourceEntry = entries[i];
|
||||||
ICSourceEntry sourceEntry = (ICSourceEntry)entries[i];
|
|
||||||
ISourceRoot root = getSourceRoot(sourceEntry);
|
ISourceRoot root = getSourceRoot(sourceEntry);
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
list.add(root);
|
list.add(root);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
return new ArrayList(0);
|
return new ArrayList(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean computeSourceRoots(OpenableInfo info, IResource res) throws CModelException {
|
/**
|
||||||
info.setChildren(computeSourceRoots());
|
* Add any output paths which don't overlay paths already in the list.
|
||||||
|
*/
|
||||||
|
private List addOutputOnlyRoots(List sourceRoots) {
|
||||||
|
IResource[] resources;
|
||||||
|
ArrayList result = new ArrayList(sourceRoots.size());
|
||||||
|
try {
|
||||||
|
resources = getProject().members();
|
||||||
|
for (int i = 0; i < resources.length; i++) {
|
||||||
|
if (resources[i].getType() == IResource.FOLDER) {
|
||||||
|
boolean found = false;
|
||||||
|
for (int j = 0; j < sourceRoots.size(); j++) {
|
||||||
|
if (((ICElement) sourceRoots.get(j)).getResource().getProjectRelativePath().isPrefixOf(resources[i].getProjectRelativePath())) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
result.add(new CContainer(this, resources[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
result.addAll(sourceRoots);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean computeChildren(OpenableInfo info, IResource res) throws CModelException {
|
||||||
|
List list = computeSourceRoots();
|
||||||
|
list = addOutputOnlyRoots(list);
|
||||||
|
info.setChildren(list);
|
||||||
if (info instanceof CProjectInfo) {
|
if (info instanceof CProjectInfo) {
|
||||||
CProjectInfo pinfo = (CProjectInfo)info;
|
CProjectInfo pinfo = (CProjectInfo)info;
|
||||||
pinfo.setNonCResources(null);
|
pinfo.setNonCResources(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see ICProject
|
* @see ICProject
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -85,31 +85,24 @@ class CProjectInfo extends OpenableInfo {
|
||||||
IProject project = cproject.getProject();
|
IProject project = cproject.getProject();
|
||||||
IPath projectPath = project.getFullPath();
|
IPath projectPath = project.getFullPath();
|
||||||
char[][] exclusionPatterns = null;
|
char[][] exclusionPatterns = null;
|
||||||
// try {
|
ICProjectDescription des = CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
|
||||||
// entries = cproject.getResolvedPathEntries();
|
if (des != null) {
|
||||||
ICProjectDescription des = CProjectDescriptionManager.getInstance().getProjectDescription(project, false);
|
ICConfigurationDescription cfg = des.getDefaultSettingConfiguration();
|
||||||
if(des != null){
|
if (cfg != null) {
|
||||||
ICConfigurationDescription cfg = des.getDefaultSettingConfiguration();
|
entries = cfg.getResolvedSourceEntries();
|
||||||
if(cfg != null){
|
}
|
||||||
entries = cfg.getResolvedSourceEntries();
|
}
|
||||||
|
|
||||||
|
if (entries != null) {
|
||||||
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
ICSourceEntry entry = entries[i];
|
||||||
|
if (projectPath.equals(entry.getFullPath())) {
|
||||||
|
srcIsProject = true;
|
||||||
|
exclusionPatterns = entry.fullExclusionPatternChars();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(entries != null){
|
|
||||||
for (int i = 0; i < entries.length; i++) {
|
|
||||||
// if (entries[i].getEntryKind() == IPathEntry.CDT_SOURCE) {
|
|
||||||
ICSourceEntry entry = /*(ISourceEntry)*/entries[i];
|
|
||||||
if (projectPath.equals(entry.getFullPath())) {
|
|
||||||
srcIsProject = true;
|
|
||||||
exclusionPatterns = entry.fullExclusionPatternChars();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// } catch (CModelException e) {
|
|
||||||
// ignore
|
|
||||||
// }
|
|
||||||
|
|
||||||
ArrayList notChildren = new ArrayList();
|
ArrayList notChildren = new ArrayList();
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue