1
0
Fork 0
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:
Doug Schaefer 2007-02-13 18:41:39 +00:00
parent 1946cf2dee
commit de80e83c99
2 changed files with 9 additions and 5 deletions

View file

@ -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;
@ -97,8 +98,8 @@ public class OpenDeclarationsAction extends SelectionParseAction {
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;
}
}
}

View file

@ -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;
}
}
}