001: /*******************************************************************************
002: * Copyright (c) 2005, 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.navigator.extensions;
011:
012: import org.eclipse.core.runtime.Assert;
013: import org.eclipse.jface.viewers.StructuredViewer;
014: import org.eclipse.ui.internal.navigator.NavigatorContentService;
015: import org.eclipse.ui.navigator.CommonActionProvider;
016: import org.eclipse.ui.navigator.ICommonActionExtensionSite;
017: import org.eclipse.ui.navigator.ICommonViewerSite;
018:
019: /**
020: *
021: * Provides access to information required for the initialization of
022: * CommonActionProviders.
023: *
024: * <p>
025: * See the documentation of the <b>org.eclipse.ui.navigator.navigatorContent</b>
026: * extension point and {@link CommonActionProvider} for more information on
027: * declaring {@link CommonActionProvider}s.
028: * </p>
029: *
030: *
031: * @since 3.2
032: */
033: public final class CommonActionExtensionSite extends
034: CommonExtensionSite implements ICommonActionExtensionSite {
035:
036: private String extensionId;
037:
038: private ICommonViewerSite commonViewerSite;
039:
040: private StructuredViewer structuredViewer;
041:
042: /**
043: * Create a config element for the initialization of Common Action
044: * Providers.
045: *
046: * @param anExtensionId
047: * The unique identifier of the associated content extension or
048: * the top-level action provider. <b>May NOT be null.</b>
049: * @param aCommonViewerSite
050: * The common viewer site may be used to access information about
051: * the part for which the instantiated CommonActionProvider will
052: * be used. <b>May NOT be null.</b>
053: * @param aContentService
054: * The associated content service to allow coordination with
055: * content extensions via the IExtensionStateModel. Clients may
056: * access the content providers and label providers as necessary
057: * also to render labels or images in their UI. <b>May NOT be
058: * null.</b>
059: * @param aStructuredViewer
060: * The viewer control that will use the instantiated Common
061: * Action Provider. <b>May NOT be null.</b>
062: */
063: public CommonActionExtensionSite(String anExtensionId,
064: ICommonViewerSite aCommonViewerSite,
065: NavigatorContentService aContentService,
066: StructuredViewer aStructuredViewer) {
067: super (aContentService, anExtensionId);
068:
069: Assert.isNotNull(aCommonViewerSite);
070: Assert.isNotNull(aStructuredViewer);
071: extensionId = anExtensionId;
072: commonViewerSite = aCommonViewerSite;
073: structuredViewer = aStructuredViewer;
074:
075: }
076:
077: /**
078: *
079: * @return The unique identifier of the associated content extension or the
080: * top-level Common Action Provider.
081: */
082: public String getExtensionId() {
083: return extensionId;
084: }
085:
086: /**
087: *
088: * @return The associated structured viewer for the instantiated Common
089: * Action Provider.
090: */
091: public StructuredViewer getStructuredViewer() {
092: return structuredViewer;
093: }
094:
095: /**
096: *
097: * @return The ICommonViewerSite from the CommonViewer.
098: */
099: public ICommonViewerSite getViewSite() {
100: return commonViewerSite;
101: }
102: }
|