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:
parent
25f6e085ff
commit
558fca8f5e
1 changed files with 4 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue