Package org.eclipse.ui.texteditor
Class MarkerUtilities
java.lang.Object
org.eclipse.ui.texteditor.MarkerUtilities
Utility class for accessing marker attributes. The static methods provided
on this class provide internal exception handling (unexpected
CoreException
s are logged to workbench).
This class provides static methods only; it is not intended to be instantiated or subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
changeAttributes
(IMarker marker, Map<String, Object> attributeChanges) Changes the given attribute key-value pairs of the map on this marker.static void
Creates a marker on the given resource with the given type and attributes.static int
getCharEnd
(IMarker marker) Returns the ending character offset of the given marker.static int
getCharStart
(IMarker marker) Returns the starting character offset of the given marker.static int
getLineNumber
(IMarker marker) Returns the line number of the given marker.static String
getMarkerType
(IMarker marker) Returns the marker type of the given marker ornull
if the type could not be determined.static String
getMessage
(IMarker marker) Returns the message associated with the given marker.static int
getPriority
(IMarker marker) Returns the priority of the given marker.static int
getSeverity
(IMarker marker) Returns the severity of the given marker.static String[]
getSuperTypes
(String markerType) Returns the list of super types for the given marker.static boolean
isMarkerType
(IMarker marker, String type) Returns whether the given marker is of the given type (either directly or indirectly).static void
setCharEnd
(Map<String, Object> map, int charEnd) Sets the ending character offset in the given map using the standard marker attribute name as the key.static void
setCharEnd
(IMarker marker, int charEnd) Sets the ending character offset of the given marker.static void
setCharStart
(Map<String, Object> map, int charStart) Sets the starting character offset in the given map using the standard marker attribute name as the key.static void
setCharStart
(IMarker marker, int charStart) Sets the starting character offset of the given marker.static void
setLineNumber
(Map<String, Object> map, int lineNum) Sets the line number in the given map using the standard marker attribute name as the key.static void
setLineNumber
(IMarker marker, int lineNum) Sets the line number of the given marker.static void
setMessage
(Map<String, Object> map, String message) Sets the message in the given map using the standard marker attribute name as the key.
-
Method Details
-
getCharEnd
Returns the ending character offset of the given marker.- Parameters:
marker
- the marker- Returns:
- the ending character offset, or
-1
if not set - See Also:
-
getCharStart
Returns the starting character offset of the given marker.- Parameters:
marker
- the marker- Returns:
- the starting character offset, or
-1
if not set - See Also:
-
getLineNumber
Returns the line number of the given marker.- Parameters:
marker
- the marker- Returns:
- the line number, or
-1
if not set - See Also:
-
getPriority
Returns the priority of the given marker.- Parameters:
marker
- the marker- Returns:
- the priority, or
IMarker.PRIORITY_NORMAL
if not set - See Also:
-
getSeverity
Returns the severity of the given marker.- Parameters:
marker
- the marker- Returns:
- the priority, or
IMarker.SEVERITY_INFO
if not set - See Also:
-
isMarkerType
Returns whether the given marker is of the given type (either directly or indirectly).- Parameters:
marker
- the marker to be checkedtype
- the reference type- Returns:
true
if maker is an instance of the reference type
-
getMarkerType
Returns the marker type of the given marker ornull
if the type could not be determined.- Parameters:
marker
- the marker- Returns:
- the marker type
- Since:
- 3.0
-
getMessage
Returns the message associated with the given marker.- Parameters:
marker
- the marker- Returns:
- the message associated with the marker or
null
- Since:
- 3.0
-
setCharEnd
Sets the ending character offset of the given marker.- Parameters:
marker
- the markercharEnd
- the ending character offset- See Also:
-
setCharEnd
Sets the ending character offset in the given map using the standard marker attribute name as the key.- Parameters:
map
- the mapcharEnd
- the ending character offset- See Also:
-
setCharStart
Sets the starting character offset of the given marker.- Parameters:
marker
- the markercharStart
- the starting character offset- See Also:
-
setCharStart
Sets the starting character offset in the given map using the standard marker attribute name as the key.- Parameters:
map
- the mapcharStart
- the starting character offset- See Also:
-
setLineNumber
Sets the line number of the given marker.- Parameters:
marker
- the markerlineNum
- the line number- See Also:
-
setLineNumber
Sets the line number in the given map using the standard marker attribute name as the key.- Parameters:
map
- the maplineNum
- the line number- See Also:
-
setMessage
Sets the message in the given map using the standard marker attribute name as the key.- Parameters:
map
- the mapmessage
- the message- See Also:
-
createMarker
public static void createMarker(IResource resource, Map<String, Object> attributes, String markerType) throws CoreExceptionCreates a marker on the given resource with the given type and attributes.This method modifies the workspace (progress is not reported to the user).
- Parameters:
resource
- the resourceattributes
- the attribute mapmarkerType
- the type of marker- Throws:
CoreException
- if this method fails- See Also:
-
getSuperTypes
Returns the list of super types for the given marker. The list is a depth first list and maintains the sequence in which the super types are listed in the marker specification.- Parameters:
markerType
- the marker's type- Returns:
- a depth-first list of all super types of the given marker type
-
changeAttributes
Changes the given attribute key-value pairs of the map on this marker. The values must benull
or an instance of one of the following classes:String
,Integer
, orBoolean
. If a value isnull
, the new value of the attribute is considered to be undefined.The values of the attributes cannot be
String
whose UTF encoding exceeds 65535 bytes. On persistent markers this limit is enforced by an assertion.This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this marker has been modified.
- Parameters:
marker
- the markerattributeChanges
- map with to be executed attribute changes- Since:
- 3.17
- See Also:
-