congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
IProjectionPosition
Code IndexAdd Tabnine to your IDE (free)

How to use
IProjectionPosition
in
org.eclipse.jface.text.source.projection

Best Java code snippets using org.eclipse.jface.text.source.projection.IProjectionPosition (Showing top 8 results out of 315)

origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

private boolean isCaptionLine(Position position, IDocument document, int line) {
  if (position.getOffset() > -1 && position.getLength() > -1) {
    try {
      int captionOffset;
      if (position instanceof IProjectionPosition)
        captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document);
      else
        captionOffset= 0;
      int startLine= document.getLineOfOffset(position.getOffset() + captionOffset);
      return line == startLine;
    } catch (BadLocationException x) {
    }
  }
  return false;
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Computes the regions that must be collapsed when the given position is
 * the position of an expanded projection annotation.
 *
 * @param position the position
 * @return the ranges that must be collapsed, or <code>null</code> if
 *         there are none
 * @since 3.1
 */
IRegion[] computeCollapsedRegions(Position position) {
  try {
    IDocument document= getDocument();
    if (document == null)
      return null;
    if (position instanceof IProjectionPosition) {
      IProjectionPosition projPosition= (IProjectionPosition) position;
      return projPosition.computeProjectionRegions(document);
    }
    int line= document.getLineOfOffset(position.getOffset());
    int offset= document.getLineOffset(line + 1);
    int length= position.getLength() - (offset - position.getOffset());
    if (length > 0)
      return new IRegion[] {new Region(offset, length)};
    return null;
  } catch (BadLocationException x) {
    return null;
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Computes the regions that must be collapsed when the given position is
 * the position of an expanded projection annotation.
 *
 * @param position the position
 * @return the ranges that must be collapsed, or <code>null</code> if
 *         there are none
 * @since 3.1
 */
IRegion[] computeCollapsedRegions(Position position) {
  try {
    IDocument document= getDocument();
    if (document == null)
      return null;
    if (position instanceof IProjectionPosition) {
      IProjectionPosition projPosition= (IProjectionPosition) position;
      return projPosition.computeProjectionRegions(document);
    }
    int line= document.getLineOfOffset(position.getOffset());
    int offset= document.getLineOffset(line + 1);
    int length= position.getLength() - (offset - position.getOffset());
    if (length > 0)
      return new IRegion[] {new Region(offset, length)};
    return null;
  } catch (BadLocationException x) {
    return null;
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

private boolean isCaptionLine(Position position, IDocument document, int line) {
  if (position.getOffset() > -1 && position.getLength() > -1) {
    try {
      int captionOffset;
      if (position instanceof IProjectionPosition)
        captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document);
      else
        captionOffset= 0;
      int startLine= document.getLineOfOffset(position.getOffset() + captionOffset);
      return line == startLine;
    } catch (BadLocationException x) {
    }
  }
  return false;
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Computes the collapsed region anchor for the given position. Assuming
 * that the position is the position of an expanded projection annotation,
 * the anchor is the region that is still visible after the projection
 * annotation has been collapsed.
 *
 * @param position the position
 * @return the collapsed region anchor
 */
public Position computeCollapsedRegionAnchor(Position position) {
  try {
    IDocument document= getDocument();
    if (document == null)
      return null;
    int captionOffset= position.getOffset();
    if (position instanceof IProjectionPosition)
      captionOffset+= ((IProjectionPosition) position).computeCaptionOffset(document);
    IRegion lineInfo= document.getLineInformationOfOffset(captionOffset);
    return new Position(lineInfo.getOffset() + lineInfo.getLength(), 0);
  } catch (BadLocationException x) {
  }
  return null;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Computes the collapsed region anchor for the given position. Assuming
 * that the position is the position of an expanded projection annotation,
 * the anchor is the region that is still visible after the projection
 * annotation has been collapsed.
 *
 * @param position the position
 * @return the collapsed region anchor
 */
public Position computeCollapsedRegionAnchor(Position position) {
  try {
    IDocument document= getDocument();
    if (document == null)
      return null;
    int captionOffset= position.getOffset();
    if (position instanceof IProjectionPosition)
      captionOffset+= ((IProjectionPosition) position).computeCaptionOffset(document);
    IRegion lineInfo= document.getLineInformationOfOffset(captionOffset);
    return new Position(lineInfo.getOffset() + lineInfo.getLength(), 0);
  } catch (BadLocationException x) {
  }
  return null;
}
origin: org.eclipse.platform/org.eclipse.jface.text

int captionOffset;
if (position instanceof IProjectionPosition)
  captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document);
else
  captionOffset= 0;
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

int captionOffset;
if (position instanceof IProjectionPosition)
  captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document);
else
  captionOffset= 0;
org.eclipse.jface.text.source.projectionIProjectionPosition

Javadoc

An IProjectionPosition is a position that is associated with a ProjectionAnnotation and that is able to compute its collapsed regions. That is, if a Position implements this interface, ProjectionViewer will delegate to the #computeProjectionRegions(IDocument) method when determining the document regions that should be collapsed for a certain ProjectionAnnotation.

Most used methods

  • computeCaptionOffset
    Returns the offset of the caption (the anchor region) of this projection position. The returned offs
  • computeProjectionRegions
    Returns an array of regions that should be collapsed when the annotation belonging to this position

Popular in Java

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • getResourceAsStream (ClassLoader)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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