001: /*******************************************************************************
002: * Copyright (c) 2004, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.internal;
011:
012: import org.eclipse.jface.viewers.ISelectionProvider;
013: import org.eclipse.swt.widgets.Shell;
014: import org.eclipse.ui.IActionBars;
015: import org.eclipse.ui.IKeyBindingService;
016: import org.eclipse.ui.IViewSite;
017: import org.eclipse.ui.IWorkbenchPage;
018: import org.eclipse.ui.IWorkbenchWindow;
019: import org.eclipse.ui.internal.intro.IntroDescriptor;
020: import org.eclipse.ui.intro.IIntroSite;
021:
022: /**
023: * Simple <code>IIntroSite</code> that wraps a <code>IViewSite</code>. For use in conjunction with
024: * <code>ViewIntroAdapterPart</code>.
025: *
026: * @since 3.0
027: */
028: final class ViewIntroAdapterSite implements IIntroSite {
029: private IntroDescriptor descriptor;
030:
031: private IViewSite viewSite;
032:
033: public ViewIntroAdapterSite(IViewSite viewSite,
034: IntroDescriptor descriptor) {
035: this .viewSite = viewSite;
036: this .descriptor = descriptor;
037: }
038:
039: /* (non-Javadoc)
040: * @see org.eclipse.ui.intro.IIntroSite#getActionBars()
041: */
042: public IActionBars getActionBars() {
043: return viewSite.getActionBars();
044: }
045:
046: /* (non-Javadoc)
047: * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
048: */
049: public Object getAdapter(Class adapter) {
050: return viewSite.getAdapter(adapter);
051: }
052:
053: /* (non-Javadoc)
054: * @see org.eclipse.ui.IWorkbenchPartSite#getId()
055: */
056: public String getId() {
057: return descriptor.getId();
058: }
059:
060: /* (non-Javadoc)
061: * @see org.eclipse.ui.IWorkbenchPartSite#getKeyBindingService()
062: */
063: public IKeyBindingService getKeyBindingService() {
064: return viewSite.getKeyBindingService();
065: }
066:
067: /* (non-Javadoc)
068: * @see org.eclipse.ui.IWorkbenchSite#getPage()
069: */
070: public IWorkbenchPage getPage() {
071: return viewSite.getPage();
072: }
073:
074: /* (non-Javadoc)
075: * @see org.eclipse.ui.IWorkbenchPartSite#getPluginId()
076: */
077: public String getPluginId() {
078: return descriptor.getPluginId();
079: }
080:
081: /* (non-Javadoc)
082: * @see org.eclipse.ui.IWorkbenchSite#getSelectionProvider()
083: */
084: public ISelectionProvider getSelectionProvider() {
085: return viewSite.getSelectionProvider();
086: }
087:
088: public final Object getService(final Class key) {
089: return viewSite.getService(key);
090: }
091:
092: /* (non-Javadoc)
093: * @see org.eclipse.ui.IWorkbenchSite#getShell()
094: */
095: public Shell getShell() {
096: return viewSite.getShell();
097: }
098:
099: /* (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 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 toString() {
121: return viewSite.toString();
122: }
123: }
|