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
FieldsModifier and TypeFieldDescriptionprotected static final Object[]Array of all supported attributes.protected static final ObjectThe preference key for the presentation color.protected static final ObjectThe 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 ObjectIndicates whether the annotation type contributed to the overview ruler's header.protected static final ObjectThe preference key for highlighting inside text.protected static final ObjectThe value for highlighting inside text.protected static final ObjectThe image to be used for drawing in the vertical ruler.protected static final ObjectThe annotation image provider.protected static final ObjectThe value for the includeOnPreferencePage property.protected static final ObjectThe preference key for go to next navigation enablement.protected static final ObjectThe value for go to next navigation enablement.protected static final ObjectThe preference key for go to previous navigation enablement.protected static final ObjectThe value for go to previous navigation enablement.protected static final ObjectThe preference key for the visibility in the overview ruler.protected static final ObjectThe visibility in the overview ruler.protected static final ObjectThe preference label.protected static final ObjectThe presentation layer.protected static final ObjectThe Quick Fix image to be used for drawing in the vertical ruler.protected static final ObjectThe preference key for the visibility in the next/previous drop down toolbar action.protected static final ObjectThe value for the visibility in the next/previous drop down toolbar action.static final StringConstant defining box decoration for the show in text style preference.static final StringConstant defining dashed box decoration for the show in text style preference.static final StringConstant defining i-beam decoration for the show in text style preference.static final StringConstant defining no decoration for the show in text style preference.static final StringConstant defining the native problem underline decoration for the show in text style preference.static final StringConstant defining squiggly decoration for the show in text style preference.static final StringConstant defining underline decoration for the show in text style preference.protected static final ObjectThe symbolic name of the image to be drawn in the vertical ruler.protected static final ObjectThe preference key for the visibility inside text.protected static final ObjectThe visibility inside text.protected static final ObjectThe preference key for the decoration style.protected static final ObjectThe value for the text decoration style.protected static final ObjectThe preference key for the visibility in the vertical ruler.protected static final ObjectThe visibility in the vertical ruler. -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionbooleanReturns whether the annotation type contributes to the header of the overview ruler.Returns the annotation image provider.Returns the annotation type.protected booleangetBooleanValue(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.booleanReturns the default value for highlighting inside text.Returns the image descriptor for the image to be drawn in the vertical ruler.protected intgetIntegerValue(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.booleanReturns the default visibility in the overview ruler.Returns the presentation string for this annotation type.intReturns the presentation layer.Returns the Quick Fix image descriptor for the image to be drawn in the vertical ruler.intDeprecated.since 3.0Returns the preference key for the visibility in the next/previous drop down toolbar action.protected StringgetStringValue(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.booleanReturns 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.booleanReturns the default visibility in the vertical ruler.booleanReturns whether the given attribute is defined.booleanReturns the default value for go to next navigation enablement.booleanReturns the default value for go to previous navigation enablement.booleanReturns the property of the receiver of whether it should be included on the default annotation preference page.booleanisPreferenceKey(String key) Returns whether the given string is a preference key.booleanReturns the default value for the visibility in the next/previous drop down toolbar action.voidmerge(AnnotationPreference preference) Merges the values of the given preference into this preference.voidSets the annotation image provider who provides images for annotations of the specified annotation type.voidsetAnnotationImageProviderData(IConfigurationElement configurationElement, String annotationImageProviderAttribute) Sets the data needed to create the annotation image provider.voidsetAnnotationType(Object annotationType) Sets the annotation type.voidsetColorPreferenceKey(String colorKey) Sets the preference key for the presentation color.voidsetColorPreferenceValue(RGB colorValue) Sets the default presentation color.voidsetContributesToHeader(boolean contributesToHeader) Sets whether the annotation type contributes to the overview ruler's header.voidsetHighlightPreferenceKey(String highlightKey) Sets the preference key for highlighting inside text.voidsetHighlightPreferenceValue(boolean highlightValue) Sets the default value for highlighting inside text.voidsetImageDescriptor(ImageDescriptor descriptor) Sets the image descriptor for the image to be drawn in the vertical ruler.voidsetIncludeOnPreferencePage(boolean includeOnPreferencePage) Sets the property of this annotation preference whether it should be included on the default annotation preference page.voidsetIsGoToNextNavigationTarget(boolean isGoToNextNavigationTarget) Sets the default value for go to next navigation enablement.voidsetIsGoToNextNavigationTargetKey(String isGoToNextNavigationTargetKey) Sets the preference key for go to next navigation enablement.voidsetIsGoToPreviousNavigationTarget(boolean isGoToPreviousNavigationTarget) Sets the default value for go to previous navigation enablement.voidsetIsGoToPreviousNavigationTargetKey(String isGoToPreviousNavigationTargetKey) Sets the preference key for go to previous navigation enablement.voidsetMarkerType(String markerType) Sets the marker type.voidsetOverviewRulerPreferenceKey(String overviewRulerKey) Sets the preference key for the visibility in the overview ruler.voidsetOverviewRulerPreferenceValue(boolean overviewRulerValue) Sets the default visibility in the overview ruler.voidsetPreferenceLabel(String label) Sets the presentation label of this annotation type.voidsetPresentationLayer(int presentationLayer) Sets the presentation layer.voidsetQuickFixImageDescriptor(ImageDescriptor descriptor) Sets the Quick Fix image descriptor for the image to be drawn in the vertical ruler.voidsetSeverity(int severity) Sets the marker severity.voidsetShowInNextPrevDropdownToolbarAction(boolean showInNextPrevDropdownToolbarAction) Sets the default value for the visibility in the next/previous drop down toolbar action.voidsetShowInNextPrevDropdownToolbarActionKey(String showInNextPrevDropdownToolbarActionKey) Sets the preference key for the visibility in the next/previous drop down toolbar action.voidsetSymbolicImageName(String symbolicImageName) Sets the symbolic name of the image to be drawn in the vertical ruler.voidsetTextPreferenceKey(String textKey) Sets the preference key for the visibility of squiggles inside text.voidsetTextPreferenceValue(boolean textValue) Sets the default visibility inside text.voidSets the preference key for the text style property.voidsetTextStyleValue(String value) Sets the value for the text style property.protected voidSets the given value for the given attribute.protected voidSets the given value for the given attribute.protected voidSets the given value for the given attribute.voidsetVerticalRulerPreferenceKey(String verticalRulerKey) Sets the preference key for the visibility in the vertical ruler.voidsetVerticalRulerPreferenceValue(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 anullannotation 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:
trueif the attribute has a valuefalseotherwise- Since:
- 3.0
-
isPreferenceKey
Returns whether the given string is a preference key.- Parameters:
key- the string to test- Returns:
trueif 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,
nullif the receiver has not been initialized yet
-
getMarkerType
Deprecated.since 3.0Returns the marker type.- Returns:
- the marker type, or
nullif none is set
-
getSeverity
Deprecated.since 3.0Returns the marker severity.- Returns:
- the marker severity
-
setAnnotationType
Sets the annotation type. Note that instances with anullannotation 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
nullif none is set
-
getColorPreferenceValue
Returns the default presentation color.- Returns:
- the default presentation color or
nullif none is set
-
getPreferenceLabel
Returns the presentation string for this annotation type.- Returns:
- the presentation string for this annotation type or
nullif 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
nullif 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
nullif 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
nullif 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
nullif 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:
trueif 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-trueif visible by default,falseotherwise
-
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-trueif visible by default,falseotherwise- 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-trueif visible by default,falseotherwise
-
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-trueif highlighted in text by default,falseotherwise- Since:
- 3.0
-
setContributesToHeader
public void setContributesToHeader(boolean contributesToHeader) Sets whether the annotation type contributes to the overview ruler's header.- Parameters:
contributesToHeader-trueif in header,falseotherwise
-
getShowInNextPrevDropdownToolbarActionKey
Returns the preference key for the visibility in the next/previous drop down toolbar action.- Returns:
- the preference key or
nullif 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:
trueif 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-trueif 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
nullif 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
nullif 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, ifgetAnnotationImageProviderreturnsnull.- 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 ifgetImageDescriptorreturnsnull.- 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, ifgetAnnotationImageProviderreturnsnull.- Returns:
- the image descriptor or
null - Since:
- 3.2
-