mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
findElement check for relative path.
This commit is contained in:
parent
562219c341
commit
aa2c9be127
1 changed files with 14 additions and 3 deletions
|
@ -45,9 +45,20 @@ public class CProject extends CResource implements ICProject {
|
|||
}
|
||||
|
||||
public ICElement findElement(IPath path) throws CModelException {
|
||||
ICElement celem = CModelManager.getDefault().create(path);
|
||||
if (celem == null)
|
||||
new CModelStatus(ICModelStatusConstants.INVALID_PATH, path);
|
||||
ICElement celem = null;
|
||||
if (path.isAbsolute()) {
|
||||
celem = CModelManager.getDefault().create(path);
|
||||
} else {
|
||||
IProject project = getProject();
|
||||
if (project != null) {
|
||||
IPath p = project.getFullPath().append(path);
|
||||
celem = CModelManager.getDefault().create(p);
|
||||
}
|
||||
}
|
||||
if (celem == null) {
|
||||
CModelStatus status = new CModelStatus(ICModelStatusConstants.INVALID_PATH, path);
|
||||
throw new CModelException(status);
|
||||
}
|
||||
return celem;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue