Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.ITypedRegion


   * <p>
   * May be replaced or extended by subclasses.
   * </p>
   */
  public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
    ITypedRegion region= getPartition(offset);
    if (preferOpenPartitions) {
      if (region.getOffset() == offset && !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
        if (offset > 0) {
          region= getPartition(offset - 1);
          if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE))
            return region;
        }
        return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE);
      }
    }
View Full Code Here


  /*
   * @see org.eclipse.jface.text.IDocumentPartitionerExtension2#getPartition(int)
   * @since 3.0
   */
  public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
    ITypedRegion region= getPartition(offset);
    if (preferOpenPartitions) {
      if (region.getOffset() == offset && !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
        if (offset > 0) {
          region= getPartition(offset - 1);
          if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE))
            return region;
        }
        return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE);
      }
    }
View Full Code Here

        if (!fType.equals(partitions[partitions.length - 1].getType()))
          partitions[partitions.length - 1]= TextUtilities.getPartition(document, fPartitioning, partitions[partitions.length - 1].getOffset(), false);
      }

      String type= null;
      ITypedRegion partition= null;

      partitioners= TextUtilities.removeDocumentPartitioners(document);

      for (int index= partitions.length - 1; index >= 0; index--) {

        partition= partitions[index];
        type= partition.getType();

        if (!fType.equals(type))
          formatSlave(context, document, partition.getOffset(), partition.getLength(), type);
      }

    } catch (BadLocationException exception) {
      // Should not happen
    } finally {
View Full Code Here

  /*
   * @see org.eclipse.jface.text.IDocumentPartitionerExtension2#getPartition(int)
   * @since 3.0
   */
  public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
    ITypedRegion region= getPartition(offset);
    if (preferOpenPartitions) {
      if (region.getOffset() == offset && !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
        if (offset > 0) {
          region= getPartition(offset - 1);
          if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE))
            return region;
        }
        return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE);
      }
    }
View Full Code Here

     *
     * @param pos an offset within this document
     * @return true if the offset is within this document's partition
     */
    public boolean inPartition(int pos) {
      final ITypedRegion partition= getPartition(pos);
      return partition != null && partition.getType().equals(fPartition);
    }
View Full Code Here

     * @param pos an offset within the document
     * @param searchForward the direction of the search
     * @return the next position to query
     */
    public int getNextPosition(int pos, boolean searchForward) {
      final ITypedRegion partition= getPartition(pos);
      if (partition == null) return simpleIncrement(pos, searchForward);
      if (fPartition.equals(partition.getType()))
        return simpleIncrement(pos, searchForward);
      if (searchForward) {
        int end= partition.getOffset() + partition.getLength();
        if (pos < end)
          return end;
      } else {
        int offset= partition.getOffset();
        if (pos > offset)
          return offset - 1;
      }
      return simpleIncrement(pos, searchForward);
    }
View Full Code Here

      TextPresentation presentation= new TextPresentation(damage, 1000);

      ITypedRegion[] partitioning= TextUtilities.computePartitioning(document, getDocumentPartitioning(), damage.getOffset(), damage.getLength(), false);
      for (int i= 0; i < partitioning.length; i++) {
        ITypedRegion r= partitioning[i];
        IPresentationRepairer repairer= getRepairer(r.getType());
        if (repairer != null)
          repairer.createPresentation(presentation, r);
      }

      return presentation;
View Full Code Here

    IRegion damage= null;
    try {
      int offset= e.getOffset();
      if (isDeletion)
        offset= Math.max(0, offset - 1);
      ITypedRegion partition= getPartition(e.getDocument(), offset);
      IPresentationDamager damager= getDamager(partition.getType());
      if (damager == null)
        return null;

      IRegion r= damager.getDamageRegion(partition, e, fDocumentPartitioningChanged);
View Full Code Here

      length= e.getText().length();
      if (length > 0)
        -- length;
    }

    ITypedRegion partition= getPartition(d, e.getOffset() + length);
    int endOffset= partition.getOffset() + partition.getLength();
    if (endOffset == e.getOffset())
      return -1;

    int end= fRememberedPosition == null ? -1 : fRememberedPosition.getOffset() + fRememberedPosition.getLength();
    if (endOffset < end && end < d.getLength())
      partition= getPartition(d, end);

    IPresentationDamager damager= getDamager(partition.getType());
    if (damager == null)
      return -1;

    IRegion r= damager.getDamageRegion(partition, e, fDocumentPartitioningChanged);
View Full Code Here

      fDocumentChanging= true;
      if (fCachedRedrawState) {
        try {
          int offset= e.getOffset() + e.getLength();
          ITypedRegion region= getPartition(e.getDocument(), offset);
          fRememberedPosition= new TypedPosition(region);
          e.getDocument().addPosition(fPositionCategory, fRememberedPosition);
        } catch (BadLocationException x) {
          // can not happen
        } catch (BadPositionCategoryException x) {
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.ITypedRegion

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.