import java.io.Serializable;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Set;
import org.aspectj.asm.internal.ProgramElement;
public void flushHandleMap();
public void updateHandleMap(Set deletedFiles);
+
+ /**
+ * For a specified node, check if any of the children more accurately represent the specified line.
+ *
+ * @param node where to start looking
+ * @param lineno the line number
+ * @return any closer match below 'node' or null if nothing is a more accurate match
+ */
+ public IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno);
}
\ No newline at end of file
}
}
}
+ // 'binaries' will be checked automatically by the code above as it is represented as a SOURCE_FOLDER
return matchingPackageNodes;
} else {
// dealing directly with packages below the root, no source folders. Therefore at most one
return result;
}
}
+ if (possiblePackage.getKind() == IProgramElement.Kind.SOURCE_FOLDER) { // might be 'binaries'
+ if (possiblePackage.getName().equals("binaries")) {
+ for (Iterator iter2 = possiblePackage.getChildren().iterator(); iter2.hasNext();) {
+ IProgramElement possiblePackage2 = (IProgramElement) iter2.next();
+ if (possiblePackage2.getKind() == IProgramElement.Kind.PACKAGE) {
+ if (possiblePackage2.getName().equals(packagename)) {
+ List result = new ArrayList();
+ result.add(possiblePackage2);
+ return result;
+ }
+ }
+ }
+ }
+ }
}
}
return Collections.EMPTY_LIST;
public IProgramElement findElementForSourceLine(String sourceFilePath, int lineNumber) {
String canonicalSFP = asm.getCanonicalFilePath(new File(sourceFilePath));
// Used to do this:
-// IProgramElement node2 = findNodeForSourceLineHelper(root, canonicalSFP, lineNumber, -1);
-
+ // IProgramElement node2 = findNodeForSourceLineHelper(root, canonicalSFP, lineNumber, -1);
+
// Find the relevant source file node first
IProgramElement node = findNodeForSourceFile(root, canonicalSFP);
if (node == null) {
return node;
}
return null; // no need to search children of a source file node
- } else {
+ } else {
// check the children
for (Iterator iterator = node.getChildren().iterator(); iterator.hasNext();) {
IProgramElement foundit = findNodeForSourceFile((IProgramElement) iterator.next(), sourcefilePath);
* @param lineno the line number
* @return any closer match below 'node' or null if nothing is a more accurate match
*/
- private IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno) {
+ public IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno) {
for (Iterator childrenIter = node.getChildren().iterator(); childrenIter.hasNext();) {
IProgramElement child = (IProgramElement) childrenIter.next();
ISourceLocation childLoc = child.getSourceLocation();
} else {
return evenCloserMatch;
}
- } else if (child.getKind().isType()) { // types are a bit clueless about where they are... do other nodes have similar problems??
+ } else if (child.getKind().isType()) { // types are a bit clueless about where they are... do other nodes have
+ // similar problems??
IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno);
if (evenCloserMatch != null) {
return evenCloserMatch;
- }
+ }
}
}
}