Java 类org.eclipse.ui.texteditor.AnnotationPreference 实例源码

项目:PDFReporter-Studio    文件:StyledTextXtextAdapter.java   
/**
 * Creates decoration support for the sourceViewer. code is entirely copied
 * from {@link XtextEditor} and its super class
 * {@link AbstractDecoratedTextEditor}.
 * 
 */
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
    MarkerAnnotationPreferences annotationPreferences = new MarkerAnnotationPreferences();
    @SuppressWarnings("unchecked")
    List<AnnotationPreference> prefs = annotationPreferences.getAnnotationPreferences();
    for (AnnotationPreference annotationPreference : prefs) {
        support.setAnnotationPreference(annotationPreference);
    }

    support.setCharacterPairMatcher(characterPairMatcher);
    support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY,
            BracketMatchingPreferencesInitializer.COLOR_KEY);

    support.install(preferenceStoreAccess.getPreferenceStore());

}
项目:Pydev    文件:BaseEditor.java   
@Override
protected IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) {
    // Note: create the minimap overview ruler regardless of whether it should be shown or not
    // (the setting to show it will control what's drawn).
    if (MinimapOverviewRulerPreferencesPage.useMinimap()) {
        IOutlineModel outlineModel = (IOutlineModel) this.getAdapter(IOutlineModel.class);
        IOverviewRuler ruler = new MinimapOverviewRuler(getAnnotationAccess(), sharedColors, outlineModel);

        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);
    }
}
项目:Hydrograph    文件:SourceViewer.java   
private void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {

        Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator();
        while (e.hasNext()) {
            support.setAnnotationPreference((AnnotationPreference) e.next());
        }

        support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
        support.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN);
        support.setSymbolicFontName(JFaceResources.TEXT_FONT);
    }
