Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.TextSelection


    private Logger logger = Logger.getInstance();
   
    public Object execute(ExecutionEvent event) throws ExecutionException {
        ISelection selection = ((ITextEditor)Util.getActiveEditor()).getSelectionProvider().getSelection();
        TextSelection tselection = null;
        if (selection instanceof TextSelection) {
            tselection = (TextSelection)selection;
        } else {
            return null;
        }
       
        String functionName = getWord(Util.getActiveDocument(event).get(), tselection.getOffset());
        ITextEditor targetEditor = null;
        try {
            CompletionDictionary dict = CompletionDictionary.getInstance(Util.getActiveFile().getProject().getName());
            String fileName = dict.getFileData(Util.getActiveFile().getLocation().toFile().getAbsolutePath()).getFunctionOwner(functionName, dict);
            if (fileName == null)
View Full Code Here


        if (currentFile == null)
        {
            return;
        }
        HaxeTree ast = currentFile.getAst();
        TextSelection selection = (TextSelection)getSelectionProvider().getSelection();
        if (ast == null || selection == null)
        {
            return;
        }
        int offset = selection.getOffset();
        int length = selection.getLength();
        currentNode = TreeUtils.getNodeByOffset(offset, length, ast);
    }
View Full Code Here

        if (offset > endoffset) {
          int temp = offset;
          offset = endoffset;
          endoffset = temp;
        }
        return new TextSelection(offset, endoffset - offset);
      }
    }
        return new TextSelection(0, 0);
  }
View Full Code Here

      ISelection selection) {
    if (selection instanceof IStructuredSelection) {
      IStructuredSelection nodes = convertFromDesignSelection((IStructuredSelection) selection);
      IDOMNode node = (IDOMNode) nodes.getFirstElement();
      if (node != null && node.getNodeType() != Node.DOCUMENT_NODE) {
        return new TextSelection(node.getStartOffset(), node
            .getEndOffset()
            - node.getStartOffset());
      }
    } else if (selection instanceof DesignRange) {
      return convertFromDesignSelection((DesignRange) selection);
    }
        return new TextSelection(0, 0);
  }
View Full Code Here

        ((IPostSelectionProvider) textSelectionProvider)
            .addPostSelectionChangedListener(new ISelectionChangedListener() {
              public void selectionChanged(
                  SelectionChangedEvent event) {
                if (event.getSelection() instanceof TextSelection) {
                  TextSelection textSelection = ((TextSelection) event
                      .getSelection());
                  _designViewer
                      .getSynchronizer()
                      .textSelectionChanged(
                          textSelection.getOffset(),
                          textSelection.getOffset()
                              + textSelection
                                  .getLength());
                }
              }
            });
      } else {
        textSelectionProvider
            .addSelectionChangedListener(new ISelectionChangedListener() {
              public void selectionChanged(
                  SelectionChangedEvent event) {
                TextSelection textSelection = ((TextSelection) event
                    .getSelection());
                _designViewer.getSynchronizer()
                    .textSelectionChanged(
                        textSelection.getOffset(),
                        textSelection.getOffset()
                            + textSelection
                                .getLength());
              }
            });
      }
    }
View Full Code Here

    public SPathDataObject getPath() {
        return this.path;
    }

    public ITextSelection getSelection() {
        return new TextSelection(this.offset, this.length);
    }
View Full Code Here

            int cursorOffset = textEdit.getOffset()
                + textEdit.getText().length();
            if (viewer.getTopIndexStartOffset() <= cursorOffset
                && cursorOffset <= viewer.getBottomIndexEndOffset()) {

                editorAPI.setSelection(editorPart, new TextSelection(
                    cursorOffset, 0), user, user.equals(getFollowedUser()));
            }
        }

        // inform all registered ISharedEditorListeners about this text edit
View Full Code Here

            EditorManager.log
                .error("Received text selection but have no writable editor");
            return;
        }

        TextSelection textSelection = new TextSelection(selection.getOffset(),
            selection.getLength());

        User user = selection.getSource();

        Set<IEditorPart> editors = EditorManager.this.editorPool
View Full Code Here

    public SPath getPath() {
        return this.path;
    }

    public ITextSelection getSelection() {
        return new TextSelection(this.offset, this.length);
    }
View Full Code Here

   * @see org.eclipse.wst.sse.core.undo.IDocumentSelectionMediator#undoOperationSelectionChanged(org.eclipse.wst.sse.core.undo.UndoDocumentEvent)
   */
  public void undoOperationSelectionChanged(UndoDocumentEvent event) {
    if (event.getRequester() != null && event.getRequester().equals(this) && event.getDocument().equals(getDocument())) {
      // BUG107687: Undo/redo do not scroll editor
      ITextSelection selection = new TextSelection(event.getOffset(), event.getLength());
      setSelection(selection, true);
    }
  }
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.