Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.TextSelection


        if (newNode instanceof IndexedRegion) {
          IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
          newRegion = new Region(textSelection.getOffset(), newIndexedRegion.getEndOffset() - textSelection.getOffset());

          if (newNode.getNodeType() == Node.TEXT_NODE) {
            newRegion = getNewSelectionRegion2(newIndexedRegion, new TextSelection(newRegion.getOffset(), newRegion.getLength()));
          }
        }
      }
    }
    return newRegion;
View Full Code Here


    if (fEditor instanceof ITextEditor) {
      // update the selection if text selection changed
      if (selectionPosition != null) {
        ITextSelection selection = null;
        if (updateStartOffset) {
          selection = new TextSelection(document, selectionPosition.getOffset() - OPEN_COMMENT.length(), selectionPosition.getLength() + OPEN_COMMENT.length());
        }
        else {
          selection = new TextSelection(document, selectionPosition.getOffset(), selectionPosition.getLength());
        }
        ISelectionProvider provider = ((ITextEditor) fEditor).getSelectionProvider();
        if (provider != null) {
          provider.setSelection(selection);
        }
View Full Code Here

    final JavaEditor editor = closeAndOpenEditor();

    // Set the editor to select the package declaration:
    int offset = getDocument(editor).get().indexOf(pkg.getElementName());
    int len = pkg.getElementName().length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    // Run the tracker to capture the event:
    long preStart = System.currentTimeMillis();
    tracker.setEnabled(true); // Start
    long postStart = System.currentTimeMillis();
View Full Code Here

    JavaEditor editor = closeAndOpenEditor();

    // Set the editor to select the package declaration:
    int offset = getDocument(editor).get().indexOf(pkg.getElementName());
    int len = pkg.getElementName().length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    // Now run the tracker to capture the event:
    long preStart = System.currentTimeMillis();
    tracker.setEnabled(true);
    long postStart = System.currentTimeMillis();
View Full Code Here

    // Set the editor to select the package declaration:
    IDocument document = getDocument(editor);
    int offset = document.get().indexOf(pkg.getElementName());
    int len = pkg.getElementName().length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    // Keeps the reference of the package declaration for testing latter:
    final IJavaElement element = getElementAtOffset(editor);

    // Run the tracker to capture the event:
View Full Code Here

    JavaEditor editor = closeAndOpenEditor();

    // Set the editor to select the package declaration:
    int offset = getDocument(editor).get().indexOf(unit.getElementName());
    int len = unit.getElementName().length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    // Open a new shell to cause the workbench window to lose focus:
    Shell shell = null;
    try {
      shell = new Shell(Display.getCurrent());
View Full Code Here

    // Set the editor to select the package declaration:
    String className = unit.getTypes()[0].getElementName();
    int offset = getDocument(editor).get().indexOf(className);
    int len = className.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    // Run the tracker to capture the event:
    long preStart = System.currentTimeMillis();
    tracker.setEnabled(true);
    long postStart = System.currentTimeMillis();
View Full Code Here

    document.replace(offset, len, builder.toString());

    content = document.get();
    offset = content.indexOf("Runnable", content.indexOf("Runnable") + 1);
    len = "Runnable".length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    long preStart = System.currentTimeMillis();
    tracker.setEnabled(true);
    long postStart = System.currentTimeMillis();
View Full Code Here

    JavaEditor editor = closeAndOpenEditor(myUnit);

    // Set the editor to select the package declaration:
    int offset = getDocument(editor).get().indexOf(pkg.getElementName());
    int len = pkg.getElementName().length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));
    // Make sure we got the selection right:
    assertEquals(IJavaElement.PACKAGE_DECLARATION,
        getElementAtOffset(editor).getElementType());

    // Run the tracker to capture the event:
View Full Code Here

    document.replace(offset, len, field);

    // Set the editor to select the field:
    offset = document.get().indexOf(field);
    len = field.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    // Run the tracker to capture the event:
    long preStart = System.currentTimeMillis();
    tracker.setEnabled(true);
    long postStart = System.currentTimeMillis();
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.