KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ViewIntroAdapterSite


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.internal;
12
13 import org.eclipse.jface.viewers.ISelectionProvider;
14 import org.eclipse.swt.widgets.Shell;
15 import org.eclipse.ui.IActionBars;
16 import org.eclipse.ui.IKeyBindingService;
17 import org.eclipse.ui.IViewSite;
18 import org.eclipse.ui.IWorkbenchPage;
19 import org.eclipse.ui.IWorkbenchWindow;
20 import org.eclipse.ui.internal.intro.IntroDescriptor;
21 import org.eclipse.ui.intro.IIntroSite;
22
23 /**
24  * Simple <code>IIntroSite</code> that wraps a <code>IViewSite</code>. For use in conjunction with
25  * <code>ViewIntroAdapterPart</code>.
26  *
27  * @since 3.0
28  */

29 final class ViewIntroAdapterSite implements IIntroSite {
30     private IntroDescriptor descriptor;
31
32     private IViewSite viewSite;
33
34     public ViewIntroAdapterSite(IViewSite viewSite, IntroDescriptor descriptor) {
35         this.viewSite = viewSite;
36         this.descriptor = descriptor;
37     }
38
39     /* (non-Javadoc)
40      * @see org.eclipse.ui.intro.IIntroSite#getActionBars()
41      */

42     public IActionBars getActionBars() {
43         return viewSite.getActionBars();
44     }
45
46     /* (non-Javadoc)
47      * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
48      */

49     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
50         return viewSite.getAdapter(adapter);
51     }
52
53     /* (non-Javadoc)
54      * @see org.eclipse.ui.IWorkbenchPartSite#getId()
55      */

56     public String JavaDoc getId() {
57         return descriptor.getId();
58     }
59
60     /* (non-Javadoc)
61      * @see org.eclipse.ui.IWorkbenchPartSite#getKeyBindingService()
62      */

63     public IKeyBindingService getKeyBindingService() {
64         return viewSite.getKeyBindingService();
65     }
66
67     /* (non-Javadoc)
68      * @see org.eclipse.ui.IWorkbenchSite#getPage()
69      */

70     public IWorkbenchPage getPage() {
71         return viewSite.getPage();
72     }
73
74     /* (non-Javadoc)
75      * @see org.eclipse.ui.IWorkbenchPartSite#getPluginId()
76      */

77     public String JavaDoc getPluginId() {
78         return descriptor.getPluginId();
79     }
80
81     /* (non-Javadoc)
82      * @see org.eclipse.ui.IWorkbenchSite#getSelectionProvider()
83      */

84     public ISelectionProvider getSelectionProvider() {
85         return viewSite.getSelectionProvider();
86     }
87     
88     public final Object JavaDoc getService(final Class JavaDoc key) {
89             return viewSite.getService(key);
90     }
91
92     /* (non-Javadoc)
93      * @see org.eclipse.ui.IWorkbenchSite#getShell()
94      */

95     public Shell getShell() {
96         return viewSite.getShell();
97     }
98
99     /* (non-Javadoc)
100      * @see org.eclipse.ui.IWorkbenchSite#getWorkbenchWindow()
101      */

102     public IWorkbenchWindow getWorkbenchWindow() {
103         return viewSite.getWorkbenchWindow();
104     }
105
106     public final boolean hasService(final Class JavaDoc key) {
107         return viewSite.hasService(key);
108     }
109
110     /* (non-Javadoc)
111      * @see org.eclipse.ui.IWorkbenchSite#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider)
112      */

113     public void setSelectionProvider(ISelectionProvider provider) {
114         viewSite.setSelectionProvider(provider);
115     }
116
117     /* (non-Javadoc)
118      * @see java.lang.Object#toString()
119      */

120     public String JavaDoc toString() {
121         return viewSite.toString();
122     }
123 }
124
Popular Tags