1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.compare;
15 
16 import org.eclipse.swt.graphics.Image;
17 
18 /**
19  * Interface for getting the name, image, and type for an object.
20  * <p>
21  * These methods are typically used to present an input object in the compare UI
22  * (<code>getName</code> and <code>getImage</code>)
23  * and for finding a viewer for a given input type (<code>getType</code>).
24  * <p>
25  * Clients may implement this interface.
26  */
27 public interface ITypedElement {
28 
29 	/**
30 	 * Type for a folder input (value <code>"FOLDER"</code>).
31 	 * Folders are comparison elements that have no contents, only a name and children.
32 	 */
33 	public static final String FOLDER_TYPE= "FOLDER"; //$NON-NLS-1$
34 
35 	/**
36 	 * Type for an element whose actual type is text  (value <code>"txt"</code>).
37 	 */
38 	public static final String TEXT_TYPE= "txt"; //$NON-NLS-1$
39 
40 	/**
41 	 * Type for an element whose actual type could not
42 	 * be determined. (value <code>"???"</code>).
43 	 */
44 	public static final String UNKNOWN_TYPE= "???"; //$NON-NLS-1$
45 
46 	/**
47 	 * Returns the name of this object.
48 	 * The name is used when displaying this object in the UI.
49 	 *
50 	 * @return the name of this object
51 	 */
getName()52 	String getName();
53 
54 	/**
55 	 * Returns an image for this object.
56 	 * This image is used when displaying this object in the UI.
57 	 *
58 	 * @return the image of this object or <code>null</code> if this type of input has no image
59 	 */
getImage()60 	Image getImage();
61 
62 	/**
63 	 * Returns the type of this object. For objects with a file name
64 	 * this is typically the file extension. For folders its the constant
65 	 * <code>FOLDER_TYPE</code>.
66 	 * The type is used for determining a suitable viewer for this object.
67 	 *
68 	 * @return the type of this object
69 	 */
getType()70 	String getType();
71 }
72