KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.eclipse.swt.graphics.FontData;
15 import org.eclipse.swt.graphics.RGB;
16
17 /**
18  * Abstract base class with basic implementations of the IWorkbenchAdapter
19  * interface. Intended to be subclassed.
20  *
21  * @since 3.0
22  */

23 public abstract class WorkbenchAdapter implements IWorkbenchAdapter,
24         IWorkbenchAdapter2 {
25     /**
26      * The empty list of children.
27      */

28     protected static final Object JavaDoc[] NO_CHILDREN = new Object JavaDoc[0];
29
30     /**
31      * The default implementation of this <code>IWorkbenchAdapter</code> method
32      * returns the empty list. Subclasses may override.
33      */

34     public Object JavaDoc[] getChildren(Object JavaDoc object) {
35         return NO_CHILDREN;
36     }
37
38     /**
39      * The default implementation of this <code>IWorkbenchAdapter</code> method
40      * returns <code>null</code>. Subclasses may override.
41      */

42     public ImageDescriptor getImageDescriptor(Object JavaDoc object) {
43         return null;
44     }
45
46     /**
47      * The default implementation of this <code>IWorkbenchAdapter</code> method
48      * returns the empty string if the object is <code>null</code>, and
49      * the object's <code>toString</code> otherwise. Subclasses may override.
50      */

51     public String JavaDoc getLabel(Object JavaDoc object) {
52         return object == null ? "" : object.toString(); //$NON-NLS-1$
53
}
54
55     /**
56      * The default implementation of this <code>IWorkbenchAdapter</code> method
57      * returns <code>null</code>. Subclasses may override.
58      */

59     public Object JavaDoc getParent(Object JavaDoc object) {
60         return null;
61     }
62
63     /**
64      * The default implementation of this <code>IWorkbenchAdapter2</code> method
65      * returns <code>null</code>. Subclasses may override.
66      */

67     public RGB getBackground(Object JavaDoc element) {
68         return null;
69     }
70
71     /**
72      * The default implementation of this <code>IWorkbenchAdapter2</code> method
73      * returns <code>null</code>. Subclasses may override.
74      */

75     public RGB getForeground(Object JavaDoc element) {
76         return null;
77     }
78
79     /**
80      * The default implementation of this <code>IWorkbenchAdapter2</code> method
81      * returns <code>null</code>. Subclasses may override.
82      */

83     public FontData getFont(Object JavaDoc element) {
84         return null;
85     }
86 }
87
Popular Tags