mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 13:25:45 +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) {
|
for (int i = 0; i < preprocs.length; ++i) {
|
||||||
if (!(preprocs[i] instanceof IASTPreprocessorIncludeStatement))
|
if (!(preprocs[i] instanceof IASTPreprocessorIncludeStatement))
|
||||||
continue;
|
continue;
|
||||||
|
IASTPreprocessorIncludeStatement incStmt = (IASTPreprocessorIncludeStatement)preprocs[i];
|
||||||
|
if (!incStmt.isResolved())
|
||||||
|
continue;
|
||||||
IASTFileLocation loc = preprocs[i].getFileLocation();
|
IASTFileLocation loc = preprocs[i].getFileLocation();
|
||||||
if (loc != null
|
if (loc != null
|
||||||
&& loc.getFileName().equals(ast.getFilePath())
|
&& loc.getFileName().equals(ast.getFilePath())
|
||||||
&& loc.getNodeOffset() < selectionStart
|
&& loc.getNodeOffset() < selectionStart
|
||||||
&& loc.getNodeOffset() + loc.getNodeLength() > selectionStart) {
|
&& loc.getNodeOffset() + loc.getNodeLength() > selectionStart) {
|
||||||
// Got it
|
// Got it
|
||||||
String name = ((IASTPreprocessorIncludeStatement)preprocs[i]).getPath();
|
String name = incStmt.getPath();
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
final IPath path = new Path(name);
|
final IPath path = new Path(name);
|
||||||
runInUIThread(new Runnable() {
|
runInUIThread(new Runnable() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue