@Override protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { super.configureSourceViewerDecorationSupport(support); support.setCharacterPairMatcher(fBracketMatcher); support.setMatchingCharacterPainterPreferenceKeys( PydevEditorPrefs.USE_MATCHING_BRACKETS, PydevEditorPrefs.MATCHING_BRACKETS_COLOR); }
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { support.setCharacterPairMatcher(pairMatcher); support.setMatchingCharacterPainterPreferenceKeys( org.eclipse.jdt.ui.PreferenceConstants.EDITOR_MATCHING_BRACKETS, org.eclipse.jdt.ui.PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR); super.configureSourceViewerDecorationSupport(support); }
/** * @param parent * @param ruler * @param styles */ public DiffViewer(Composite parent, IVerticalRuler ruler, int styles) { super(parent, ruler, styles); setDocument(new Document()); SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(this, null, null, EditorsUI.getSharedTextColors()); support.setCursorLinePainterPreferenceKeys( AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR); support.install(EditorsUI.getPreferenceStore()); if (ruler instanceof CompositeRuler) { lineNumberRuler = new LineNumberRulerColumn(); ((CompositeRuler) ruler).addDecorator(0, lineNumberRuler); } initListeners(); getControl() .addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { EditorsUI.getPreferenceStore().removePropertyChangeListener(editorPrefListener); PlatformUI.getWorkbench() .getThemeManager() .removePropertyChangeListener(themeListener); colors.dispose(); } }); refreshDiffColors(); styleViewer(); }
@Override protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { support.setCharacterPairMatcher(this.fBracketMatcher); support.setMatchingCharacterPainterPreferenceKeys( PreferenceConstants.EDITOR_MATCHING_BRACKETS, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR); super.configureSourceViewerDecorationSupport(support); }
// for bracket matching @Override protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { super.configureSourceViewerDecorationSupport(support); char[] brackets = {'(', ')', '[', ']'}; ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(brackets, IDocumentExtension3.DEFAULT_PARTITIONING); support.setCharacterPairMatcher(matcher); support.setMatchingCharacterPainterPreferenceKeys( Activator.PREFERENCE_BRACKET_MATCHING, Activator.PREFERENCE_COLOR_BRACKET_MATCHING); }
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; }
@Override protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { super.configureSourceViewerDecorationSupport(support); if (AttemptToChangeCurrentLineColorAccordingToTheme) { adjustCurrentLineColor(getTheme()); support.setCursorLinePainterPreferenceKeys( AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, PreferenceConstants.CUSTOM_CURRENT_LINE_COLOR); } }
public void dispose() { getEditorPreferenceStore().removePropertyChangeListener(this); JFaceResources.getFontRegistry().removeListener(this); JFaceResources.getColorRegistry().removeListener(this); if (fSourceViewerDecorationSupport != null) { fSourceViewerDecorationSupport.dispose(); fSourceViewerDecorationSupport = null; } if (fActions != null) { fActions.clear(); fActions = null; } }
public void create(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(data); fVerticalRuler = createCompositeRuler(); fOverviewRuler = createOverviewRuler(getSharedColors()); createActions(); fViewer = createViewer(composite, fVerticalRuler, fOverviewRuler); fControl = composite; createViewContextMenu(); createRulerContextMenu(); if (fSourceViewerDecorationSupport != null) { fSourceViewerDecorationSupport.install(getEditorPreferenceStore()); } }
/* * overview ruler problem: displayed in both viewers. the diff editor ruler is actually custom drawn (see * TextMergeViewer.fBirdsEyeCanvas) the ruler that gets created in this method is longer than the editor, meaning its * not an overview (not next to the scrollbar) */ @SuppressWarnings("unused") private void createOverviewRuler(IDocument newInput, Class<SourceViewer> sourceViewerClazz) throws SecurityException, NoSuchMethodException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { sourceViewer.setOverviewRulerAnnotationHover(new CommentAnnotationHover(null)); OverviewRuler ruler = new OverviewRuler( new DefaultMarkerAnnotationAccess(), 15, EditorsPlugin.getDefault().getSharedTextColors()); Field compositeField = sourceViewerClazz.getDeclaredField("fComposite"); compositeField.setAccessible(true); ruler.createControl((Composite) compositeField.get(sourceViewer), sourceViewer); ruler.setModel(annotationModel); // ruler.setModel(compareAnnotationModel.leftAnnotationModel); // XXX should go through SourceViewerDecorationSupport instead // ruler.addAnnotationType("org.eclipse.mylyn.reviews.ui.comment.Annotation"); // ruler.setAnnotationTypeLayer("org.eclipse.mylyn.reviews.ui.comment.Annotation", 1); // ruler.update(); IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess(); final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport( sourceViewer, ruler, annotationAccess, EditorsUI.getSharedTextColors()); Iterator<?> e = new MarkerAnnotationPreferences().getAnnotationPreferences().iterator(); while (e.hasNext()) { support.setAnnotationPreference((AnnotationPreference) e.next()); } support.install(EditorsUI.getPreferenceStore()); sourceViewer .getControl() .addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { support.dispose(); } }); Field overViewRulerField = sourceViewerClazz.getDeclaredField("fOverviewRuler"); overViewRulerField.setAccessible(true); if (overViewRulerField.get(sourceViewer) == null) { overViewRulerField.set(sourceViewer, ruler); } Method declareMethod = sourceViewerClazz.getDeclaredMethod("ensureOverviewHoverManagerInstalled"); declareMethod.setAccessible(true); declareMethod.invoke(sourceViewer); // overviewRuler is null Field hoverManager = sourceViewerClazz.getDeclaredField("fOverviewRulerHoveringController"); hoverManager.setAccessible(true); AnnotationBarHoverManager manager = (AnnotationBarHoverManager) hoverManager.get(sourceViewer); if (manager != null) { Field annotationHover = AnnotationBarHoverManager.class.getDeclaredField("fAnnotationHover"); annotationHover.setAccessible(true); IAnnotationHover hover = (IAnnotationHover) annotationHover.get(manager); annotationHover.set(manager, new CommentAnnotationHover(null)); } sourceViewer.showAnnotations(true); sourceViewer.showAnnotationsOverview(true); declareMethod = sourceViewerClazz.getDeclaredMethod("showAnnotationsOverview", new Class[] {Boolean.TYPE}); declareMethod.setAccessible(true); }
private void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { for (Object pref : fAnnotationPreferences.getAnnotationPreferences()) { support.setAnnotationPreference((AnnotationPreference) pref); } support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR); }