mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-18 21:55:45 +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:
parent
22825b7fac
commit
3cd2cd8098
3 changed files with 48 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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()
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue