Interface DiffView.Actions

Enclosing class:
DiffView

public static interface DiffView.Actions
Callbacks into the owning repository view.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Goes back to the history.
    default int
    How many unchanged lines are shown around a change (see DiffView.CONTEXT_CHOICES).
    default void
    discardLines(Set<String> keys, boolean hunk)
    The user pressed Discard lines (or Discard hunk, hunk) for lines of the unstaged changes with these keys.
    default void
    hunk(String action, String header)
    The user pressed the button of a hunk: action is "stage" or "unstage", header its @@ line.
    default boolean
    Whether picture files are shown as pictures (the file can be read from the repository and the diff is of one commit).
    default void
    lines(String action, Set<String> keys)
    The user pressed Stage lines or Unstage lines (action is "stage" or "unstage") for lines with these keys.
    The lines selected in the diff of the working tree (feature 50); null where lines cannot be staged (a commit, a sample).
    default void
    Reads the picture before and after the change and hands it to onLoaded on the UI thread; null if it cannot be read.
    default void
    Reads the text of the file (its new version) and hands it to onText on the UI thread; null if it cannot be read.
    void
    Opens another file of the same commit or change.
    default void
    The user clicked a link of the preview.
    default boolean
    Whether the file can be shown rendered (a Markdown file whose text can be read); the tab bar is only there then.
    default boolean
    Whether the preview tab was chosen: kept while the diff view is made again.
    default void
    setContext(int lines)
    The user chose another number of context lines.
    default void
    setPreviewSelected(boolean on)
     
    void
    setSplit(boolean split)
    Switches between the unified and the side-by-side diff.
    default void
    setWrapLines(boolean wrap)
    The user switched the wrapping of long lines on or off.
    default boolean
    Whether long lines are wrapped (else the diff scrolls sideways).
  • Method Details

    • close

      void close()
      Goes back to the history.
    • open

      void open(FileChange file)
      Opens another file of the same commit or change.
    • setSplit

      void setSplit(boolean split)
      Switches between the unified and the side-by-side diff.
    • wrapLines

      default boolean wrapLines()
      Whether long lines are wrapped (else the diff scrolls sideways).
    • setWrapLines

      default void setWrapLines(boolean wrap)
      The user switched the wrapping of long lines on or off.
    • previewAvailable

      default boolean previewAvailable()
      Whether the file can be shown rendered (a Markdown file whose text can be read); the tab bar is only there then.
    • loadPreview

      default void loadPreview(Consumer<String> onText)
      Reads the text of the file (its new version) and hands it to onText on the UI thread; null if it cannot be read.
    • previewSelected

      default boolean previewSelected()
      Whether the preview tab was chosen: kept while the diff view is made again.
    • setPreviewSelected

      default void setPreviewSelected(boolean on)
    • imagesAvailable

      default boolean imagesAvailable()
      Whether picture files are shown as pictures (the file can be read from the repository and the diff is of one commit).
    • loadImages

      default void loadImages(Consumer<ImageFiles.Versions> onLoaded)
      Reads the picture before and after the change and hands it to onLoaded on the UI thread; null if it cannot be read.
    • openLink

      default void openLink(String href)
      The user clicked a link of the preview.
    • contextLines

      default int contextLines()
      How many unchanged lines are shown around a change (see DiffView.CONTEXT_CHOICES).
    • setContext

      default void setContext(int lines)
      The user chose another number of context lines.
    • hunk

      default void hunk(String action, String header)
      The user pressed the button of a hunk: action is "stage" or "unstage", header its @@ line.
    • lineSelection

      default LineSelection lineSelection()
      The lines selected in the diff of the working tree (feature 50); null where lines cannot be staged (a commit, a sample).
    • lines

      default void lines(String action, Set<String> keys)
      The user pressed Stage lines or Unstage lines (action is "stage" or "unstage") for lines with these keys.
    • discardLines

      default void discardLines(Set<String> keys, boolean hunk)
      The user pressed Discard lines (or Discard hunk, hunk) for lines of the unstaged changes with these keys.