Examples of TextSelection


Examples of org.eclipse.jface.text.TextSelection

        @Override
        public ISelection getSelection() {
            if (fControl instanceof StyledText) {
                final IDocument document = new Document(
                        ((StyledText) fControl).getSelectionText());
                return new TextSelection(document, 0, document.getLength());
            }
            return StructuredSelection.EMPTY;
        }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

            final int endLine = selection.getEndLine();
            int offset;
            try {
                offset = document.getLineOffset(endLine)
                        + document.getLineLength(endLine);
                selection = new TextSelection(offset, 0);
            } catch (final BadLocationException e) {
                offset = document.getLength();
            }
        }
        return selection;
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

    }

    public ErlideSelection(final IDocument doc, final int line, final int col,
            final int len) {
        this.doc = doc;
        textSelection = new TextSelection(doc, getAbsoluteCursorOffset(line, col), len);
    }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

     *            the offset where the selection will happen (0 characters will
     *            be selected)
     */
    public ErlideSelection(final IDocument doc, final int offset) {
        this.doc = doc;
        textSelection = new TextSelection(doc, offset, 0);
    }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

     *            this is the offset of the start of the selection
     * @param absoluteEnd
     *            this is the offset of the end of the selection
     */
    public void setSelection(final int absoluteStart, final int absoluteEnd) {
        textSelection = new TextSelection(doc, absoluteStart, absoluteEnd - absoluteStart);
    }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

     */
    public void selectCompleteLine() {
        final IRegion endLine = getEndLine();
        final IRegion startLine = getStartLine();

        textSelection = new TextSelection(doc, startLine.getOffset(), endLine.getOffset()
                + endLine.getLength() - startLine.getOffset());
    }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

            if (getSelLength() > 0) {
                return;
            }
        }

        textSelection = new TextSelection(doc, 0, doc.getLength());
    }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

                            final int docLength = document.getLength();
                            if (offset + length > docLength) {
                                length = docLength - offset;
                            }
                            return extendSelectionToWholeLines(document,
                                    new TextSelection(document, offset, length));
                        } else if (e2 == null) {
                            return extendSelectionToWholeLines(
                                    document,
                                    new TextSelection(document, offset, selection
                                            .getLength() + selection.getOffset() - offset));
                        } else if (e2 instanceof ISourceReference) {
                            final ISourceReference ref2 = (ISourceReference) e2;
                            final ISourceRange r2 = ref2.getSourceRange();
                            return extendSelectionToWholeLines(document,
                                    new TextSelection(document, offset, r2.getOffset()
                                            - offset + r2.getLength()));
                        }
                    }
                } catch (final ErlModelException e) {
                }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

        int startLineOffset;
        try {
            startLineOffset = document.getLineOffset(startLine);
            final int endTextOffset = document.getLineOffset(endLine)
                    + document.getLineLength(endLine);
            return new TextSelection(document, startLineOffset, endTextOffset
                    - startLineOffset);
        } catch (final BadLocationException e) {
            ErlLogger.error(e);
        }
        return selection;
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

            return;
        }

        final ISelection selection = getSelectionProvider().getSelection();
        if (selection instanceof TextSelection) {
            final TextSelection textSelection = (TextSelection) selection;
            if (moveCursor
                    && (textSelection.getOffset() != 0 || textSelection.getLength() != 0)) {
                markInNavigationHistory();
            }
        }

        if (reference != null) {
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.