KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > IViewPart


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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;
12
13
14 /**
15  * A view is a visual component within a workbench page. It is typically used to
16  * navigate a hierarchy of information (like the workspace), open an editor,
17  * or display properties for the active editor. Modifications made in a view are
18  * saved immediately (in contrast to an editor part, which conforms to a more
19  * elaborate open-save-close lifecycle).
20  * <p>
21  * Only one instance of a particular view type may exist within a workbench page.
22  * This policy is designed to simplify part management for a user.
23  * </p><p>
24  * This interface may be implemented directly. For convenience, a base
25  * implementation is defined in <code>ViewPart</code>.
26  * </p>
27  * <p>
28  * A view is added to the workbench in two steps:
29  * <ol>
30  * <li>A view extension is contributed to the workbench registry. This
31  * extension defines the extension id and extension class.</li>
32  * <li>The view is included in the default layout for a perspective.
33  * Alternatively, the user may open the view from the Perspective menu.</li>
34  * </ol>
35  * </p>
36  * <p>
37  * Views implement the <code>IAdaptable</code> interface; extensions
38  * are managed by the platform's adapter manager.
39  * </p>
40  *
41  * @see IWorkbenchPage#showView
42  * @see org.eclipse.ui.part.ViewPart
43  */

44 public interface IViewPart extends IWorkbenchPart, IPersistable {
45     /**
46      * Returns the site for this view.
47      * This method is equivalent to <code>(IViewSite) getSite()</code>.
48      * <p>
49      * The site can be <code>null</code> while the view is being initialized.
50      * After the initialization is complete, this value must be non-<code>null</code>
51      * for the remainder of the view's life cycle.
52      * </p>
53      *
54      * @return the view site; this value may be <code>null</code> if the view
55      * has not yet been initialized
56      */

57     public IViewSite getViewSite();
58
59     /**
60      * Initializes this view with the given view site.
61      * <p>
62      * This method is automatically called by the workbench shortly after the
63      * part is instantiated. It marks the start of the views's lifecycle. Clients must
64      * not call this method.
65      * </p>
66      *
67      * @param site the view site
68      * @exception PartInitException if this view was not initialized successfully
69      */

70     public void init(IViewSite site) throws PartInitException;
71
72     /**
73      * Initializes this view with the given view site. A memento is passed to
74      * the view which contains a snapshot of the views state from a previous
75      * session. Where possible, the view should try to recreate that state
76      * within the part controls.
77      * <p>
78      * This method is automatically called by the workbench shortly after the part
79      * is instantiated. It marks the start of the views's lifecycle. Clients must
80      * not call this method.
81      * </p>
82      *
83      * @param site the view site
84      * @param memento the IViewPart state or null if there is no previous saved state
85      * @exception PartInitException if this view was not initialized successfully
86      */

87     public void init(IViewSite site, IMemento memento) throws PartInitException;
88
89     /**
90      * Saves the object state within a memento.
91      *
92      * @param memento a memento to receive the object state
93      */

94     public void saveState(IMemento memento);
95 }
96
Popular Tags