KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 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
12 package org.eclipse.ui.internal.navigator.extensions;
13
14 import org.eclipse.core.runtime.Assert;
15 import org.eclipse.ui.navigator.ICommonActionExtensionSite;
16 import org.eclipse.ui.navigator.ICommonContentExtensionSite;
17 import org.eclipse.ui.navigator.IExtensionStateModel;
18 import org.eclipse.ui.navigator.INavigatorContentService;
19
20 /**
21  *
22  * Provides a common base class for {@link ICommonContentExtensionSite} and
23  * {@link ICommonActionExtensionSite}.
24  *
25  * @since 3.2
26  *
27  */

28 public class CommonExtensionSite {
29
30     private final INavigatorContentService contentService;
31
32     private IExtensionStateModel extensionStateModel;
33
34     protected CommonExtensionSite(INavigatorContentService aContentService,
35             String JavaDoc anExtensionId) {
36
37         Assert.isNotNull(aContentService);
38
39         contentService = aContentService;
40         if (anExtensionId != null) {
41             extensionStateModel = aContentService.findStateModel(anExtensionId);
42         }
43     }
44
45     /**
46      *
47      * @return The content service used to create this extension site
48      */

49     public final INavigatorContentService getContentService() {
50         return contentService;
51     }
52
53     /**
54      * By default, the extension state model returned is for the associated
55      * content extension (if this is NOT a top-level action provider).
56      * Otherwise, clients may use
57      * {@link INavigatorContentService#findStateModel(String)} to locate the
58      * state model of another content extension.
59      *
60      * @return The extension state model of the associated extension.
61      * @see IExtensionStateModel
62      */

63     public final IExtensionStateModel getExtensionStateModel() {
64         return extensionStateModel;
65     }
66
67 }
68
Popular Tags