Community
Participate
Working Groups
build 137 org.eclipse.core.resources.IMarker compare bug 7244, item "d)" and the thread "(New) Question on deleting (in)complete tasks..." on the newsgroup eclipse.tools I programmatically create a new Task (per the code in "Mark My Words" at www.eclipse.org/articles), and it shows up in the Tasks View, it is not a compiler error or anything like that, but is something which a user might wish to delete. But even if I programmatically mark it as completed, there is no way for the user to delete it: that Task's context-menu item "Delete" is never enabled, and there is no user interface (that I can find) for marking the Task as completed. Here is some xml and code, from my plugin "LineCounter1": <extension id="counter" name="counter" point="org.eclipse.core.resources.markers"> <super type="org.eclipse.core.resources.problemmarker"> </super> <transient value="false"> </transient> </extension> ========================================================================= public void setActiveEditor(IAction arg0, IEditorPart edPart) { this.edPart = edPart; IEditorInput iei = (IEditorInput) this.edPart.getEditorInput(); if (iei instanceof IFileEditorInput) { try { IFile ifile = ((IFileEditorInput) iei).getFile(); // clear out any old ones IMarker[] markers = ifile.findMarkers(COUNT_TYPE, true, IResource.DEPTH_INFINITE); for (int i = 0; i < markers.length; ++i) { if ((null == this.marker) || (this.marker.getId() != markers[i].getId())) { markers[i].delete(); } } if (null == this.marker || !this.marker.exists()) { this.marker = ifile.createMarker(COUNT_TYPE); this.marker.setAttribute(IMarker.DONE, true); // so user can delete if desired -- @@ FAILS @@ } } catch (CoreException ce) { ce.printStackTrace(); } } else { System.out.println( "setActiveEditor(): IEditorInput is a " + iei.getClass()); } } // end setActiveEditor() private IEditorPart edPart; private IMarker marker; private static final String COUNT_TYPE = "LineCounter1.counter";
User's problem has to do with enablement of context menu operations based on marker attribute values. Moving to Platform/UI.
This works as intended. You cannot delete problem markers from the UI, only task markers. Problem markers are usually generated programmatically, e.g. by the Java builder, and should not be modified or deleted by the user. Try creating your marker as a subtype of org.eclipse.core.resources.taskmarker instead. Note that you don't have to change the done status before deleting it.