Examples of TextChange


Examples of com.google.collide.shared.document.TextChange

      public void onTextChange(Document document, JsonArray<TextChange> textChanges) {
        opFromListener[0] = DocOpUtils.createFromTextChange(factory, textChanges.get(0));
      }
    });
   
    TextChange textChange = doc.insertText(doc.getFirstLine(), 0, "\n");
    assertEquals(TextChange.createInsertion(doc.getFirstLine(), 0, 0, doc.getFirstLine()
        .getNextLine(), 1, "\n"), textChange);
   
    DocOp opPostListener = DocOpUtils.createFromTextChange(factory, textChange);
    DocOpTestUtils.assertDocOpEquals(opPostListener, opFromListener[0]);
View Full Code Here

Examples of com.google.collide.shared.document.TextChange

   *
   * and we delete a\nb\nc\nd.
   */
  public void testBuggyDueToNoRetainWithTrailingNewLine() {
    doc = Document.createFromString("a\nb\nc\nd\ne");
    TextChange textChange = doc.deleteText(doc.getFirstLine(), 0, 0, 7);
    DocOp op = DocOpUtils.createFromTextChange(factory, textChange);

    assertSize(6, op);
    assertDelete("a\n", op, 0);
    assertDelete("b\n", op, 1);
View Full Code Here

Examples of com.google.collide.shared.document.TextChange

        + "ASD\nAS\nDAS\nDAS\nD\nASD\nASD\nASD\nAS?\n?\n");
    assertEquals(23, doc.getLineCount());
   
    int textCount = LineUtils.getTextCount(
        doc.getFirstLine(), 10, doc.getLastLine().getPreviousLine().getPreviousLine(), 1);
    TextChange textChange = doc.deleteText(doc.getFirstLine(), 10, textCount);
    DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);
    docOp.toString();
  }
View Full Code Here

Examples of com.google.collide.shared.document.TextChange

 
  public void testMissingRetainLineAfterDelete() {
    {
      doc = Document.createFromString("\n");

      TextChange textChange = doc.deleteText(doc.getFirstLine(), 0, 1);
      DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);

      DocOp expected = b.d("\n").rl(1).b();
      DocOpTestUtils.assertDocOpEquals(expected, docOp);
    }
    {
      doc = Document.createFromString("alex\n");

      TextChange textChange = doc.deleteText(doc.getFirstLine(), 4, 1);
      DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);

      DocOp expected = b.r(4).d("\n").rl(1).b();
      DocOpTestUtils.assertDocOpEquals(expected, docOp);
    }
    {
      doc = Document.createFromString("alex");

      TextChange textChange = doc.insertText(doc.getFirstLine(), 4, "\n");
      DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);

      DocOp expected = b.r(4).i("\n").rl(1).b();
      DocOpTestUtils.assertDocOpEquals(expected, docOp);
    }
    {
      doc = Document.createFromString("alex\ntest");

      TextChange textChange = doc.deleteText(doc.getFirstLine(), 0, 9);
      DocOp docOp = DocOpUtils.createFromTextChange(factory, textChange);

      DocOp expected = b.d("alex\n").d("test").rl(1).b();
      DocOpTestUtils.assertDocOpEquals(expected, docOp);
    }
View Full Code Here

Examples of com.google.collide.shared.document.TextChange

  }

  public void testSimpleConversionWorks() {
    doc = Document.createFromString("aa\nhh\nii");
   
    TextChange textChange = doc.insertText(doc.getFirstLine().getNextLine(), 0, "hh\nii\n");
    DocOp docOpA = DocOpUtils.createFromTextChange(factory, textChange);
    DocOp expected = b.rl(1).i("hh\n").i("ii\n").eolR(3).rl(1).b();
    DocOpTestUtils.assertDocOpEquals(expected, docOpA);
   
    textChange = doc.deleteText(doc.getFirstLine().getNextLine().getNextLine(), 2, 6);
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

                /*
                 * get the previous change for this file if it exists, or otherwise create a new change for it, but do
                 * not store it yet: wait until we know if there are actually changes in the file
                 */
                TextChange fileChange = getTextChange(resource);
                final boolean fileChangeIsNew = (fileChange == null);
                if (fileChange == null) {
                    fileChange = new TextFileChange(proxy.getName(), resource);
                    fileChange.setEdit(new MultiTextEdit());
                }
                TextEdit rootEdit = fileChange.getEdit();

                /* loop over all renames to perform */
                for (Map.Entry<IPackageFragment,RenameArguments> entry : pkgFragments.entrySet()) {
                    IPackageFragment pkgFragment = entry.getKey();
                    RenameArguments arguments = entry.getValue();
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

      @Override
      public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
        IFile file= matchAccess.getFile();
        TextFileChange change= (TextFileChange) changes.get(file);
        if (change == null) {
          TextChange textChange= getTextChange(file); // an other participant already modified that file?
          if (textChange != null) {
            return false; // don't try to merge changes
          }
          change= new TextFileChange(file.getName(), file);
          change.setEdit(new MultiTextEdit());
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

      @Override
      public boolean acceptPatternMatch(final TextSearchMatchAccess matchAccess) throws CoreException {
        final IFile file = matchAccess.getFile();
        TextFileChange change = changes.get(file);
        if (change == null) {
          final TextChange textChange = getTextChange(file);
          if (textChange != null) {
            return false;
          }
          change = new TextFileChange(file.getName(), file);
          change.setEdit(new MultiTextEdit());
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

      @Override
      public boolean acceptPatternMatch(final TextSearchMatchAccess matchAccess) throws CoreException {
        final IFile file = matchAccess.getFile();
        TextFileChange change = changes.get(file);
        if (change == null) {
          final TextChange textChange = getTextChange(file);
          if (textChange != null) {
            return false;
          }
          change = new TextFileChange(file.getName(), file);
          change.setEdit(new MultiTextEdit());
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

   * {@link #createChange(IProgressMonitor)}.</p>
   *
   * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getTextChange(java.lang.Object)
   */
  public TextChange getTextChange(Object element) {
    TextChange existingChange = (TextChange)fLocalTextChanges.get(element);
    if(existingChange == null) {
      existingChange = super.getTextChange(element);
    }
   
    return existingChange;
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.