KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > properties > tabbed > ISection


1 /*******************************************************************************
2  * Copyright (c) 2001, 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.views.properties.tabbed;
12
13 import org.eclipse.jface.viewers.ISelection;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.ui.IWorkbenchPart;
16
17 /**
18  * Represents a section of properties for a given input.
19  * <p>
20  * The lifecycle of an ISection is as follows:
21  * <ul>
22  * <li><code>ISection.createControls()</code></li>
23  * <li><code>ISection.setInput()</code></li>
24  * <li><code>ISection.aboutToBeShown()</code></li>
25  * <li><code>ISection.refresh()</code></li>
26  * <li><code>ISection.aboutToBeHidden()</code></li>
27  * <li><code>ISection.dispose()</code></li>
28  * </ul>
29  * </p>
30  * <p>
31  * Implementors of this class should be aware that a section instance might be
32  * reused for different input objects (as long as they are valid section
33  * inputs). It means that <code>ISection.setInput</code> can be called at any
34  * time between <code>ISection.createControls</code> and
35  * <code>ISection.dispose</code>.
36  * </p>
37  * <p>
38  * When an input change event occurs, such as a tab selection or a workbench
39  * selection change, an ISection is sent:
40  * <ul>
41  * <li><code>ISection.setInput()</code></li>
42  * <li><code>ISection.refresh()</code></li>
43  * </ul>
44  * </p>
45  * <p>
46  * When an part activation event occurs, such as the contributor part activation
47  * event, an ISection is sent:
48  * <ul>
49  * <li><code>ISection.setInput()</code></li>
50  * <li><code>ISection.aboutToBeShown()</code></li>
51  * <li><code>ISection.refresh()</code></li>
52  * <li><code>ISection.setInput()</code></li>
53  * <li><code>ISection.refresh()</code></li>
54  * </ul>
55  * This is because both a tab selection event and an input selection event have
56  * occurred.
57  * </p>
58  * <p>
59  * This interface should not be extended or implemented. New section instances
60  * should be created using <code>AbstractPropertySection</code>.
61  * </p>
62  * @see org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage
63  *
64  * @author Anthony Hunter
65  */

66 public interface ISection {
67
68     /**
69      * Creates the controls for the section.
70      * <p>
71      * Clients should take advantage of the widget factory provided by the
72      * framework to achieve a common look between property sections.
73      * </p>
74      * @see org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage#getWidgetFactory()
75      *
76      * @param parent
77      * the parent composite for the section.
78      * @param tabbedPropertySheetPage
79      * the tabbed property sheet page.
80      */

81     public abstract void createControls(Composite parent,
82             TabbedPropertySheetPage tabbedPropertySheetPage);
83
84     /**
85      * Notifies the section that the workbench selection has changed.
86      * @param part The active workench part.
87      * @param selection The active selection in the workbench part.
88      */

89     public abstract void setInput(IWorkbenchPart part, ISelection selection);
90
91     /**
92      * Notifies the section that its controls are about to be shown. It is
93      * expected that sections enable domain related functions in this method,
94      * most commonly add listeners.
95      * <p>
96      * Since the controls are not visible, the section should wait for the
97      * refresh() before updating the section controls.
98      * </p>
99      */

100     public abstract void aboutToBeShown();
101
102     /**
103      * Notifies the section that its controls are about to be hidden. It is
104      * expected that sections disable domain related functions in this method,
105      * most commonly remove listeners.
106      */

107     public abstract void aboutToBeHidden();
108
109     /**
110      * Dispose this section.
111      */

112     public abstract void dispose();
113
114     /**
115      * Returns the minimum height needed by this section. A return value of
116      * <code>SWT.DEFAULT</code> indicates that no minimum height is defined.
117      *
118      * @return the minimum height needed by this section.
119      */

120     public abstract int getMinimumHeight();
121
122     /**
123      * Determine whether this section would like extra height space in case
124      * there is some left. Normally this is true when the section is the last to
125      * be displayed on a tab or is the only section on a tab.
126      * @return <code>true</code> if this section would like extra height space.
127      */

128     public abstract boolean shouldUseExtraSpace();
129
130     /**
131      * Refresh the contents of the controls displayed in this section.
132      */

133     public abstract void refresh();
134 }
135
Popular Tags