KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > compare > ITypedElement


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.compare;
12
13 import org.eclipse.swt.graphics.Image;
14
15 /**
16  * Interface for getting the name, image, and type for an object.
17  * <p>
18  * These methods are typically used to present an input object in the compare UI
19  * (<code>getName</code> and <code>getImage</code>)
20  * and for finding a viewer for a given input type (<code>getType</code>).
21  * <p>
22  * Clients may implement this interface.
23  */

24 public interface ITypedElement {
25
26     /**
27      * Type for a folder input (value <code>"FOLDER"</code>).
28      * Folders are comparison elements that have no contents, only a name and children.
29      */

30     public static final String JavaDoc FOLDER_TYPE= "FOLDER"; //$NON-NLS-1$
31

32     /**
33      * Type for an element whose actual type is text (value <code>"txt"</code>).
34      */

35     public static final String JavaDoc TEXT_TYPE= "txt"; //$NON-NLS-1$
36

37     /**
38      * Type for an element whose actual type could not
39      * be determined. (value <code>"???"</code>).
40      */

41     public static final String JavaDoc UNKNOWN_TYPE= "???"; //$NON-NLS-1$
42

43     /**
44      * Returns the name of this object.
45      * The name is used when displaying this object in the UI.
46      *
47      * @return the name of this object
48      */

49     String JavaDoc getName();
50
51     /**
52      * Returns an image for this object.
53      * This image is used when displaying this object in the UI.
54      *
55      * @return the image of this object or <code>null</code> if this type of input has no image
56      */

57     Image getImage();
58
59     /**
60      * Returns the type of this object. For objects with a file name
61      * this is typically the file extension. For folders its the constant
62      * <code>FOLDER_TYPE</code>.
63      * The type is used for determining a suitable viewer for this object.
64      *
65      * @return the type of this object
66      */

67     String JavaDoc getType();
68 }
69
Popular Tags