KickJava   Java API By Example, From Geeks To Geeks.

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


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
12 package org.eclipse.ui;
13
14 /**
15  * An editor is a visual component within a workbench page. It is
16  * typically used to edit or browse a document or input object. The input
17  * is identified using an <code>IEditorInput</code>. Modifications made
18  * in an editor part follow an open-save-close lifecycle model (in contrast
19  * to a view part, where modifications are saved to the workbench
20  * immediately).
21  * <p>
22  * An editor is document or input-centric. Each editor has an input, and only
23  * one editor can exist for each editor input within a page. This policy has
24  * been designed to simplify part management.
25  * </p><p>
26  * An editor should be used in place of a view whenever more than one instance
27  * of a document type can exist.
28  * </p><p>
29  * This interface may be implemented directly. For convenience, a base
30  * implementation is defined in <code>EditorPart</code>.
31  * </p>
32  * <p>
33  * An editor part is added to the workbench in two stages:
34  * <ol>
35  * <li>An editor extension is contributed to the workbench registry. This
36  * extension defines the extension id, extension class, and the file
37  * extensions which are supported by the editor.</li>
38  * <li>An editor part based upon the extension is created and added to the
39  * workbench when the user opens a file with one of the supported file
40  * extensions (or some other suitable form of editor input).</li>
41  * </ol>
42  * </p>
43  * <p>
44  * All editor parts implement the <code>IAdaptable</code> interface; extensions
45  * are managed by the platform's adapter manager.
46  * </p>
47  *
48  * @see org.eclipse.ui.IWorkbenchPage#openEditor(IEditorInput, String)
49  * @see org.eclipse.ui.part.EditorPart
50  */

51 public interface IEditorPart extends IWorkbenchPart, ISaveablePart {
52
53     /**
54      * The property id for <code>isDirty</code>.
55      */

56     public static final int PROP_DIRTY = IWorkbenchPartConstants.PROP_DIRTY;
57
58     /**
59      * The property id for <code>getEditorInput</code>.
60      */

61     public static final int PROP_INPUT = IWorkbenchPartConstants.PROP_INPUT;
62
63     /**
64      * Returns the input for this editor. If this value changes the part must
65      * fire a property listener event with <code>PROP_INPUT</code>.
66      *
67      * @return the editor input
68      */

69     public IEditorInput getEditorInput();
70
71     /**
72      * Returns the site for this editor.
73      * This method is equivalent to <code>(IEditorSite) getSite()</code>.
74      * <p>
75      * The site can be <code>null</code> while the editor is being initialized.
76      * After the initialization is complete, this value must be non-<code>null</code>
77      * for the remainder of the editor's life cycle.
78      * </p>
79      *
80      * @return the editor site; this value may be <code>null</code> if the editor
81      * has not yet been initialized
82      */

83     public IEditorSite getEditorSite();
84
85     /**
86      * Initializes this editor with the given editor site and input.
87      * <p>
88      * This method is automatically called shortly after the part is instantiated.
89      * It marks the start of the part's lifecycle. The
90      * {@link IWorkbenchPart#dispose IWorkbenchPart.dispose} method will be called
91      * automically at the end of the lifecycle. Clients must not call this method.
92      * </p><p>
93      * Implementors of this method must examine the editor input object type to
94      * determine if it is understood. If not, the implementor must throw
95      * a <code>PartInitException</code>
96      * </p>
97      * @param site the editor site
98      * @param input the editor input
99      * @exception PartInitException if this editor was not initialized successfully
100      */

101     public void init(IEditorSite site, IEditorInput input)
102             throws PartInitException;
103 }
104
Popular Tags