Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 45718a8fae8c8ba94c54d809a4aa0bb89db84e52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*******************************************************************************
 * Copyright (c) 2000, 2011 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.compare;

import org.eclipse.swt.graphics.Image;

/**
 * Interface for getting the name, image, and type for an object.
 * <p>
 * These methods are typically used to present an input object in the compare UI
 * (<code>getName</code> and <code>getImage</code>)
 * and for finding a viewer for a given input type (<code>getType</code>).
 * <p>
 * Clients may implement this interface.
 */
public interface ITypedElement {

	/**
	 * Type for a folder input (value <code>"FOLDER"</code>).
	 * Folders are comparison elements that have no contents, only a name and children.
	 */
	public static final String FOLDER_TYPE= "FOLDER"; //$NON-NLS-1$

	/**
	 * Type for an element whose actual type is text  (value <code>"txt"</code>).
	 */
	public static final String TEXT_TYPE= "txt"; //$NON-NLS-1$

	/**
	 * Type for an element whose actual type could not
	 * be determined. (value <code>"???"</code>).
	 */
	public static final String UNKNOWN_TYPE= "???"; //$NON-NLS-1$

	/**
	 * Returns the name of this object.
	 * The name is used when displaying this object in the UI.
	 *
	 * @return the name of this object
	 */
	String getName();

	/**
	 * Returns an image for this object.
	 * This image is used when displaying this object in the UI.
	 *
	 * @return the image of this object or <code>null</code> if this type of input has no image
	 */
	Image getImage();

	/**
	 * Returns the type of this object. For objects with a file name
	 * this is typically the file extension. For folders its the constant
	 * <code>FOLDER_TYPE</code>.
	 * The type is used for determining a suitable viewer for this object.
	 *
	 * @return the type of this object
	 */
	String getType();
}

Back to the top