Package org.eclipse.text.edits

Examples of org.eclipse.text.edits.TextEditGroup


    RewriteEvent event= getEvent(parent, MethodDeclaration.BODY_PROPERTY);
    if (event != null) {
      switch (event.getChangeKind()) {
        case RewriteEvent.INSERTED: {
          int endPos= parent.getStartPosition() + parent.getLength();
          TextEditGroup editGroup= getEditGroup(event);
          ASTNode body= (ASTNode) event.getNewValue();
          doTextRemove(startPos, endPos - startPos, editGroup);
          int indent= getIndent(parent.getStartPosition());
          String prefix= this.formatter.METHOD_BODY.getPrefix(indent);
          doTextInsert(startPos, prefix, editGroup);
          doTextInsert(startPos, body, indent, true, editGroup);
          return;
        }
        case RewriteEvent.REMOVED: {
          TextEditGroup editGroup= getEditGroup(event);
          ASTNode body= (ASTNode) event.getOriginalValue();
          int endPos= parent.getStartPosition() + parent.getLength();
          doTextRemoveAndVisit(startPos, endPos - startPos, body, editGroup);
          doTextInsert(startPos, ";", editGroup); //$NON-NLS-1$
          return;
        }
        case RewriteEvent.REPLACED: {
          TextEditGroup editGroup= getEditGroup(event);
          ASTNode body= (ASTNode) event.getOriginalValue();
          doTextRemoveAndVisit(body.getStartPosition(), body.getLength(), body, editGroup);
          doTextInsert(body.getStartPosition(), (ASTNode) event.getNewValue(), getIndent(body.getStartPosition()), true, editGroup);
          return;
        }
View Full Code Here


    }
    int oldDim= ((Integer) event.getOriginalValue()).intValue();
    int newDim= ((Integer) event.getNewValue()).intValue();

    if (oldDim != newDim) {
      TextEditGroup editGroup= getEditGroup(event);
      rewriteExtraDimensions(oldDim, newDim, pos, editGroup);
    }
    return oldDim;
  }
View Full Code Here

      return;
    }
    try {
      int oldModifiers= ((Integer) event.getOriginalValue()).intValue();
      int newModifiers= ((Integer) event.getNewValue()).intValue();
      TextEditGroup editGroup= getEditGroup(event);

      TokenScanner scanner= getScanner();

      int tok= scanner.readNext(offset, false);
      int startPos= scanner.getCurrentStartOffset();
View Full Code Here

   */
  public final ITrackedNodePosition track(ASTNode node) {
    if (node == null) {
      throw new IllegalArgumentException();
    }
    TextEditGroup group = this.eventStore.getTrackedNodeData(node);
    if (group == null) {
      group = new TextEditGroup("internal"); //$NON-NLS-1$
      this.eventStore.setTrackedNodeData(node, group);
    }
    return new TrackedNodePosition(group, node);
  }
View Full Code Here

  private void addToRootEdit(final IASTNode modifiedNode) {
    if (rootEdit == null) {
      rootEdit = new MultiTextEdit();
    }
    TextEditGroup editGroup = new TextEditGroup(ChangeGeneratorMessages.ChangeGenerator_group);
    for (final List<ASTModification> modifications : getModifications(modifiedNode).values()) {
      for (final ASTModification modification : modifications) {
        if (modification.getAssociatedEditGroup() != null) {
          editGroup = modification.getAssociatedEditGroup();
          rootEdit.addChildren(editGroup.getTextEdits());
          return;
        }
      }
    }
  }
View Full Code Here

        try {
            boolean addedEdit = false;
            for (Tuple<TextEdit, String> t : renameEdits) {
                addedEdit = true;
                rootEdit.addChild(t.o1);
                docChange.addTextEditGroup(new TextEditGroup(t.o2, t.o1));
            }
            if (addedEdit) {
                fChange.add(docChange);
            }
        } catch (RuntimeException e) {
View Full Code Here

                    continue;
                }

                ReplaceEdit replaceEdit = new ReplaceEdit(offset, length, replacementString);
                change.addEdit(replaceEdit);
                TextEditChangeGroup textEditChangeGroup = new TextEditChangeGroup(change, new TextEditGroup(
                        SearchMessages.ReplaceRefactoring_group_label_match_replace, replaceEdit));
                change.addTextEditChangeGroup(textEditChangeGroup);
                matchGroups.add(new MatchGroup(textEditChangeGroup, match));
            }
        } finally {
View Full Code Here

      }
      if (multiEdit.hasChildren()) {
        TextFileChange change = new TextFileChange("", file);
        change.setEdit(multiEdit);
        for (TextEdit e : multiEdit.getChildren()) {
          change.addTextEditGroup(new TextEditGroup("Rename constructor argument", e));
        }
        return change;
      }
    }
    catch (IOException e) {
View Full Code Here

      }
      if (multiEdit.hasChildren()) {
        TextFileChange change = new TextFileChange("", file);
        change.setEdit(multiEdit);
        for (TextEdit e : multiEdit.getChildren()) {
          change.addTextEditGroup(new TextEditGroup("Rename Bean property name", e));
        }
        return change;
      }
    }
    catch (IOException e) {
View Full Code Here

      if (multiEdit.hasChildren()) {
        TextFileChange change = new TextFileChange("", file);
        change.setEdit(multiEdit);
        for (TextEdit e : multiEdit.getChildren()) {
          change.addTextEditGroup(new TextEditGroup("Rename " + descriptor.getType() + " id", e));
        }
        if (refChanges != null) {
          MultiTextEdit edit = (MultiTextEdit) refChanges.getEdit();
          if (edit.hasChildren()) {
            for (TextEdit e : edit.getChildren()) {
              edit.removeChild(e);
              multiEdit.addChild(e);
              change.addTextEditGroup(new TextEditGroup("Rename " + descriptor.getType() + " reference", e));
            }
          }
        }
        return change;
      }
View Full Code Here

TOP

Related Classes of org.eclipse.text.edits.TextEditGroup

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.