Package org.eclipse.ui.texteditor
Class AnnotationPreference
java.lang.Object
org.eclipse.ui.texteditor.AnnotationPreference
An annotation preference provides all the information required for handing
the preferences for the presentation of annotations of a specified type. The
type can be changed and retrieved using the
getAnnotationType
and setAnnotationType
methods. For each preference, getter and
setter methods are provided.
Preferences that may be changed by the user also have a corresponding key
that can be used to obtain the currently set value from an
IPreferenceStore
.
The following annotation preferences are covered:
Display Preferences controlling how and where annotations are shown
- as text background highlighting (and respective preference key),
- as text decorations (and respective preference key),
- on the overview ruler (and respective preference key),
- on the overview ruler header,
- on the vertical ruler (and respective preference key),
Additional Display Preferences
- the base color for annotations of this type (and respective preference key),
- the style of text decorations that are drawn (and respective preference key),
- the annotation image provider,
- the quick fix image descriptor,
- the image descriptor,
- the symbolic image name,
- the presentation layer.
Navigation Preferences
- whether included in the "Go to Next Annotation" navigation action (and respective preference key),
- whether included in the "Go to Previous Annotation" navigation action (and respective preference key),
- whether to be shown in the "Go to Next/Previous Annotation" navigation toolbar drop down (and respective preference key).
Preference Page Preferences
- whether the annotation type should be included on the generic annotation preference page,
- preference label.
- Since:
- 2.1
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final Object[]
Array of all supported attributes.protected static final Object
The preference key for the presentation color.protected static final Object
The presentation color.The annotation image provider.The name of the attribute used to load the annotation image provider from the configuration element.The configuration element from which to create the annotation image provider.protected static final Object
Indicates whether the annotation type contributed to the overview ruler's header.protected static final Object
The preference key for highlighting inside text.protected static final Object
The value for highlighting inside text.protected static final Object
The image to be used for drawing in the vertical ruler.protected static final Object
The annotation image provider.protected static final Object
The value for the includeOnPreferencePage property.protected static final Object
The preference key for go to next navigation enablement.protected static final Object
The value for go to next navigation enablement.protected static final Object
The preference key for go to previous navigation enablement.protected static final Object
The value for go to previous navigation enablement.protected static final Object
The preference key for the visibility in the overview ruler.protected static final Object
The visibility in the overview ruler.protected static final Object
The preference label.protected static final Object
The presentation layer.protected static final Object
The Quick Fix image to be used for drawing in the vertical ruler.protected static final Object
The preference key for the visibility in the next/previous drop down toolbar action.protected static final Object
The value for the visibility in the next/previous drop down toolbar action.static final String
Constant defining box decoration for the show in text style preference.static final String
Constant defining dashed box decoration for the show in text style preference.static final String
Constant defining i-beam decoration for the show in text style preference.static final String
Constant defining no decoration for the show in text style preference.static final String
Constant defining the native problem underline decoration for the show in text style preference.static final String
Constant defining squiggly decoration for the show in text style preference.static final String
Constant defining underline decoration for the show in text style preference.protected static final Object
The symbolic name of the image to be drawn in the vertical ruler.protected static final Object
The preference key for the visibility inside text.protected static final Object
The visibility inside text.protected static final Object
The preference key for the decoration style.protected static final Object
The value for the text decoration style.protected static final Object
The preference key for the visibility in the vertical ruler.protected static final Object
The visibility in the vertical ruler. -
Constructor Summary
ConstructorDescriptionCreates a new un-initialized annotation preference.AnnotationPreference
(Object annotationType, String colorKey, String textKey, String overviewRulerKey, int presentationLayer) Creates a new annotation preference for the given annotation type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the annotation type contributes to the header of the overview ruler.Returns the annotation image provider.Returns the annotation type.protected boolean
getBooleanValue
(Object attribute) Returns the value of the given attribute as boolean.Returns the preference key for the presentation color.Returns the default presentation color.Returns the preference key for highlighting inside text.boolean
Returns the default value for highlighting inside text.Returns the image descriptor for the image to be drawn in the vertical ruler.protected int
getIntegerValue
(Object attribute) Returns the value of the given attribute as integer.Returns the preference key for go to next navigation enablement.Returns the preference key for go to previous navigation enablement.Deprecated.since 3.0Returns the preference key for the visibility in the overview ruler.boolean
Returns the default visibility in the overview ruler.Returns the presentation string for this annotation type.int
Returns the presentation layer.Returns the Quick Fix image descriptor for the image to be drawn in the vertical ruler.int
Deprecated.since 3.0Returns the preference key for the visibility in the next/previous drop down toolbar action.protected String
getStringValue
(Object attribute) Returns the value of the given attribute as string.Returns the symbolic name of the image to be drawn in the vertical ruler.Returns the preference key for the visibility inside text.boolean
Returns the default visibility inside text.Returns the preference key for the decoration style used when the annotation is shown in text.Returns the value for the decoration style used when the annotation is shown in text.Returns the value of the given attribute.Returns the preference key for the visibility in the vertical ruler.boolean
Returns the default visibility in the vertical ruler.boolean
Returns whether the given attribute is defined.boolean
Returns the default value for go to next navigation enablement.boolean
Returns the default value for go to previous navigation enablement.boolean
Returns the property of the receiver of whether it should be included on the default annotation preference page.boolean
isPreferenceKey
(String key) Returns whether the given string is a preference key.boolean
Returns the default value for the visibility in the next/previous drop down toolbar action.void
merge
(AnnotationPreference preference) Merges the values of the given preference into this preference.void
Sets the annotation image provider who provides images for annotations of the specified annotation type.void
setAnnotationImageProviderData
(IConfigurationElement configurationElement, String annotationImageProviderAttribute) Sets the data needed to create the annotation image provider.void
setAnnotationType
(Object annotationType) Sets the annotation type.void
setColorPreferenceKey
(String colorKey) Sets the preference key for the presentation color.void
setColorPreferenceValue
(RGB colorValue) Sets the default presentation color.void
setContributesToHeader
(boolean contributesToHeader) Sets whether the annotation type contributes to the overview ruler's header.void
setHighlightPreferenceKey
(String highlightKey) Sets the preference key for highlighting inside text.void
setHighlightPreferenceValue
(boolean highlightValue) Sets the default value for highlighting inside text.void
setImageDescriptor
(ImageDescriptor descriptor) Sets the image descriptor for the image to be drawn in the vertical ruler.void
setIncludeOnPreferencePage
(boolean includeOnPreferencePage) Sets the property of this annotation preference whether it should be included on the default annotation preference page.void
setIsGoToNextNavigationTarget
(boolean isGoToNextNavigationTarget) Sets the default value for go to next navigation enablement.void
setIsGoToNextNavigationTargetKey
(String isGoToNextNavigationTargetKey) Sets the preference key for go to next navigation enablement.void
setIsGoToPreviousNavigationTarget
(boolean isGoToPreviousNavigationTarget) Sets the default value for go to previous navigation enablement.void
setIsGoToPreviousNavigationTargetKey
(String isGoToPreviousNavigationTargetKey) Sets the preference key for go to previous navigation enablement.void
setMarkerType
(String markerType) Sets the marker type.void
setOverviewRulerPreferenceKey
(String overviewRulerKey) Sets the preference key for the visibility in the overview ruler.void
setOverviewRulerPreferenceValue
(boolean overviewRulerValue) Sets the default visibility in the overview ruler.void
setPreferenceLabel
(String label) Sets the presentation label of this annotation type.void
setPresentationLayer
(int presentationLayer) Sets the presentation layer.void
setQuickFixImageDescriptor
(ImageDescriptor descriptor) Sets the Quick Fix image descriptor for the image to be drawn in the vertical ruler.void
setSeverity
(int severity) Sets the marker severity.void
setShowInNextPrevDropdownToolbarAction
(boolean showInNextPrevDropdownToolbarAction) Sets the default value for the visibility in the next/previous drop down toolbar action.void
setShowInNextPrevDropdownToolbarActionKey
(String showInNextPrevDropdownToolbarActionKey) Sets the preference key for the visibility in the next/previous drop down toolbar action.void
setSymbolicImageName
(String symbolicImageName) Sets the symbolic name of the image to be drawn in the vertical ruler.void
setTextPreferenceKey
(String textKey) Sets the preference key for the visibility of squiggles inside text.void
setTextPreferenceValue
(boolean textValue) Sets the default visibility inside text.void
Sets the preference key for the text style property.void
setTextStyleValue
(String value) Sets the value for the text style property.protected void
Sets the given value for the given attribute.protected void
Sets the given value for the given attribute.protected void
Sets the given value for the given attribute.void
setVerticalRulerPreferenceKey
(String verticalRulerKey) Sets the preference key for the visibility in the vertical ruler.void
setVerticalRulerPreferenceValue
(boolean verticalRulerValue) Sets the default visibility in the vertical ruler.
-
Field Details
-
STYLE_NONE
Constant defining no decoration for the show in text style preference.- Since:
- 3.0
- See Also:
-
STYLE_SQUIGGLES
Constant defining squiggly decoration for the show in text style preference.- Since:
- 3.0
- See Also:
-
STYLE_PROBLEM_UNDERLINE
Constant defining the native problem underline decoration for the show in text style preference.The look of this style is platform dependent.
- Since:
- 3.4
- See Also:
-
STYLE_BOX
Constant defining box decoration for the show in text style preference.- Since:
- 3.0
- See Also:
-
STYLE_DASHED_BOX
Constant defining dashed box decoration for the show in text style preference.- Since:
- 3.3
- See Also:
-
STYLE_UNDERLINE
Constant defining underline decoration for the show in text style preference.- Since:
- 3.0
- See Also:
-
STYLE_IBEAM
Constant defining i-beam decoration for the show in text style preference.- Since:
- 3.0
- See Also:
-
IMAGE_DESCRIPTOR
The image to be used for drawing in the vertical ruler.- Since:
- 3.0
-
QUICK_FIX_IMAGE_DESCRIPTOR
The Quick Fix image to be used for drawing in the vertical ruler.- Since:
- 3.2
-
PREFERENCE_LABEL
The preference label.- Since:
- 3.0
-
PRESENTATION_LAYER
The presentation layer.- Since:
- 3.0
-
SYMBOLIC_IMAGE_NAME
The symbolic name of the image to be drawn in the vertical ruler.- Since:
- 3.0
-
HEADER_VALUE
Indicates whether the annotation type contributed to the overview ruler's header.- Since:
- 3.0
-
IMAGE_PROVIDER
The annotation image provider.- Since:
- 3.0
-
INCLUDE_ON_PREFERENCE_PAGE
The value for the includeOnPreferencePage property.- Since:
- 3.0
-
TEXT_PREFERENCE_KEY
The preference key for the visibility inside text.- Since:
- 3.0
-
TEXT_PREFERENCE_VALUE
The visibility inside text.- Since:
- 3.0
-
COLOR_PREFERENCE_KEY
The preference key for the presentation color.- Since:
- 3.0
-
COLOR_PREFERENCE_VALUE
The presentation color.- Since:
- 3.0
-
HIGHLIGHT_PREFERENCE_KEY
The preference key for highlighting inside text.- Since:
- 3.0
-
HIGHLIGHT_PREFERENCE_VALUE
The value for highlighting inside text.- Since:
- 3.0
-
IS_GO_TO_NEXT_TARGET_KEY
The preference key for go to next navigation enablement.- Since:
- 3.0
-
IS_GO_TO_NEXT_TARGET_VALUE
The value for go to next navigation enablement.- Since:
- 3.0
-
IS_GO_TO_PREVIOUS_TARGET_KEY
The preference key for go to previous navigation enablement.- Since:
- 3.0
-
IS_GO_TO_PREVIOUS_TARGET_VALUE
The value for go to previous navigation enablement.- Since:
- 3.0
-
VERTICAL_RULER_PREFERENCE_KEY
The preference key for the visibility in the vertical ruler.- Since:
- 3.0
-
VERTICAL_RULER_PREFERENCE_VALUE
The visibility in the vertical ruler.- Since:
- 3.0
-
OVERVIEW_RULER_PREFERENCE_KEY
The preference key for the visibility in the overview ruler.- Since:
- 3.0
-
OVERVIEW_RULER_PREFERENCE_VALUE
The visibility in the overview ruler.- Since:
- 3.0
-
SHOW_IN_NAVIGATION_DROPDOWN_KEY
The preference key for the visibility in the next/previous drop down toolbar action.- Since:
- 3.0
-
SHOW_IN_NAVIGATION_DROPDOWN_VALUE
The value for the visibility in the next/previous drop down toolbar action.- Since:
- 3.0
-
TEXT_STYLE_PREFERENCE_KEY
The preference key for the decoration style.- Since:
- 3.0
-
TEXT_STYLE_PREFERENCE_VALUE
The value for the text decoration style.- Since:
- 3.0
-
ATTRIBUTES
Array of all supported attributes.- Since:
- 3.0
-
fAnnotationImageProvider
The annotation image provider.- Since:
- 3.0
-
fConfigurationElement
The configuration element from which to create the annotation image provider.- Since:
- 3.0
-
fAnnotationImageProviderAttribute
The name of the attribute used to load the annotation image provider from the configuration element.- Since:
- 3.0
-
-
Constructor Details
-
AnnotationPreference
public AnnotationPreference()Creates a new un-initialized annotation preference. Note that instances with anull
annotation type are invalid and should not be used. -
AnnotationPreference
public AnnotationPreference(Object annotationType, String colorKey, String textKey, String overviewRulerKey, int presentationLayer) Creates a new annotation preference for the given annotation type.- Parameters:
annotationType
- the annotation typecolorKey
- the preference key for the presentation colortextKey
- the preference key for the visibility inside textoverviewRulerKey
- the preference key for the visibility in the overview rulerpresentationLayer
- the presentation layer
-
-
Method Details
-
setValue
Sets the given value for the given attribute.- Parameters:
attribute
- the attributevalue
- the attribute value- Since:
- 3.0
-
setValue
Sets the given value for the given attribute.- Parameters:
attribute
- the attributevalue
- the attribute value- Since:
- 3.0
-
setValue
Sets the given value for the given attribute.- Parameters:
attribute
- the attributevalue
- the attribute value- Since:
- 3.0
-
getStringValue
Returns the value of the given attribute as string.- Parameters:
attribute
- the attribute- Returns:
- the attribute value
- Since:
- 3.0
-
getBooleanValue
Returns the value of the given attribute as boolean.- Parameters:
attribute
- the attribute- Returns:
- the attribute value
- Since:
- 3.0
-
getIntegerValue
Returns the value of the given attribute as integer.- Parameters:
attribute
- the attribute- Returns:
- the attribute value
- Since:
- 3.0
-
getValue
Returns the value of the given attribute.- Parameters:
attribute
- the attribute- Returns:
- the attribute value
- Since:
- 3.0
-
hasValue
Returns whether the given attribute is defined.- Parameters:
attribute
- the attribute- Returns:
true
if the attribute has a valuefalse
otherwise- Since:
- 3.0
-
isPreferenceKey
Returns whether the given string is a preference key.- Parameters:
key
- the string to test- Returns:
true
if the string is a preference key
-
getAnnotationType
Returns the annotation type. Should not be null in a completely set up instance.- Returns:
- the annotation type,
null
if the receiver has not been initialized yet
-
getMarkerType
Deprecated.since 3.0Returns the marker type.- Returns:
- the marker type, or
null
if none is set
-
getSeverity
Deprecated.since 3.0Returns the marker severity.- Returns:
- the marker severity
-
setAnnotationType
Sets the annotation type. Note that instances with anull
annotation type are considered invalid and should not be used with the framework.- Parameters:
annotationType
- the annotation type
-
setMarkerType
Sets the marker type.- Parameters:
markerType
- the marker type
-
setSeverity
public void setSeverity(int severity) Sets the marker severity.- Parameters:
severity
- the marker severity
-
getColorPreferenceKey
Returns the preference key for the presentation color.- Returns:
- the preference key for the presentation color or
null
if none is set
-
getColorPreferenceValue
Returns the default presentation color.- Returns:
- the default presentation color or
null
if none is set
-
getPreferenceLabel
Returns the presentation string for this annotation type.- Returns:
- the presentation string for this annotation type or
null
if none is set
-
getOverviewRulerPreferenceKey
Returns the preference key for the visibility in the overview ruler.- Returns:
- the preference key for the visibility in the overview ruler or
null
if none is set
-
getOverviewRulerPreferenceValue
public boolean getOverviewRulerPreferenceValue()Returns the default visibility in the overview ruler.- Returns:
- the default visibility in the overview ruler
-
getVerticalRulerPreferenceKey
Returns the preference key for the visibility in the vertical ruler.- Returns:
- the preference key for the visibility in the vertical ruler or
null
if none is set - Since:
- 3.0
-
getVerticalRulerPreferenceValue
public boolean getVerticalRulerPreferenceValue()Returns the default visibility in the vertical ruler.- Returns:
- the default visibility in the vertical ruler
- Since:
- 3.0
-
getPresentationLayer
public int getPresentationLayer()Returns the presentation layer.- Returns:
- the presentation layer
-
getTextPreferenceKey
Returns the preference key for the visibility inside text.- Returns:
- the preference key for the visibility inside text or
null
if none is set
-
getTextPreferenceValue
public boolean getTextPreferenceValue()Returns the default visibility inside text.- Returns:
- the default visibility inside text
-
getHighlightPreferenceKey
Returns the preference key for highlighting inside text.- Returns:
- the preference key for highlighting inside text or
null
if none is set - Since:
- 3.0
-
getHighlightPreferenceValue
public boolean getHighlightPreferenceValue()Returns the default value for highlighting inside text.- Returns:
- the default value for highlighting inside text
- Since:
- 3.0
-
contributesToHeader
public boolean contributesToHeader()Returns whether the annotation type contributes to the header of the overview ruler.- Returns:
true
if the annotation type contributes to the header of the overview ruler
-
setColorPreferenceKey
Sets the preference key for the presentation color.- Parameters:
colorKey
- the preference key
-
setColorPreferenceValue
Sets the default presentation color.- Parameters:
colorValue
- the default color
-
setPreferenceLabel
Sets the presentation label of this annotation type.- Parameters:
label
- the presentation label
-
setOverviewRulerPreferenceKey
Sets the preference key for the visibility in the overview ruler.- Parameters:
overviewRulerKey
- the preference key
-
setOverviewRulerPreferenceValue
public void setOverviewRulerPreferenceValue(boolean overviewRulerValue) Sets the default visibility in the overview ruler.- Parameters:
overviewRulerValue
-true
if visible by default,false
otherwise
-
setVerticalRulerPreferenceKey
Sets the preference key for the visibility in the vertical ruler.- Parameters:
verticalRulerKey
- the preference key- Since:
- 3.0
-
setVerticalRulerPreferenceValue
public void setVerticalRulerPreferenceValue(boolean verticalRulerValue) Sets the default visibility in the vertical ruler.- Parameters:
verticalRulerValue
-true
if visible by default,false
otherwise- Since:
- 3.0
-
setPresentationLayer
public void setPresentationLayer(int presentationLayer) Sets the presentation layer.- Parameters:
presentationLayer
- the presentation layer
-
setTextPreferenceKey
Sets the preference key for the visibility of squiggles inside text.- Parameters:
textKey
- the preference key
-
setTextPreferenceValue
public void setTextPreferenceValue(boolean textValue) Sets the default visibility inside text.- Parameters:
textValue
-true
if visible by default,false
otherwise
-
setHighlightPreferenceKey
Sets the preference key for highlighting inside text.- Parameters:
highlightKey
- the preference key- Since:
- 3.0
-
setHighlightPreferenceValue
public void setHighlightPreferenceValue(boolean highlightValue) Sets the default value for highlighting inside text.- Parameters:
highlightValue
-true
if highlighted in text by default,false
otherwise- Since:
- 3.0
-
setContributesToHeader
public void setContributesToHeader(boolean contributesToHeader) Sets whether the annotation type contributes to the overview ruler's header.- Parameters:
contributesToHeader
-true
if in header,false
otherwise
-
getShowInNextPrevDropdownToolbarActionKey
Returns the preference key for the visibility in the next/previous drop down toolbar action.- Returns:
- the preference key or
null
if the key is undefined - Since:
- 3.0
-
setShowInNextPrevDropdownToolbarActionKey
public void setShowInNextPrevDropdownToolbarActionKey(String showInNextPrevDropdownToolbarActionKey) Sets the preference key for the visibility in the next/previous drop down toolbar action.- Parameters:
showInNextPrevDropdownToolbarActionKey
- the preference key- Since:
- 3.0
-
isShowInNextPrevDropdownToolbarAction
public boolean isShowInNextPrevDropdownToolbarAction()Returns the default value for the visibility in the next/previous drop down toolbar action.- Returns:
true
if enabled by default- Since:
- 3.0
-
setShowInNextPrevDropdownToolbarAction
public void setShowInNextPrevDropdownToolbarAction(boolean showInNextPrevDropdownToolbarAction) Sets the default value for the visibility in the next/previous drop down toolbar action.- Parameters:
showInNextPrevDropdownToolbarAction
-true
if enabled by default- Since:
- 3.0
-
setTextStylePreferenceKey
Sets the preference key for the text style property.- Parameters:
key
- the new key- Since:
- 3.0
-
getTextStylePreferenceKey
Returns the preference key for the decoration style used when the annotation is shown in text.- Returns:
- the preference key for the decoration style or
null
if the key is undefined - Since:
- 3.0
-
getTextStyleValue
Returns the value for the decoration style used when the annotation is shown in text.- Returns:
- the value for the decoration style or
null
if the key is undefined - Since:
- 3.0
-
setTextStyleValue
Sets the value for the text style property.- Parameters:
value
- the new text decoration style- Since:
- 3.0
-
getImageDescriptor
Returns the image descriptor for the image to be drawn in the vertical ruler. The provided image is only used, ifgetAnnotationImageProvider
returnsnull
.- Returns:
- the image descriptor or
null
- Since:
- 3.0
-
setImageDescriptor
Sets the image descriptor for the image to be drawn in the vertical ruler.- Parameters:
descriptor
- the image descriptor- Since:
- 3.0
-
getSymbolicImageName
Returns the symbolic name of the image to be drawn in the vertical ruler. The image is only used ifgetImageDescriptor
returnsnull
.- Returns:
- the symbolic name of the image or
null
- Since:
- 3.0
-
setSymbolicImageName
Sets the symbolic name of the image to be drawn in the vertical ruler.- Parameters:
symbolicImageName
- the symbolic image name- Since:
- 3.0
-
getAnnotationImageProvider
Returns the annotation image provider. If no default annotation image provider has been set, this method checks whether the annotation image provider data has been set. If so, an annotation image provider is created if the configuration element's plug-in is loaded. When an annotation image provider has been created successfully, it is set as the default annotation image provider.- Returns:
- the annotation image provider
- Since:
- 3.0
-
setAnnotationImageProvider
Sets the annotation image provider who provides images for annotations of the specified annotation type.- Parameters:
provider
- the annotation image provider- Since:
- 3.0
-
setAnnotationImageProviderData
public void setAnnotationImageProviderData(IConfigurationElement configurationElement, String annotationImageProviderAttribute) Sets the data needed to create the annotation image provider.- Parameters:
configurationElement
- the configuration elementannotationImageProviderAttribute
- the attribute of the configuration element- Since:
- 3.0
-
setIncludeOnPreferencePage
public void setIncludeOnPreferencePage(boolean includeOnPreferencePage) Sets the property of this annotation preference whether it should be included on the default annotation preference page.- Parameters:
includeOnPreferencePage
- the new value- Since:
- 3.0
-
isIncludeOnPreferencePage
public boolean isIncludeOnPreferencePage()Returns the property of the receiver of whether it should be included on the default annotation preference page.- Returns:
- the includeOnPreferencePage property
- Since:
- 3.0
-
merge
Merges the values of the given preference into this preference. Existing values will not be overwritten. Subclasses may extend.- Parameters:
preference
- the preference to merge into this preference- Since:
- 3.0
-
setQuickFixImageDescriptor
Sets the Quick Fix image descriptor for the image to be drawn in the vertical ruler.- Parameters:
descriptor
- the image descriptor- Since:
- 3.2
-
getQuickFixImageDescriptor
Returns the Quick Fix image descriptor for the image to be drawn in the vertical ruler. The provided image is only used, ifgetAnnotationImageProvider
returnsnull
.- Returns:
- the image descriptor or
null
- Since:
- 3.2
-