KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > forms > editor > IFormPage


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.forms.editor;
12 import org.eclipse.swt.widgets.Control;
13 import org.eclipse.ui.IEditorPart;
14 import org.eclipse.ui.forms.IManagedForm;
15 /**
16  * Interface that all GUI pages need to implement in order
17  * to be added to FormEditor part. The interface makes
18  * several assumptions:
19  * <ul>
20  * <li>The form page has a managed form</li>
21  * <li>The form page has a unique id</li>
22  * <li>The form page can be GUI but can also wrap a complete
23  * editor class (in that case, it should return <code>true</code>
24  * from <code>isEditor()</code> method).</li>
25  * <li>The form page is lazy i.e. understands that
26  * its part control will be created at the last possible
27  * moment.</li>.
28  * </ul>
29  * <p>Existing editors can be wrapped by implementing
30  * this interface. In this case, 'isEditor' should return <code>true</code>.
31  * A common editor to wrap in <code>TextEditor</code> that is
32  * often added to show the raw source code of the file open into
33  * the multi-page editor.
34  *
35  * @since 3.0
36  */

37 public interface IFormPage extends IEditorPart {
38     /**
39      * @param editor
40      * the form editor that this page belongs to
41      */

42     void initialize(FormEditor editor);
43     /**
44      * Returns the editor this page belongs to.
45      *
46      * @return the form editor
47      */

48     FormEditor getEditor();
49     /**
50      * Returns the managed form of this page, unless this is a source page.
51      *
52      * @return the managed form or <samp>null </samp> if this is a source page.
53      */

54     IManagedForm getManagedForm();
55     /**
56      * Indicates whether the page has become the active in the editor. Classes
57      * that implement this interface may use this method to commit the page (on
58      * <code>false</code>) or lazily create and/or populate the content on
59      * <code>true</code>.
60      *
61      * @param active
62      * <code>true</code> if page should be visible, <code>false</code>
63      * otherwise.
64      */

65     void setActive(boolean active);
66     /**
67      * Returns <samp>true </samp> if page is currently active, false if not.
68      *
69      * @return <samp>true </samp> for active page.
70      */

71     boolean isActive();
72     /**
73      * Tests if the content of the page is in a state that allows the
74      * editor to flip to another page. Typically, pages that contain
75      * raw source with syntax errors should not allow editors to
76      * leave them until errors are corrected.
77      * @return <code>true</code> if the editor can flip to another page,
78      * <code>false</code> otherwise.
79      */

80     boolean canLeaveThePage();
81     /**
82      * Returns the control associated with this page.
83      *
84      * @return the control of this page if created or <samp>null </samp> if the
85      * page has not been shown yet.
86      */

87     Control getPartControl();
88     /**
89      * Page must have a unique id that can be used to show it without knowing
90      * its relative position in the editor.
91      *
92      * @return the unique page identifier
93      */

94     String JavaDoc getId();
95     /**
96      * Returns the position of the page in the editor.
97      *
98      * @return the zero-based index of the page in the editor.
99      */

100     int getIndex();
101     /**
102      * Sets the position of the page in the editor.
103      *
104      * @param index
105      * the zero-based index of the page in the editor.
106      */

107     void setIndex(int index);
108     /**
109      * Tests whether this page wraps a complete editor that
110      * can be registered on its own, or represents a page
111      * that cannot exist outside the multi-page editor context.
112      *
113      * @return <samp>true </samp> if the page wraps an editor,
114      * <samp>false </samp> if this is a form page.
115      */

116     boolean isEditor();
117     /**
118      * A hint to bring the provided object into focus. If the object is in a
119      * tree or table control, select it. If it is shown on a scrollable page,
120      * ensure that it is visible. If the object is not presented in
121      * the page, <code>false</code> should be returned to allow another
122      * page to try.
123      *
124      * @param object
125      * object to select and reveal
126      * @return <code>true</code> if the request was successful, <code>false</code>
127      * otherwise.
128      */

129     boolean selectReveal(Object JavaDoc object);
130 }
131
Popular Tags