Package org.eclipse.jface.text

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


  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

    {
      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

 
  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

            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

        DocumentTemplateContext context =
            (DocumentTemplateContext) contextType.createContext();

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

        Template[] templates = Templates.getInstance().getTemplates();
        for (int i = 0; i != templates.length; i++)
        {
            if (context.canEvaluate(templates[i]))
View Full Code Here

      return;

    try {
      // find start of line
      int p = (c.offset == d.getLength() ? c.offset  - 1 : c.offset);
      IRegion info= d.getLineInformationOfOffset(p);
      String line = d.get(info.getOffset(), info.getLength());
      if (Helper.isBlockContainer(line))
        // TODO: get actual indentation string
        c.text += "\t";
    }
    catch (BadLocationException e) {
View Full Code Here

    public String text() {
      return matcher.group(1);
    }

    public IHyperlink hyperlink(final String type, int startOffset, int endOffset) {
      final IRegion region= new Region(
          offset + matcher.start() + startOffset,
          matcher.end() - matcher.start() - startOffset + endOffset);
      return new IHyperlink() {

        @Override
View Full Code Here

   * @return the line end offset for the given offset
   * @exception BadLocationException if offset is invalid in the current document
   */
  protected int endOfLineOf(int offset) throws BadLocationException {

    IRegion info = fDocument.getLineInformationOfOffset(offset);
    if (offset <= info.getOffset() + info.getLength())
      return info.getOffset() + info.getLength();

    int line = fDocument.getLineOfOffset(offset);
    try {
      info = fDocument.getLineInformation(line + 1);
      return info.getOffset() + info.getLength();
    } catch (BadLocationException x) {
      return fDocument.getLength();
    }
  }
View Full Code Here

    DocumentEvent event,
    boolean documentPartitioningChanged) {
    if (!documentPartitioningChanged) {
      try {

        IRegion info =
          fDocument.getLineInformationOfOffset(event.getOffset());
        int start = Math.max(partition.getOffset(), info.getOffset());

        int end =
          event.getOffset()
            + (event.getText() == null
              ? event.getLength()
              : event.getText().length());

        if (info.getOffset() <= end
          && end <= info.getOffset() + info.getLength()) {
          // optimize the case of the same line
          end = info.getOffset() + info.getLength();
        } else
          end = endOfLineOf(end);

        end =
          Math.min(
View Full Code Here

TOP

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

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.