Community
Participate
Working Groups
Paul T. Keyser on the newsgroup noted some problems and possible improvements to the "Mark my Words" article by Jeff and Dejan. The first item is certainly a bug which should be fixed. The other three items fall into the "how to improve the article" category. I will cite the complete post below so it doesn't get lost: a) The code for manipulateMarker() is either wrong or *looks* wrong and needs a comment: public void manipulateMarker(IMarker marker) { // test to see if the marker really exists. Perhaps its stale? if (marker.exists()) return; // ... }// end manipulateMarker() shouldn't that be "if (!marker.exists())" ...? b) this XML is deeply confusing to anyone not an Eclipse guru: <extension id="coolmarker" point="org.eclipse.core.resources.markers"/> <extension id="coolproblem" point="org.eclipse.core.resources.markers"> <super type="org.eclipse.core.resources.problemmarker"/> <super type="com.example.markers.r.us.coolmarker"/> <attribute name="coolFactor"/> <persistent value="true"/> </extension> there are TWO new types of markers, the second of which "inherits" both from the first and from org.eclipse.core.resources.problemmarker; that should be stated in the accompanying text. c) the creation code here contains a string whose construction needs to be explained: public IMarker createCoolMarker(IResource resource) { try { IMarker marker = resource.createMarker("com.example.markers.r.us.coolproblem"); marker.setAttribute("coolFactor", "ULTRA"); // ... } the accompanying text should explain that the string is composed of a "prefix" derived from the *id* of the *plug-in* (in this case, not ever given in the accompanying text, it is "com.example.markers.r.us") and a suffix which is identical to the *id* of the *extension* (in this case "coolproblem"). d) the article should explain, and never does, how programmatically to set the "completion" status of a marker, as well as how to set/create one so that a user can mark it as completed. At the moment, no-one, using just the article, could ever manage to do either of those things, and in fact the "obvious" API for doing the second does not work. (See the as-yet unanswered thread "(New) Question on deleting (in)complete tasks..." where I ask about how to do that.)
See also bug 7448 for an example of confusion.
Dejan or Jeff, this article was written in 2001 and could use updating. Would one or both of you be willing to create an updated version?
I am way out of touch with anything related to resources. Perhaps someone like John A would be able to do the updates accurately.
John do you want to take it or get somebody else to fix it? Are the problems serious enough we should have the article removed until it's fixed?
I think the only real "bug" in the article is the missing "!" in the code snippet (problem a)). The rest are merely suggestions. I reread the article and its content is still valid, so I don't think major revisions are necessary. I suggest just fixing the "!" in the code snippet.
Ok, let's ask "He who has write permission" to add the "!". Denis, please change: if (marker.exists()) to: if (!marker.exists()) in: http://www.eclipse.org/articles/Article-Mark%20My%20Words/Mark%20My%20Words.html . Thanks.
Done. This has to be a new speed record for solving a three-year-old bug =) D.
Thanks Denis