Class UnifiedDiff

java.lang.Object
org.eclipse.compare.unifieddiff.UnifiedDiff

public final class UnifiedDiff extends Object
  • Method Details

    • create

      public static UnifiedDiff.Builder create(ITextEditor editor, String source, UnifiedDiffMode mode)
      Shows the unified diff in the given editor.
      Parameters:
      editor - the text editor where the diff will be shown
      source - the source content to compare
      mode - the mode in which the diff will be displayed
      Returns:
      a builder to configure and open the unified diff
    • dispose

      public static void dispose(ITextEditor editor)
      Removes the unified diff display from the given editor without changing its document or computing another diff. Clears diff annotations and code minings, disposes diff toolbars and listeners, removes diff folds, restores the editor's navigation actions, and prevents a pending diff computation from restoring the display. Annotations unrelated to the diff are preserved.

      Must be called on the editor's UI thread. Has no effect when the editor has no unified diff or no live text viewer. A new diff can be opened afterwards.

      Parameters:
      editor - the text editor whose unified diff display is removed
      Throws:
      NullPointerException - if the editor is null
      Since:
      3.13