项目:subclipse    文件:CommitCommentArea.java   
private Color getSpellingErrorColor(Composite composite) {
    AnnotationPreference pref = EditorsUI
            .getAnnotationPreferenceLookup().getAnnotationPreference(
                    "org.eclipse.ui.workbench.texteditor.spelling"); // $NON-NLS-1$
    String preferenceKey = pref.getColorPreferenceKey();
    try {
        return fResources.createColor(PreferenceConverter.getColor(EditorsUI.getPreferenceStore(), preferenceKey));
    } catch (DeviceResourceException e) {
        SVNUIPlugin.log(IStatus.ERROR, Policy.bind("internal"), e); //$NON-NLS-1$
        return JFaceColors.getErrorText(composite.getDisplay());
    }
}
项目:mesfavoris    文件:SpellcheckableMessageArea.java   
private SourceViewerDecorationSupport configureAnnotationPreferences() {
    ISharedTextColors textColors = EditorsUI.getSharedTextColors();
    IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
    final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(
            sourceViewer, null, annotationAccess, textColors);

    List annotationPreferences = new MarkerAnnotationPreferences()
    .getAnnotationPreferences();
    Iterator e = annotationPreferences.iterator();
    while (e.hasNext())
        support.setAnnotationPreference((AnnotationPreference) e.next());

    support.install(EditorsUI.getPreferenceStore());
    return support;
}
项目:typescript.java    文件:AbstractAnnotationHover.java   
@Override
public void run() {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

    Object data = null;
    AnnotationPreference preference = getAnnotationPreference(fAnnotation);
    if (preference != null)
        data = preference.getPreferenceLabel();

    fInfoControl.dispose(); // FIXME: should have protocol to hide,
                            // rather than dispose
    PreferencesUtil
            .createPreferenceDialogOn(shell, "org.eclipse.ui.editors.preferencePages.Annotations", null, data) //$NON-NLS-1$
            .open();
}
项目:bts    文件:XtextAnnotation.java   
public XtextAnnotation(String type, boolean isPersistent, IXtextDocument document, Issue issue, boolean isQuickfixable) {
    super(type, isPersistent, issue.getMessage());

    AnnotationPreference preference= lookup.getAnnotationPreference(this);
    if (preference != null)
        this.layer = preference.getPresentationLayer() + 1;
    else
        this.layer = IAnnotationAccessExtension.DEFAULT_LAYER + 1;

    this.document = document;
    this.issue = issue;
    this.isQuickfixable = isQuickfixable;
}
项目:statecharts    文件:StyledTextXtextAdapter.java   
/**
 * Creates decoration support for the sourceViewer. code is entirely copied from
 * {@link XtextEditor} and its super class {@link AbstractDecoratedTextEditor}.
 * 
 */
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
    MarkerAnnotationPreferences annotationPreferences = new MarkerAnnotationPreferences();
    List<AnnotationPreference> prefs = annotationPreferences.getAnnotationPreferences();
    for (AnnotationPreference annotationPreference : prefs) {
        support.setAnnotationPreference(annotationPreference);
    }

    support.setCharacterPairMatcher(getCharacterPairMatcher());
    support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY,
            BracketMatchingPreferencesInitializer.COLOR_KEY);

    support.install(getPreferenceStoreAccess().getPreferenceStore());
}
项目:APICloud-Studio    文件:CommitCommentArea.java   
private Color getSpellingErrorColor(Composite composite) {
    AnnotationPreference pref = EditorsUI
            .getAnnotationPreferenceLookup().getAnnotationPreference(
                    "org.eclipse.ui.workbench.texteditor.spelling"); // $NON-NLS-1$
    String preferenceKey = pref.getColorPreferenceKey();
    try {
        return fResources.createColor(PreferenceConverter.getColor(EditorsUI.getPreferenceStore(), preferenceKey));
    } catch (DeviceResourceException e) {
        SVNUIPlugin.log(IStatus.ERROR, Policy.bind("internal"), e); //$NON-NLS-1$
        return JFaceColors.getErrorText(composite.getDisplay());
    }
}
项目:APICloud-Studio    文件:ProblemAnnotation.java   
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;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitDocumentProvider.java   
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;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
/**
 * Tells whether override indicators are shown.
 *
 * @return <code>true</code> if the override indicators are shown
 * @since 3.0
 */
