Bug 24212 [Tasks view] Support read-only tasks in Task list
JDT has now support for generating tasks from source, e.g. //TODO will add a task and show it in the task list. Such tasks can only be edited and changed in the source code. For this reason we would like to have support in the task list for such non-modifiable tasks. For example, we could add a marker attribute "read-only" and if this attribute is set then menu actions to delete or change the task will be disabled.
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerUtil.java
}
/**
 * Returns whether the given marker is of the given type (either directly or indirectly).
 */
public static boolean isMarkerType(IMarker marker, String type) {
	try {
		return marker.isSubtypeOf(type);
	}
	catch (CoreException e) {
		return false;
	}
}
/**
 * Returns whether the given marker is read-only.
 */
public static boolean isReadOnly(IMarker marker) {
	return marker.getAttribute("readOnly", false);  
}
/**
 * Returns the creation time of the marker as a string.
 */
public static String getCreationTime(IMarker marker) {
	try {
		return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM).format(new Date(marker.getCreationTime()));
	} catch (CoreException e) {
		return null;
	}
}
}