Examples of IRegion


Examples of org.eclipse.jface.text.IRegion

   */
  public int getLength() {
    if (this.group.isEmpty()) {
      return this.node.getLength();
    }
    IRegion coverage= TextEdit.getCoverage(this.group.getTextEdits());
    if (coverage == null) {
      return this.node.getLength();
    }
    return coverage.getLength();
  }
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

          stringsToInsert.add(str);
        }
       
        for (int k= 0; k < nImports; k++) {
          ImportDeclEntry currDecl= pack.getImportAt(k);
          IRegion region= currDecl.getSourceRange();
         
          if (region == null) { // new entry
            if (!doStarImport || currDecl.isOnDemand() || (onDemandConflicts != null && onDemandConflicts.contains(currDecl.getSimpleName()))) {
              String str= getNewImportString(currDecl.getElementName(), isStatic, lineDelim);
              stringsToInsert.add(str);
            }
          } else {
            if (!doStarImport || currDecl.isOnDemand() || onDemandConflicts == null || onDemandConflicts.contains(currDecl.getSimpleName())) {
              int offset= region.getOffset();
              removeAndInsertNew(buffer, currPos, offset, stringsToInsert, resEdit);
              stringsToInsert.clear();
              currPos= offset + region.getLength();
            }
          }
        }
      }
     
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

    this.scribe = formatter.scribe;

    final ILineTracker tracker= new DefaultLineTracker();

    IRegion range= null;
    CommentLine line= null;

    tracker.set(getText(0, getLength()));
    final int lines= tracker.getNumberOfLines();

    fSingleLine= lines == 1;

    try {

      for (int index= 0; index < lines; index++) {

        range= tracker.getLineInformation(index);
        line= createLine();
        line.append(new CommentRange(range.getOffset(), range.getLength()));

        fLines.add(line);
      }

    } catch (BadLocationException exception) {
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

        if (lineNum >= lineCount) {
            lastRegion = null;
            return null;
        }

        IRegion lineInfo = document.getLineInformation(lineNum);
        char[] chars = document.get(lineInfo.getOffset(), lineInfo.getLength()).toCharArray();

        if (continued) {
            int length = lastRegion.getLength();
            length += document.getLineDelimiter(lineNum - 1).length();
            length += lineInfo.getLength();
            lastRegion = new Region(lastRegion.getOffset(), length);
        } else {
            lastRegion = lineInfo;
        }
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

        if (lineNum >= lineCount) {
            lastRegion = null;
            return null;
        }

        IRegion lineInfo = document.getLineInformation(lineNum);
        char[] chars = document.get(lineInfo.getOffset(), lineInfo.getLength()).toCharArray();

        if (continued) {
            int length = lastRegion.getLength();
            length += document.getLineDelimiter(lineNum - 1).length();
            length += lineInfo.getLength();
            lastRegion = new Region(lastRegion.getOffset(), length);
        } else {
            lastRegion = lineInfo;
        }
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

            if (type == LineType.entry) {
                String entryKey = reader.key();
                if (Constants.BUNDLE_VERSION.equals(entryKey)) {
                    LineLocation loc = new LineLocation();
                    loc.lineNum = lineNum;
                    IRegion region = reader.region();
                    loc.start = region.getOffset();
                    loc.end = region.getOffset() + region.getLength();
                    return loc;
                }
            }

            lineNum++;
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

  private static String getIndentAt(final IDocument document, final int offset, final CodeGenerationSettings settings)
  {
    try
    {
      IRegion region = document.getLineInformationOfOffset(offset);
      return IndentManipulation.extractIndentString(document.get(region.getOffset(), region.getLength()),
          settings.tabWidth, settings.indentWidth);
    }
    catch (BadLocationException e)
    {
      return "";
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

    {
      return null;
    }

    ITypeBinding paramType = null;
    IRegion wordRegion = null;
    IMethodBinding mockMethod = null, realMethod = null;

    CompilationUnit astRoot = ASTUtil.getAstOrParse(input, null);
    if( astRoot == null )
    {
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

 
  public SelectionData getLineRangeFromPosition(int pos) {
    SelectionData result = new SelectionData();
   
    try {
      IRegion lineInfo = doc.getLineInformationOfOffset(pos);
      result.updateRangeWithLength(lineInfo.getOffset(), lineInfo.getLength());
    } catch (BadLocationException e) { }
   
    return result;
  }
View Full Code Here

Examples of org.eclipse.jface.text.IRegion

            int offset = -1;

            FindReplaceDocumentAdapter docFind = new FindReplaceDocumentAdapter(doc);

            IRegion regionEnd =
                docFind.find(selection.getOffset(), "^__END__", true, true, false, true);
            offset = (regionEnd != null) ? regionEnd.getOffset() : doc.getLength();

            String lineSep = getLineSeparator(doc.get());

            // format and insert the new subroutine code
            doc.replace(offset, 0, lineSep + SourceFormatter.format(result[1], getLog()));
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.