Codota Logo
TextEditUtil
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
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

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now