01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.model;
11:
12: import org.eclipse.jface.resource.ImageDescriptor;
13:
14: /**
15: * This adapter interface provides visual presentation and hierarchical structure
16: * for workbench elements, allowing them to be displayed in the UI
17: * without having to know the concrete type of the element.
18: * <p>
19: * There is an associate label provider and content provider for showing
20: * elements with a registered workbench adapter in JFace structured viewers.
21: * </p>
22: * @see WorkbenchLabelProvider
23: * @see BaseWorkbenchContentProvider
24: */
25: public interface IWorkbenchAdapter {
26: /**
27: * Returns the children of this object. When this object
28: * is displayed in a tree, the returned objects will be this
29: * element's children. Returns an empty array if this
30: * object has no children.
31: *
32: * @param o The object to get the children for.
33: * @return Object[]
34: */
35: public Object[] getChildren(Object o);
36:
37: /**
38: * Returns an image descriptor to be used for displaying an object in the workbench.
39: * Returns <code>null</code> if there is no appropriate image.
40: *
41: * @param object The object to get an image descriptor for.
42: * @return ImageDescriptor
43: */
44: public ImageDescriptor getImageDescriptor(Object object);
45:
46: /**
47: * Returns the label text for this element. This is typically
48: * used to assign a label to this object when displayed
49: * in the UI. Returns an empty string if there is no appropriate
50: * label text for this object.
51: *
52: * @param o The object to get a label for.
53: * @return String
54: */
55: public String getLabel(Object o);
56:
57: /**
58: * Returns the logical parent of the given object in its tree.
59: * Returns <code>null</code> if there is no parent, or if this object doesn't
60: * belong to a tree.
61: *
62: * @param o The object to get the parent for.
63: * @return Object
64: */
65: public Object getParent(Object o);
66: }
|