KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > navigator > extensions > CommonActionExtensionSite


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.extensions;
12
13 import org.eclipse.core.runtime.Assert;
14 import org.eclipse.jface.viewers.StructuredViewer;
15 import org.eclipse.ui.internal.navigator.NavigatorContentService;
16 import org.eclipse.ui.navigator.CommonActionProvider;
17 import org.eclipse.ui.navigator.ICommonActionExtensionSite;
18 import org.eclipse.ui.navigator.ICommonViewerSite;
19
20 /**
21  *
22  * Provides access to information required for the initialization of
23  * CommonActionProviders.
24  *
25  * <p>
26  * See the documentation of the <b>org.eclipse.ui.navigator.navigatorContent</b>
27  * extension point and {@link CommonActionProvider} for more information on
28  * declaring {@link CommonActionProvider}s.
29  * </p>
30  *
31  *
32  * @since 3.2
33  */

34 public final class CommonActionExtensionSite extends CommonExtensionSite
35         implements ICommonActionExtensionSite {
36
37     private String JavaDoc extensionId;
38
39     private ICommonViewerSite commonViewerSite;
40
41     private StructuredViewer structuredViewer;
42
43     /**
44      * Create a config element for the initialization of Common Action
45      * Providers.
46      *
47      * @param anExtensionId
48      * The unique identifier of the associated content extension or
49      * the top-level action provider. <b>May NOT be null.</b>
50      * @param aCommonViewerSite
51      * The common viewer site may be used to access information about
52      * the part for which the instantiated CommonActionProvider will
53      * be used. <b>May NOT be null.</b>
54      * @param aContentService
55      * The associated content service to allow coordination with
56      * content extensions via the IExtensionStateModel. Clients may
57      * access the content providers and label providers as necessary
58      * also to render labels or images in their UI. <b>May NOT be
59      * null.</b>
60      * @param aStructuredViewer
61      * The viewer control that will use the instantiated Common
62      * Action Provider. <b>May NOT be null.</b>
63      */

64     public CommonActionExtensionSite(String JavaDoc anExtensionId,
65             ICommonViewerSite aCommonViewerSite,
66             NavigatorContentService aContentService,
67             StructuredViewer aStructuredViewer) {
68         super(aContentService, anExtensionId);
69
70         Assert.isNotNull(aCommonViewerSite);
71         Assert.isNotNull(aStructuredViewer);
72         extensionId = anExtensionId;
73         commonViewerSite = aCommonViewerSite;
74         structuredViewer = aStructuredViewer;
75
76     }
77
78     /**
79      *
80      * @return The unique identifier of the associated content extension or the
81      * top-level Common Action Provider.
82      */

83     public String JavaDoc getExtensionId() {
84         return extensionId;
85     }
86
87     /**
88      *
89      * @return The associated structured viewer for the instantiated Common
90      * Action Provider.
91      */

92     public StructuredViewer getStructuredViewer() {
93         return structuredViewer;
94     }
95
96     /**
97      *
98      * @return The ICommonViewerSite from the CommonViewer.
99      */

100     public ICommonViewerSite getViewSite() {
101         return commonViewerSite;
102     }
103 }
104
Popular Tags