mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Ed Swartz (Nokia) Bug 172237 - Try all declNames until we find one that has a valid file location.
This commit is contained in:
parent
1946cf2dee
commit
de80e83c99
2 changed files with 9 additions and 5 deletions
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Ed Swartz (Nokia)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.search.actions;
|
||||
|
@ -96,9 +97,9 @@ public class OpenDeclarationsAction extends SelectionParseAction {
|
|||
findDefinitions(index, ast, binding) :
|
||||
findDeclarations(index, ast, binding);
|
||||
}
|
||||
|
||||
if (declNames.length > 0) {
|
||||
IASTFileLocation fileloc = declNames[0].getFileLocation();
|
||||
|
||||
for (int i = 0; i < declNames.length; i++) {
|
||||
IASTFileLocation fileloc = declNames[i].getFileLocation();
|
||||
if (fileloc != null) {
|
||||
final IPath path = new Path(fileloc.getFileName());
|
||||
final int offset = fileloc.getNodeOffset();
|
||||
|
@ -113,6 +114,7 @@ public class OpenDeclarationsAction extends SelectionParseAction {
|
|||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Ed Swartz (Nokia)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.search.actions;
|
||||
|
||||
|
@ -88,8 +89,8 @@ public class OpenDefinitionAction extends SelectionParseAction {
|
|||
IBinding binding = searchName.resolveBinding();
|
||||
if (binding != null) {
|
||||
final IName[] declNames = ast.getDefinitions(binding);
|
||||
if (declNames.length > 0) {
|
||||
IASTFileLocation fileloc = declNames[0].getFileLocation();
|
||||
for (int i = 0; i < declNames.length; i++) {
|
||||
IASTFileLocation fileloc = declNames[i].getFileLocation();
|
||||
// no source location - TODO spit out an error in the status bar
|
||||
if (fileloc != null) {
|
||||
final IPath path = new Path(fileloc.getFileName());
|
||||
|
@ -105,6 +106,7 @@ public class OpenDefinitionAction extends SelectionParseAction {
|
|||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue