Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.TextSelection


      try {
        IJavaElementDelta[] affectedChildren = delta.getAffectedChildren();
        if (affectedChildren.length == 1 &&
                affectedChildren[0].getElement() instanceof IImportContainer) {
          IJavaElement elem = SelectionConverter.getElementAtOffset(ast.getTypeRoot(),
                  new TextSelection(selectedRange.x, selectedRange.y));
          if (!(elem instanceof IImportDeclaration))
            return false;

        }
      } catch (JavaModelException e) {
View Full Code Here


      event.detail = DND.DROP_NONE;
      return;
    }

    if (selectRange) {
      getTemplateEditor().getSelectionProvider().setSelection(new TextSelection(_selection.getOffset(), _selection.getLength()));
    } else {
      getTemplateEditor().getSelectionProvider().setSelection(new TextSelection(_selection.getOffset(), 0));
    }

    inserter.insert();
  }
View Full Code Here

  public void run() {
    if (_selection instanceof TextSelection) {
      RulePosition rulePosition;
      try {
        TextSelection selection = (TextSelection) _selection;
        ITextEditor textEditor = (ITextEditor) _activeEditor;
        IEditorInput editorInput = textEditor.getEditorInput();
        IDocument document = textEditor.getDocumentProvider().getDocument(editorInput);

        WodScanner scanner = WodScanner.wodScannerForDocument(document);
        rulePosition = scanner.getRulePositionAtOffset(selection.getOffset());

        IProject project = null;
        if (editorInput instanceof FileEditorInput) {
          IFile file = ((FileEditorInput) editorInput).getFile();
          project = file.getProject();
View Full Code Here

    if (delim != null && document.getLineLength(endLine) == delim.length())
      fAddDelimiter= true;
    else
      fAddDelimiter= false;

    return new TextSelection(document, low, high - low);
  }
View Full Code Here

      return null;
    try {
      if (fCopy && skippedLineN == -1)
        skippedLineN= 0;
      IRegion line= document.getLineInformation(skippedLineN);
      return new TextSelection(document, line.getOffset(), line.getLength());
    } catch (BadLocationException e) {
      // only happens on concurrent modifications
      return null;
    }
  }
View Full Code Here

  /*
   * @see org.eclipse.ui.texteditor.IDeleteLineTarget#deleteLine(org.eclipse.jface.text.IDocument, int, int, int, boolean)
   * @since 3.4
   */
  public void deleteLine(IDocument document, int offset, int length, int type, boolean copyToClipboard) throws BadLocationException {
    deleteLine(document, new TextSelection(offset, length), type, copyToClipboard);
  }
View Full Code Here

      ISelectionProvider provider= editor.getEditorSite().getSelectionProvider();
      if (provider == null)
        return;

      provider.setSelection(new TextSelection(pos.offset, pos.length));
    }
  }
View Full Code Here

    Integer length= memento.getInteger(TAG_SELECTION_LENGTH);
    if (length == null)
      return;

    doSetSelection(new TextSelection(offset.intValue(), length.intValue()));

    final StyledText textWidget= fSourceViewer.getTextWidget();

    Integer topPixel= memento.getInteger(TAG_SELECTION_TOP_PIXEL);
    if (topPixel != null)
View Full Code Here

   * @see org.eclipse.jface.text.TextViewer#copyMarkedRegion(boolean)
   */
  protected void copyMarkedRegion(boolean delete) {
    IRegion markedRegion= getMarkedRegion();
    if (markedRegion != null)
      copyToClipboard(new TextSelection(getDocument(), markedRegion.getOffset(), markedRegion.getLength()), delete, getTextWidget());
  }
View Full Code Here

                    final IDOMNode domNode = (IDOMNode) xmlElement.getDomNode();
                    range.merge( domNode.getStartOffset(), domNode.getEndOffset() );
                }
            }
           
            final TextSelection textSelection
                = ( range.initialized() ? new TextSelection( range.start(), range.end() - range.start() ) : null );

            sourceView.getSelectionProvider().setSelection( textSelection );
           
            getEditor().showPage( sourceView );
        }
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.