private static void paintLine(int line, int y, int lineHeight, GC gc, Display display, LineNumberChangeRulerColumn l) { try { Method m = LineNumberRulerColumn.class .getDeclaredMethod("paintLine", new Class[] { int.class, int.class, int.class, GC.class, Display.class }); m.setAccessible(true); m.invoke(l, line, y, lineHeight, gc, display); } catch (Exception e) { e.printStackTrace(); } }
@Override protected void initializeLineNumberRulerColumn(LineNumberRulerColumn rulerColumn) { super.initializeLineNumberRulerColumn(rulerColumn); if (rulerColumn instanceof CommonLineNumberChangeRulerColumn) { ((CommonLineNumberChangeRulerColumn) rulerColumn).showLineNumbers(isLineNumberVisible()); } this.fThemeableEditorColorsExtension.initializeLineNumberRulerColumn(rulerColumn); }
/** * Creates a new line number ruler column that is appropriately initialized. * @param annotationModel * * @return the created line number column */ private IVerticalRulerColumn createLineNumberRulerColumn( ) { LineNumberRulerColumn column = new LineNumberRulerColumn( ); column.setForeground( JSSourceViewerConfiguration.getColorByCategory( PreferenceNames.P_LINENUMBER_COLOR ) ); return column; }
/** * Creates a new line number ruler column that is appropriately initialized. * * @param annotationModel * * @return the created line number column */ private IVerticalRulerColumn createLineNumberRulerColumn( ) { LineNumberRulerColumn column = new LineNumberRulerColumn( ); column.setForeground( JSSourceViewerConfiguration.getColorByCategory( PreferenceNames.P_LINENUMBER_COLOR ) ); return column; }
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 void initializeLineNumberRulerColumn(LineNumberRulerColumn rulerColumn) { this.fLineColumn = rulerColumn; }
@Override protected void initializeLineNumberRulerColumn(LineNumberRulerColumn rulerColumn) { super.initializeLineNumberRulerColumn(rulerColumn); this.onInitializeLineNumberRulerColumn.call(rulerColumn); }
/** * Gets the private field {@code fIndentation} from the parent instance. * * @return the field {@code fIndentation}. * @throws IllegalAccessException * if the Field object is enforcing Java language access control and the field * {@code fIndentation} is inaccessible. * @throws NoSuchFieldException * if the field {@code fIndentation} is not found. */ private int[] getIndentations() throws IllegalAccessException, NoSuchFieldException { // access private field via reflection Field privateField = LineNumberRulerColumn.class.getDeclaredField("fIndentation"); privateField.setAccessible(true); int[] indentations = (int[]) privateField.get(this); privateField.setAccessible(false); return indentations; }