Examples of IDocumentPartitioner


Examples of org.eclipse.jface.text.IDocumentPartitioner

public class TMLDocumentProvider extends FileDocumentProvider {

  protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
      IDocumentPartitioner partitioner =
        new TMLDocumentPartitioner(
          new TMLPartitionScanner(), TMLPartitionScanner.PARTITIONS);
      partitioner.connect(document);
      document.setDocumentPartitioner(partitioner);
    }
    return document;
  }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

public class TMLScriptDocumentProvider extends FileDocumentProvider {

  protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
      IDocumentPartitioner partitioner =
        new TMLScriptDocumentPartitioner(
          new TMLScriptPartitionScanner(),
          TMLScriptPartitionScanner.PARTITIONS);
      partitioner.connect(document);
      document.setDocumentPartitioner(partitioner);
    }
    return document;
  }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

public class DroolsDocumentProvider extends FileDocumentProvider {

  protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
      IDocumentPartitioner partitioner =
        new FastPartitioner(
          new DroolsPartitionScanner(),
          new String[] {
            DroolsPartitionScanner.TAG,
            DroolsPartitionScanner.COMMENT });
      partitioner.connect(document);
      document.setDocumentPartitioner(partitioner);
    }
    return document;
  }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

    } catch (Exception e) {
      System.out.println(this.getClass().getName() + ": " + e.getMessage());
    }
   
    if (document != null) {
      IDocumentPartitioner partitioner = new IDocumentPartitioner() {

        @Override
        public ITypedRegion getPartition(int offset) {
          for(ITypedRegion region : computePartitioning(offset, 0)) {
            if(region.getOffset() + region.getLength() >= offset) {
              return region;
            }
          }
          return null;
        }

        @Override
        public String[] getLegalContentTypes() {
          return editor.getTypes();
        }

        @Override
        public String getContentType(int offset) {
          return getPartition(offset).getType();
        }

        @Override
        public boolean documentChanged(DocumentEvent event) {
          return true;
        }

        @Override
        public void documentAboutToBeChanged(DocumentEvent event) {
        }

        @Override
        public void disconnect() {
        }

        @Override
        public void connect(IDocument document) {
          document.addPositionCategory(IDocument.DEFAULT_CATEGORY);
          document.setDocumentPartitioner(this);
        }

        @Override
        public ITypedRegion[] computePartitioning(int offset, int length) {
          List<ITypedRegion> regions = new ArrayList<ITypedRegion>();
          editor.reset();
          while (!editor.eof) {
            ITypedRegion current = editor.nextToken();
            int start = current.getOffset();
            int stop = current.getOffset() + current.getLength();
            if (start >= offset && stop <= offset + length) {
              // Region included in the zone
              regions.add(current);
            } else if (start < offset && stop >= offset) {
              // Overlap on the beginning of the zone
              regions.add(new TypedRegion(offset, (stop - offset), current.getType()));
            } else if (start <= offset && stop > offset + length) {
              // XXX this condition actually contains the previous one. problem? --bran
              // Overlap on the end of the zone
              regions.add(new TypedRegion(start, (offset + length - start), current.getType()));
            }
            else if (start > offset + length ) { // bran cut off
              break;
            }
          }
          return regions.toArray(new ITypedRegion[regions.size()]);
        }

      };
      partitioner.connect(document);
    }
    return document;
  }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

  @Override
  protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
      IDocumentPartitioner partitioner =
        new FastPartitioner(
          new RSPartitionScanner(),
          new String[] {
            RSPartitionScanner.COMMENT });
      partitioner.connect(document);
      document.setDocumentPartitioner(partitioner);
    }
    return document;
  }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

                       "   then\n" + //
                       "       " +//
                       "end\n\n" ;

        IDocument doc = new Document( input );
        IDocumentPartitioner partitioner = new FastPartitioner( new DRLPartionScanner(),
                                                                DRLPartionScanner.LEGAL_CONTENT_TYPES );
        partitioner.connect( doc );
        doc.setDocumentPartitioner( partitioner );
        return doc;
    }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

        assertThat(shell, is(not(nullValue())));
        this.shell = shell;
        shell.addListener(this);
        changed(new BackendShellEvent(0, 0, get()));
        final IDocumentPartitioner partitioner = new FastPartitioner(createScanner(),
                LEGAL_CONTENT_TYPES);
        partitioner.connect(this);
        setDocumentPartitioner(partitioner);
    }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

        setupErlangDocumentPartitioner(document, IErlangPartitions.ERLANG_PARTITIONING);
    }

    public void setupErlangDocumentPartitioner(final IDocument document,
            final String partitioning) {
        final IDocumentPartitioner partitioner = createDocumentPartitioner();
        if (document instanceof IDocumentExtension3) {
            final IDocumentExtension3 extension3 = (IDocumentExtension3) document;
            extension3.setDocumentPartitioner(partitioning, partitioner);
        } else {
            document.setDocumentPartitioner(partitioner);
        }
        partitioner.connect(document);
    }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

public class DjangoDocumentProvider extends FileDocumentProvider {

  protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
      IDocumentPartitioner partitioner = createPartitioner();
      partitioner.connect(document);
      document.setDocumentPartitioner(partitioner);
    }
    return document;
  }
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentPartitioner

public class DjangoDocumentProvider extends FileDocumentProvider {

  protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
      IDocumentPartitioner partitioner = new DjangoPartitioner();
      partitioner.connect(document);
      document.setDocumentPartitioner(partitioner);
    }
    return document;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.