Package org.eclipse.text.edits

Examples of org.eclipse.text.edits.MultiTextEdit.addChild()


      edit = new MultiTextEdit(this.textRegionStart, this.textRegionEnd - this.textRegionStart + 1);
    }
    for (int i= 0, max = this.editsIndex; i < max; i++) {
      OptimizedReplaceEdit currentEdit = edits[i];
      if (isValidEdit(currentEdit)) {
        edit.addChild(new ReplaceEdit(currentEdit.offset, currentEdit.length, currentEdit.replacement));
      }
    }
    this.edits = null;
    return edit;
  }
View Full Code Here


      int currPos= importsStart;
      MultiTextEdit resEdit= new MultiTextEdit();
     
      if ((this.flags & F_NEEDS_LEADING_DELIM) != 0) {
        // new import container
        resEdit.addChild(new InsertEdit(currPos, lineDelim));
      }
     
      PackageEntry lastPackage= null;
     
      Set onDemandConflicts= null;
View Full Code Here

      removeAndInsertNew(buffer, currPos, end, stringsToInsert, resEdit);
     
      if (importsLen == 0) {
        if (!this.importsCreated.isEmpty() || !this.staticImportsCreated.isEmpty()) { // new import container
          if ((this.flags & F_NEEDS_TRAILING_DELIM) != 0) {
            resEdit.addChild(new InsertEdit(currPos, lineDelim));
          }
        } else {
          return new MultiTextEdit(); // no changes
        }
      }
View Full Code Here

        final File tf = new File(oldPath);
        final List<TextEdit> edits = ChangesetMaker.createEdits(tf, newFileContent);
        final MultiTextEdit multiEdit = new MultiTextEdit();
        if (edits.size() != 0) {
            for (final TextEdit edit : edits) {
                multiEdit.addChild(edit);
            }
            change.setEdit(multiEdit);
            return change;
        }
        return null;
View Full Code Here

        final int addedLength = addedEnd - addedStart + 1;
        final int deletedLength = deletedEnd - deletedStart + 1;
        final int minLength = Math.min(addedLength, deletedLength);

        if (deletedLength < addedLength) {
            result.addChild(new InsertEdit(deletedStart + minLength, getString(addedStart
                    + minLength, addedEnd)));
        }

        result.addChild(new ReplaceEdit(deletedStart, minLength, getString(addedStart,
                addedStart + minLength - 1)));
View Full Code Here

        if (deletedLength < addedLength) {
            result.addChild(new InsertEdit(deletedStart + minLength, getString(addedStart
                    + minLength, addedEnd)));
        }

        result.addChild(new ReplaceEdit(deletedStart, minLength, getString(addedStart,
                addedStart + minLength - 1)));

        if (addedLength < deletedLength) {
            result.addChild(new DeleteEdit(deletedStart + minLength, deletedLength
                    - minLength));
View Full Code Here

        result.addChild(new ReplaceEdit(deletedStart, minLength, getString(addedStart,
                addedStart + minLength - 1)));

        if (addedLength < deletedLength) {
            result.addChild(new DeleteEdit(deletedStart + minLength, deletedLength
                    - minLength));
        }

        return result;
    }
View Full Code Here

        String nameAndDefaultValue = " "; //$NON-NLS-1$
        if ((i == 0) && (lastRegion.getLength() > lastRegion.getTextLength())) {
          nameAndDefaultValue = ""; //$NON-NLS-1$
        }
        nameAndDefaultValue += requiredAttributeName + "=\"" + defaultValue + "\""; //$NON-NLS-1$//$NON-NLS-2$
        multiTextEdit.addChild(new InsertEdit(index, nameAndDefaultValue));
        // BUG3381: MultiTextEdit applies all child TextEdit's basing
        // on offsets
        // in the document before the first TextEdit, not after each
        // child TextEdit. Therefore, do not need to advance the
        // index.
View Full Code Here

            TextFileChange change = new TextFileChange(drlFile.getName(), drlFile);
            MultiTextEdit mte = new MultiTextEdit();
            change.setEdit(mte);
            while (matcher.find()) {
                ReplaceEdit replace = new ReplaceEdit(matcher.start(), currentName.length(), newName);
                mte.addChild(replace);
            }
            if (change.getEdit().getChildrenSize() > 0)
                changes.add(change);
        }
        if (changes.getChildren().length==0)
View Full Code Here

                // rename the field name
                Pattern pattern = Pattern.compile(FIELD_NAME.replaceAll("FIELD_NAME", currentName));
                matcher = pattern.matcher(content);
                while (matcher.find()) {
                    ReplaceEdit replace = new ReplaceEdit(matcher.start(), currentName.length(), newName);
                    mte.addChild(replace);
                }

                // search all the variables of the type to replace the getters/setters
                pattern = Pattern.compile(VARIABLE_ASSIGNED.replace("TYPE", typeName));
                matcher = pattern.matcher(content);
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.