1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Make the open decl on includes a little safer.

This commit is contained in:
Doug Schaefer 2007-04-17 13:54:35 +00:00
parent 25f6e085ff
commit 558fca8f5e

View file

@ -126,13 +126,16 @@ public class OpenDeclarationsAction extends SelectionParseAction {
for (int i = 0; i < preprocs.length; ++i) {
if (!(preprocs[i] instanceof IASTPreprocessorIncludeStatement))
continue;
IASTPreprocessorIncludeStatement incStmt = (IASTPreprocessorIncludeStatement)preprocs[i];
if (!incStmt.isResolved())
continue;
IASTFileLocation loc = preprocs[i].getFileLocation();
if (loc != null
&& loc.getFileName().equals(ast.getFilePath())
&& loc.getNodeOffset() < selectionStart
&& loc.getNodeOffset() + loc.getNodeLength() > selectionStart) {
// Got it
String name = ((IASTPreprocessorIncludeStatement)preprocs[i]).getPath();
String name = incStmt.getPath();
if (name != null) {
final IPath path = new Path(name);
runInUIThread(new Runnable() {