|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Markers are a general mechanism for associating notes and metadata with resources.
Markers themselves are handles in the same way as IResources
are handles. Instances of IMarker
do not hold the attributes
themselves but rather uniquely refer to the attribute container. As such,
their state may change underneath the handle with no warning to the holder
of the handle.
Each marker has:
"org.eclipse.core.resources.taskmarker"
), The resources plug-in defines five standard types:
org.eclipse.core.resources.marker
org.eclipse.core.resources.taskmarker
org.eclipse.core.resources.problemmarker
org.eclipse.core.resources.bookmark
org.eclipse.core.resources.textmarker
org.eclipse.core.resources.markers
) into which other
plug-ins can install marker type declaration extensions.
Marker types are declared within a multiple inheritance type system.
New markers are defined in the plugin.xml
file of the
declaring plug-in. A valid declaration contains elements as defined by
the extension point DTD:
All markers declared as persistent
are saved when the
workspace is saved. A plug-in which defines a persistent marker is not
directly involved in saving and restoring the marker.
Markers are not under version and configuration management, and
cannot be shared via VCM repositories.
This interface is not intended to be implemented by developers.
Markers implement the IAdaptable
interface;
extensions are managed by the platform's adapter manager.
Field Summary | |
static String |
BOOKMARK
Bookmark marker type |
static String |
CHAR_END
Character end marker attribute. |
static String |
CHAR_START
Character start marker attribute. |
static String |
DONE
Done marker attribute. |
static String |
LINE_NUMBER
Line number marker attribute. |
static String |
LOCATION
Location marker attribute. |
static String |
MARKER
Base marker type |
static String |
MESSAGE
Message marker attribute. |
static String |
PRIORITY
Priority marker attribute. |
static int |
PRIORITY_HIGH
High priority constant (value 2). |
static int |
PRIORITY_LOW
Low priority constant (value 0). |
static int |
PRIORITY_NORMAL
Normal priority constant (value 1). |
static String |
PROBLEM
Problem marker type |
static String |
SEVERITY
Severity marker attribute. |
static int |
SEVERITY_ERROR
Error severity constant (value 2) indicating an error state. |
static int |
SEVERITY_INFO
Info severity constant (value 0) indicating information only. |
static int |
SEVERITY_WARNING
Warning severity constant (value 1) indicating a warning. |
static String |
TASK
Task marker type |
static String |
TEXT
Text marker type |
Method Summary | |
void |
delete()
Deletes this marker from its associated resource. |
boolean |
equals(Object object)
Tests this marker for equality with the given object. |
boolean |
exists()
Returns whether this marker exists in the workspace. |
Object |
getAttribute(String attributeName)
Returns the attribute with the given name. |
boolean |
getAttribute(String attributeName,
boolean defaultValue)
Returns the boolean-valued attribute with the given name. |
int |
getAttribute(String attributeName,
int defaultValue)
Returns the integer-valued attribute with the given name. |
String |
getAttribute(String attributeName,
String defaultValue)
Returns the string-valued attribute with the given name. |
Map |
getAttributes()
Returns a map with all the attributes for the marker. |
Object[] |
getAttributes(String[] attributeNames)
Returns the attributes with the given names. |
long |
getId()
Returns the id of the marker. |
IResource |
getResource()
Returns the resource with which this marker is associated. |
String |
getType()
Returns the type of this marker. |
boolean |
isSubtypeOf(String superType)
Returns whether the type of this marker is considered to be a subtype of the given marker type. |
void |
setAttribute(String attributeName,
boolean value)
Sets the boolean-valued attribute with the given name. |
void |
setAttribute(String attributeName,
int value)
Sets the integer-valued attribute with the given name. |
void |
setAttribute(String attributeName,
Object value)
Sets the attribute with the given name. |
void |
setAttributes(Map attributes)
Sets the attributes for this marker to be the ones contained in the given table. |
void |
setAttributes(String[] attributeNames,
Object[] values)
Sets the given attribute key-value pairs on this marker. |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
getAdapter |
Field Detail |
public static final String MARKER
getType()
,
Constant Field Valuespublic static final String TASK
getType()
,
Constant Field Valuespublic static final String PROBLEM
getType()
,
Constant Field Valuespublic static final String TEXT
getType()
,
Constant Field Valuespublic static final String BOOKMARK
getType()
,
Constant Field Valuespublic static final String SEVERITY
SEVERITY_ERROR
,
SEVERITY_WARNING
,
SEVERITY_INFO
,
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String MESSAGE
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String LOCATION
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String PRIORITY
PRIORITY_HIGH
,
PRIORITY_NORMAL
,
PRIORITY_LOW
,
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String DONE
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String CHAR_START
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String CHAR_END
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String LINE_NUMBER
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final int PRIORITY_HIGH
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final int PRIORITY_NORMAL
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final int PRIORITY_LOW
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final int SEVERITY_ERROR
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final int SEVERITY_WARNING
getAttribute(java.lang.String)
,
Constant Field Valuespublic static final int SEVERITY_INFO
getAttribute(java.lang.String)
,
Constant Field ValuesMethod Detail |
public void delete() throws CoreException
CoreException
- if this marker could not be deleted. Reasons include:
public boolean equals(Object object)
equals
in class Object
object
- the other object
public boolean exists()
true
if this marker exists, otherwise
false
public Object getAttribute(String attributeName) throws CoreException
String
, Integer
,
or Boolean
.
Returns null
if the attribute is undefined.
attributeName
- the name of the attribute
null
if the attribute is undefined.
CoreException
- if this method fails. Reasons include:
public int getAttribute(String attributeName, int defaultValue)
attributeName
- the name of the attributedefaultValue
- the value to use if no value is found
public String getAttribute(String attributeName, String defaultValue)
attributeName
- the name of the attributedefaultValue
- the value to use if no value is found
public boolean getAttribute(String attributeName, boolean defaultValue)
attributeName
- the name of the attributedefaultValue
- the value to use if no value is found
public Map getAttributes() throws CoreException
null
is returned.
String
value type : String
, Integer
, or
Boolean
) or null
.
CoreException
- if this method fails. Reasons include:
public Object[] getAttributes(String[] attributeNames) throws CoreException
null
or an instance of one
of the following classes: String
, Integer
,
or Boolean
.
attributeNames
- the names of the attributes
CoreException
- if this method fails. Reasons include:
public long getId()
IResource.findMarker(long)
public IResource getResource()
public String getType() throws CoreException
CoreException
- if this method fails. Reasons include:
public boolean isSubtypeOf(String superType) throws CoreException
true
if the marker's type
is the same as (or a subtype of) the given type.
CoreException
- if this method fails. Reasons include:
public void setAttribute(String attributeName, int value) throws CoreException
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this marker has been modified.
attributeName
- the name of the attributevalue
- the value
CoreException
- if this method fails. Reasons include:
public void setAttribute(String attributeName, Object value) throws CoreException
null
or
an instance of one of the following classes:
String
, Integer
, or Boolean
.
If the value is null
, the attribute is considered to be undefined.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this marker has been modified.
attributeName
- the name of the attributevalue
- the value, or null
if the attribute is to be undefined
CoreException
- if this method fails. Reasons include:
public void setAttribute(String attributeName, boolean value) throws CoreException
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this marker has been modified.
attributeName
- the name of the attributevalue
- the value
CoreException
- if this method fails. Reasons include:
public void setAttributes(String[] attributeNames, Object[] values) throws CoreException
null
or an instance of
one of the following classes: String
,
Integer
, or Boolean
.
If a value is null
, the new value of the
attribute is considered to be undefined.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this marker has been modified.
attributeNames
- an array of attribute namesvalues
- an array of attribute values
CoreException
- if this method fails. Reasons include:
public void setAttributes(Map attributes) throws CoreException
String
, Integer
, or Boolean
.
Attributes previously set on the marker but not included in the given map
are considered to be removals. Setting the given map to be null
is equivalent to removing all marker attributes.
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this marker has been modified.
attributes
- a map of attribute names to attribute values
(key type : String
value type : String
,
Integer
, or Boolean
) or null
CoreException
- if this method fails. Reasons include:
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |