01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.internal.navigator.extensions;
11:
12: import org.eclipse.core.runtime.Assert;
13: import org.eclipse.ui.navigator.ICommonActionExtensionSite;
14: import org.eclipse.ui.navigator.ICommonContentExtensionSite;
15: import org.eclipse.ui.navigator.IExtensionStateModel;
16: import org.eclipse.ui.navigator.INavigatorContentService;
17:
18: /**
19: *
20: * Provides a common base class for {@link ICommonContentExtensionSite} and
21: * {@link ICommonActionExtensionSite}.
22: *
23: * @since 3.2
24: *
25: */
26: public class CommonExtensionSite {
27:
28: private final INavigatorContentService contentService;
29:
30: private IExtensionStateModel extensionStateModel;
31:
32: protected CommonExtensionSite(
33: INavigatorContentService aContentService,
34: String anExtensionId) {
35:
36: Assert.isNotNull(aContentService);
37:
38: contentService = aContentService;
39: if (anExtensionId != null) {
40: extensionStateModel = aContentService
41: .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: }
|