UserDefinedMergeTool.java

  1. /*
  2.  * Copyright (C) 2018-2022, Andre Bossert <andre.bossert@siemens.com>
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */

  10. package org.eclipse.jgit.internal.diffmergetool;

  11. import org.eclipse.jgit.lib.internal.BooleanTriState;

  12. /**
  13.  * The user-defined merge tool.
  14.  */
  15. public class UserDefinedMergeTool extends UserDefinedDiffTool
  16.         implements ExternalMergeTool {

  17.     /**
  18.      * the merge tool "trust exit code" option
  19.      */
  20.     private BooleanTriState trustExitCode;

  21.     /**
  22.      * Creates the merge tool
  23.      *
  24.      * @param name
  25.      *            the name
  26.      * @param path
  27.      *            the path
  28.      * @param cmd
  29.      *            the command
  30.      * @param trustExitCode
  31.      *            the "trust exit code" option
  32.      */
  33.     public UserDefinedMergeTool(String name, String path, String cmd,
  34.             BooleanTriState trustExitCode) {
  35.         super(name, path, cmd);
  36.         this.trustExitCode = trustExitCode;
  37.     }
  38.     /**
  39.      * @return the "trust exit code" flag
  40.      */
  41.     @Override
  42.     public BooleanTriState getTrustExitCode() {
  43.         return trustExitCode;
  44.     }

  45.     /**
  46.      * @param trustExitCode
  47.      *            the new "trust exit code" flag
  48.      */
  49.     protected void setTrustExitCode(BooleanTriState trustExitCode) {
  50.         this.trustExitCode = trustExitCode;
  51.     }

  52.     /**
  53.      * @param withBase
  54.      *            not used, because user-defined merge tool can only define one
  55.      *            cmd -> it must handle with and without base present (empty)
  56.      * @return the tool command
  57.      */
  58.     @Override
  59.     public String getCommand(boolean withBase) {
  60.         return getCommand();
  61.     }
  62. }