/*
   * (non-Javadoc)
   * @see
   * com.aptana.editor.common.ISourceViewerConfiguration#setupPresentationReconciler(org.eclipse.jface.text.presentation
   * .PresentationReconciler, org.eclipse.jface.text.source.ISourceViewer)
   */
  public void setupPresentationReconciler(
      PresentationReconciler reconciler, ISourceViewer sourceViewer) {
    DefaultDamagerRepairer dr = new ThemeingDamagerRepairer(new IDLSourceScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    reconciler.setDamager(dr, DEFAULT);
    reconciler.setRepairer(dr, DEFAULT);

    DefaultDamagerRepairer docCommentDR =
        new ThemeingDamagerRepairer(
            new CommentScanner(getToken("comment.block.documentation.idl"))); // $NON-NLS-1$
    reconciler.setDamager(docCommentDR, IDL_DOC_COMMENT);
    reconciler.setRepairer(docCommentDR, IDL_DOC_COMMENT);

    DefaultDamagerRepairer multilineCommentDR =
        new ThemeingDamagerRepairer(
            new CommentScanner(getToken("comment.block.idl"))); // $NON-NLS-1$
    reconciler.setDamager(multilineCommentDR, IDL_MULTILINE_COMMENT);
    reconciler.setRepairer(multilineCommentDR, IDL_MULTILINE_COMMENT);

    DefaultDamagerRepairer singlelineCommentDR =
        new ThemeingDamagerRepairer(
            new CommentScanner(getToken("comment.line.double-slash.idl"))); // $NON-NLS-1$
    reconciler.setDamager(singlelineCommentDR, IDL_SINGLELINE_COMMENT);
    reconciler.setRepairer(singlelineCommentDR, IDL_SINGLELINE_COMMENT);
  }
コード例 #2
0
  @Override
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

    MarkupDamagerRepairer damagerRepairer = new MarkupDamagerRepairer(getMarkupScanner());
    for (String partitionType : FastMarkupPartitioner.ALL_CONTENT_TYPES) {
      reconciler.setDamager(damagerRepairer, partitionType);
      reconciler.setRepairer(damagerRepairer, partitionType);
    }
    reconciler.setDamager(damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE);

    return reconciler;
  }
コード例 #3
0
 private void configureReconciler(
     PresentationReconciler reconciler, String partitionType, ITokenScanner scanner) {
   DefaultDamagerRepairer dr;
   dr = new DefaultDamagerRepairer(scanner);
   reconciler.setDamager(dr, partitionType);
   reconciler.setRepairer(dr, partitionType);
 }
