Examples of TextSelection


Examples of org.eclipse.jface.text.TextSelection

    super(parentShell);
    this.selection = selection;
    this.project = project;
   
    if (this.selection != null && this.selection instanceof TextSelection){
      TextSelection ts = (TextSelection)this.selection;
      this.setTypeName(ts.getText());
     
    } else if (this.selection != null && this.selection instanceof TreeSelection){
      TreeSelection ts = (TreeSelection)this.selection;
      Object element = ts.getFirstElement();
      if (element instanceof ToolAttribute){
        this.setTypeName(((ToolAttribute)element).getType());
      } else if (element instanceof ToolVirtualAttribute){
        this.setTypeName(((ToolAttribute)element).getType());
      } else {
        this.setTypeName(ts.getFirstElement().toString());
      }
    }
  }
View Full Code Here

Examples of org.eclipse.jface.text.TextSelection

            return null;
        }
       
        ISelection selection = HandlerUtil.getCurrentSelection(event);
        if ((selection != null) && (selection instanceof TextSelection)) {
            TextSelection docSelection = (TextSelection)selection;
            try {
                int lineStart = docSelection.getStartLine();
                int lineEnd = docSelection.getEndLine();
                boolean shouldComment = shouldComment(lineStart, lineEnd, doc);
                for (int i = lineStart; i <= lineEnd; i++) {
                    if (shouldComment)
                        doc.replace(doc.getLineOffset(i), 0, "#");
                    else
View Full Code Here

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

Examples of org.eclipse.jface.text.TextSelection

        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

Examples of org.eclipse.jface.text.TextSelection

        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

Examples of org.eclipse.jface.text.TextSelection

      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

Examples of org.eclipse.jface.text.TextSelection

        ((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

Examples of org.eclipse.jface.text.TextSelection

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

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

Examples of org.eclipse.jface.text.TextSelection

            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

Examples of org.eclipse.jface.text.TextSelection

            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
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.