Examples of ITextSelection


Examples of org.eclipse.jface.text.ITextSelection

    IDocument document= getDocument(editor);
    if (document == null)
      return;

    ITextSelection selection= getSelection(editor);
    if (selection == null)
      return;

    try {
      fTarget.deleteLine(document, selection.getOffset(), selection.getLength(), fType, fCopyToClipboard);
    } catch (BadLocationException e) {
      // should not happen
    }
  }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

   * @return the prefix at the current cursor position that will be used in
   *         the search for possible completions
   * @throws BadLocationException if accessing the document fails
   */
  private String getCurrentPrefix() throws BadLocationException {
    ITextSelection selection= (ITextSelection) getTextEditor().getSelectionProvider().getSelection();
    if (selection.getLength() > 0) {
      return null;
    }
    return fEngine.getPrefixString(fDocument, selection.getOffset());
  }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

      ISelection s= part.getSelectionProvider().getSelection();
      if(s == null || s.isEmpty())
        return;

      ITextSelection selection= (ITextSelection) s;
      if(selection.getOffset() == 0 && selection.getLength() == 0)
        return;

      IDocument document= getDocument(part);
      Position position= new Position(selection.getOffset(), selection.getLength());
      if (installOnDocument(document, position)) {
        fDocument= document;
        fPosition= position;
        if (!part.isDirty())
          fSavedPosition= new Position(fPosition.offset, fPosition.length);
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

      return false;

    ISelectionProvider provider= part.getSite().getSelectionProvider();
    ISelection selection= provider.getSelection();
    if (selection instanceof ITextSelection) {
      ITextSelection textSelection= (ITextSelection) selection;
      if (textSelection.getOffset() == fPosition.offset && textSelection.getLength() == fPosition.length) {
        String text= textSelection.getText();
        if (text != null) {
          try {
            return text.equals(fDocument.get(fPosition.offset, fPosition.length));
          } catch (BadLocationException e) {
          }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

      ISelection s= textEditor.getSelectionProvider().getSelection();
      if(s == null || s.isEmpty())
        return;

      ITextSelection selection= (ITextSelection) s;
      if(selection.getOffset() == 0 && selection.getLength() == 0)
        return;

      fPosition.offset= selection.getOffset();
      fPosition.length= selection.getLength();
      fPosition.isDeleted= false;

      if (!part.isDirty())
        fSavedPosition= new Position(fPosition.offset, fPosition.length);
    }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

    IDocument document= getDocument(editor);
    if (document == null)
      return;

    ITextSelection selection= getSelection(editor);
    if (selection == null)
      return;

    int startLine= selection.getStartLine();
    int endLine= selection.getEndLine();
    try {
      int caretOffset= joinLines(document, startLine, endLine);
      if (caretOffset > -1)
        editor.selectAndReveal(caretOffset, 0);
    } catch (BadLocationException e) {
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

   */
  public boolean computeEnablement() {
    if (!super.computeEnablement())
      return false;

    ITextSelection selection= getSelection();
    if (selection == null)
      return false;
    fStartLine= selection.getStartLine();
    fEndLine= selection.getEndLine();
    // only enable if mouse activity is inside line range
    int activityLine= getLastLine();
    if (activityLine == -1 || activityLine < fStartLine || activityLine > fEndLine + 1)
      // + 1 to cover the case where the selection goes to the offset of the next line
      return false;
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

      if (ruler == null)
        lastLine= -1;
      else
        lastLine= ruler.getLineOfLastMouseButtonActivity();
    } else {
      ITextSelection selection= getSelection();
      if (selection == null)
        lastLine= -1;
      else
        lastLine= selection.getEndLine();
    }
    return lastLine;
  }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

   * @see #rememberSelection()
   * @since 2.0
   */
  protected void restoreSelection() {
    if (fRememberedSelection instanceof ITextSelection) {
      ITextSelection textSelection= (ITextSelection)fRememberedSelection;
      if (isValidSelection(textSelection.getOffset(), textSelection.getLength()))
        doSetSelection(fRememberedSelection);
    }
    fRememberedSelection= null;
  }
View Full Code Here

Examples of org.eclipse.jface.text.ITextSelection

   * @param selection
   * @since 2.1
   */
  protected void doSetSelection(ISelection selection) {
    if (selection instanceof ITextSelection) {
      ITextSelection textSelection= (ITextSelection) selection;
      selectAndReveal(textSelection.getOffset(), textSelection.getLength());
    }
  }
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.