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: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.search.actions; package org.eclipse.cdt.internal.ui.search.actions;
@ -96,9 +97,9 @@ public class OpenDeclarationsAction extends SelectionParseAction {
findDefinitions(index, ast, binding) : findDefinitions(index, ast, binding) :
findDeclarations(index, ast, binding); findDeclarations(index, ast, binding);
} }
if (declNames.length > 0) { for (int i = 0; i < declNames.length; i++) {
IASTFileLocation fileloc = declNames[0].getFileLocation(); IASTFileLocation fileloc = declNames[i].getFileLocation();
if (fileloc != null) { if (fileloc != null) {
final IPath path = new Path(fileloc.getFileName()); final IPath path = new Path(fileloc.getFileName());
final int offset = fileloc.getNodeOffset(); final int offset = fileloc.getNodeOffset();
@ -113,6 +114,7 @@ public class OpenDeclarationsAction extends SelectionParseAction {
} }
} }
}); });
break;
} }
} }
} }

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.search.actions; package org.eclipse.cdt.internal.ui.search.actions;
@ -88,8 +89,8 @@ public class OpenDefinitionAction extends SelectionParseAction {
IBinding binding = searchName.resolveBinding(); IBinding binding = searchName.resolveBinding();
if (binding != null) { if (binding != null) {
final IName[] declNames = ast.getDefinitions(binding); final IName[] declNames = ast.getDefinitions(binding);
if (declNames.length > 0) { for (int i = 0; i < declNames.length; i++) {
IASTFileLocation fileloc = declNames[0].getFileLocation(); IASTFileLocation fileloc = declNames[i].getFileLocation();
// no source location - TODO spit out an error in the status bar // no source location - TODO spit out an error in the status bar
if (fileloc != null) { if (fileloc != null) {
final IPath path = new Path(fileloc.getFileName()); final IPath path = new Path(fileloc.getFileName());
@ -105,6 +106,7 @@ public class OpenDefinitionAction extends SelectionParseAction {
} }
} }
}); });
break;
} }
} }
} }