congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TextEditUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
TextEditUtil
in
org.eclipse.jdt.internal.corext.refactoring.util

Best Java code snippets using org.eclipse.jdt.internal.corext.refactoring.util.TextEditUtil (Showing top 17 results out of 315)

origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

/**
 * Degenerates the given edit tree into a list.<br>
 * All nodes of the result are leafs.<br>
 * <strong>The given edit is modified and can no longer be used.</strong>
 *
 * @param edit the edit tree to flatten
 * @return a list of edits
 * @since 3.4
 */
public static MultiTextEdit flatten(TextEdit edit) {
  MultiTextEdit result= new MultiTextEdit();
  flatten(edit, result);
  return result;
}
origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

/**
 * Create an edit which contains <code>edit1</code> and <code>edit2</code>
 * <p>If <code>edit1</code> overlaps <code>edit2</code> this method fails with a {@link MalformedTreeException}</p>
 * <p><strong>The given edits are modified and they can no longer be used.</strong></p>
 *
 * @param edit1 the edit to merge with edit2
 * @param edit2 the edit to merge with edit1
 * @return the merged tree
 * @throws MalformedTreeException if {@link #overlaps(TextEdit, TextEdit)} returns <b>true</b>
 * @see #overlaps(TextEdit, TextEdit)
 * @since 3.4
 */