コード例 #4
0
  /*
   * @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;
  }
コード例 #5
0
 public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceView) {
   PresentationReconciler reconciler = new PresentationReconciler();
   DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getScanner());
   reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
   reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
   return reconciler;
 }
コード例 #6
0
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    LogManager.logDebug("Start getPresentationReconciler: sourceViewer-" + sourceViewer, this);
    PresentationReconciler reconciler = new PresentationReconciler();

    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    IPreferenceStore store = IDEPlugin.getDefault().getPreferenceStore();
    RGB comment = PreferenceConverter.getColor(store, IDEPreferenceConstants.P_C_COMMENT_COLOR);
    NonRuleBasedDamagerRepairer ndr =
        new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(comment)));
    reconciler.setDamager(ndr, CPartitionScanner.C_COMMENT);
    reconciler.setRepairer(ndr, CPartitionScanner.C_COMMENT);

    LogManager.logDebug("End getPresentationReconciler: returnVal-" + reconciler, this);
    return reconciler;
  }
コード例 #7
0
  @Override
  public IPresentationReconciler getPresentationReconciler(final ISourceViewer aSourceViewer) {

    initProviders();

    // Scanners
    RestLiteralBlockScanner literalBlockScanner = new RestLiteralBlockScanner(pRuleProvider);

    RestSectionBlockScanner sectionBlockScanner = new RestSectionBlockScanner(pRuleProvider);

    RestSourceBlockScanner sourceBlockScanner = new RestSourceBlockScanner(pTokenProvider);

    RestTableBlockScanner tableBlockScanner = new RestTableBlockScanner(pRuleProvider);

    // Reconciler
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(aSourceViewer));

    // Text data
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getDocumentScanner());

    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    // Literal blocks
    dr = new DefaultDamagerRepairer(literalBlockScanner);
    reconciler.setDamager(dr, RestPartitionScanner.LITERAL_BLOCK);
    reconciler.setRepairer(dr, RestPartitionScanner.LITERAL_BLOCK);

    // Section blocks
    dr = new DefaultDamagerRepairer(sectionBlockScanner);
    reconciler.setDamager(dr, RestPartitionScanner.SECTION_BLOCK);
    reconciler.setRepairer(dr, RestPartitionScanner.SECTION_BLOCK);

    // Source blocks
    dr = new DefaultDamagerRepairer(sourceBlockScanner);
    reconciler.setDamager(dr, RestPartitionScanner.SOURCE_BLOCK);
    reconciler.setRepairer(dr, RestPartitionScanner.SOURCE_BLOCK);

    // Table blocks
    dr = new DefaultDamagerRepairer(tableBlockScanner);
    reconciler.setDamager(dr, RestPartitionScanner.GRID_TABLE_BLOCK);
    reconciler.setRepairer(dr, RestPartitionScanner.GRID_TABLE_BLOCK);

    return reconciler;
  }
コード例 #8
0
  @Override
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {

    PresentationReconciler reconciler = new DartPresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    dr = new DefaultDamagerRepairer(getJavaDocScanner());
    reconciler.setDamager(new DartIndiscriminateDamager(), DartPartitions.DART_DOC);
    reconciler.setRepairer(dr, DartPartitions.DART_DOC);
    reconciler.setDamager(new DartIndiscriminateDamager(), DartPartitions.DART_SINGLE_LINE_DOC);
    reconciler.setRepairer(dr, DartPartitions.DART_SINGLE_LINE_DOC);

    dr = new DefaultDamagerRepairer(getMultilineCommentScanner());
    reconciler.setDamager(dr, DartPartitions.DART_MULTI_LINE_COMMENT);
    reconciler.setRepairer(dr, DartPartitions.DART_MULTI_LINE_COMMENT);

    dr = new DefaultDamagerRepairer(getSinglelineCommentScanner());
    reconciler.setDamager(dr, DartPartitions.DART_SINGLE_LINE_COMMENT);
    reconciler.setRepairer(dr, DartPartitions.DART_SINGLE_LINE_COMMENT);

    dr = new DefaultDamagerRepairer(getStringScanner());
    reconciler.setDamager(dr, DartPartitions.DART_STRING);
    reconciler.setRepairer(dr, DartPartitions.DART_STRING);

    dr = new DefaultDamagerRepairer(getMultilineStringScanner());
    reconciler.setDamager(dr, DartPartitions.DART_MULTI_LINE_STRING);
    reconciler.setRepairer(dr, DartPartitions.DART_MULTI_LINE_STRING);

    return reconciler;
  }
コード例 #9
0
  /*
   * (non-Javadoc)
   * @see
   * com.aptana.editor.common.ISourceViewerConfiguration#setupPresentationReconciler(org.eclipse.jface.text.presentation
   * .PresentationReconciler, org.eclipse.jface.text.source.ISourceViewer)
   */
  public void setupPresentationReconciler(
      PresentationReconciler reconciler, ISourceViewer sourceViewer) {
    DefaultDamagerRepairer dr =
        new ThemeingDamagerRepairer(Activator.getDefault().getCodeScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    reconciler.setDamager(dr, DEFAULT);
    reconciler.setRepairer(dr, DEFAULT);

    dr = new ThemeingDamagerRepairer(getWordScanner());
    reconciler.setDamager(dr, MULTILINE_COMMENT);
    reconciler.setRepairer(dr, MULTILINE_COMMENT);

    dr = new ThemeingDamagerRepairer(getStringScanner());
    reconciler.setDamager(dr, STRING);
    reconciler.setRepairer(dr, STRING);
  }
コード例 #10
0
  /**
   * This code is used to activate syntax coloring for each section detected by the
   * XWikiPartitionner The partitioner is activated in createDocument in PageDocumentProvider.java
   *
   * @see PageDocumentProvider#createDocument(Object)
   */
  @Override
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

    /* Use the XWiki markup for tables and default content. */
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new XWikiMarkupScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_TABLE);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_TABLE);

    /* Use the Velocity Scanner for velocity blocks */
    dr = new DefaultDamagerRepairer(new VelocityScanner());
    reconciler.setDamager(dr, XWikiPartitionScanner.VELOCITY);
    reconciler.setRepairer(dr, XWikiPartitionScanner.VELOCITY);

    /* Use the Groovy Scanner for groovy blocks */
    dr = new DefaultDamagerRepairer(new GroovyScanner());
    reconciler.setDamager(dr, XWikiPartitionScanner.GROOVY);
    reconciler.setRepairer(dr, XWikiPartitionScanner.GROOVY);

    /* Use a uniform style for html blocks. */
    RuleBasedScanner codeScanner = new RuleBasedScanner();
    codeScanner.setDefaultReturnToken(
        new Token(Preferences.getDefault().getTextAttribute(Preferences.Style.HTML)));
    dr = new DefaultDamagerRepairer(codeScanner);
    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_HTML);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_HTML);

    /* Use a uniform style for code blocks. */
    codeScanner = new RuleBasedScanner();
    codeScanner.setDefaultReturnToken(
        new Token(Preferences.getDefault().getTextAttribute(Preferences.Style.CODE)));
    dr = new DefaultDamagerRepairer(codeScanner);
    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_CODE);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_CODE);

    /* Use a uniform style for pre blocks. */
    RuleBasedScanner preScanner = new RuleBasedScanner();
    preScanner.setDefaultReturnToken(
        new Token(Preferences.getDefault().getTextAttribute(Preferences.Style.CODE)));
    dr = new DefaultDamagerRepairer(preScanner);
    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_PRE);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_PRE);

    RuleBasedScanner javadocScanner = new GroovyScanner();
    dr = new DefaultDamagerRepairer(javadocScanner);
    reconciler.setDamager(dr, GroovyPartitionScanner.GROOVY_DEFAULT);
    reconciler.setRepairer(dr, GroovyPartitionScanner.GROOVY_DEFAULT);

    return reconciler;
  }
