01: /*******************************************************************************
02: * Copyright (c) 2000, 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;
11:
12: import org.eclipse.core.runtime.IConfigurationElement;
13: import org.eclipse.ui.IViewPart;
14: import org.eclipse.ui.IViewReference;
15: import org.eclipse.ui.IViewSite;
16: import org.eclipse.ui.internal.util.Util;
17: import org.eclipse.ui.views.IViewDescriptor;
18:
19: /**
20: * A view container manages the services for a view.
21: */
22: public class ViewSite extends PartSite implements IViewSite {
23:
24: public ViewSite(IViewReference ref, IViewPart view,
25: WorkbenchPage page, String id, String pluginId,
26: String registeredName) {
27:
28: super (ref, view, page);
29:
30: setId(id);
31: setRegisteredName(registeredName);
32: setPluginId(pluginId);
33: }
34:
35: /**
36: * Creates a new ViewSite.
37: */
38: public ViewSite(IViewReference ref, IViewPart view,
39: WorkbenchPage page, IViewDescriptor desc) {
40: super (ref, view, page);
41: setConfigurationElement((IConfigurationElement) Util
42: .getAdapter(desc, IConfigurationElement.class));
43: }
44:
45: /**
46: * Returns the secondary id or <code>null</code>.
47: */
48: public String getSecondaryId() {
49: return ((IViewReference) getPartReference()).getSecondaryId();
50: }
51:
52: /**
53: * Returns the view.
54: */
55: public IViewPart getViewPart() {
56: return (IViewPart) getPart();
57: }
58: }
|