protected boolean isShowingOverrideIndicators() {
    AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(OverrideIndicatorManager.ANNOTATION_TYPE);
    IPreferenceStore store= getPreferenceStore();
    return getBoolean(store, preference.getHighlightPreferenceKey())
        || getBoolean(store, preference.getVerticalRulerPreferenceKey())
        || getBoolean(store, preference.getOverviewRulerPreferenceKey())
        || getBoolean(store, preference.getTextPreferenceKey());
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
/**
 * Determines whether the preference change encoded by the given event
 * changes the override indication.
 *
 * @param event the event to be investigated
 * @return <code>true</code> if event causes a change
 * @since 3.0
 */
protected boolean affectsOverrideIndicatorAnnotations(PropertyChangeEvent event) {
    String key= event.getProperty();
    AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(OverrideIndicatorManager.ANNOTATION_TYPE);
    if (key == null || preference == null)
        return false;

    return key.equals(preference.getHighlightPreferenceKey())
        || key.equals(preference.getVerticalRulerPreferenceKey())
        || key.equals(preference.getOverviewRulerPreferenceKey())
        || key.equals(preference.getTextPreferenceKey());
}
项目:Eclipse-Postfix-Code-Completion    文件:AbstractAnnotationHover.java   
@Override
public void run() {
    Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

    Object data= null;
    AnnotationPreference preference= getAnnotationPreference(fAnnotation);
    if (preference != null)
        data= preference.getPreferenceLabel();

    fInfoControl.dispose(); //FIXME: should have protocol to hide, rather than dispose
    PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.editors.preferencePages.Annotations", null, data).open(); //$NON-NLS-1$
}
项目:Eclipse-Postfix-Code-Completion    文件:AbstractAnnotationHover.java   
/**
 * Returns the annotation preference for the given annotation.
 *
 * @param annotation the annotation
 * @return the annotation preference or <code>null</code> if none
 */
private static AnnotationPreference getAnnotationPreference(Annotation annotation) {

    if (annotation.isMarkedDeleted())
        return null;
    return EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
/**
 * Gets the respective color value from the annotation preferences based on the given color key.
 * 
 * @param colorKey
 *            the given color key.
 * @param annotationPreferences
 *            the annotation preferences.
 * @return the color.
 */
private Color getColorValueFor(String colorKey, List<AnnotationPreference> annotationPreferences) {
    for (AnnotationPreference aPref : annotationPreferences) {
        if (colorKey.equals(aPref.getColorPreferenceKey())) {
            RGB rgb = aPref.getColorPreferenceValue();
            return new Color(Display.getCurrent(), rgb.red, rgb.green, rgb.blue);
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitDocumentProvider.java   
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;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
/**
 * Tells whether override indicators are shown.
 *
 * @return <code>true</code> if the override indicators are shown
 * @since 3.0
 */
protected boolean isShowingOverrideIndicators() {
    AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(OverrideIndicatorManager.ANNOTATION_TYPE);
    IPreferenceStore store= getPreferenceStore();
    return getBoolean(store, preference.getHighlightPreferenceKey())
        || getBoolean(store, preference.getVerticalRulerPreferenceKey())
        || getBoolean(store, preference.getOverviewRulerPreferenceKey())
        || getBoolean(store, preference.getTextPreferenceKey());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
/**
 * Determines whether the preference change encoded by the given event
 * changes the override indication.
 *
 * @param event the event to be investigated
 * @return <code>true</code> if event causes a change
 * @since 3.0
 */
protected boolean affectsOverrideIndicatorAnnotations(PropertyChangeEvent event) {
    String key= event.getProperty();
    AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(OverrideIndicatorManager.ANNOTATION_TYPE);
    if (key == null || preference == null)
        return false;

    return key.equals(preference.getHighlightPreferenceKey())
        || key.equals(preference.getVerticalRulerPreferenceKey())
        || key.equals(preference.getOverviewRulerPreferenceKey())
        || key.equals(preference.getTextPreferenceKey());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AbstractAnnotationHover.java   
@Override
public void run() {
    Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

    Object data= null;
    AnnotationPreference preference= getAnnotationPreference(fAnnotation);
    if (preference != null)
        data= preference.getPreferenceLabel();

    fInfoControl.dispose(); //FIXME: should have protocol to hide, rather than dispose
    PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.editors.preferencePages.Annotations", null, data).open(); //$NON-NLS-1$
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AbstractAnnotationHover.java   
/**
 * Returns the annotation preference for the given annotation.
 *
 * @param annotation the annotation
 * @return the annotation preference or <code>null</code> if none
 */
private static AnnotationPreference getAnnotationPreference(Annotation annotation) {

    if (annotation.isMarkedDeleted())
        return null;
    return EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
}
项目:goclipse    文件:AbstractAnnotationHover.java   
/**
 * Returns the annotation preference for the given annotation.
 *
 * @param annotation the annotation
 * @return the annotation preference or <code>null</code> if none
 */
private static AnnotationPreference getAnnotationPreference(Annotation annotation) {

    if (annotation.isMarkedDeleted())
        return null;
    return EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
}
项目:typescript.java    文件:AbstractAnnotationHover.java   
@Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
    IPath path;
    IAnnotationModel model;
    if (textViewer instanceof ISourceViewer) {
        path = null;
        model = ((ISourceViewer) textViewer).getAnnotationModel();
    } else {
        // Get annotation model from file buffer manager
        path = getEditorInputPath();
        model = getAnnotationModel(path);
    }
    if (model == null)
        return null;

    try {
        Iterator<Annotation> parent;
        if (model instanceof IAnnotationModelExtension2)
            parent = ((IAnnotationModelExtension2) model).getAnnotationIterator(hoverRegion.getOffset(),
                    hoverRegion.getLength() > 0 ? hoverRegion.getLength() : 1, true, true);
        else
            parent = model.getAnnotationIterator();
        Iterator<Annotation> e = new TypeScriptAnnotationIterator(parent, fAllAnnotations);

        int layer = -1;
        Annotation annotation = null;
        Position position = null;
        while (e.hasNext()) {
            Annotation a = e.next();

            AnnotationPreference preference = getAnnotationPreference(a);
            if (preference == null || !(preference.getTextPreferenceKey() != null
            /*
             * && fStore.getBoolean(preference.getTextPreferenceKey()) ||
             * (preference.getHighlightPreferenceKey() != null &&
             * fStore.getBoolean(preference.getHighlightPreferenceKey()))
             */))
                continue;

            Position p = model.getPosition(a);

            int l = fAnnotationAccess.getLayer(a);

            if (l > layer && p != null && p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
                String msg = a.getText();
                if (msg != null && msg.trim().length() > 0) {
                    layer = l;
                    annotation = a;
                    position = p;
                }
            }
        }
        if (layer > -1)
            return createAnnotationInfo(annotation, position, textViewer);

    } finally {
        try {
            if (path != null) {
                ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
                manager.disconnect(path, LocationKind.NORMALIZE, null);
            }
        } catch (CoreException ex) {
            TypeScriptUIPlugin.log(ex.getStatus());
        }
    }

    return null;
}
项目:bts    文件:WrappedSourceViewer.java   
public void createPartControl(Composite parent)
{
    int VERTICAL_RULER_WIDTH = 12;

    int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
    ISharedTextColors sharedColors = EditorsPlugin.getDefault().getSharedTextColors();
    IOverviewRuler overviewRuler = new OverviewRuler(null, VERTICAL_RULER_WIDTH, sharedColors);
    CompositeRuler ruler = new CompositeRuler(VERTICAL_RULER_WIDTH);

    _document = new Document();
    _document.set(_docString);

    _annotationModel = new AnnotationModel();
    _annotationModel.connect(_document);

    _sourceViewer = new SourceViewer(parent, ruler, overviewRuler, true, styles);
    _sourceViewer.configure(new SourceViewerConfiguration());

    _sds = new SourceViewerDecorationSupport(_sourceViewer, overviewRuler, null, sharedColors);

    AnnotationPreference ap = new AnnotationPreference();
    ap.setColorPreferenceKey(ANNO_KEY_COLOR);
    ap.setHighlightPreferenceKey(ANNO_KEY_HIGHLIGHT);
    ap.setVerticalRulerPreferenceKey(ANNO_KEY_VERTICAL);
    ap.setOverviewRulerPreferenceKey(ANNO_KEY_OVERVIEW);
    ap.setTextPreferenceKey(ANNO_KEY_TEXT);
    ap.setAnnotationType(ANNO_TYPE);
    _sds.setAnnotationPreference(ap);

    //      _sds.install(EditorsPlugin.getDefault().getPreferenceStore());

    _sourceViewer.setDocument(_document, _annotationModel);

    _sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    ruler.addDecorator(0, new LineNumberRulerColumn());

    Annotation annotation = new Annotation(false);
    annotation.setType(ANNO_TYPE);
    Position position = new Position(0, 4);
    _annotationModel.addAnnotation(annotation, position);
    parent.layout();
}
项目:brainfuck    文件:BfSourceViewerConfiguration.java   
@Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
    IAnnotationModel model = sourceViewer.getAnnotationModel();
    @SuppressWarnings("unchecked")
    Iterator<Annotation> i = model.getAnnotationIterator();
    Annotation provideText = null;
    AnnotationPreferenceLookup preferenceLookup = EditorsUI.getAnnotationPreferenceLookup();
    int annotationLayer = -1;
    while (i.hasNext()) {
        Annotation ann = i.next();

        Position p = model.getPosition(ann);
        if (p == null || !p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
            continue;
        }
        if (UNCHANGED_QUICKDIFF_ANNOTATION.equals(ann.getType())) {
            continue; //Ignore unchanged line notification
        }
        if (provideText == null) {
            provideText = ann;
        }
        AnnotationPreference preference = preferenceLookup.getAnnotationPreference(ann);
        if (preference != null && preference.getPresentationLayer() > annotationLayer) {
            provideText = ann;
            annotationLayer = preference.getPresentationLayer();
        }
    }
    String text = null;
    if (provideText != null) {
        if (this.hoverContributions.containsKey(provideText.getType())) {
            text = this.hoverContributions.get(provideText.getType()).getHoverText(provideText, textViewer, hoverRegion);
        }
        else {
            text = "<b>" +  provideText.getText() + "</b>";
        }
    }
    try {
        if (text == null) {
            IDocument document = textViewer.getDocument();
            if (document instanceof IDocumentExtension3) {
                IDocumentExtension3 ext3 = (IDocumentExtension3) document;
                ITypedRegion partition = ext3.getPartition(EditorConstants.BF_PARTITIONING, hoverRegion.getOffset(), false);
                if (EditorConstants.PARTITION_TYPE_BRAINFUCK_CODE.equals(partition.getType())) {
                    text = "Offset: [<b>" + hoverRegion.getOffset() + "</b>]";
                }
            }
        }
    }
    catch (BadLocationException | BadPartitioningException ex) {
        BfActivator.getDefault().logError("hoverRegion partitioning could not be evaluated", ex);
    }
    return text;
}
项目:APICloud-Studio    文件:ThemeManager.java   
private void setAnnotationColorsToMatchTheme(Theme theme)
{
    IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode("org.eclipse.ui.editors"); //$NON-NLS-1$
    if (!theme.hasEntry("override.searchResultIndication")) //$NON-NLS-1$
    {
        prefs.put("searchResultIndicationColor", toString(theme.getSearchResultColor())); //$NON-NLS-1$
    }
    // TODO Use markup.changed bg color for "decoration color" in Prefs>General>Appearance>Colors and Fonts

    // TODO Move this stuff over to theme change listeners in the XML/HTML/Ruby editor plugins?
    if (!theme.hasEntry("override.xmlTagPairOccurrenceIndication")) //$NON-NLS-1$
    {
        prefs.putBoolean("xmlTagPairOccurrenceIndicationHighlighting", false); //$NON-NLS-1$
        prefs.putBoolean("xmlTagPairOccurrenceIndication", true); //$NON-NLS-1$
        prefs.put("xmlTagPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
        prefs.put("xmlTagPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
    }
    if (!theme.hasEntry("override.htmlTagPairOccurrenceIndication")) //$NON-NLS-1$
    {
        prefs.putBoolean("htmlTagPairOccurrenceIndicationHighlighting", false); //$NON-NLS-1$
        prefs.putBoolean("htmlTagPairOccurrenceIndication", true); //$NON-NLS-1$
        prefs.put("htmlTagPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
        prefs.put("htmlTagPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
    }
    if (!theme.hasEntry("override.rubyBlockPairOccurrenceIndication")) //$NON-NLS-1$
    {
        prefs.putBoolean("rubyBlockPairOccurrenceIndicationHighlighting", false); //$NON-NLS-1$
        prefs.putBoolean("rubyBlockPairOccurrenceIndication", true); //$NON-NLS-1$
        prefs.put("rubyBlockPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
        prefs.put("rubyBlockPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
    }
    // PyDev Occurrences (com.python.pydev.occurrences)
    // Override them if pydev is set to use our themes
    if (Platform.getPreferencesService().getBoolean("org.python.pydev.red_core", "PYDEV_USE_APTANA_THEMES", true, //$NON-NLS-1$ //$NON-NLS-2$
            null))
    {
        if (!theme.hasEntry("override.pydevOccurrenceIndication")) //$NON-NLS-1$
        {
            MarkerAnnotationPreferences preferences = new MarkerAnnotationPreferences();
            AnnotationPreference pydevOccurPref = null;
            for (Object obj : preferences.getAnnotationPreferences())
            {
                AnnotationPreference pref = (AnnotationPreference) obj;
                Object type = pref.getAnnotationType();
                if ("com.python.pydev.occurrences".equals(type)) //$NON-NLS-1$
                {
                    pydevOccurPref = pref;
                }
            }
            if (pydevOccurPref != null)
            {
                if (pydevOccurPref.getTextStylePreferenceKey() != null)
                {
                    // Now that pydev supports text style, use the box style and don't highlight.
                    prefs.putBoolean("pydevOccurrenceHighlighting", false); //$NON-NLS-1$
                    prefs.putBoolean("pydevOccurrenceIndication", true); //$NON-NLS-1$
                    prefs.put("pydevOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); //$NON-NLS-1$
                    prefs.put("pydevOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); //$NON-NLS-1$
                }
                else
                {
                    // Must use highlighting, since we're against older pydev that had no text style
                    prefs.putBoolean("pydevOccurrenceHighlighting", true); //$NON-NLS-1$
                    prefs.putBoolean("pydevOccurrenceIndication", true); //$NON-NLS-1$
                    prefs.put("pydevOccurrenceIndicationColor", toString(theme.getSearchResultColor())); //$NON-NLS-1$
                }
            }
        }
    }

    try
    {
        prefs.flush();
    }
    catch (BackingStoreException e)
    {
        IdeLog.logError(ThemePlugin.getDefault(), e);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaSelectAnnotationRulerAction.java   
private void findJavaAnnotation() {
    fPosition= null;
    fAnnotation= null;
    fHasCorrection= false;

    AbstractMarkerAnnotationModel model= getAnnotationModel();
    IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();

    IDocument document= getDocument();
    if (model == null)
        return ;

    boolean hasAssistLightbulb= fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);

    Iterator<Annotation> iter= model.getAnnotationIterator();
    int layer= Integer.MIN_VALUE;

    while (iter.hasNext()) {
        Annotation annotation= iter.next();
        if (annotation.isMarkedDeleted())
            continue;

        int annotationLayer= layer;
        if (annotationAccess != null) {
            annotationLayer= annotationAccess.getLayer(annotation);
            if (annotationLayer < layer)
                continue;
        }

        Position position= model.getPosition(annotation);
        if (!includesRulerLine(position, document))
            continue;

        AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
        if (preference == null)
            continue;

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

        if (!fStore.getBoolean(key))
            continue;

        boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
        if (!isReadOnly
                && (
                    ((hasAssistLightbulb && annotation instanceof AssistAnnotation)
                    || JavaCorrectionProcessor.hasCorrections(annotation)))) {
            fPosition= position;
            fAnnotation= annotation;
            fHasCorrection= true;
            layer= annotationLayer;
            continue;
        } else if (!fHasCorrection) {
                fPosition= position;
                fAnnotation= annotation;
                layer= annotationLayer;
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaExpandHover.java   
@Override
protected Object getHoverInfoForLine(final ISourceViewer viewer, final int line) {
    final boolean showTemporaryProblems= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
    IAnnotationModel model= viewer.getAnnotationModel();
    IDocument document= viewer.getDocument();

    if (model == null)
        return null;

    List<Annotation> exact= new ArrayList<Annotation>();
    HashMap<Position, Object> messagesAtPosition= new HashMap<Position, Object>();

    Iterator<Annotation> e= model.getAnnotationIterator();
    while (e.hasNext()) {
        Annotation annotation= e.next();

        if (fAnnotationAccess instanceof IAnnotationAccessExtension)
            if (!((IAnnotationAccessExtension)fAnnotationAccess).isPaintable(annotation))
                continue;

        if (annotation instanceof IJavaAnnotation && !isIncluded((IJavaAnnotation)annotation, showTemporaryProblems))
            continue;

        AnnotationPreference pref= fLookup.getAnnotationPreference(annotation);
        if (pref != null) {
            String key= pref.getVerticalRulerPreferenceKey();
            if (key != null && !fStore.getBoolean(key))
                continue;
        }

        Position position= model.getPosition(annotation);
        if (position == null)
            continue;

        if (compareRulerLine(position, document, line) == 1) {

            if (isDuplicateMessage(messagesAtPosition, position, annotation.getText()))
                continue;

            exact.add(annotation);
        }
    }

    sort(exact, model);

    if (exact.size() > 0)
        setLastRulerMouseLocation(viewer, line);

    if (exact.size() > 0) {
        Annotation first= exact.get(0);
        if (!isBreakpointAnnotation(first))
            exact.add(0, new NoBreakpointAnnotation());
    }

    if (exact.size() <= 1)
        return null;

    AnnotationHoverInput input= new AnnotationHoverInput();
    input.fAnnotations= exact.toArray(new Annotation[0]);
    input.fViewer= viewer;
    input.fRulerInfo= fCompositeRuler;
    input.fAnnotationListener= fgListener;
    input.fDoubleClickListener= fDblClickListener;
    input.redoAction= new AnnotationExpansionControl.ICallback() {

        public void run(IInformationControlExtension2 control) {
            control.setInput(getHoverInfoForLine(viewer, line));
        }

    };
    input.model= model;

    return input;
}
项目:Eclipse-Postfix-Code-Completion    文件:AbstractAnnotationHover.java   
@Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
    IPath path;
    IAnnotationModel model;
    if (textViewer instanceof ISourceViewer) {
        path= null;
        model= ((ISourceViewer)textViewer).getAnnotationModel();
    } else {
        // Get annotation model from file buffer manager
        path= getEditorInputPath();
        model= getAnnotationModel(path);
    }
    if (model == null)
        return null;

    try {
        Iterator<Annotation> parent;
        if (model instanceof IAnnotationModelExtension2)
            parent= ((IAnnotationModelExtension2)model).getAnnotationIterator(hoverRegion.getOffset(), hoverRegion.getLength(), true, true);
        else
            parent= model.getAnnotationIterator();
        Iterator<Annotation> e= new JavaAnnotationIterator(parent, fAllAnnotations);

        int layer= -1;
        Annotation annotation= null;
        Position position= null;
        while (e.hasNext()) {
            Annotation a= e.next();

            AnnotationPreference preference= getAnnotationPreference(a);
            if (preference == null || !(preference.getTextPreferenceKey() != null && fStore.getBoolean(preference.getTextPreferenceKey()) || (preference.getHighlightPreferenceKey() != null && fStore.getBoolean(preference.getHighlightPreferenceKey()))))
                continue;

            Position p= model.getPosition(a);

            int l= fAnnotationAccess.getLayer(a);

            if (l > layer && p != null && p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
                String msg= a.getText();
                if (msg != null && msg.trim().length() > 0) {
                    layer= l;
                    annotation= a;
                    position= p;
                }
            }
        }
        if (layer > -1)
            return createAnnotationInfo(annotation, position, textViewer);

    } finally {
        try {
            if (path != null) {
                ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
                manager.disconnect(path, LocationKind.NORMALIZE, null);
            }
        } catch (CoreException ex) {
            JavaPlugin.log(ex.getStatus());
        }
    }

    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:MarkOccurrencesConfigurationBlock.java   
/**
 * Creates page for mark occurrences preferences.
 *
 * @param parent the parent composite
 * @return the control for the preference page
 */
public Control createControl(final Composite parent) {

    Composite composite= new Composite(parent, SWT.NONE);
    GridLayout layout= new GridLayout();
    layout.numColumns= 1;
    layout.marginHeight= 0;
    layout.marginWidth= 0;
    composite.setLayout(layout);

    Link link= new Link(composite, SWT.NONE);
    link.setText(PreferencesMessages.MarkOccurrencesConfigurationBlock_link);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            String data= null;
            AnnotationPreference preference= EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference("org.eclipse.jdt.ui.occurrences"); //$NON-NLS-1$
            if (preference != null)
                data= preference.getPreferenceLabel();
            PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, data);
        }
    });

    addFiller(composite);

    String label;

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markOccurrences;
    Button master= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_OCCURRENCES, 0);

    addFiller(composite);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markTypeOccurrences;
    Button slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES, 0);
    createDependency(master, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markMethodOccurrences;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markConstantOccurrences;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markFieldOccurrences;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markLocalVariableOccurrences;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markExceptionOccurrences;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_EXCEPTION_OCCURRENCES, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_EXCEPTION_OCCURRENCES, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markMethodExitPoints;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markImplementors;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_IMPLEMENTORS, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_IMPLEMENTORS, slave);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markBreakContinueTargets;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_BREAK_CONTINUE_TARGETS, 0);
    createDependency(master, PreferenceConstants.EDITOR_MARK_BREAK_CONTINUE_TARGETS, slave);

    addFiller(composite);

    label= PreferencesMessages.MarkOccurrencesConfigurationBlock_stickyOccurrences;
    slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, 0);
    createDependency(master, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, slave);

    return composite;
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
/**
 * Highlights the differences within the unified difference editor.
 * 
 * @return the color to unified lines mapping.
 */
@SuppressWarnings({ "unchecked" })
public Map<Integer, Color> highlightLines() {
    // initialize local variables
    UnifiedDiffConnectorModel diffModel = editorInput.getDiffConnectorModel();
    Map<Integer, Color> colorToUnifiedLinesMapping = new HashMap<Integer, Color>();
    MarkerAnnotationPreferences maPrefs = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    List<AnnotationPreference> aPrefs = (List<AnnotationPreference>) (List<?>) maPrefs.getAnnotationPreferences();
    IFile ressource = (IFile) editorInput.getAdapter(IFile.class);

    // add new markers from connector content
    int offset = 0;
    int lineCount = editor.getViewer().getTextWidget().getLineCount();
    int lineTextLength = 0;
    String lineText = "";
    for (int line = 0; line < lineCount - 1; line++) {
        lineText = editor.getViewer().getTextWidget().getLine(line);
        lineTextLength = lineText.length();

        // create marker according to type
        MarkerType markerType = diffModel.getMarkerTypeFor(line);
        if (markerType != MarkerType.NONE) {
            try {
                IMarker marker = ressource.createMarker(UIConstants.UNIFIED_DIFF_MARKERTYPE);
                TextSelection selection = new TextSelection(offset, lineTextLength);
                createAnnotation(marker, selection, this.editor, markerType);

            } catch (CoreException exception) {
                LOGGER.error("An error occurred while creating a marker or setting an attribute for said marker!",
                        exception);
            }

            // get and add color to mapping
            IGetMarkerColor getMarkerColor = markerTypeToGetMarkerColor.get(markerType);
            colorToUnifiedLinesMapping.put(line, getMarkerColor.get(aPrefs)); 
        }

        offset += lineTextLength + 1;
    }

    return colorToUnifiedLinesMapping;
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_LEADING_DARK, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_LEADING_LIGHT, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_INTEGRATION1_DARK, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_INTEGRATION1_LIGHT, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_INTEGRATION2_DARK, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_INTEGRATION2_LIGHT, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_INTEGRATION3_DARK, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_INTEGRATION3_LIGHT, annotationPreferences);
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
@Override
public Color get(List<AnnotationPreference> annotationPreferences) {
    return getColorValueFor(UIConstants.CKEY_MIXED_DARK, annotationPreferences);
}