コード例 #11
0
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();

    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getXMLTagScanner());
    reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
    reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);

    dr = new DefaultDamagerRepairer(getXMLScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    NonRuleBasedDamagerRepairer ndr =
        new NonRuleBasedDamagerRepairer(
            new TextAttribute(colorManager.getColor(IXMLColorConstants.XML_COMMENT)));
    reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
    reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);

    return reconciler;
  }
コード例 #12
0
 private void addDelegatedKeywords(PresentationReconciler reconciler) {
   Collection delegates = mode.getDelegates().keySet();
   for (Iterator rules = delegates.iterator(); rules.hasNext(); ) {
     String mungedName = (String) rules.next();
     Rule rule = (Rule) mode.getDelegates().get(mungedName);
     RuleBasedScanner scanner = getDelegateScanner(rule);
     DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
     reconciler.setDamager(dr, mungedName);
     reconciler.setRepairer(dr, mungedName);
   }
 }
コード例 #13
0
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
  */
 @Override
 public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
   PresentationReconciler reconciler = new PresentationReconciler();
   AbstractIntentScanner[] usedScanners = getScanners();
   for (int i = 0; i < usedScanners.length; i++) {
     AbstractIntentScanner scanner = usedScanners[i];
     DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
     reconciler.setDamager(dr, scanner.getConfiguredContentType());
     reconciler.setRepairer(dr, scanner.getConfiguredContentType());
   }
   return reconciler;
 }
