Package org.eclipse.jface.text.rules

Examples of org.eclipse.jface.text.rules.DefaultDamagerRepairer


    PartitionType[] partitionTypes = PartitionType.values();
    for (PartitionType partitionType : partitionTypes) {
      ITokenScanner scanner = partitionType.createColoringTokenizer(editor);
      if (scanner != null) {
        DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
        reconciler.setDamager(dr, partitionType.name());
        reconciler.setRepairer(dr, partitionType.name());
      }
    }
    //FIXME: Add back XML syntax coloring some day
View Full Code Here


  @Override
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new ScriptPresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

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

    dr = new DefaultDamagerRepairer(getStringScanner());
    reconciler.setDamager(dr, RutaPartitions.RUTA_STRING);
    reconciler.setRepairer(dr, RutaPartitions.RUTA_STRING);

    dr = new DefaultDamagerRepairer(getCommentScanner());
    reconciler.setDamager(dr, RutaPartitions.RUTA_COMMENT);
    reconciler.setRepairer(dr, RutaPartitions.RUTA_COMMENT);

    return reconciler;
  }
View Full Code Here

    addDamagerRepairer(pr, Colors.OTHER, IDocument.DEFAULT_CONTENT_TYPE);
    return pr;
  }

  private void addDamagerRepairer(PresentationReconciler pr, String partition, ITokenScanner scanner) {
    final DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
    pr.setDamager(dr, partition);
    pr.setRepairer(dr, partition);
  }
View Full Code Here

    final TextAttribute ta = new TextAttribute(color);
    addDamagerRepairer(pr, new SingleTokenScanner(ta), type);
  }
 
  private void addDamagerRepairer(PresentationReconciler pr, ITokenScanner scanner, String type) {
    final DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
    pr.setDamager(dr, type);
    pr.setRepairer(dr, type);
  }
View Full Code Here

  }

  @Override
  public void configurePresentationReconciler(
    PresentationReconciler reconciler, Colors colors) {
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new JavascriptScanner(colors));
    reconciler.setDamager(dr, JS_DEFAULT_TYPE);
    reconciler.setRepairer(dr, JS_DEFAULT_TYPE);
    dr = new DefaultDamagerRepairer(new SingleTokenScanner(new TextAttribute(colors.get(Colors.MULTI_LINE_COMMENT))));
    reconciler.setDamager(dr, JavascriptPartitionScanner.JS_MULTILINE_COMMENT);
    reconciler.setRepairer(dr, JavascriptPartitionScanner.JS_MULTILINE_COMMENT);
  }
View Full Code Here

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

        // Creating the damager/repairer for code
        DefaultDamagerRepairer dr = new DefaultDamagerRepairer( Activator.getDefault().getAciCodeScanner() );
        reconciler.setDamager( dr, IDocument.DEFAULT_CONTENT_TYPE );
        reconciler.setRepairer( dr, IDocument.DEFAULT_CONTENT_TYPE );

        return reconciler;
    }
View Full Code Here

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

        // Creating the damager/repairer for code
        DefaultDamagerRepairer dr = new DefaultDamagerRepairer( Activator.getDefault().getSchemaCodeScanner() );
        reconciler.setDamager( dr, IDocument.DEFAULT_CONTENT_TYPE );
        reconciler.setRepairer( dr, IDocument.DEFAULT_CONTENT_TYPE );

        return reconciler;
    }
View Full Code Here

        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
                ICodeScannerKeywords codeScannerKeywords = null;
                if (sourceViewer instanceof IAdaptable) {
                    IAdaptable iAdaptable = (IAdaptable) sourceViewer;
                    codeScannerKeywords = (ICodeScannerKeywords) iAdaptable.getAdapter(ICodeScannerKeywords.class);
                    codeScanner = new PyCodeScanner(colorCache, codeScannerKeywords);
                } else {
                    codeScanner = new PyCodeScanner(colorCache);
                }
                dr = new DefaultDamagerRepairer(codeScanner);
                reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
                reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
            }
        }
View Full Code Here

      PresentationReconciler reconciler, String contentType) {
   
    IPresentationDamager d = new ClojureTopLevelFormsDamager(editor);
    reconciler.setDamager(d, contentType);
   
    IPresentationRepairer r = new DefaultDamagerRepairer(tokenScanner);
    reconciler.setRepairer(r, contentType);

  }
View Full Code Here

    public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {

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

        DefaultDamagerRepairer dr = null;
        if (apexCodeScanner != null) {
            dr = new DefaultDamagerRepairer(apexCodeScanner);
            reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
            reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
        }
        if (apexDocScanner != null) {
            dr = new DefaultDamagerRepairer(apexDocScanner);
            reconciler.setDamager(dr, ApexPartitionScanner.APEX_DOC);
            reconciler.setRepairer(dr, ApexPartitionScanner.APEX_DOC);
        }

        if (apexCodeColorProvider != null) {
            dr =
                    new DefaultDamagerRepairer(new SingleTokenScanner(new TextAttribute(
                            apexCodeColorProvider.getColor(ApexCodeColorProvider.MULTI_LINE_COMMENT))));
            reconciler.setDamager(dr, ApexPartitionScanner.APEX_MULTILINE_COMMENT);
            reconciler.setRepairer(dr, ApexPartitionScanner.APEX_MULTILINE_COMMENT);
        }
        return reconciler;
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.rules.DefaultDamagerRepairer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.