Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.ITextSelection


  @Override
  public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
    ITextEditor textEditor = getEditor(part);
    if (textEditor != null) {
      IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class);
      ITextSelection textSelection = (ITextSelection) selection;
      int lineNumber = textSelection.getStartLine() + 1;
      IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXVRConstants.ID_XVR_DEBUG_MODEL);
      for (int i = 0; i < breakpoints.length; i++) {
        IBreakpoint breakpoint = breakpoints[i];
        if (resource.equals(breakpoint.getMarker().getResource())) {
          if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber)) {
View Full Code Here


        }
    };

    protected void generateSelection() {

        ITextSelection selection = (ITextSelection) viewer
            .getSelectionProvider().getSelection();

        if (!this.lastSelection.equals(selection)) {
            this.lastSelection = selection;
            this.manager.generateSelection(this.part, selection);
View Full Code Here

            /**
             * Check if source is an observed user with
             * {@link User.Permission#WRITE_ACCESS} and his cursor is outside
             * the viewport.
             */
            ITextSelection userWithWriteAccessSelection = remoteEditorManager
                .getSelection(user);
            /**
             * user with {@link User.Permission#WRITE_ACCESS} selection can be
             * null if viewport activityDataObject came before the first text
             * selection activityDataObject.
             */
            if (userWithWriteAccessSelection != null) {
                /**
                 * TODO MR Taking the last line of the last selection of the
                 * user with {@link User.Permission#WRITE_ACCESS} might be a bit
                 * inaccurate.
                 */
                int userWithWriteAccessCursor = userWithWriteAccessSelection
                    .getEndLine();
                int top = viewport.getTopIndex();
                int bottom = viewport.getBottomIndex();
                following = following
                    && (userWithWriteAccessCursor < top || userWithWriteAccessCursor > bottom);
View Full Code Here

            }
        }

        SPath editorPath = this.editorAPI.getEditorPath(editorPart);
        ILineRange viewport = this.editorAPI.getViewport(editorPart);
        ITextSelection selection = this.editorAPI.getSelection(editorPart);

        // Set (and thus send) in this order:
        generateEditorActivated(editorPath);
        generateSelection(editorPart, selection);
        if (viewport == null) {
View Full Code Here

                if (viewport != null) {
                    editorAPI.setViewportAnnotation(editorPart, viewport, user);
                }
            }

            ITextSelection selection = remoteEditor.getSelection();
            if (selection != null) {
                editorAPI.setSelection(editorPart, selection, user, false);
            }
        }
    }
View Full Code Here

    ISelection selection = getTextEditor().getSelectionProvider().getSelection();
    if (selection == null || !(selection instanceof ITextSelection)) {
      return;
    }

    ITextSelection textSelection = (ITextSelection) selection;
    final IRegion region = new Region(textSelection.getOffset(), textSelection.getLength());
    IHyperlink hyperlink = null;

    synchronized (fHyperlinkDetectors) {
      for (int i = 0, length = fHyperlinkDetectors.length; i < length && hyperlink == null; i++) {
        final IHyperlinkDetector detector = fHyperlinkDetectors[i];
View Full Code Here

    }
    if (textEditor != null) {
      IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
      if (document != null && document instanceof IStructuredDocument) {
        // get current text selection
        ITextSelection textSelection = getCurrentSelection(textEditor);
        if (!textSelection.isEmpty()) {
          //call the implementers code to deal with the event
          processAction(textEditor, (IStructuredDocument)document, textSelection);
        }
      }
    }
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

          // TODO: make independent of 'model'.
          IStructuredModel model = editor.getModel();
          if (model != null) {
            try {
              // begin recording
              ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
              model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$

              // tell the model that we are about to make a big
              // model change
              model.aboutToChangeModel();

              // run
              BusyIndicator.showWhile(editor.getTextViewer().getControl().getDisplay(), runnable);
            } finally {
              // tell the model that we are done with the big
              // model
              // change
              model.changedModel();

              // end recording
              ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
              model.endRecording(this, selection.getOffset(), selection.getLength());
            }
          }
        }

      }
View Full Code Here

   *      org.eclipse.jface.viewers.ISelection)
   */
  public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
    ITextEditor editor = (ITextEditor) part.getAdapter(ITextEditor.class);
    if (selection instanceof ITextSelection) {
      ITextSelection textSelection = (ITextSelection) selection;
      IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
      if (document != null && textSelection.getOffset() > -1) {
        int lineNumber = -1;
        try {
          lineNumber = document.getLineOfOffset(textSelection.getOffset());
        }
        catch (BadLocationException e) {
        }
        if (lineNumber >= 0) {
          ToggleBreakpointAction toggler = new ToggleBreakpointAction(editor, null);
View Full Code Here

TOP

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

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.