0
我有以下通用代碼,可以轉儲系統中所有屬性的所有標記。如果我設置了一些斷點,則LINE_NUMBER和IMarker.CHAR_START的值始終顯示爲空,儘管它們具有明確的值。 任何人都可以幫助理解嗎?Markes轉儲顯示爲IMarker.LINE_NUMBER和IMarker.CHAR_START的空值插件開發標記
private void printAllMarkers() {
IMarker[] markers = null;
IWorkspace root = ResourcesPlugin.getWorkspace();
IProject projects[] = root.getRoot().getProjects();
for (IProject p : projects) {
try {
markers = p.findMarkers(IMarker.MARKER, true, IResource.DEPTH_INFINITE);
System.out.println("\nAll Markers Are: ");
for (IMarker m : markers) {
System.out.println("-----------Marker of Type: " + m.getType());
dumpMarker(m);
}
} catch (CoreException e) {
e.printStackTrace();
}
}
}
public static void dumpMarker(IMarker m) {
try {
for (String attrName : m.getAttributes().keySet()) {
System.out.println("Attribute:" + attrName + "=" + m.getAttribute(attrName, null));
}
} catch (CoreException e) {
e.printStackTrace();
}
}