Package org.eclipse.ui.texteditor

Examples of org.eclipse.ui.texteditor.AnnotationPreference


            + "." + String.valueOf(colorID + 1);

        AnnotationPreferenceLookup lookup = EditorsUI
            .getAnnotationPreferenceLookup();

        final AnnotationPreference ap = lookup
            .getAnnotationPreference(annotationType);

        final AnnotationPreference apForViewPort = lookup
            .getAnnotationPreference(annotationTypeForViewPort);

        final AnnotationPreference apForContribution = lookup
            .getAnnotationPreference(annotationTypeForContribution);

        if (ap == null) {
            return;
        }

        if (apForViewPort == null) {
            return;
        }

        if (apForContribution == null) {
            return;
        }

        try {
            Utils.runSafeSWTSync(log, new Runnable() {
                public void run() {
                    int r = userRGB.red;
                    int g = userRGB.green;
                    int b = userRGB.blue;

                    log.info("Set new User Color: " + userRGB);
                    // Highlighting color of buddy
                    EditorsUI.getPreferenceStore().setValue(
                        ap.getColorPreferenceKey(), r + "," + g + "," + b);

                    // viewport color (side bar, displays what buddy is looking
                    // at)
                    EditorsUI.getPreferenceStore().setValue(
                        apForViewPort.getColorPreferenceKey(),
                        r + "," + g + "," + b);

                    // color for things, that the buddy writes
                    // make a small different color for selection and
                    // contribution color
                    EditorsUI.getPreferenceStore().setValue(
                        apForContribution.getColorPreferenceKey(),
                        (int) (r * 0.9) + "," + (int) (g * 0.9) + ","
                            + (int) (b * 0.9));
                }
            });

View Full Code Here


            + (source.getColorID() + 1);
        setType(annotationType);

        AnnotationPreferenceLookup lookup = EditorsUI
            .getAnnotationPreferenceLookup();
        AnnotationPreference annotationPreference = lookup
            .getAnnotationPreference(annotationType);
        RGB rgb = PreferenceConverter.getColor(EditorsUI.getPreferenceStore(),
            annotationPreference.getColorPreferenceKey());

        Display display = Display.getDefault();
        strokeColor = new Color(display, ColorUtils.scaleColorBy(rgb,
            STROKE_SCALE));
        // FIXME: dispose strokeColor somewhere
View Full Code Here

    }
    return fPreferenceStore;
  }

  boolean isAnnotationValid(Annotation a) {
    AnnotationPreference preference = getAnnotationPreference(a);
    if (preference == null)
      return false;
    String textPreferenceKey = preference.getTextPreferenceKey();
    String highlightPreferenceKey = preference.getHighlightPreferenceKey();
    if (textPreferenceKey == null || !(getPreferenceStore().getBoolean(textPreferenceKey)) || highlightPreferenceKey == null || getPreferenceStore().getBoolean(highlightPreferenceKey))
      return false;
    return true;
  }
View Full Code Here

        ERROR_LAYER= computeLayer("org.eclipse.wst.sse.ui.temp.error", lookup); //$NON-NLS-1$
    }
   
    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;
    }
View Full Code Here

   *         otherwise
   * @see Eclipse 3.0
   */
  protected boolean isNavigationTarget(Annotation annotation) {
    Preferences preferences = EditorsUI.getPluginPreferences();
    AnnotationPreference preference = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
    // See bug 41689
    // String key= forward ? preference.getIsGoToNextNavigationTargetKey()
    // : preference.getIsGoToPreviousNavigationTargetKey();
    String key = preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
    return (key != null && preferences.getBoolean(key));
  }
View Full Code Here

        fAnnotation = annotation;
        fHasCorrection = true;
        layer = annotationLayer;
        continue;
      } else {
        AnnotationPreference preference = fAnnotationPreferenceLookup
                .getAnnotationPreference(annotation);
        if (preference == null)
          continue;

        String key = preference.getVerticalRulerPreferenceKey();
        if (key == null)
          continue;

        if (fStore.getBoolean(key)) {
          fPosition = position;
View Full Code Here

        if (MinimapOverviewRulerPreferencesPage.useMinimap()) {
            IOverviewRuler ruler = new MinimapOverviewRuler(getAnnotationAccess(), sharedColors);

            Iterator e = getAnnotationPreferences().getAnnotationPreferences().iterator();
            while (e.hasNext()) {
                AnnotationPreference preference = (AnnotationPreference) e.next();
                if (preference.contributesToHeader()) {
                    ruler.addHeaderAnnotationType(preference.getAnnotationType());
                }
            }
            return ruler;
        } else {
            return super.createOverviewRuler(sharedColors);
View Full Code Here

    }
    return fPreferenceStore;
  }

  boolean isAnnotationValid(Annotation a) {
    AnnotationPreference preference = getAnnotationPreference(a);
    if (preference == null)
      return false;
    String textPreferenceKey = preference.getTextPreferenceKey();
    String highlightPreferenceKey = preference.getHighlightPreferenceKey();
    if (textPreferenceKey == null
        || !(getPreferenceStore().getBoolean(textPreferenceKey))
        || highlightPreferenceKey == null
        || getPreferenceStore().getBoolean(highlightPreferenceKey))
      return false;
View Full Code Here

   * @return the decoration style for <code>type</code>
   * @since 3.0
   */
  private Object getAnnotationDecorationType(Object annotationType) {
    if (areAnnotationsShown(annotationType) && fPreferenceStore != null) {
      AnnotationPreference info= (AnnotationPreference) fAnnotationTypeKeyMap.get(annotationType);
      if (info != null) {
        String key= info.getTextStylePreferenceKey();
        if (key != null)
          return fPreferenceStore.getString(key);
        else
          // legacy
          return AnnotationPreference.STYLE_BOX;
View Full Code Here

   * @param editorKey the preference key for the presentation in the text area
   * @param overviewRulerKey the preference key for the presentation in the overview  ruler
   * @param layer the layer
   */
  public void setAnnotationPainterPreferenceKeys(Object type, String colorKey, String editorKey, String overviewRulerKey, int layer) {
    AnnotationPreference info = null;
    AnnotationPreferenceLookup prefLookup = new AnnotationPreferenceLookup();
    if(prefLookup != null) {
      // different versions may pas a string or an annotation
      if(type instanceof Annotation) {
        info = prefLookup.getAnnotationPreference((Annotation) type);
      } else {
        info = prefLookup.getAnnotationPreference((String)type);
      }     
    }
    if(info == null) {
      info= new AnnotationPreference(type, colorKey, editorKey, overviewRulerKey, layer);     
    }
    fAnnotationTypeKeyMap.put(type, info);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.texteditor.AnnotationPreference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.