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.ui.IMemento;
13: import org.eclipse.ui.internal.navigator.NavigatorContentService;
14: import org.eclipse.ui.navigator.ICommonContentExtensionSite;
15: import org.eclipse.ui.navigator.INavigatorContentExtension;
16: import org.eclipse.ui.navigator.INavigatorContentService;
17:
18: /**
19: * @since 3.2
20: *
21: */
22: public class CommonContentExtensionSite extends CommonExtensionSite
23: implements ICommonContentExtensionSite {
24:
25: private NavigatorContentExtension extension;
26:
27: private IMemento memento;
28:
29: private NavigatorContentService contentService;
30:
31: /**
32: * Create a config element for the initialization of Content Extensions.
33: *
34: * @param anExtensionId
35: * The unique identifier of the associated content extension or
36: * the top-level action provider. <b>May NOT be null.</b>
37: * @param aContentService
38: * The associated content service to allow coordination with
39: * content extensions via the IExtensionStateModel. Clients may
40: * access the content providers and label providers as necessary
41: * also to render labels or images in their UI. <b>May NOT be
42: * null.</b>
43: * @param aMemento
44: * The memento associated with the parent viewer.
45: */
46: public CommonContentExtensionSite(String anExtensionId,
47: NavigatorContentService aContentService, IMemento aMemento) {
48: super (aContentService, anExtensionId);
49:
50: NavigatorContentDescriptor contentDescriptor = NavigatorContentDescriptorManager
51: .getInstance().getContentDescriptor(anExtensionId);
52:
53: extension = aContentService.getExtension(contentDescriptor);
54: memento = aMemento;
55: contentService = aContentService;
56: }
57:
58: /*
59: * (non-Javadoc)
60: *
61: * @see org.eclipse.ui.navigator.ICommonContentExtensionSite#getMemento()
62: */
63: public IMemento getMemento() {
64: return memento;
65: }
66:
67: /*
68: * (non-Javadoc)
69: *
70: * @see org.eclipse.ui.navigator.ICommonContentExtensionSite#getExtension()
71: */
72: public INavigatorContentExtension getExtension() {
73: return extension;
74: }
75:
76: /* (non-Javadoc)
77: * @see org.eclipse.ui.navigator.ICommonContentExtensionSite#getService()
78: */
79: public INavigatorContentService getService() {
80: return contentService;
81: }
82:
83: }
|