@Override public Object invoke(Object obj, Method thisMethod, Method proceed, Object[] args) throws Throwable { if ("createControl".equals(thisMethod.getName())) { CompositeRuler parentRuler = (CompositeRuler) args[0]; this.fCachedTextViewer = parentRuler.getTextViewer(); this.fCachedTextWidget = fCachedTextViewer.getTextWidget(); } else if ("setDisplayMode".equals(thisMethod.getName())) { this.fCharacterDisplay = (boolean) args[0]; } else if ("doPaint".equals(thisMethod.getName()) && args.length > 1) { GC gc = (GC) args[0]; ILineRange visibleLines = (ILineRange) args[1]; if (fRevisionPainter == null) { fRevisionPainter = getValue("fRevisionPainter", obj); fDiffPainter = getValue("fDiffPainter", obj); } LineNumberChangeRulerColumn l = ((LineNumberChangeRulerColumn) obj); doPaint(gc, visibleLines, l); return null; } return proceed.invoke(obj, args); }
@Override protected void handlePreferenceStoreChanged(final PropertyChangeEvent event) { final LineNumberColumn c; super.handlePreferenceStoreChanged(event); if (event.getProperty().equals(PREFERENCE_COLOR_BACKGROUND)) { // this.fSourceViewerDecorationSupport.updateOverviewDecorations(); this.getVerticalRuler().getControl() .setBackground(GamaColors.get(AutoStartup.EDITOR_BACKGROUND_COLOR.getValue()).color()); final Iterator e = ((CompositeRuler) getVerticalRuler()).getDecoratorIterator(); while (e.hasNext()) { final IVerticalRulerColumn column = (IVerticalRulerColumn) e.next(); column.getControl() .setBackground(GamaColors.get(AutoStartup.EDITOR_BACKGROUND_COLOR.getValue()).color()); column.redraw(); } } }
public SqlSourceViewer(Composite parent, int style) { super(parent, new CompositeRuler(), SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | style); this.setRangeIndicator(new DefaultRangeIndicator()); this.configure(new SQLEditorSourceViewerConfiguration(EditorsUI .getSharedTextColors(), Activator.getDefault() .getPreferenceStore(), null)); this.getTextWidget().setFont(JFaceResources.getTextFont()); }
@Override public void createPartControl(Composite composite) { SourceViewer sourceViewer = (SourceViewer) createTypeScriptSourceViewer(composite, new CompositeRuler(), null, false, fTextOrientation | SWT.H_SCROLL | SWT.V_SCROLL, createChainedPreferenceStore(null)); setSourceViewer(this, sourceViewer); createNavigationActions(); getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener()); }
@Override public Control createControl(CompositeRuler parentRuler, Composite parentControl) { Control control = super.createControl(parentRuler, parentControl); setBackground(BTSUIConstants.COLOR_RULER_COLUMN_BACKGROUND); return control; }
@SuppressWarnings("unchecked") private void overrideRulerColors() { IThemeableEditor editor = this.fEditor.get(); // default to bg color of surrounding composite Color bg = null; // Use editor background color if we can if (editor != null) { ISourceViewer sv = editor.getISourceViewer(); if (sv != null) { StyledText text = sv.getTextWidget(); if (text != null) { bg = text.getBackground(); // copy the color because for some reason it gets disposed bg = ThemePlugin.getDefault().getColorManager().getColor(bg.getRGB()); } } // force the colors for all the ruler columns (specifically so we force the folding bg to match). CompositeRuler ruler = (CompositeRuler) editor.getIVerticalRuler(); Iterator<IVerticalRulerColumn> iter = ruler.getDecoratorIterator(); while (iter.hasNext()) { IVerticalRulerColumn column = iter.next(); column.getControl().setBackground(bg); } } if (fLineColumn != null) { fLineColumn.setBackground(bg); } }
@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() { 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; }
@Override public void createPartControl(Composite composite) { SourceViewer sourceViewer= (SourceViewer)createJavaSourceViewer(composite, new CompositeRuler(), null, false, fTextOrientation | SWT.H_SCROLL | SWT.V_SCROLL, createChainedPreferenceStore(null)); setSourceViewer(this, sourceViewer); createNavigationActions(); getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener()); }
/** * Creates a new line number ruler column that is appropriately initialized. * * @return the created line number column */ private CompositeRuler createCompositeRuler( ) { CompositeRuler ruler = new CompositeRuler( ); ruler.setModel( new AnnotationModel( ) ); return ruler; }
/** * Creates the vertical ruler to be used by this editor. * * @return the vertical ruler */ protected IVerticalRuler createVerticalRuler( ) { CompositeRuler ruler = createCompositeRuler( ); ruler.addDecorator( 0, createLineNumberRulerColumn( ) ); return ruler; }
/** * Creates the vertical ruler to be used by this editor. * * @return the vertical ruler */ private IVerticalRuler createVerticalRuler( ) { IVerticalRuler ruler = createCompositeRuler( ); if ( ruler instanceof CompositeRuler ) { CompositeRuler compositeRuler = (CompositeRuler) ruler; compositeRuler.addDecorator( 0, createLineNumberRulerColumn( ) ); } return ruler; }
public static CompositeRuler getCpAnnotationRuler() { return cpAnnotationRuler; }
public static void setCpAnnotationRuler(CompositeRuler cpAnnotationRuler) { EmbeddedEditorFactory.cpAnnotationRuler = cpAnnotationRuler; }
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(); }
public Control createControl(CompositeRuler parentRuler, Composite parentControl) { Control control= super.createControl(parentRuler, parentControl); fRevisionPainter.setParentRuler(parentRuler); fDiffPainter.setParentRuler(parentRuler); return control; }
public JavaExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) { super(ruler, access, doubleClickListener); }
@Override protected IVerticalRuler createVerticalRuler() { // main purpose of this is to get a reference to the vertical ruler object ruler = (CompositeRuler) super.createVerticalRuler(); return ruler; }
@Override protected SourceViewer createSourceViewer(Composite parent, int textOrientation) { int styles = textOrientation | SWT.H_SCROLL | SWT.V_SCROLL; return new LangSourceViewer(parent, new CompositeRuler(), styles); }
/** * Creates a new hover instance. * * @param ruler * @param access * @param doubleClickListener */ public AnnotationExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) { fCompositeRuler= ruler; fAnnotationAccess= access; fDblClickListener= doubleClickListener; }