KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > breakpoints > BreakpointContainerWorkbenchAdapter


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.debug.internal.ui.views.breakpoints;
12
13 import org.eclipse.core.runtime.IAdaptable;
14 import org.eclipse.jface.resource.ImageDescriptor;
15 import org.eclipse.swt.graphics.FontData;
16 import org.eclipse.swt.graphics.RGB;
17 import org.eclipse.ui.model.IWorkbenchAdapter;
18 import org.eclipse.ui.model.IWorkbenchAdapter2;
19
20 /**
21  * BreakpointContainerWorkbenchAdapter
22  */

23 public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2{
24
25     /* (non-Javadoc)
26      * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
27      */

28     public Object JavaDoc[] getChildren(Object JavaDoc o) {
29         // not used
30
return null;
31     }
32
33     /* (non-Javadoc)
34      * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
35      */

36     public ImageDescriptor getImageDescriptor(Object JavaDoc object) {
37         if (object instanceof BreakpointContainer) {
38             BreakpointContainer container = (BreakpointContainer) object;
39             IAdaptable category = container.getCategory();
40             IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
41             if (adapter != null) {
42                 return adapter.getImageDescriptor(category);
43             }
44             return container.getOrganizer().getImageDescriptor();
45         }
46         return null;
47     }
48
49     /* (non-Javadoc)
50      * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
51      */

52     public String JavaDoc getLabel(Object JavaDoc object) {
53         if (object instanceof BreakpointContainer) {
54             BreakpointContainer container = (BreakpointContainer) object;
55             IAdaptable category = container.getCategory();
56             IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
57             if (adapter != null) {
58                 return adapter.getLabel(category);
59             }
60             return container.getOrganizer().getLabel();
61         }
62         return ""; //$NON-NLS-1$
63
}
64
65     /* (non-Javadoc)
66      * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
67      */

68     public Object JavaDoc getParent(Object JavaDoc o) {
69         return null;
70     }
71
72     /* (non-Javadoc)
73      * @see org.eclipse.ui.model.IWorkbenchAdapter2#getForeground(java.lang.Object)
74      */

75     public RGB getForeground(Object JavaDoc object) {
76         if (object instanceof BreakpointContainer) {
77             BreakpointContainer container = (BreakpointContainer) object;
78             IAdaptable category = container.getCategory();
79             IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
80             if (adapter != null) {
81                 return adapter.getForeground(category);
82             }
83         }
84         return null;
85     }
86
87     /* (non-Javadoc)
88      * @see org.eclipse.ui.model.IWorkbenchAdapter2#getBackground(java.lang.Object)
89      */

90     public RGB getBackground(Object JavaDoc object) {
91         if (object instanceof BreakpointContainer) {
92             BreakpointContainer container = (BreakpointContainer) object;
93             IAdaptable category = container.getCategory();
94             IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
95             if (adapter != null) {
96                 return adapter.getBackground(category);
97             }
98         }
99         return null;
100     }
101
102     /* (non-Javadoc)
103      * @see org.eclipse.ui.model.IWorkbenchAdapter2#getFont(java.lang.Object)
104      */

105     public FontData getFont(Object JavaDoc object) {
106         if (object instanceof BreakpointContainer) {
107             BreakpointContainer container = (BreakpointContainer) object;
108             IAdaptable category = container.getCategory();
109             IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
110             if (adapter != null) {
111                 return adapter.getFont(category);
112             }
113         }
114         return null;
115     }
116
117 }
118
Popular Tags