コード例 #14
0
  public org.eclipse.jface.text.presentation.IPresentationReconciler getPresentationReconciler(
      org.eclipse.jface.text.source.ISourceViewer sourceViewer) {

    org.eclipse.jface.text.presentation.PresentationReconciler reconciler =
        new org.eclipse.jface.text.presentation.PresentationReconciler();
    org.eclipse.jface.text.rules.DefaultDamagerRepairer repairer =
        new org.eclipse.jface.text.rules.DefaultDamagerRepairer(getScanner());
    reconciler.setDamager(repairer, org.eclipse.jface.text.IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(repairer, org.eclipse.jface.text.IDocument.DEFAULT_CONTENT_TYPE);

    return reconciler;
  }
  /*
   * @see SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
   */
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {

    PresentationReconciler reconciler = new JavaPresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    dr = new DefaultDamagerRepairer(getJavaDocScanner());
    reconciler.setDamager(dr, IJavaPartitions.JAVA_DOC);
    reconciler.setRepairer(dr, IJavaPartitions.JAVA_DOC);

    dr = new DefaultDamagerRepairer(getMultilineCommentScanner());
    reconciler.setDamager(dr, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
    reconciler.setRepairer(dr, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);

    dr = new DefaultDamagerRepairer(getSinglelineCommentScanner());
    reconciler.setDamager(dr, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
    reconciler.setRepairer(dr, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);

    dr = new DefaultDamagerRepairer(getStringScanner());
    reconciler.setDamager(dr, IJavaPartitions.JAVA_STRING);
    reconciler.setRepairer(dr, IJavaPartitions.JAVA_STRING);

    dr = new DefaultDamagerRepairer(getStringScanner());
    reconciler.setDamager(dr, IJavaPartitions.JAVA_CHARACTER);
    reconciler.setRepairer(dr, IJavaPartitions.JAVA_CHARACTER);

    return reconciler;
  }
コード例 #16
0
  @Override
  public IPresentationReconciler getPresentationReconciler(final ISourceViewer sourceViewer) {
    final PresentationReconciler reconciler = new ErlangPresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    DefaultDamagerRepairer dr = new ErlDamagerRepairer(codeScanner);
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    dr = new ErlDamagerRepairer(commentScanner);
    reconciler.setDamager(dr, IErlangPartitions.ERLANG_COMMENT);
    reconciler.setRepairer(dr, IErlangPartitions.ERLANG_COMMENT);
    dr = new ErlDamagerRepairer(stringScanner);
    reconciler.setDamager(dr, IErlangPartitions.ERLANG_STRING);
    reconciler.setRepairer(dr, IErlangPartitions.ERLANG_STRING);
    dr = new ErlDamagerRepairer(qatomScanner);
    reconciler.setDamager(dr, IErlangPartitions.ERLANG_QATOM);
    reconciler.setRepairer(dr, IErlangPartitions.ERLANG_QATOM);
    dr = new ErlDamagerRepairer(charScanner);
    reconciler.setDamager(dr, IErlangPartitions.ERLANG_CHARACTER);
    reconciler.setRepairer(dr, IErlangPartitions.ERLANG_CHARACTER);

    return reconciler;
  }
コード例 #17
0
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {

    PresentationReconciler reconciler = new PresentationReconciler();

    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    dr = new DefaultDamagerRepairer(getMultilineCommentScanner());
    reconciler.setDamager(dr, IConstants.SQL_MULTILINE_COMMENT);
    reconciler.setRepairer(dr, IConstants.SQL_MULTILINE_COMMENT);

    dr = new DefaultDamagerRepairer(getSinglelineCommentScanner());
    reconciler.setDamager(dr, IConstants.SQL_SINGLE_LINE_COMMENT);
    reconciler.setRepairer(dr, IConstants.SQL_SINGLE_LINE_COMMENT);

    dr = new DefaultDamagerRepairer(getStringScanner());
    reconciler.setDamager(dr, IConstants.SQL_STRING);
    reconciler.setRepairer(dr, IConstants.SQL_STRING);

    return reconciler;
  }
コード例 #18
0
 private void setupScannerType(PresentationReconciler reconciler, String typeName) {
   String[] contentTypes = mode.getContentTypes();
   for (int i = 0; i < contentTypes.length; i++) {
     String contentType = contentTypes[i];
     if (!contentType.startsWith(typeName)) continue;
     RuleBasedScanner scanner = new RuleBasedScanner();
     String type = contentType.substring(contentType.lastIndexOf('.') + 1);
     IToken defaultToken = newToken(colorManager.colorForType(type));
     scanner.setDefaultReturnToken(defaultToken);
     DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
     reconciler.setDamager(dr, contentType);
     reconciler.setRepairer(dr, contentType);
   }
 }
コード例 #19
0
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {

    synchronized (lock) {
      if (reconciler == null) {
        reconciler = new PresentationReconciler();
        reconciler.setDocumentPartitioning(IPythonPartitions.PYTHON_PARTITION_TYPE);

        DefaultDamagerRepairer dr;

        // DefaultDamagerRepairer implements both IPresentationDamager, IPresentationRepairer
        // IPresentationDamager::getDamageRegion does not scan, just
        // returns the intersection of document event, and partition region
        // IPresentationRepairer::createPresentation scans
        // gets each token, and sets text attributes according to token

        // We need to cover all the content types from PyPartitionScanner

        // Comments have uniform color
        commentScanner = new PyColoredScanner(colorCache, PydevEditorPrefs.COMMENT_COLOR);
        dr = new DefaultDamagerRepairer(commentScanner);
        reconciler.setDamager(dr, IPythonPartitions.PY_COMMENT);
        reconciler.setRepairer(dr, IPythonPartitions.PY_COMMENT);

        // Backquotes have uniform color
        backquotesScanner = new PyColoredScanner(colorCache, PydevEditorPrefs.BACKQUOTES_COLOR);
        dr = new DefaultDamagerRepairer(backquotesScanner);
        reconciler.setDamager(dr, IPythonPartitions.PY_BACKQUOTES);
        reconciler.setRepairer(dr, IPythonPartitions.PY_BACKQUOTES);

        // Strings have uniform color
        stringScanner = new PyColoredScanner(colorCache, PydevEditorPrefs.STRING_COLOR);
        dr = new DefaultDamagerRepairer(stringScanner);
        reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_STRING1);
        reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_STRING1);
        reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_STRING2);
        reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_STRING2);
        reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_STRING1);
        reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_STRING1);
        reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_STRING2);
        reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_STRING2);

        // Default content is code, we need syntax highlighting
        codeScanner = new PyCodeScanner(colorCache);
        dr = new DefaultDamagerRepairer(codeScanner);
        reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
        reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
      }
    }

    return reconciler;
  }
