Package org.eclipse.jface.text

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


     *            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

     *            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

     */
    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

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

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

                            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

        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

            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

                        final ISelectionChangedListener listener) {
                }

                @Override
                public ISelection getSelection() {
                    return new TextSelection(document, offset, 0);
                }

                @Override
                public void addSelectionChangedListener(
                        final ISelectionChangedListener listener) {
View Full Code Here

            }
          }
        }

        if (targetOffset >= 0) {
          getTextEditor().getSelectionProvider().setSelection(new TextSelection(targetOffset, 0));
        }
      }
    }
  }
View Full Code Here

TOP

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

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.