Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Document.replace()


    final IDocument buffer = new Document(document.get());
    int index = offset - 1;
    while (index >= 0 && Character.isJavaIdentifierPart(buffer.getChar(index)))
      index--;
    final int length = offset - index - 1;
    buffer.replace(index + 1, length, " "); //$NON-NLS-1$
    return true;
  }

  public boolean isAutoInsertable() {
    return false;
View Full Code Here


          resultIndent = commonIndent + currentIndent;
          // TODO commented to retain indent of pasted blocks
          // if (getPhysicalLength(resultIndent) > getPhysicalLength(lastIndent))
          // resultIndent = lastIndent;
        }
        temp.replace(offset, currentIndent.length(), resultIndent);
        String currentLine = getDocumentLine(temp, line);
        if (currentLine.trim().length() > 0 && (!currentLine.trim().startsWith("//"))) {
          lastIndent = resultIndent;
        }
View Full Code Here

        monitor.worked(1);
        // String updatableCode=
        // source.substring(start,end+NewTestSuiteCreationWizardPage.endMarker.length());
        source.replace(classRange.getStart(), classRange.getEnd(),
            getUpdatableString(fSelectedTestCases));
        fullSource.replace(range.getOffset(), range.getLength(), source
            .toString());
        monitor.worked(1);
        String formattedContent = JUnitStubUtility
            .formatCompilationUnit(fTestSuite.getJavaProject(),
                fullSource.get(), fTestSuite
View Full Code Here

          resultIndent = commonIndent + currentIndent;
          // TODO commented to retain indent of pasted blocks
          // if (getPhysicalLength(resultIndent) > getPhysicalLength(lastIndent))
          // resultIndent = lastIndent;
        }
        temp.replace(offset, currentIndent.length(), resultIndent);
        String currentLine = getDocumentLine(temp, line);
        if (currentLine.trim().length() > 0 && (!currentLine.trim().startsWith("//"))) {
          lastIndent = resultIndent;
        }
View Full Code Here

    final IDocument buffer = new Document(document.get());
    int index = offset - 1;
    while (index >= 0 && Character.isJavaIdentifierPart(buffer.getChar(index)))
      index--;
    final int length = offset - index - 1;
    buffer.replace(index + 1, length, " "); //$NON-NLS-1$
    return true;
  }

  public boolean isAutoInsertable() {
    return false;
View Full Code Here

        PyAutoIndentStrategy strategy = (PyAutoIndentStrategy) listener.getIndentStrategy();
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        listener.setDocument(doc);

        doc.replace(0, 0, ">>> class A:");
        doc.replace(doc.getLength(), 0, "\n");
        //Things happen in a thread now, so, we have to wait for it to happen...
        for (int i = 0; i < 50; i++) {
            //if we get at the expected condition, break our for.
            if (com.aptana.shared_core.string.StringUtils.format(">>> class A:%s>>>     ", listener.getDelimeter()).equals(doc.get())) {
View Full Code Here

        PyAutoIndentStrategy strategy = (PyAutoIndentStrategy) listener.getIndentStrategy();
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        listener.setDocument(doc);

        doc.replace(0, 0, ">>> class A:");
        doc.replace(doc.getLength(), 0, "\n");
        //Things happen in a thread now, so, we have to wait for it to happen...
        for (int i = 0; i < 50; i++) {
            //if we get at the expected condition, break our for.
            if (com.aptana.shared_core.string.StringUtils.format(">>> class A:%s>>>     ", listener.getDelimeter()).equals(doc.get())) {
                break;
View Full Code Here

            synchronized (this) {
                wait(250);
            }
        }
        assertEquals(com.aptana.shared_core.string.StringUtils.format(">>> class A:%s>>>     ", listener.getDelimeter()), doc.get());
        doc.replace(doc.getLength(), 0, "def m1");
        doc.replace(doc.getLength(), 0, "(");
        assertEquals(com.aptana.shared_core.string.StringUtils.format(">>> class A:%s>>>     def m1(self):", listener.getDelimeter()), doc.get());

        listener.clear(false);
        assertEquals(">>> ", doc.get());
View Full Code Here

                wait(250);
            }
        }
        assertEquals(com.aptana.shared_core.string.StringUtils.format(">>> class A:%s>>>     ", listener.getDelimeter()), doc.get());
        doc.replace(doc.getLength(), 0, "def m1");
        doc.replace(doc.getLength(), 0, "(");
        assertEquals(com.aptana.shared_core.string.StringUtils.format(">>> class A:%s>>>     def m1(self):", listener.getDelimeter()), doc.get());

        listener.clear(false);
        assertEquals(">>> ", doc.get());
        doc.replace(doc.getLength(), 0, "c()");
View Full Code Here

        doc.replace(doc.getLength(), 0, "(");
        assertEquals(com.aptana.shared_core.string.StringUtils.format(">>> class A:%s>>>     def m1(self):", listener.getDelimeter()), doc.get());

        listener.clear(false);
        assertEquals(">>> ", doc.get());
        doc.replace(doc.getLength(), 0, "c()");
        assertEquals(">>> c()", doc.get());
        doc.replace(doc.getLength() - 1, 0, ")");
        assertEquals(">>> c()", doc.get());
        doc.replace(doc.getLength(), 0, ")");
        assertEquals(">>> c())", doc.get());
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.