KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > presentations > IPresentablePart


1 /*******************************************************************************
2  * Copyright (c) 2004, 2007 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.presentations;
12
13 import org.eclipse.jface.util.IPropertyChangeListener;
14 import org.eclipse.swt.graphics.Image;
15 import org.eclipse.swt.graphics.Rectangle;
16 import org.eclipse.swt.widgets.Control;
17 import org.eclipse.ui.IPropertyListener;
18 import org.eclipse.ui.IWorkbenchPartConstants;
19
20 /**
21  * This is a skin's interface to the contents of a view or editor. Note that this
22  * is essentially the same as IWorkbenchPart, except it does not provide access
23  * to lifecycle events and allows repositioning of the part.
24  *
25  * Not intended to be implemented by clients.
26  *
27  * @since 3.0
28  */

29 public interface IPresentablePart {
30
31     /**
32      * The property id for <code>isDirty</code>.
33      */

34     public static final int PROP_DIRTY = IWorkbenchPartConstants.PROP_DIRTY;
35
36     /**
37      * The property id for <code>getEditorInput</code>.
38      */

39     public static final int PROP_INPUT = IWorkbenchPartConstants.PROP_INPUT;
40
41     /**
42      * The property id for <code>getTitle</code>, <code>getTitleImage</code>
43      * and <code>getTitleToolTip</code>.
44      */

45     public static final int PROP_TITLE = IWorkbenchPartConstants.PROP_TITLE;
46
47     /**
48      * The property id for <code>IWorkbenchPart2.getContentDescription()</code>
49      */

50     public static final int PROP_CONTENT_DESCRIPTION = IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION;
51
52     /**
53      * The property id for <code>IWorkbenchPart2.getContentDescription()</code>
54      */

55     public static final int PROP_PART_NAME = IWorkbenchPartConstants.PROP_PART_NAME;
56
57     /**
58      * The property id for <code>isBusy</code>.
59      */

60     public static final int PROP_BUSY = 0x92;
61
62     /**
63      * The property id for toolbar changes
64      */

65     public static final int PROP_TOOLBAR = 0x93;
66
67     /**
68      * The property id for highlighting the
69      * part if it is not in front.
70      */

71     public static final int PROP_HIGHLIGHT_IF_BACK = 0x94;
72
73     /**
74      * The property id for pane menu changes
75      */

76     public static final int PROP_PANE_MENU = 0x302;
77
78     /**
79      * Sets the bounds of this part.
80      *
81      * @param bounds bounding rectangle (not null)
82      */

83     public void setBounds(Rectangle bounds);
84
85     /**
86      * Notifies the part whether or not it is visible in the current
87      * perspective. A part is visible iff any part of its widgetry can
88      * be seen.
89      *
90      * @param isVisible true if the part has just become visible, false
91      * if the part has just become hidden
92      */

93     public void setVisible(boolean isVisible);
94
95     /**
96      * Forces this part to have focus.
97      */

98     public void setFocus();
99
100     /**
101      * Adds a listener for changes to properties of this workbench part.
102      * Has no effect if an identical listener is already registered.
103      * <p>
104      * The properties ids are defined by the PROP_* constants, above.
105      * </p>
106      *
107      * @param listener a property listener (not null)
108      */

109     public void addPropertyListener(IPropertyListener listener);
110
111     /**
112      * Remove a listener that was previously added using addPropertyListener.
113      *
114      * @param listener a property listener (not null)
115      */

116     public void removePropertyListener(IPropertyListener listener);
117
118     /**
119      * Returns the short name of the part. This is used as the text on
120      * the tab when this part is stacked on top of other parts.
121      *
122      * @return the short name of the part (not null)
123      */

124     public String JavaDoc getName();
125
126     /**
127      * Returns the title of this workbench part. If this value changes
128      * the part must fire a property listener event with
129      * <code>PROP_TITLE</code>.
130      * <p>
131      * The title is used to populate the title bar of this part's visual
132      * container.
133      * </p>
134      *
135      * @return the workbench part title (not null)
136      */

137     public String JavaDoc getTitle();
138
139     /**
140      * Returns the status message from the part's title, or the empty string if none.
141      * This is a substring of the part's title. A typical title will consist of
142      * the part name, a separator, and a status message describing the current contents.
143      * <p>
144      * Presentations can query getName() and getTitleStatus() if they want to display
145      * the status message and name separately, or they can use getTitle() if they want
146      * to display the entire title.
147      * </p>
148      *
149      * @return the status message or the empty string if none (not null)
150      */

151     public String JavaDoc getTitleStatus();
152
153     /**
154      * Returns the title image of this workbench part. If this value changes
155      * the part must fire a property listener event with
156      * <code>PROP_TITLE</code>.
157      * <p>
158      * The title image is usually used to populate the title bar of this part's
159      * visual container. Since this image is managed by the part itself, callers
160      * must <b>not</b> dispose the returned image.
161      * </p>
162      *
163      * @return the title image
164      */

165     public Image getTitleImage();
166
167     /**
168      * Returns the title tool tip text of this workbench part. If this value
169      * changes the part must fire a property listener event with
170      * <code>PROP_TITLE</code>.
171      * <p>
172      * The tool tip text is used to populate the title bar of this part's
173      * visual container.
174      * </p>
175      *
176      * @return the workbench part title tool tip (not null)
177      */

178     public String JavaDoc getTitleToolTip();
179
180     /**
181      * Returns true iff the contents of this part have changed recently. For
182      * editors, this indicates that the part has changed since the last save.
183      * For views, this indicates that the view contains interesting changes
184      * that it wants to draw the user's attention to.
185      *
186      * @return true iff the part is dirty
187      */

188     public boolean isDirty();
189
190     /**
191      * Return true if the the receiver is currently in a busy state.
192      * @return boolean true if busy
193      */

194     public boolean isBusy();
195     
196     /**
197      * Returns true iff this part can be closed
198      *
199      * @return true iff this part can be closed
200      * @since 3.1
201      */

202     public boolean isCloseable();
203     
204     /**
205      * Returns the local toolbar for this part, or null if this part does not
206      * have a local toolbar. Callers must not dispose or downcast the return value.
207      *
208      * @return the local toolbar for the part, or null if none
209      */

210     public Control getToolBar();
211
212     /**
213      * Returns the menu for this part or null if none
214      *
215      * @return the menu for this part or null if none
216      */

217     public IPartMenu getMenu();
218
219     /**
220      * Returns an SWT control that can be used to indicate the tab order for
221      * this part. This can be returned as part of the result to
222      * {@link StackPresentation#getTabList(IPresentablePart)}. Any other use of this control is
223      * unsupported. This may return a placeholder control that is only
224      * meaningful in the context of <code>getTabList</code>.
225      *
226      * @return the part's control (not null)
227      */

228     public Control getControl();
229
230     /**
231      * Get a property from the part's arbitrary property set.
232      * <p>
233      * <b>Note:</b> this is a different set of properties than the ones covered
234      * by the PROP_* constants.
235      * </p>
236      *
237      * @param key
238      * The property key to retrieve. Must not be <code>null</code>.
239      * @return the property, or <code>null</code> if that property is not set.
240      * @since 3.3
241      */

242     public String JavaDoc getPartProperty(String JavaDoc key);
243     
244     /**
245      * Add a listener for changes in the arbitrary properties set.
246      * <p>
247      * <b>Note:</b> this is a different set of properties than the ones covered
248      * by the PROP_* constants.
249      * </p>
250      *
251      * @param listener
252      * Must not be <code>null</code>.
253      * @since 3.3
254      */

255     public void addPartPropertyListener(IPropertyChangeListener listener);
256     
257     /**
258      * Remove a change listener from the arbitrary properties set.
259      * <p>
260      * <b>Note:</b> this is a different set of properties than the ones covered
261      * by the PROP_* constants.
262      * </p>
263      *
264      * @param listener
265      * Must not be <code>null</code>.
266      * @since 3.3
267      */

268     public void removePartPropertyListener(IPropertyChangeListener listener);
269 }
270
Popular Tags