private void updateLineNumberColumnPresentation(boolean refresh) {
   if (fLineNumberColumn == null) return;
   RGB rgb =
       getColorFromStore(
           EditorsUI.getPreferenceStore(),
           AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR);
   if (rgb == null) rgb = new RGB(0, 0, 0);
   ISharedTextColors sharedColors = getSharedColors();
   fLineNumberColumn.setForeground(sharedColors.getColor(rgb));
   if (refresh) {
     fLineNumberColumn.redraw();
   }
 }
 private IRule createBoldItalicRule() {
   Color color = colors.getColor(new RGB(0, 0, 0));
   TextAttribute attr = new TextAttribute(color, null, SWT.BOLD | SWT.ITALIC);
   IToken token = new Token(attr);
   SingleLineRule rule = new SingleLineRule("'''''", "'''''", token);
   return rule;
 }
 private IRule createNumberedListRule() {
   Color color = colors.getColor(new RGB(63, 127, 95));
   IToken dashToken = new Token(new TextAttribute(color, null, SWT.NONE));
   SingleLineRule singleLineRule = new SingleLineRule("#", "\n", dashToken);
   singleLineRule.setColumnConstraint(0);
   return singleLineRule;
 }
 private IRule createHeader6Rule() {
   Color color = colors.getColor(new RGB(0, 0, 140));
   IToken token = new Token(new TextAttribute(color, null, SWT.NONE));
   SingleLineRule rule = new SingleLineRule("======", "======\n", token);
   rule.setColumnConstraint(0);
   return rule;
 }
  /*
   * @seeorg.eclipse.jface.text.source.SourceViewerConfiguration#
   * getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
   */
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getDefaultScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    reconciler.setDamager(dr, WikiPartitionScanner.SectionToken);
    reconciler.setRepairer(dr, WikiPartitionScanner.SectionToken);

    TextAttribute attr = new TextAttribute(colors.getColor(ColorSource));
    NonRuleBasedDamagerRepairer nr = new NonRuleBasedDamagerRepairer(attr);
    reconciler.setDamager(nr, WikiPartitionScanner.SourceToken);
    reconciler.setRepairer(nr, WikiPartitionScanner.SourceToken);

    return reconciler;
  }
示例#6
0
  /**
   * Enables projection mode. If not yet done, installs the projection ruler column in the viewer's
   * vertical ruler and installs a painter that indicate the locations of collapsed regions.
   */
  protected void doEnableProjection() {

    if (fPainter == null) {
      fPainter = new ProjectionAnnotationsPainter(fViewer, fAnnotationAccess);
      fPainter.addDrawingStrategy(PROJECTION, getDrawingStrategy());
      fPainter.addAnnotationType(ProjectionAnnotation.TYPE, PROJECTION);
      fPainter.setAnnotationTypeColor(
          ProjectionAnnotation.TYPE, fSharedTextColors.getColor(getColor()));
      fViewer.addPainter(fPainter);
    }

    if (fColumn == null) {
      fColumn = new ProjectionRulerColumn(9, fAnnotationAccess);
      fColumn.addAnnotationType(ProjectionAnnotation.TYPE);
      fColumn.setHover(createProjectionAnnotationHover());
      fViewer.addVerticalRulerColumn(fColumn);
    }

    fColumn.setModel(fViewer.getVisualAnnotationModel());
  }
 protected SingleQuotedStringScanner getSingleQuotedStringScanner() {
   if (_sqsScanner == null) {
     _sqsScanner = new SingleQuotedStringScanner(_colorManager.getColor(BooColorConstants.STRING));
   }
   return _sqsScanner;
 }
 private IRule createItalicRule() {
   Color color = colors.getColor(new RGB(0, 0, 0));
   IToken italicToken = new Token(new TextAttribute(color, null, SWT.ITALIC));
   SingleLineRule singleLineRule = new SingleLineRule("''", "''", italicToken);
   return singleLineRule;
 }
 private IRule createBoldRule() {
   Color color = colors.getColor(new RGB(0, 0, 0));
   IToken boldToken = new Token(new TextAttribute(color, null, SWT.BOLD));
   SingleLineRule singleLineRule = new SingleLineRule("'''", "'''", boldToken);
   return singleLineRule;
 }
 private IRule createExternalHTTPRule() {
   Color color = colors.getColor(new RGB(200, 100, 100));
   IToken token = new Token(new TextAttribute(color, null, SWT.NONE));
   SingleLineRule rule = new SingleLineRule("[http", "]", token);
   return rule;
 }
 private IRule createListRule() {
   Color color = colors.getColor(new RGB(63, 127, 95));
   IToken dashToken = new Token(new TextAttribute(color, null, SWT.NONE));
   SingleLineRule singleLineRule = new SingleLineRule(" * ", "\n", dashToken);
   return singleLineRule;
 }