View Javadoc
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  
11  package org.eclipse.jgit.internal.diffmergetool;
12  
13  /**
14   * The pre-defined diff tool.
15   */
16  public class PreDefinedDiffTool extends UserDefinedDiffTool {
17  
18  	/**
19  	 * Create a pre-defined diff tool
20  	 *
21  	 * @param name
22  	 *            the name
23  	 * @param path
24  	 *            the path
25  	 * @param parameters
26  	 *            the tool parameters as one string that is used together with
27  	 *            path as command
28  	 */
29  	public PreDefinedDiffTool(String name, String path, String parameters) {
30  		super(name, path, parameters);
31  	}
32  
33  	/**
34  	 * Creates the pre-defined diff tool
35  	 *
36  	 * @param tool
37  	 *            the command line diff tool
38  	 *
39  	 */
40  	public PreDefinedDiffTool(CommandLineDiffTool tool) {
41  		this(tool.name(), tool.getPath(), tool.getParameters());
42  	}
43  
44  	/**
45  	 * @param path
46  	 */
47  	@Override
48  	public void setPath(String path) {
49  		super.setPath(path);
50  	}
51  
52  	/**
53  	 * {@inheritDoc}
54  	 *
55  	 * @return the concatenated path and command of the pre-defined diff tool
56  	 */
57  	@Override
58  	public String getCommand() {
59  		return ExternalToolUtils.quotePath(getPath()) + " " + super.getCommand(); //$NON-NLS-1$
60  	}
61  
62  }