KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ViewSite


1 /*******************************************************************************
2  * Copyright (c) 2000, 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 package org.eclipse.ui.internal;
12
13 import org.eclipse.core.runtime.IConfigurationElement;
14 import org.eclipse.ui.IViewPart;
15 import org.eclipse.ui.IViewReference;
16 import org.eclipse.ui.IViewSite;
17 import org.eclipse.ui.internal.util.Util;
18 import org.eclipse.ui.views.IViewDescriptor;
19
20 /**
21  * A view container manages the services for a view.
22  */

23 public class ViewSite extends PartSite implements IViewSite {
24     
25     public ViewSite(IViewReference ref, IViewPart view, WorkbenchPage page,
26             String JavaDoc id, String JavaDoc pluginId, String JavaDoc 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, WorkbenchPage page,
39             IViewDescriptor desc) {
40         super(ref, view, page);
41         setConfigurationElement((IConfigurationElement) Util.getAdapter(desc, IConfigurationElement.class));
42     }
43
44     /**
45      * Returns the secondary id or <code>null</code>.
46      */

47     public String JavaDoc getSecondaryId() {
48         return ((IViewReference) getPartReference()).getSecondaryId();
49     }
50
51     /**
52      * Returns the view.
53      */

54     public IViewPart getViewPart() {
55         return (IViewPart) getPart();
56     }
57 }
58
Popular Tags