Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.TextSelection


    int len = 0;
    document.replace(offset, len, importStatement);

    offset = document.get().indexOf(importStatement);
    len = importStatement.length();
    ITextSelection selection = new TextSelection(offset, len);
    editor.getSelectionProvider().setSelection(selection);

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


    int len = 0;
    document.replace(offset, len, methodText);

    offset = document.get().indexOf(staticName);
    len = staticName.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    IJavaElement element = getElementAtOffset(editor);
    // Check we got the selection right
    assertEquals(IJavaElement.INITIALIZER, element.getElementType());
View Full Code Here

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

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

    IJavaElement element = getElementAtOffset(editor);
    // Make sure we got the selection right:
    assertEquals("run", element.getElementName());
View Full Code Here

    int length = 0;
    document.replace(offset, length, methodText);

    offset = document.get().indexOf(methodName);
    length = methodName.length();
    ITextSelection selection = new TextSelection(offset, length);
    editor.getSelectionProvider().setSelection(selection);

    IJavaElement element = getElementAtOffset(editor);
    // Make sure we got the selection right:
    assertEquals(IJavaElement.METHOD, element.getElementType());
View Full Code Here

  public void testFilter_existingElement_packageDeclaration() throws Exception {
    JavaEditor editor = closeAndOpenEditor();
    IDocument document = getDocument(editor);
    int offset = document.get().indexOf(pkg.getElementName());
    int len = pkg.getElementName().length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    IJavaElement element = getElementAtOffset(editor);
    // Make sure we got the selection right:
    assertEquals(IJavaElement.PACKAGE_DECLARATION, element.getElementType());
View Full Code Here

    int len = 0;
    document.replace(offset, len, anonymous.toString());

    offset = document.get().indexOf("Runnable");
    len = "Runnable".length();
    ITextSelection selection = new TextSelection(offset, len);
    editor.getSelectionProvider().setSelection(selection);

    IJavaElement element = getElementAtOffset(editor);
    // Check that we got the selection right:
    assertEquals(IJavaElement.TYPE, element.getElementType());
View Full Code Here

    int len = 0;
    document.replace(offset, len, innerClassText);

    offset = document.get().indexOf(innerClassName);
    len = innerClassName.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    IJavaElement element = getElementAtOffset(editor);
    assertEquals(IJavaElement.TYPE, element.getElementType());

    long preStart = System.currentTimeMillis();
View Full Code Here

  public void testFilter_existingElement_typeNormal() throws Exception {
    JavaEditor editor = closeAndOpenEditor();
    String className = unit.getTypes()[0].getElementName();
    int offset = getDocument(editor).get().indexOf(className);
    int len = className.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    IJavaElement element = getElementAtOffset(editor);
    assertEquals(IJavaElement.TYPE, element.getElementType());

    long preStart = System.currentTimeMillis();
View Full Code Here

    int len = 0;
    document.replace(offset, len, methodText);

    offset = document.get().indexOf(fieldName);
    len = fieldName.length();
    editor.getSelectionProvider().setSelection(new TextSelection(offset, len));

    IJavaElement element = getElementAtOffset(editor);
    assertEquals(IJavaElement.FIELD, element.getElementType());

    long preStart = 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));

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