Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Region


        end =
          Math.min(
              partition.getOffset() + partition.getLength(),
              end);
        return new Region(start, end - start);

      } catch (BadLocationException x) {
      }
    }
View Full Code Here


      }
      IPath path = context.getSourceModule().getPath();
      try {
        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
        IStructuredModel model = StructuredModelManager.getModelManager().getNewModelForEdit(file, true);
        PDTFormatterUtils.format(model.getStructuredDocument(), new Region(0, model.getStructuredDocument().get().length()), context.getScriptProject()
            .getProject());
      } catch (ResourceAlreadyExists e) {
        e.printStackTrace();
      } catch (ResourceInUse e) {
        e.printStackTrace();
View Full Code Here

     
    }           
   
    document.replace(end, 0, methods);
    PDTFormatterUtils.format(document, new Region(end, methods.length()), type.getScriptProject().getProject());
  }
View Full Code Here

        }
        final int adjustedEndOffset = isForward ? endOffset + 1 : endOffset;
        if (adjustedEndOffset == adjustedOffset) {
            return null;
        }
        return new Region(Math.min(adjustedOffset, adjustedEndOffset),
                Math.abs(adjustedEndOffset - adjustedOffset));
    }
View Full Code Here

        editor.reconcileNow();
        final ErlToken token = editor.getScanner().getTokenAt(offset);
        if (token == null) {
            return null;
        }
        return new Region(token.getOffset(), token.getLength());
    }
View Full Code Here

        while (start < end && Character.isWhitespace(buffer.charAt(start))) {
            ++start;
        }

        buffer.delete(0, start);
        presentation.setResultWindow(new Region(start, buffer.length()));
        return buffer.toString();
    }
View Full Code Here

                // preRegion= new Region(offset + prefixEnd, contentStart -
                // prefixEnd);
                final int preOffset = document.getLineOffset(firstLine);
                final IRegion preEndLineInfo = document.getLineInformation(captionLine);
                final int preEnd = preEndLineInfo.getOffset();
                preRegion = new Region(preOffset, preEnd - preOffset);
            } else {
                preRegion = null;
            }

            if (captionLine < lastLine) {
                final int postOffset = document.getLineOffset(captionLine + 1);
                final IRegion postRegion = new Region(postOffset, offset + length
                        - postOffset);

                if (preRegion == null) {
                    return new IRegion[] { postRegion };
                }
View Full Code Here

            IRegion preRegion;
            if (firstLine < captionLine) {
                final int preOffset = document.getLineOffset(firstLine);
                final IRegion preEndLineInfo = document.getLineInformation(captionLine);
                final int preEnd = preEndLineInfo.getOffset();
                preRegion = new Region(preOffset, preEnd - preOffset);
            } else {
                preRegion = null;
            }

            if (captionLine < lastLine) {
                final int postOffset = document.getLineOffset(captionLine + 1);
                final IRegion postRegion = new Region(postOffset, offset + length
                        - postOffset);

                if (preRegion == null) {
                    return new IRegion[] { postRegion };
                }
View Full Code Here

        }
        return false;
    }

    public IRegion getRegion() {
        return new Region(textSelection.getOffset(), textSelection.getLength());
    }
View Full Code Here

     */
    private IRegion computeProjectionRanges(final IErlElement element) {
        if (element instanceof ISourceReference) {
            final ISourceReference reference = (ISourceReference) element;
            final ISourceRange range = reference.getSourceRange();
            return new Region(range.getOffset(), range.getLength());
        }
        return null;
    }
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.