Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.IRegion


     *         the cursor position).
     * @throws BadLocationException
     */
    public String getLineContentsToCursor() throws BadLocationException {
        final int lineOfOffset = getDoc().getLineOfOffset(getAbsoluteCursorOffset());
        final IRegion lineInformation = getDoc().getLineInformation(lineOfOffset);
        final String lineToCursor = getDoc().get(lineInformation.getOffset(),
                getAbsoluteCursorOffset() - lineInformation.getOffset());
        return lineToCursor;
    }
View Full Code Here


    /**
     * @return the offset mapping to the end of the line passed as parameter.
     * @throws BadLocationException
     */
    public int getEndLineOffset(final int line) throws BadLocationException {
        final IRegion lineInformation = doc.getLineInformation(line);
        return lineInformation.getOffset() + lineInformation.getLength();
    }
View Full Code Here

    /**
     * @return the offset mapping to the end of the current 'end' line.
     */
    public int getEndLineOffset() {
        final IRegion endLine = getEndLine();
        return endLine.getOffset() + endLine.getLength();
    }
View Full Code Here

    /**
     * @return the offset mapping to the start of the current line.
     */
    public int getStartLineOffset() {
        final IRegion startLine = getStartLine();
        return startLine.getOffset();
    }
View Full Code Here

     * cursor for the contents passed as parameter
     */
    public void replaceLineContentsToSelection(final String newContents)
            throws BadLocationException {
        final int lineOfOffset = getDoc().getLineOfOffset(getAbsoluteCursorOffset());
        final IRegion lineInformation = getDoc().getLineInformation(lineOfOffset);
        getDoc().replace(lineInformation.getOffset(),
                getAbsoluteCursorOffset() - lineInformation.getOffset(), newContents);

    }
View Full Code Here

     * @return
     * @throws BadLocationException
     */
    public static int getFirstCharRelativeLinePosition(final IDocument doc, final int line)
            throws BadLocationException {
        IRegion region;
        region = doc.getLineInformation(line);
        return getFirstCharRelativePosition(doc, region);
    }
View Full Code Here

     * @return
     * @throws BadLocationException
     */
    public static int getFirstCharRelativePosition(final IDocument doc,
            final int cursorOffset) throws BadLocationException {
        IRegion region;
        region = doc.getLineInformationOfOffset(cursorOffset);
        return getFirstCharRelativePosition(doc, region);
    }
View Full Code Here

     *         absolute offset)
     * @throws BadLocationException
     */
    public static int getFirstCharPosition(final IDocument doc, final int cursorOffset)
            throws BadLocationException {
        IRegion region;
        region = doc.getLineInformationOfOffset(cursorOffset);
        final int offset = region.getOffset();
        return offset + getFirstCharRelativePosition(doc, cursorOffset);
    }
View Full Code Here

     *            the offset we want info on
     * @return a tuple with the line, col of the passed offset in the document
     */
    public Pair<Integer, Integer> getLineAndCol(final int offset) {
        try {
            final IRegion region = doc.getLineInformationOfOffset(offset);
            final int line = doc.getLineOfOffset(offset);
            final int col = offset - region.getOffset();
            return new Pair<Integer, Integer>(line, col);
        } catch (final BadLocationException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        } else if (element.getKind() == ErlElementKind.TYPESPEC) {
            collapse = fAllowCollapsing && fCollapseTypespecs;
            createProjection = true;
        }
        if (createProjection) {
            final IRegion region = computeProjectionRanges(element);
            if (region != null) {
                final Position position = createProjectionPosition(region, element);
                if (position != null) {
                    map.put(new ErlangProjectionAnnotation(element, collapse
                            && fFirstTimeInitialCollapse, element instanceof IErlComment),
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.