1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-19 14:15:50 +02:00

2004-08-13 Chris Wiebe

Add findSourceRoot() method needed for class wizard
	* model/org/eclipse/cdt/core/model/ICProject.java
	* model/org/eclipse/cdt/internal/core/model/CProject.java
This commit is contained in:
Chris Wiebe 2004-08-13 21:38:35 +00:00
parent 22825b7fac
commit 3cd2cd8098
3 changed files with 48 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2004-08-13 Chris Wiebe
Add findSourceRoot() method needed for class wizard
* model/org/eclipse/cdt/core/model/ICProject.java
* model/org/eclipse/cdt/internal/core/model/CProject.java
2004-08-09 Bogdan Gheorghe
Fix for Bug 71115: Double Indexing
* model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java

View file

@ -82,6 +82,10 @@ public interface ICProject extends IParent, IOpenable, ICElement {
*/
ISourceRoot getSourceRoot(ISourceEntry entry) throws CModelException;
ISourceRoot findSourceRoot(IResource resource);
ISourceRoot findSourceRoot(IPath path);
/**
* Return the output entries.
*
@ -102,6 +106,12 @@ public interface ICProject extends IParent, IOpenable, ICElement {
*/
boolean isOnSourceRoot(IResource resource);
/**
* @param element
* @return
*/
boolean isOnSourceRoot(ICElement element);
/**
* Return the library references for this project.
*

View file

@ -434,6 +434,38 @@ public class CProject extends Openable implements ICProject {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#findSourceRoot()
*/
public ISourceRoot findSourceRoot(IResource res) {
try {
ISourceRoot[] roots = getAllSourceRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].isOnSourceEntry(res)) {
return roots[i];
}
}
} catch (CModelException e) {
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#findSourceRoot()
*/
public ISourceRoot findSourceRoot(IPath path) {
try {
ISourceRoot[] roots = getAllSourceRoots();
for (int i = 0; i < roots.length; i++) {
if (roots[i].getPath().equals(path)) {
return roots[i];
}
}
} catch (CModelException e) {
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#getSourceRoots()
*/