Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Region


     */
    protected void adjustHighlightRange( int offset, int length ) {
        ISourceViewer viewer = getSourceViewer();
        if (viewer instanceof ITextViewerExtension5) {
            ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
            extension.exposeModelRange(new Region(offset, length));
        }
    }
View Full Code Here


    switch(kind & K_MASK) {
      case K_JAVA_DOC :
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=102780
        // use the integrated comment formatter to format comment
                return formatComment(kind & K_MASK, source, indentationLevel, lineSeparator, new IRegion[] {new Region(offset, length)});
        // $FALL-THROUGH$ - fall through next case when old comment formatter is activated
      case K_MULTI_LINE_COMMENT :
      case K_SINGLE_LINE_COMMENT :
                return formatComment(kind & K_MASK, source, indentationLevel, lineSeparator, new IRegion[] {new Region(offset, length)});
    }

    return format(kind, source, new IRegion[] {new Region(offset, length)}, indentationLevel, lineSeparator);
  }
View Full Code Here

    }

    int offset = regions[0].getOffset();
    IRegion lastRegion = regions[length - 1];

    return new Region(offset, lastRegion.getOffset() + lastRegion.getLength() - offset);
  }
View Full Code Here

      // if next import is on a different line, modify the end position to the next line begin offset
      if (currEndLine < nextOffsetLine) {
        currEndLine++;
        nextOffset= root.getPosition(currEndLine, 0);
      }
      currPackage.add(new ImportDeclEntry(packName.length(), name, isStatic, new Region(currOffset, nextOffset - currOffset)));
      currOffset= nextOffset;
      curr= next;

      // add a comment entry for spacing between imports
      if (currEndLine < nextOffsetLine) {
        nextOffset= root.getPosition(nextOffsetLine, 0);

        currPackage= new PackageEntry(); // create a comment package entry for this
        this.packageEntries.add(currPackage);
        currPackage.add(new ImportDeclEntry(packName.length(), null, false, new Region(currOffset, nextOffset - currOffset)));

        currOffset= nextOffset;
      }
      currEndLine= root.getLineNumber(nextOffset + nextLength);
    }

    boolean isStatic= curr.isStatic();
    String name= getFullName(curr);
    String packName= getQualifier(curr);
    if (currPackage == null || currPackage.compareTo(packName, isStatic) != 0) {
      currPackage= new PackageEntry(packName, null, isStatic);
      this.packageEntries.add(currPackage);
    }
    int length= this.replaceRange.getOffset() + this.replaceRange.getLength() - curr.getStartPosition();
    currPackage.add(new ImportDeclEntry(packName.length(), name, isStatic, new Region(curr.getStartPosition(), length)));
  }
View Full Code Here

          } else {
            endPos= nextLinePos;
          }
        }
      }
      return new Region(startPos, endPos - startPos);
    } else {
      int start= getPackageStatementEndPos(root);
      return new Region(start, 0);
    }
  }
View Full Code Here

  static class Proposal extends SourceProposal {
    Lambda additional;  // IO String!
    String info;
    public Proposal(String proposal, String newText, String prefix, int offset, int length,
        int cursor, Lambda additional) {
      super(proposal, newText, prefix, new Region(offset, length), cursor);
      this.additional = additional;
      info = null;
    }
View Full Code Here

  ((CompilationUnitContextType) fContextType).setContextParameters(document, completionPosition, selection.y);//mpilationUnit);

    PerlUnitContext context= (PerlUnitContext) fContextType.createContext();
    int start= context.getStart();
    int end= context.getEnd();
    IRegion region= new Region(start, end - start);

//    Template[] templates= Templates.getInstance().getTemplates();
  String subroutine = null;
    for (int i= 0; i != identifiers.length; i++) {
      subroutine = (String) identifiers[i];
View Full Code Here

    ((CompilationUnitContextType) fContextType).setContextParameters(document, completionPosition, selection.y);//mpilationUnit);

    PerlUnitContext context= (PerlUnitContext) fContextType.createContext();
    int start= context.getStart();
    int end= context.getEnd();
    IRegion region= new Region(start, end - start);

//    Template[] templates= Templates.getInstance().getTemplates();
    String subroutine = null;
    for (int i= 0; i != identifiers.length; i++) {
      subroutine = (String) identifiers[i];
View Full Code Here

   * Returns the cursor selection, after having entered the linked mode.
   * <code>enter()</code> must be called prior to a call to this method.
   */
  public IRegion getSelectedRegion() {
    if (fFramePosition == null)
      return new Region(fFinalCaretOffset, 0);
    else
      return new Region(fFramePosition.getOffset(), fFramePosition.getLength());
  }
View Full Code Here

    int offset= 0;
    int length= 0;
   
    if (fViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer;
      IRegion modelRange= extension.widgetRange2ModelRange(new Region(event.start, event.end - event.start));
      if (modelRange == null)
        return;
       
      offset= modelRange.getOffset();
      length= modelRange.getLength();
View Full Code Here

TOP

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

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.