public static TextEdit merge(TextEdit edit1, TextEdit edit2) {
  if (edit1 instanceof MultiTextEdit && !edit1.hasChildren()) {
    return edit2;
  }
  if (edit2 instanceof MultiTextEdit && !edit2.hasChildren()) {
    return edit1;
  }
  MultiTextEdit result= new MultiTextEdit();
  merge(edit1, edit2, result);
  return result;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

    if (!TextEditUtil.isPacked(formatEdit)) {
      formatEdit= TextEditUtil.flatten(formatEdit);
          if (j < lineExclusiveEnd) {
            DeleteEdit edit= new DeleteEdit(j, lineExclusiveEnd - j);
            if (!TextEditUtil.overlaps(formatEdit, edit)) {
              otherEdit.addChild(edit);
              group.addTextEdit(edit);
            if (j < lineExclusiveEnd) {
              DeleteEdit edit= new DeleteEdit(j, lineExclusiveEnd - j);
              if (!TextEditUtil.overlaps(formatEdit, edit)) {
                otherEdit.addChild(edit);
                group.addTextEdit(edit);
            TextEdit child= children[i];
            edit.removeChild(child);
            if (!TextEditUtil.overlaps(formatEdit, child) && !TextEditUtil.overlaps(otherEdit, child)) {
              otherEdit.addChild(child);
              group.addTextEdit(child);
          if (!TextEditUtil.overlaps(formatEdit, edit) && !TextEditUtil.overlaps(otherEdit, edit)) {
            otherEdit.addChild(edit);
            group.addTextEdit(edit);
TextEdit resultEdit= TextEditUtil.merge(formatEdit, otherEdit);
if (!resultEdit.hasChildren())
  return null;
origin: org.eclipse.jdt/org.eclipse.jdt.ui

if (TextEditUtil.overlaps(currentEdit, solution.getEdit())) {
  undoneCleanUps.add(cleanUp);
} else {
  CleanUpChange merge= new CleanUpChange(FixMessages.CleanUpRefactoring_clean_up_multi_chang_name, context.getCompilationUnit());
  merge.setEdit(TextEditUtil.merge(currentEdit, solution.getEdit()));
origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

if (!isPacked(children[i]))
  return false;
origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

    continue;
  if (overlaps(children1[i1], children2[i2]))
    return true;
if (overlaps(children[i], edit2))
  return true;
if (overlaps(children[i], edit1))
  return true;
origin: org.eclipse.jdt/org.eclipse.jdt.ui

    if (!TextEditUtil.isPacked(formatEdit)) {
      formatEdit= TextEditUtil.flatten(formatEdit);
          if (j < lineExclusiveEnd) {
            DeleteEdit edit= new DeleteEdit(j, lineExclusiveEnd - j);
            if (!TextEditUtil.overlaps(formatEdit, edit)) {
              otherEdit.addChild(edit);
              group.addTextEdit(edit);
            if (j < lineExclusiveEnd) {
              DeleteEdit edit= new DeleteEdit(j, lineExclusiveEnd - j);
              if (!TextEditUtil.overlaps(formatEdit, edit)) {
                otherEdit.addChild(edit);
                group.addTextEdit(edit);
            TextEdit child= children[i];
            edit.removeChild(child);
            if (!TextEditUtil.overlaps(formatEdit, child) && !TextEditUtil.overlaps(otherEdit, child)) {
              otherEdit.addChild(child);
              group.addTextEdit(child);
          if (!TextEditUtil.overlaps(formatEdit, edit) && !TextEditUtil.overlaps(otherEdit, edit)) {
            otherEdit.addChild(edit);
            group.addTextEdit(edit);
TextEdit resultEdit= TextEditUtil.merge(formatEdit, otherEdit);
if (!resultEdit.hasChildren())
  return null;
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

if (TextEditUtil.overlaps(currentEdit, solution.getEdit())) {
  undoneCleanUps.add(cleanUp);
} else {
  CleanUpChange merge= new CleanUpChange(FixMessages.CleanUpRefactoring_clean_up_multi_chang_name, context.getCompilationUnit());
  merge.setEdit(TextEditUtil.merge(currentEdit, solution.getEdit()));
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

if (!isPacked(children[i]))
  return false;
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

    continue;
  if (overlaps(children1[i1], children2[i2]))
    return true;
if (overlaps(children[i], edit2))
  return true;
if (overlaps(children[i], edit1))
  return true;
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Degenerates the given edit tree into a list.<br>
 * All nodes of the result are leafs.<br>
 * <strong>The given edit is modified and can no longer be used.</strong>
 *
 * @param edit the edit tree to flatten
 * @return a list of edits
 * @since 3.4
 */
public static MultiTextEdit flatten(TextEdit edit) {
  MultiTextEdit result= new MultiTextEdit();
  flatten(edit, result);
  return result;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Create an edit which contains <code>edit1</code> and <code>edit2</code>
 * <p>If <code>edit1</code> overlaps <code>edit2</code> this method fails with a {@link MalformedTreeException}</p>
 * <p><strong>The given edits are modified and they can no longer be used.</strong></p>
 *
 * @param edit1 the edit to merge with edit2
 * @param edit2 the edit to merge with edit1
 * @return the merged tree
 * @throws MalformedTreeException if {@link #overlaps(TextEdit, TextEdit)} returns <b>true</b>
 * @see #overlaps(TextEdit, TextEdit)
 * @since 3.4
 */
public static TextEdit merge(TextEdit edit1, TextEdit edit2) {
  if (edit1 instanceof MultiTextEdit && !edit1.hasChildren()) {
    return edit2;
  }
  if (edit2 instanceof MultiTextEdit && !edit2.hasChildren()) {
    return edit1;
  }
  MultiTextEdit result= new MultiTextEdit();
  merge(edit1, edit2, result);
  return result;
}
origin: eclipse/eclipse.jdt.ls

private List<org.eclipse.lsp4j.TextEdit> format(ICompilationUnit cu, IDocument document, IRegion region, FormattingOptions options, boolean includeComments, IProgressMonitor monitor) {
  if (cu == null || document == null || region == null || monitor.isCanceled()) {
    return Collections.emptyList();
  }
  CodeFormatter formatter = ToolFactory.createCodeFormatter(getOptions(options, cu));
  String lineDelimiter = TextUtilities.getDefaultLineDelimiter(document);
  String sourceToFormat = document.get();
  int kind = getFormattingKind(cu, includeComments);
  TextEdit format = formatter.format(kind, sourceToFormat, region.getOffset(), region.getLength(), 0, lineDelimiter);
  if (format == null || format.getChildren().length == 0 || monitor.isCanceled()) {
    // nothing to return
    return Collections.<org.eclipse.lsp4j.TextEdit>emptyList();
  }
  MultiTextEdit flatEdit = TextEditUtil.flatten(format);
  return convertEdits(flatEdit.getChildren(), document);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  merge(children1[i1], children2[i2], result);
merge(children[i], edit2, result);
i++;
while (i < children.length) {
merge(edit1, children[i], result);
i++;
while (i < children.length) {
origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

private static void flatten(TextEdit edit, MultiTextEdit result) {
  if (!edit.hasChildren()) {
    result.addChild(edit);
  } else {
    TextEdit[] children= edit.getChildren();
    for (int i= 0; i < children.length; i++) {
      TextEdit child= children[i];
      child.getParent().removeChild(0);
      flatten(child, result);
    }
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

  merge(children1[i1], children2[i2], result);
merge(children[i], edit2, result);
i++;
while (i < children.length) {
merge(edit1, children[i], result);
i++;
while (i < children.length) {
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private static void flatten(TextEdit edit, MultiTextEdit result) {
  if (!edit.hasChildren()) {
    result.addChild(edit);
  } else {
    TextEdit[] children= edit.getChildren();
    for (int i= 0; i < children.length; i++) {
      TextEdit child= children[i];
      child.getParent().removeChild(0);
      flatten(child, result);
    }
  }
}
org.eclipse.jdt.internal.corext.refactoring.utilTextEditUtil

Most used methods

  • flatten
  • isPacked
    Returns true if the given edit is minimal. That is if: * true if edit is a leaf * if edit is a inne
  • merge
  • overlaps
    Does any node in edit1 overlap with any other node in edit2.If this returns true then the two edit t

Popular in Java

  • Start an intent from android
  • getApplicationContext (Context)
  • putExtra (Intent)
  • onRequestPermissionsResult (Fragment)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Permission (java.security)
    Legacy security code; do not use.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now