Java Code Examples for org.eclipse.ui.texteditor.AnnotationPreferenceLookup#getAnnotationPreference()

The following examples show how to use org.eclipse.ui.texteditor.AnnotationPreferenceLookup#getAnnotationPreference() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProblemAnnotation.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup)
{
	Annotation annotation = new Annotation(annotationType, false, null);
	AnnotationPreference preference = lookup.getAnnotationPreference(annotation);
	if (preference != null)
	{
		return preference.getPresentationLayer() + 1;
	}
	else
	{
		return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
	}
}
 
Example 2
Source File: CompilationUnitDocumentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) {
	Annotation annotation= new Annotation(annotationType, false, null);
	AnnotationPreference preference= lookup.getAnnotationPreference(annotation);
	if (preference != null)
		return preference.getPresentationLayer() + 1;
	else
		return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
}
 
Example 3
Source File: SarosAnnotation.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Loads the default colors from the plugin.xml and overwrites possible errors in the EditorsUI
 * preference store.
 */
public static void resetColors() {

  log.debug("resetting annotation colors");

  final IPreferenceStore preferenceStore = EditorsUI.getPreferenceStore();

  final AnnotationPreferenceLookup lookup = EditorsUI.getAnnotationPreferenceLookup();

  final String[] annotationTypesToReset = {
    SelectionAnnotation.TYPE, ViewportAnnotation.TYPE, ContributionAnnotation.TYPE
  };

  for (int i = 0; i <= SIZE; ++i) {

    for (String annotationType : annotationTypesToReset) {

      final String annotationTypeToLookup = getNumberedType(annotationType, i);

      final AnnotationPreference preference =
          lookup.getAnnotationPreference(annotationTypeToLookup);

      if (preference == null) {
        log.warn("could not reset color for annotation type: " + annotationTypeToLookup);
        continue;
      }

      preferenceStore.setToDefault(preference.getColorPreferenceKey());

      if (log.isTraceEnabled()) {
        log.trace(
            "reset "
                + annotationTypeToLookup
                + " to: "
                + preferenceStore.getString(preference.getColorPreferenceKey()));
      }
    }
  }
}