Package org.eclipse.text.edits

Examples of org.eclipse.text.edits.TextEdit.apply()


    TextEdit edit= delete(selection);
    boolean complex= edit.hasChildren();
    if (complex && fRewriteTarget != null)
      fRewriteTarget.beginCompoundChange();
    try {
      edit.apply(fDocument, TextEdit.UPDATE_REGIONS);
      if (fSelectionProvider != null) {
        ISelection empty= makeEmpty(selection, true);
        fSelectionProvider.setSelection(empty);
      }
    } finally {
View Full Code Here


    TextEdit edit= replace(selection, replacement);
    boolean complex= edit.hasChildren();
    if (complex && fRewriteTarget != null)
      fRewriteTarget.beginCompoundChange();
    try {
      edit.apply(fDocument, TextEdit.UPDATE_REGIONS);

      if (fSelectionProvider != null) {
        ISelection empty= makeReplaceSelection(selection, replacement);
        fSelectionProvider.setSelection(empty);
      }
View Full Code Here

            ISelection selection= getSelection();
            int length= e.text.length();
            if (length == 0 && e.character == '\0') {
              // backspace in StyledText block selection mode...
              TextEdit edit= processor.backspace(selection);
              edit.apply(fDocument, TextEdit.UPDATE_REGIONS);
              ISelection empty= processor.makeEmpty(selection, true);
              setSelection(empty);
            } else {
              int lines= processor.getCoveredLines(selection);
              String delim= fDocument.getLegalLineDelimiters()[0];
View Full Code Here

                      }
                    }
                  }
                  ast.setInsertUseStatement(true);
                  edits = program.rewrite(document, options);
                  edits.apply(document);
                  ast.setInsertUseStatement(false);
                } else if (!useAlias
                    && (usePart == null || !usePartName
                        .equals(usePart
                            .getNamespace()
View Full Code Here

                    }
                  }
                }
                ast.setInsertUseStatement(true);
                edits = program.rewrite(document, options);
                edits.apply(document);
                ast.setInsertUseStatement(false);
              } else if (!useAlias
                  && (usePart == null || !usePartName
                      .equals(usePart.getNamespace()
                          .getFullyQualifiedName()))) {
View Full Code Here

          try {
            TextEdit edit = fProposal.computeEdits(offset,
                position, trigger, stateMask,
                fLinkedPositionModel);
            if (edit != null) {
              edit.apply(position.getDocument(), 0);
            }
          } catch (MalformedTreeException e) {
            throw new CoreException(new Status(IStatus.ERROR,
                PHPUiPlugin.ID, IStatus.ERROR,
                "Unexpected exception applying edit", e)); //$NON-NLS-1$
View Full Code Here

                + relativeLocationFromIncludePath.toString()
                + "'"), Include.IT_REQUIRE_ONCE); //$NON-NLS-1$
            program.statements().add(i,
                ast.newExpressionStatement(include));
            TextEdit edits = program.rewrite(document, null);
            edits.apply(document);
          }

        }

      } catch (Exception e) {
View Full Code Here

  @Ignore @Test public void testTextEdit() throws Exception {
   
    TextEdit edit= GherkinFormatterUtil.formatTextEdit( GherkinTestFixtures.unformatted_feature, 0, "\n");
    Document doc= new Document(GherkinTestFixtures.unformatted_feature);
    edit.apply(doc);
    String formatted = doc.get();

    assertThat(GherkinTestFixtures.formatted_feature, is(formatted));
  }
}
View Full Code Here

      Document document = new Document(this.document.get());

      try
      {
         TextEdit edit = unit.rewrite(document, null);
         edit.apply(document);
      }
      catch (Exception e)
      {
         throw new ParserException("Could not modify source: " + unit.toString(), e);
      }
View Full Code Here

   {
      Document document = new Document(this.document.get());

      try {
         TextEdit edit = unit.rewrite(document, null);
         edit.apply(document);
      }
      catch (Exception e) {
         throw new ParserException("Could not modify source: " + unit.toString(), e);
      }
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.