コード例 #20
0
 private void setupScannerTypeForMark(PresentationReconciler reconciler) {
   String[] contentTypes = mode.getContentTypes();
   for (int i = 0; i < contentTypes.length; i++) {
     String contentType = contentTypes[i];
     if (contentType.startsWith(Type.MARK_PREVIOUS)
         || contentType.startsWith(Type.MARK_FOLLOWING)) {
       RuleBasedScanner scanner = new RuleBasedScanner();
       String colorType = contentType.substring(contentType.lastIndexOf('.') + 1);
       LToken defaultToken = (LToken) newToken(colorManager.colorForType(colorType), true);
       defaultToken.setLength(getLength(contentType));
       defaultToken.isPrevious(contentType.startsWith(Type.MARK_PREVIOUS));
       scanner.setDefaultReturnToken(defaultToken);
       DefaultDamagerRepairer dr = new MarkDamagerRepairer(scanner);
       reconciler.setDamager(dr, contentType);
       reconciler.setRepairer(dr, contentType);
     }
   }
 }
コード例 #21
0
 private void addKeywordHighlighting(PresentationReconciler reconciler) {
   RuleBasedScanner codeScanner = getCodeScanner();
   DefaultDamagerRepairer dr = new DefaultDamagerRepairer(codeScanner);
   reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
   reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
 }
コード例 #22
0
  /*
   * (non-Javadoc)
   * @see
   * com.aptana.editor.common.ISourceViewerConfiguration#setupPresentationReconciler(org.eclipse.jface.text.presentation
   * .PresentationReconciler, org.eclipse.jface.text.source.ISourceViewer)
   */
  public void setupPresentationReconciler(
      PresentationReconciler reconciler, ISourceViewer sourceViewer) {
    DefaultDamagerRepairer dr = new ThemeingDamagerRepairer(getCodeScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    reconciler.setDamager(dr, DEFAULT);
    reconciler.setRepairer(dr, DEFAULT);

    dr = new ThemeingDamagerRepairer(getBlockCommentScanner());
    reconciler.setDamager(dr, MULTILINE_COMMENT);
    reconciler.setRepairer(dr, MULTILINE_COMMENT);

    dr = new ThemeingDamagerRepairer(getSingleQuotedStringScanner());
    reconciler.setDamager(dr, STRING_SINGLE);
    reconciler.setRepairer(dr, STRING_SINGLE);

    dr = new ThemeingDamagerRepairer(getDoubleQuotedStringScanner());
    reconciler.setDamager(dr, STRING_DOUBLE);
    reconciler.setRepairer(dr, STRING_DOUBLE);

    dr = new ThemeingDamagerRepairer(getSingleLineCommentScanner());
    reconciler.setDamager(dr, SINGLELINE_COMMENT);
    reconciler.setRepairer(dr, SINGLELINE_COMMENT);

    dr = new ThemeingDamagerRepairer(getRegexpScanner());
    reconciler.setDamager(dr, REGEXP);
    reconciler.setRepairer(dr, REGEXP);

    dr = new ThemeingDamagerRepairer(getHeredocScanner());
    reconciler.setDamager(dr, HEREDOC);
    reconciler.setRepairer(dr, HEREDOC);

    dr = new ThemeingDamagerRepairer(getDoubleHeredocScanner());
    reconciler.setDamager(dr, DOUBLE_HEREDOC);
    reconciler.setRepairer(dr, DOUBLE_HEREDOC);

    dr = new ThemeingDamagerRepairer(getCommandScanner());
    reconciler.setDamager(dr, COMMAND);
    reconciler.setRepairer(dr, COMMAND);

    dr = new ThemeingDamagerRepairer(getHeregexScanner());
    reconciler.setDamager(dr, HEREGEX);
    reconciler.setRepairer(dr, HEREGEX);
  }
コード例 #23
0
 private void setDamagerRepairer(
     PresentationReconciler pr, DefaultDamagerRepairer damagerRepairer, String tokenType) {
   pr.setDamager(damagerRepairer, tokenType);
   pr.setRepairer(damagerRepairer, tokenType);
 }