/** * Creates the annotation ruler column. Subclasses may re-implement or extend. * * @param ruler the composite ruler that the column will be added * @return an annotation ruler column * @since 3.2 */ protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) { return new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); }
public void propertyChange(PropertyChangeEvent event) { String property= event.getProperty(); AnnotationPreference annotationPreference= getVerticalRulerAnnotationPreference(property); if (annotationPreference != null && event.getNewValue() instanceof Boolean) { Object type= annotationPreference.getAnnotationType(); if (((Boolean)event.getNewValue()).booleanValue()) column.addAnnotationType(type); else column.removeAnnotationType(type); column.redraw(); } } };
protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) { if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) return super.createAnnotationRulerColumn(ruler); AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { // for now: just invoke ruler double click action triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK); } private void triggerAction(String actionID) { IAction action= getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) action.run(); } } })); return column; }
fDelegate= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, new DefaultMarkerAnnotationAccess()); IPreferenceStore store= getPreferenceStore(); if (store != null && fDelegate instanceof AnnotationRulerColumn) { showAnnotation= store.getBoolean(key); if (showAnnotation) column.addAnnotationType(preference.getAnnotationType()); column.addAnnotationType(Annotation.TYPE_UNKNOWN);
fCanvas= createCanvas(parentControl); doubleBufferPaint(event.gc); }); handleDispose(); fCachedTextViewer= null; fCachedTextWidget= null; fCanvas.addMouseListener(fMouseListener); fCanvas.addMouseMoveListener(e -> handleMouseMove(e)); fCanvas.addMouseWheelListener(e -> handleMouseScrolled(e));
@Override public void run() { redraw(); } });
@Override public void redraw() { if (fCanvas != null && !fCanvas.isDisposed()) { if (VerticalRuler.AVOID_NEW_GC) { fCanvas.redraw(); } else { GC gc= new GC(fCanvas); doubleBufferPaint(gc); gc.dispose(); } } }
@Override public Control createControl(CompositeRuler parentRuler, Composite parentControl) { Control control= super.createControl(parentRuler, parentControl);
fCanvas= createCanvas(parentControl);
@Override protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) { if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) return super.createAnnotationRulerColumn(ruler); AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { // for now: just invoke ruler double click action triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK); } private void triggerAction(String actionID) { IAction action= getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) action.run(); } } })); return column; }
fDelegate= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, new DefaultMarkerAnnotationAccess()); IPreferenceStore store= getPreferenceStore(); if (store != null && fDelegate instanceof AnnotationRulerColumn) { showAnnotation= store.getBoolean(key); if (showAnnotation) column.addAnnotationType(preference.getAnnotationType()); column.addAnnotationType(Annotation.TYPE_UNKNOWN);
@Override public void viewportChanged(int verticalPosition) { if (verticalPosition != fScrollPos) redraw(); }
@Override public void redraw() { if (fCanvas != null && !fCanvas.isDisposed()) { if (VerticalRuler.AVOID_NEW_GC) { fCanvas.redraw(); fCanvas.update(); } else { GC gc= new GC(fCanvas); doubleBufferPaint(gc); gc.dispose(); } } }
@Override public Control createControl(CompositeRuler parentRuler, Composite parentControl) { Control control= super.createControl(parentRuler, parentControl);
@Override protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) { if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) return super.createAnnotationRulerColumn(ruler); AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()); column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { // for now: just invoke ruler double click action triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK); } private void triggerAction(String actionID) { IAction action= getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) action.run(); } } })); return column; }
protected void afterCreatePartialEditor(XtextSourceViewer viewer, XtextDocument document, CompositeRuler verticalRuler, final EmbeddedEditorActions actions) { if (verticalRuler != null && annotationTypes != null && annotationTypes.length > 0) { AnnotationRulerColumn annotationRulerColumn = new AnnotationRulerColumn(viewer.getAnnotationModel(), VERTICAL_RULER_WIDTH, new DefaultMarkerAnnotationAccess() { @Override public int getLayer(Annotation annotation) { annotationRulerColumn.addAnnotationType(annotationType); verticalRuler.addDecorator(1, annotationRulerColumn);
@Override public void propertyChange(PropertyChangeEvent event) { String property= event.getProperty(); AnnotationPreference annotationPreference= getVerticalRulerAnnotationPreference(property); if (annotationPreference != null && property.equals(annotationPreference.getVerticalRulerPreferenceKey())) { Object type= annotationPreference.getAnnotationType(); if (getPreferenceStore().getBoolean(property)) column.addAnnotationType(type); else column.removeAnnotationType(type); column.redraw(); } } };
@Override public void controlResized(ControlEvent e) { if (fCachedTextWidget != null && fCachedTextWidget.getWordWrap()) { redraw(); } } });