Tabnine Logo
FastPartitioner
Code IndexAdd Tabnine to your IDE (free)

How to use
FastPartitioner
in
org.eclipse.jface.text.rules

Best Java code snippets using org.eclipse.jface.text.rules.FastPartitioner (Showing top 20 results out of 315)

origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Factory method for creating a Java-specific document partitioner
 * using this object's partitions scanner. This method is a
 * convenience method.
 *
 * @return a newly created Java document partitioner
 */
public IDocumentPartitioner createDocumentPartitioner() {
  return new FastPartitioner(getPartitionScanner(), LEGAL_CONTENT_TYPES);
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public final void connect(IDocument document) {
  connect(document, false);
}
origin: at.bestsolution.eclipse/org.eclipse.fx.text.compat

/**
 * {@inheritDoc}
 * <p>
 * May be extended by subclasses.
 * </p>
 */
public void stopRewriteSession(DocumentRewriteSession session) {
  if (fActiveRewriteSession == session)
    flushRewriteSession();
}
origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.text.compat

/**
 * {@inheritDoc}
 * <p>
 * May be replaced or extended by subclasses.
 * </p>
 */
public String getContentType(int offset) {
  checkInitialization();
  TypedPosition p= findClosestPosition(offset);
  if (p != null && p.includes(offset))
    return p.getType();
  return IDocument.DEFAULT_CONTENT_TYPE;
}
origin: org.apache.uima/ruta-ep-ide-ui

/**
 * Installs a partitioner with <code>document</code>.
 * 
 * @param document
 *          the document
 */
private static void installStuff(Document document) {
 String[] types = new String[] { RutaPartitions.RUTA_STRING, RutaPartitions.RUTA_COMMENT,
   IDocument.DEFAULT_CONTENT_TYPE };
 FastPartitioner partitioner = new FastPartitioner(new RutaPartitionScanner(), types);
 partitioner.connect(document);
 document.setDocumentPartitioner(RutaPartitions.RUTA_PARTITIONING, partitioner);
}
origin: org.eclipse.platform/org.eclipse.jface.text

Position[] category= getPositions();
IRegion line= fDocument.getLineInformationOfOffset(e.getOffset());
int reparseStart= line.getOffset();
  Position p= category[i];
  if (p.isDeleted) {
    rememberDeletedOffset(e.getOffset());
    break;
clearPositionCache();
category= getPositions();
  contentType= getTokenContentType(token);
  if (!isSupportedContentType(contentType)) {
    token= fScanner.nextToken();
    continue;
      rememberRegion(p.offset, p.length);
      fDocument.removePosition(fPositionCategory, p);
      ++ first;
      return createRegion();
    ++ first;
  } else {
      rememberRegion(start, length);
    } catch (BadPositionCategoryException x) {
    } catch (BadLocationException x) {
origin: org.eclipse.platform/org.eclipse.jface.text

checkInitialization();
List<TypedRegion> list= new ArrayList<>();
  Position[] category= getPositions();
  Position gap= new Position(0);
  int startIndex= getFirstIndexEndingAfterOffset(category, offset);
  int endIndex= getFirstIndexStartingAfterOffset(category, endOffset);
  for (int i= startIndex; i < endIndex; i++) {
    gap.setOffset(gapOffset);
    gap.setLength(current.getOffset() - gapOffset);
    if ((includeZeroLengthPartitions && overlapsOrTouches(gap, offset, length)) ||
        (gap.getLength() > 0 && gap.overlapsWith(offset, length))) {
      start= Math.max(offset, gapOffset);
    gap.setOffset(gapOffset);
    gap.setLength(fDocument.getLength() - gapOffset);
    if ((includeZeroLengthPartitions && overlapsOrTouches(gap, offset, length)) ||
        (gap.getLength() > 0 && gap.overlapsWith(offset, length))) {
      start= Math.max(offset, gapOffset);
  clearPositionCache();
} catch (RuntimeException ex) {
  clearPositionCache();
  throw ex;
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Performs the initial partitioning of the partitioner's document.
 * <p>
 * May be extended by subclasses.
 * </p>
 */
protected void initialize() {
  fIsInitialized= true;
  clearPositionCache();
  fScanner.setRange(fDocument, 0, fDocument.getLength());
  try {
    IToken token= fScanner.nextToken();
    while (!token.isEOF()) {
      String contentType= getTokenContentType(token);
      if (isSupportedContentType(contentType)) {
        TypedPosition p= new TypedPosition(fScanner.getTokenOffset(), fScanner.getTokenLength(), contentType);
        fDocument.addPosition(fPositionCategory, p);
      }
      token= fScanner.nextToken();
    }
  } catch (BadLocationException x) {
    // cannot happen as offsets come from scanner
  } catch (BadPositionCategoryException x) {
    // cannot happen if document has been connected before
  }
}
origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.text.compat

checkInitialization();
  Position[] category = getPositions();
origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.text.compat

public final boolean documentChanged(DocumentEvent e) {
  if (fIsInitialized) {
    IRegion region= documentChanged2(e);
    return (region != null);
  }
  return false;
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public final ITypedRegion[] computePartitioning(int offset, int length) {
  return computePartitioning(offset, length, false);
}
origin: at.bestsolution.eclipse/org.eclipse.fx.text.compat

/**
 * {@inheritDoc}
 * <p>
 * May be extended by subclasses.
 * </p>
 */
public void connect(IDocument document, boolean delayInitialization) {
  Assert.isNotNull(document);
  Assert.isTrue(!document.containsPositionCategory(fPositionCategory));
  fDocument= document;
  fDocument.addPositionCategory(fPositionCategory);
  fIsInitialized= false;
  if (!delayInitialization)
    checkInitialization();
}
origin: RepreZen/KaiZen-OpenAPI-Editor

@Override
protected IDocument createDocument(Object element) throws CoreException {
  IDocument document = super.createDocument(element);
  if (document != null) {
    JsonScanner scanner = new JsonScanner(new ColorManager(), store);
    Set<String> tokens = YAMLToken.VALID_TOKENS.keySet();
    FastPartitioner partitioner = new FastPartitioner(scanner, tokens.toArray(new String[tokens.size()]));
    document.setDocumentPartitioner(partitioner);
    partitioner.connect(document);
  }
  return document;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

Position[] category= getPositions();
IRegion line= fDocument.getLineInformationOfOffset(e.getOffset());
int reparseStart= line.getOffset();
  Position p= category[i];
  if (p.isDeleted) {
    rememberDeletedOffset(e.getOffset());
    break;
clearPositionCache();
category= getPositions();
  contentType= getTokenContentType(token);
  if (!isSupportedContentType(contentType)) {
    token= fScanner.nextToken();
    continue;
      rememberRegion(p.offset, p.length);
      fDocument.removePosition(fPositionCategory, p);
      ++ first;
      return createRegion();
    ++ first;
  } else {
      rememberRegion(start, length);
    } catch (BadPositionCategoryException x) {
    } catch (BadLocationException x) {
origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.text.compat

checkInitialization();
List list= new ArrayList();
  Position[] category= getPositions();
  Position gap= new Position(0);
  int startIndex= getFirstIndexEndingAfterOffset(category, offset);
  int endIndex= getFirstIndexStartingAfterOffset(category, endOffset);
  for (int i= startIndex; i < endIndex; i++) {
    gap.setOffset(gapOffset);
    gap.setLength(current.getOffset() - gapOffset);
    if ((includeZeroLengthPartitions && overlapsOrTouches(gap, offset, length)) ||
        (gap.getLength() > 0 && gap.overlapsWith(offset, length))) {
      start= Math.max(offset, gapOffset);
    gap.setOffset(gapOffset);
    gap.setLength(fDocument.getLength() - gapOffset);
    if ((includeZeroLengthPartitions && overlapsOrTouches(gap, offset, length)) ||
        (gap.getLength() > 0 && gap.overlapsWith(offset, length))) {
      start= Math.max(offset, gapOffset);
  clearPositionCache();
} catch (RuntimeException ex) {
  clearPositionCache();
  throw ex;
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Performs the initial partitioning of the partitioner's document.
 * <p>
 * May be extended by subclasses.
 * </p>
 */
protected void initialize() {
  fIsInitialized= true;
  clearPositionCache();
  fScanner.setRange(fDocument, 0, fDocument.getLength());
  try {
    IToken token= fScanner.nextToken();
    while (!token.isEOF()) {
      String contentType= getTokenContentType(token);
      if (isSupportedContentType(contentType)) {
        TypedPosition p= new TypedPosition(fScanner.getTokenOffset(), fScanner.getTokenLength(), contentType);
        fDocument.addPosition(fPositionCategory, p);
      }
      token= fScanner.nextToken();
    }
  } catch (BadLocationException x) {
    // cannot happen as offsets come from scanner
  } catch (BadPositionCategoryException x) {
    // cannot happen if document has been connected before
  }
}
origin: at.bestsolution.eclipse/org.eclipse.fx.text.compat

/**
 * {@inheritDoc}
 * <p>
 * May be replaced or extended by subclasses.
 * </p>
 */
public String getContentType(int offset) {
  checkInitialization();
  TypedPosition p= findClosestPosition(offset);
  if (p != null && p.includes(offset))
    return p.getType();
  return IDocument.DEFAULT_CONTENT_TYPE;
}
origin: at.bestsolution.eclipse/org.eclipse.fx.text.compat

checkInitialization();
  Position[] category = getPositions();
origin: at.bestsolution.eclipse/org.eclipse.fx.text.compat

public final boolean documentChanged(DocumentEvent e) {
  if (fIsInitialized) {
    IRegion region= documentChanged2(e);
    return (region != null);
  }
  return false;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public final ITypedRegion[] computePartitioning(int offset, int length) {
  return computePartitioning(offset, length, false);
}
org.eclipse.jface.text.rulesFastPartitioner

Javadoc

A standard implementation of a document partitioner. It uses an IPartitionTokenScanner to scan the document and to determine the document's partitioning. The tokens returned by the scanner must return the partition type as their data. The partitioner remembers the document's partitions in the document itself rather than maintaining its own data structure.

To reduce array creations in IDocument#getPositions(String), the positions get cached. The cache is cleared after updating the positions in #documentChanged2(DocumentEvent). Subclasses need to call #clearPositionCache() after modifying the partitioner's positions. The cached positions may be accessed through #getPositions().

Most used methods

  • <init>
    Creates a new partitioner that uses the given scanner and may return partitions of the given legal c
  • connect
    May be extended by subclasses.
  • flushRewriteSession
    Flushes the active rewrite session.
  • checkInitialization
    Calls #initialize() if the receiver is not yet initialized.
  • clearPositionCache
    Clears the position cache. Needs to be called whenever the positions have been updated.
  • computePartitioning
    May be replaced or extended by subclasses.
  • createRegion
    Creates the minimal region containing all partition changes using the remembered offset, end offset,
  • documentChanged2
    May be extended by subclasses.
  • findClosestPosition
    Returns the position in the partitoner's position category which is close to the given offset. This
  • getFirstIndexEndingAfterOffset
    Returns the index of the first position which ends after the given offset.
  • getFirstIndexStartingAfterOffset
    Returns the index of the first position which starts at or after the given offset.
  • getPartition
    May be replaced or extended by subclasses.
  • getFirstIndexStartingAfterOffset,
  • getPartition,
  • getPositions,
  • getTokenContentType,
  • initialize,
  • isSupportedContentType,
  • overlapsOrTouches,
  • rememberDeletedOffset,
  • rememberRegion,
  • toString

Popular in Java

  • Updating database using SQL prepared statement
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now