KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > navigator > CommonViewerSiteDelegate


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.navigator;
12
13 import org.eclipse.core.runtime.Assert;
14 import org.eclipse.core.runtime.Platform;
15 import org.eclipse.jface.viewers.ISelectionProvider;
16 import org.eclipse.swt.widgets.Shell;
17 import org.eclipse.ui.navigator.ICommonViewerSite;
18
19 /**
20  * Provides a delegate implementation of {@link ICommonViewerSite}.
21  *
22  * @since 3.2
23  *
24  */

25 public class CommonViewerSiteDelegate implements ICommonViewerSite {
26     
27     
28     private String JavaDoc id;
29     private ISelectionProvider selectionProvider;
30     private Shell shell;
31
32     /**
33      *
34      * @param anId
35      * @param aSelectionProvider
36      * @param aShell
37      */

38     public CommonViewerSiteDelegate(String JavaDoc anId, ISelectionProvider aSelectionProvider, Shell aShell) {
39         Assert.isNotNull(anId);
40         Assert.isNotNull(aSelectionProvider);
41         Assert.isNotNull(aShell);
42         id = anId;
43         selectionProvider = aSelectionProvider;
44         shell = aShell;
45     }
46
47     public String JavaDoc getId() {
48         return id;
49     }
50
51     public Shell getShell() {
52         return shell;
53     }
54
55     public ISelectionProvider getSelectionProvider() {
56         return selectionProvider;
57     }
58
59
60     public void setSelectionProvider(ISelectionProvider aSelectionProvider) {
61         selectionProvider = aSelectionProvider;
62     }
63
64     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
65         return Platform.getAdapterManager().getAdapter(this, adapter);
66     }
67
68 }
69
Popular Tags