View Javadoc
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  
11  package org.eclipse.jgit.internal.diffmergetool;
12  
13  import org.eclipse.jgit.lib.internal.BooleanTriState;
14  
15  /**
16   * The user-defined merge tool.
17   */
18  public class UserDefinedMergeTool extends UserDefinedDiffTool
19  		implements ExternalMergeTool {
20  
21  	/**
22  	 * the merge tool "trust exit code" option
23  	 */
24  	private BooleanTriState trustExitCode;
25  
26  	/**
27  	 * Creates the merge tool
28  	 *
29  	 * @param name
30  	 *            the name
31  	 * @param path
32  	 *            the path
33  	 * @param cmd
34  	 *            the command
35  	 * @param trustExitCode
36  	 *            the "trust exit code" option
37  	 */
38  	public UserDefinedMergeTool(String name, String path, String cmd,
39  			BooleanTriState trustExitCode) {
40  		super(name, path, cmd);
41  		this.trustExitCode = trustExitCode;
42  	}
43  	/**
44  	 * @return the "trust exit code" flag
45  	 */
46  	@Override
47  	public BooleanTriState getTrustExitCode() {
48  		return trustExitCode;
49  	}
50  
51  	/**
52  	 * @param trustExitCode
53  	 *            the new "trust exit code" flag
54  	 */
55  	protected void setTrustExitCode(BooleanTriState trustExitCode) {
56  		this.trustExitCode = trustExitCode;
57  	}
58  
59  	/**
60  	 * @param withBase
61  	 *            not used, because user-defined merge tool can only define one
62  	 *            cmd -> it must handle with and without base present (empty)
63  	 * @return the tool command
64  	 */
65  	@Override
66  	public String getCommand(boolean withBase) {
67  		return getCommand();
68  	}
69  }