custom markers never appear in "Problems" view [message #328989] |
Mon, 09 June 2008 23:23 |
Paul E. Keyser Messages: 878 Registered: July 2009 |
Senior Member |
|
|
R3.2
WinXp
I have read all possibly-relevant newsgroup posts with "marker" in their
subject (several on this subject never answered); I have read the (old)
article
http://www.eclipse.org/articles/Article-Mark%20My%20Words/ma rk-my-words.html
; I have read the help at
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/resAdv_markers.htm
(yes, I know that's for 3.3 -- was a bug in markers fixed b/w 3.2 and
3.3?) -- none of which gives a clue to this problem.
============================================================ ======
In a plug-in whose id is "com.mun.ist.library", I define a new
marker-type, thus:
<extension
id="duplicateRelation"
name="Relation Duplicated"
point="org.eclipse.core.resources.markers">
<persistent
value="true">
</persistent>
<super
type="org.eclipse.core.resources.problemmarker">
</super>
</extension>
============================================================ ======
In my builder, I create instances of that marker, thus:
String message = ...;
String type = "com.mun.ist.library.duplicateRelation";
String location = ...;
IFile ifile = ...; // exists etc.
try {
final Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
attrs.put(IMarker.DONE, false);
attrs.put(IMarker.MESSAGE, message);
attrs.put(IMarker.LOCATION, location);
/* 1 */ Resources.createMarker(ifile, attrs, type);
/* 2 */ Resources.createMarker(ifile, attrs, IMarker.PROBLEM);
} catch (CoreException ce) {
final String msg = "OOPS or other useful message",
Activator.writeToLog(IStatus.ERROR, msg, ce);
}
WHERE "Resources.createMarker()" is:
/**
* Creates a marker on the given resource with the given type and
attributes.
* This method modifies the workspace (progress is not reported to the
user).
* Copied from org.eclipse.ui.texteditor.MarkerUtilities.
*
* @param resource (IResource)
* @param attributes (Map<String, Object>)
* @param markerType (String) the type of marker
* @throws CoreException if this method fails
*/
public static void createMarker(
final IResource resource,
final Map<String, Object> attributes,
final String markerType)
throws CoreException {
final IWorkspaceRunnable runnable =
new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor)
throws CoreException {
/* @ */ resource.createMarker(markerType).
setAttributes(attributes);
}
};
resource.getWorkspace().run(
runnable, null, IWorkspace.AVOID_UPDATE, null);
}
============================================================ ======
In FILTER of the "Problems" view, I can see my newly-defined type and
the check-box is checked under "Show Items of Type" (just as "problem
marker" is) -- so it should show up, right?
HOWEVER -- the Eclipse-provided problem-marker *does* appear in the
"Problems" view, but the custom type *never* does.
============================================================ ======
Setting breakpoints at the two lines marked above /* 1 */ and /* 2 */
(and of course at the line marked /* @ */) shows that the marker of my
type *is* being created, just like the IMarker.PROBLEM, in
org.eclipse.core.internal.resources.MarkerManager.add(...), line 68
(although line 62 claims it is *NOT* persistent, in contrast to the
IMarker.PROBLEM which is persistent).
So -- why do the custom markers not appear?
thanks,
Paul
|
|
|
|
Powered by
FUDForum. Page generated in 0.06412 seconds