Eclipse Platform
2.0

org.eclipse.ui.texteditor
Class MarkerUtilities

java.lang.Object
  |
  +--org.eclipse.ui.texteditor.MarkerUtilities

public final class MarkerUtilities
extends Object

Utility class for accessing marker attributes. The static methods provided on this class provide internal exception handling (unexpected CoreExceptions are logged to workbench).

This class provides static methods only; it is not intended to be instantiated or subclassed by clients.


Method Summary
static void createMarker(IResource resource, Map attributes, String markerType)
          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 int getPriority(IMarker marker)
          Returns the priority of 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(IMarker marker, int charEnd)
          Sets the ending character offset of the given marker.
static void setCharEnd(Map map, int charEnd)
          Sets the ending 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 setCharStart(Map map, int charStart)
          Sets the starting character offset 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 setLineNumber(Map map, int lineNum)
          Sets the line number in the given map using the standard marker attribute name as the key.
static void setMessage(Map map, String message)
          Sets the message in the given map using the standard marker attribute name as the key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCharEnd

public static int getCharEnd(IMarker marker)
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:
IMarker.CHAR_END, IMarker.getAttribute(java.lang.String,int)

getCharStart

public static int getCharStart(IMarker marker)
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:
IMarker.CHAR_START, IMarker.getAttribute(java.lang.String,int)

getLineNumber

public static int getLineNumber(IMarker marker)
Returns the line number of the given marker.

Parameters:
marker - the marker
Returns:
the line number, or -1 if not set
See Also:
IMarker.LINE_NUMBER, IMarker.getAttribute(java.lang.String,int)

getPriority

public static int getPriority(IMarker marker)
Returns the priority of the given marker.

Parameters:
marker - the marker
Returns:
the priority, or IMarker.PRIORITY_NORMAL if not set
See Also:
IMarker.PRIORITY, IMarker.PRIORITY_NORMAL, IMarker.getAttribute(java.lang.String,int)

isMarkerType

public static boolean isMarkerType(IMarker marker,
                                   String type)
Returns whether the given marker is of the given type (either directly or indirectly).

Parameters:
marker - the marker to be checked
type - the reference type
Returns:
trueif maker is an instance of the reference type

setCharEnd

public static void setCharEnd(IMarker marker,
                              int charEnd)
Sets the ending character offset of the given marker.

Parameters:
marker - the marker
charEnd - the ending character offset
See Also:
IMarker.CHAR_END, IMarker.setAttribute(java.lang.String,int)

setCharEnd

public static void setCharEnd(Map map,
                              int charEnd)
Sets the ending character offset in the given map using the standard marker attribute name as the key.

Parameters:
map - the map (key type: String, value type: Object)
charEnd - the ending character offset
See Also:
IMarker.CHAR_END

setCharStart

public static void setCharStart(IMarker marker,
                                int charStart)
Sets the starting character offset of the given marker.

Parameters:
marker - the marker
charStart - the starting character offset
See Also:
IMarker.CHAR_START, IMarker.setAttribute(java.lang.String,int)

setCharStart

public static void setCharStart(Map map,
                                int charStart)
Sets the starting character offset in the given map using the standard marker attribute name as the key.

Parameters:
map - the map (key type: String, value type: Object)
charStart - the starting character offset
See Also:
IMarker.CHAR_START

setLineNumber

public static void setLineNumber(IMarker marker,
                                 int lineNum)
Sets the line number of the given marker.

Parameters:
marker - the marker
lineNum - the line number
See Also:
IMarker.LINE_NUMBER, IMarker.setAttribute(java.lang.String,int)

setLineNumber

public static void setLineNumber(Map map,
                                 int lineNum)
Sets the line number in the given map using the standard marker attribute name as the key.

Parameters:
map - the map (key type: String, value type: Object)
lineNum - the line number
See Also:
IMarker.LINE_NUMBER

setMessage

public static void setMessage(Map map,
                              String message)
Sets the message in the given map using the standard marker attribute name as the key.

Parameters:
map - the map (key type: String, value type: Object)
message - the message
See Also:
IMarker.MESSAGE

createMarker

public static void createMarker(IResource resource,
                                Map attributes,
                                String markerType)
                         throws CoreException
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).

Parameters:
resource - the resource
attributes - the attribute map (key type: String, value type: Object)
markerType - the type of marker
Throws:
CoreException - if this method fails
See Also:
IResource.createMarker(java.lang.String)

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.