KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > model > IWorkbenchAdapter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.ui.model;
12
13 import org.eclipse.jface.resource.ImageDescriptor;
14
15 /**
16  * This adapter interface provides visual presentation and hierarchical structure
17  * for workbench elements, allowing them to be displayed in the UI
18  * without having to know the concrete type of the element.
19  * <p>
20  * There is an associate label provider and content provider for showing
21  * elements with a registered workbench adapter in JFace structured viewers.
22  * </p>
23  * @see WorkbenchLabelProvider
24  * @see BaseWorkbenchContentProvider
25  */

26 public interface IWorkbenchAdapter {
27     /**
28      * Returns the children of this object. When this object
29      * is displayed in a tree, the returned objects will be this
30      * element's children. Returns an empty array if this
31      * object has no children.
32      *
33      * @param o The object to get the children for.
34      * @return Object[]
35      */

36     public Object JavaDoc[] getChildren(Object JavaDoc o);
37
38     /**
39      * Returns an image descriptor to be used for displaying an object in the workbench.
40      * Returns <code>null</code> if there is no appropriate image.
41      *
42      * @param object The object to get an image descriptor for.
43      * @return ImageDescriptor
44      */

45     public ImageDescriptor getImageDescriptor(Object JavaDoc object);
46
47     /**
48      * Returns the label text for this element. This is typically
49      * used to assign a label to this object when displayed
50      * in the UI. Returns an empty string if there is no appropriate
51      * label text for this object.
52      *
53      * @param o The object to get a label for.
54      * @return String
55      */

56     public String JavaDoc getLabel(Object JavaDoc o);
57
58     /**
59      * Returns the logical parent of the given object in its tree.
60      * Returns <code>null</code> if there is no parent, or if this object doesn't
61      * belong to a tree.
62      *
63      * @param o The object to get the parent for.
64      * @return Object
65      */

66     public Object JavaDoc getParent(Object JavaDoc o);
67 }
68
Popular Tags