PreDefinedDiffTool.java

  1. /*
  2.  * Copyright (C) 2018-2021, 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. /**
  12.  * The pre-defined diff tool.
  13.  */
  14. public class PreDefinedDiffTool extends UserDefinedDiffTool {

  15.     /**
  16.      * Create a pre-defined diff tool
  17.      *
  18.      * @param name
  19.      *            the name
  20.      * @param path
  21.      *            the path
  22.      * @param parameters
  23.      *            the tool parameters as one string that is used together with
  24.      *            path as command
  25.      */
  26.     public PreDefinedDiffTool(String name, String path, String parameters) {
  27.         super(name, path, parameters);
  28.     }

  29.     /**
  30.      * Creates the pre-defined diff tool
  31.      *
  32.      * @param tool
  33.      *            the command line diff tool
  34.      *
  35.      */
  36.     public PreDefinedDiffTool(CommandLineDiffTool tool) {
  37.         this(tool.name(), tool.getPath(), tool.getParameters());
  38.     }

  39.     /**
  40.      * @param path
  41.      */
  42.     @Override
  43.     public void setPath(String path) {
  44.         super.setPath(path);
  45.     }

  46.     /**
  47.      * {@inheritDoc}
  48.      *
  49.      * @return the concatenated path and command of the pre-defined diff tool
  50.      */
  51.     @Override
  52.     public String getCommand() {
  53.         return ExternalToolUtils.quotePath(getPath()) + " " + super.getCommand(); //$NON-NLS-1$
  54.     }

  55. }