KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 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
12 package org.eclipse.ui;
13
14 import org.eclipse.jface.util.IPropertyChangeListener;
15 import org.eclipse.swt.graphics.Image;
16
17 /**
18  * Implements a reference to a IWorkbenchPart.
19  * The IWorkbenchPart will not be instanciated until the part
20  * becomes visible or the API getPart is sent with true;
21  * <p>
22  * This interface is not intended to be implemented by clients.
23  * </p>
24  */

25 public interface IWorkbenchPartReference {
26     /**
27      * Returns the IWorkbenchPart referenced by this object.
28      * Returns <code>null</code> if the editors was not instantiated or
29      * it failed to be restored. Tries to restore the editor
30      * if <code>restore</code> is true.
31      */

32     public IWorkbenchPart getPart(boolean restore);
33
34     /**
35      * @see IWorkbenchPart#getTitle
36      */

37     public String JavaDoc getTitle();
38
39     /**
40      * @see IWorkbenchPart#getTitleImage
41      */

42     public Image getTitleImage();
43
44     /**
45      * @see IWorkbenchPart#getTitleToolTip
46      */

47     public String JavaDoc getTitleToolTip();
48
49     /**
50      * @see IWorkbenchPartSite#getId
51      */

52     public String JavaDoc getId();
53
54     /**
55      * @see IWorkbenchPart#addPropertyListener
56      */

57     public void addPropertyListener(IPropertyListener listener);
58
59     /**
60      * @see IWorkbenchPart#removePropertyListener
61      */

62     public void removePropertyListener(IPropertyListener listener);
63
64     /**
65      * Returns the workbench page that contains this part
66      */

67     public IWorkbenchPage getPage();
68
69     /**
70      * Returns the name of the part, as it should be shown in tabs.
71      *
72      * @return the part name
73      *
74      * @since 3.0
75      */

76     public String JavaDoc getPartName();
77
78     /**
79      * Returns the content description for the part (or the empty string if none)
80      *
81      * @return the content description for the part
82      *
83      * @since 3.0
84      */

85     public String JavaDoc getContentDescription();
86     
87
88     /**
89      * Returns whether the part is dirty (i.e. has unsaved changes).
90      *
91      * @return <code>true</code> if the part is dirty, <code>false</code> otherwise
92      *
93      * @since 3.2 (previously existed on IEditorReference)
94      */

95     public boolean isDirty();
96     
97     /**
98      * Return an arbitrary property from the reference. If the part has been
99      * instantiated, it just delegates to the part. If not, then it looks in its
100      * own cache of properties. If the property is not available or the part has
101      * never been instantiated, it can return <code>null</code>.
102      *
103      * @param key
104      * The property to return. Must not be <code>null</code>.
105      * @return The String property, or <code>null</code>.
106      * @since 3.3
107      */

108     public String JavaDoc getPartProperty(String JavaDoc key);
109     
110     /**
111      * Add a listener for changes in the arbitrary properties set.
112      *
113      * @param listener
114      * Must not be <code>null</code>.
115      * @since 3.3
116      */

117     public void addPartPropertyListener(IPropertyChangeListener listener);
118     
119     /**
120      * Remove a listener for changes in the arbitrary properties set.
121      *
122      * @param listener
123      * Must not be <code>null</code>.
124      * @since 3.3
125      */

126     public void removePartPropertyListener(IPropertyChangeListener listener);
127 }
128
Popular Tags