Class WorkbenchPartReference
- All Implemented Interfaces:
- ISizeProvider,- IWorkbenchPartReference
- Direct Known Subclasses:
- EditorReference,- ViewReference
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intInternal property ID: Indicates that the part has an active child and the active child has changed.static final intInternal property ID: Indicates that the underlying part was destroyedstatic final intInternal property ID: Indicates that changed in the min / max state has changedstatic final intInternal property ID: Indicates that the underlying part was createdstatic final intInternal property ID: Indicates that the result of IEditorReference.isPinned()static final intInternal property ID: Indicates that the result of getVisible() has changedstatic final intInternal property ID: Indicates that the result of isZoomed() has changedprotected IWorkbenchPartstatic intState constant indicating that the part has been createdstatic intState constant indicating that the part is in the process of being createdstatic intState constant indicating that the reference has been disposed (the reference shouldn't be used anymore)static intState constant indicating that the part is not created yetFields inherited from interface org.eclipse.ui.ISizeProviderINFINITE
- 
Constructor SummaryConstructorsConstructorDescriptionWorkbenchPartReference(IEclipseContext windowContext, IWorkbenchPage page, MPart part) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd a listener for changes in the arbitrary properties set.voidaddPropertyListener(IPropertyListener listener) protected voidintcomputePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult) Returns the best size for this part, given the available width and height and the workbench's preferred size for the part.protected StringComputes a new title for the part.abstract IWorkbenchPartcreateErrorPart(IStatus status) abstract IWorkbenchPartprotected voidcreatePartProperties(IWorkbenchPart3 workbenchPart) protected voidprotected voidfireInternalPropertyChange(int id) protected voidprotected voidfirePropertyChange(int id) Returns the content description for the part (or the empty string if none)getId()getModel()getPage()final PartPanegetPane()final IWorkbenchPartgetPart(boolean restore) Returns the IWorkbenchPart referenced by this object.Returns the name of the part, as it should be shown in tabs.getPartProperty(String key) Return an arbitrary property from the reference.protected final StringReturns the unmodified title for the part, or the empty string if noneabstract PartSitegetSite()intgetSizeFlags(boolean width) Returns a bitwise combination of flags indicating how and when computePreferredSize should be used.getTitle()final Imageabstract voidinitialize(IWorkbenchPart part) voidbooleanisDirty()Returns whether the part is dirty (i.e. has unsaved changes).booleanbooleanisPinned()protected voidpartPropertyChanged(Object source, int propId) protected voidprotected voidReleases any references maintained by this part reference when its actual part becomes known (not called when it is disposed).voidRemove a listener for changes in the arbitrary properties set.voidremovePropertyListener(IPropertyListener listener) voidsetPage(IWorkbenchPage newPage) voidsetPinned(boolean newPinned) voidvoid
- 
Field Details- 
INTERNAL_PROPERTY_OPENEDpublic static final int INTERNAL_PROPERTY_OPENEDInternal property ID: Indicates that the underlying part was created- See Also:
 
- 
INTERNAL_PROPERTY_CLOSEDpublic static final int INTERNAL_PROPERTY_CLOSEDInternal property ID: Indicates that the underlying part was destroyed- See Also:
 
- 
INTERNAL_PROPERTY_PINNEDpublic static final int INTERNAL_PROPERTY_PINNEDInternal property ID: Indicates that the result of IEditorReference.isPinned()- See Also:
 
- 
INTERNAL_PROPERTY_VISIBLEpublic static final int INTERNAL_PROPERTY_VISIBLEInternal property ID: Indicates that the result of getVisible() has changed- See Also:
 
- 
INTERNAL_PROPERTY_ZOOMEDpublic static final int INTERNAL_PROPERTY_ZOOMEDInternal property ID: Indicates that the result of isZoomed() has changed- See Also:
 
- 
INTERNAL_PROPERTY_ACTIVE_CHILD_CHANGEDpublic static final int INTERNAL_PROPERTY_ACTIVE_CHILD_CHANGEDInternal property ID: Indicates that the part has an active child and the active child has changed. (fired by PartStack)- See Also:
 
- 
INTERNAL_PROPERTY_MAXIMIZEDpublic static final int INTERNAL_PROPERTY_MAXIMIZEDInternal property ID: Indicates that changed in the min / max state has changed- See Also:
 
- 
STATE_LAZYpublic static int STATE_LAZYState constant indicating that the part is not created yet
- 
STATE_CREATION_IN_PROGRESSpublic static int STATE_CREATION_IN_PROGRESSState constant indicating that the part is in the process of being created
- 
STATE_CREATEDpublic static int STATE_CREATEDState constant indicating that the part has been created
- 
STATE_DISPOSEDpublic static int STATE_DISPOSEDState constant indicating that the reference has been disposed (the reference shouldn't be used anymore)
- 
legacyPart
- 
propertyCache
 
- 
- 
Constructor Details- 
WorkbenchPartReference
 
- 
- 
Method Details- 
subscribepublic void subscribe()
- 
unsubscribepublic void unsubscribe()
- 
isDisposedpublic boolean isDisposed()
- 
checkReferenceprotected void checkReference()
- 
getModel
- 
partPropertyChanged- Parameters:
- source- used for IPropertyListener
 
- 
partPropertyChanged
- 
releaseReferencesprotected void releaseReferences()Releases any references maintained by this part reference when its actual part becomes known (not called when it is disposed).
- 
fireInternalPropertyChangeprotected void fireInternalPropertyChange(int id) 
- 
addPropertyListener- Specified by:
- addPropertyListenerin interface- IWorkbenchPartReference
- Parameters:
- listener- the property listener
- See Also:
 
- 
removePropertyListener- Specified by:
- removePropertyListenerin interface- IWorkbenchPartReference
- Parameters:
- listener- the poperty listener to remove
- See Also:
 
- 
getTitle- Specified by:
- getTitlein interface- IWorkbenchPartReference
- Returns:
- the title of the part
- See Also:
 
- 
getTitleToolTip- Specified by:
- getTitleToolTipin interface- IWorkbenchPartReference
- Returns:
- the title tooltip
- See Also:
 
- 
getId- Specified by:
- getIdin interface- IWorkbenchPartReference
- Returns:
- the ID of the part
- See Also:
 
- 
computeTitleComputes a new title for the part. Subclasses may override to change the default behavior.- Returns:
- the title for the part
 
- 
getRawTitleReturns the unmodified title for the part, or the empty string if none- Returns:
- the unmodified title, as set by the IWorkbenchPart. Returns the empty string if none.
 
- 
getTitleImage- Specified by:
- getTitleImagein interface- IWorkbenchPartReference
- Returns:
- the title image of the part
- See Also:
 
- 
firePropertyChangeprotected void firePropertyChange(int id) 
- 
getSite
- 
initialize- Throws:
- PartInitException
 
- 
getPartDescription copied from interface:IWorkbenchPartReferenceReturns the IWorkbenchPart referenced by this object.- Specified by:
- getPartin interface- IWorkbenchPartReference
- Parameters:
- restore- tries to restore the part if- true.
- Returns:
- the part, or nullif the part was not instantiated or it failed to be restored.
 
- 
createPart- Throws:
- PartInitException
 
- 
createErrorPart
- 
doDisposeNestedPartsprotected void doDisposeNestedParts()
- 
setPinnedpublic void setPinned(boolean newPinned) 
- 
isPinnedpublic boolean isPinned()
- 
getPartPropertyDescription copied from interface:IWorkbenchPartReferenceReturn an arbitrary property from the reference. If the part has been instantiated, it just delegates to the part. If not, then it looks in its own cache of properties. If the property is not available or the part has never been instantiated, it can returnnull.- Specified by:
- getPartPropertyin interface- IWorkbenchPartReference
- Parameters:
- key- The property to return. Must not be- null.
- Returns:
- The String property, or null.
 
- 
addPartPropertyListenerDescription copied from interface:IWorkbenchPartReferenceAdd a listener for changes in the arbitrary properties set.- Specified by:
- addPartPropertyListenerin interface- IWorkbenchPartReference
- Parameters:
- listener- Must not be- null.
 
- 
removePartPropertyListenerDescription copied from interface:IWorkbenchPartReferenceRemove a listener for changes in the arbitrary properties set.- Specified by:
- removePartPropertyListenerin interface- IWorkbenchPartReference
- Parameters:
- listener- Must not be- null.
 
- 
firePartPropertyChange
- 
createPartProperties
- 
computePreferredSizepublic int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult) Description copied from interface:ISizeProviderReturns the best size for this part, given the available width and height and the workbench's preferred size for the part. Parts can overload this to enforce a minimum size, maximum size, or a quantized set of preferred sizes. If width == true, this method computes a width in pixels. If width == false, this method computes a height. availableParallel and availablePerpendicular contain the space available, and preferredParallel contains the preferred result. This method returns an answer that is less than or equal to availableParallel and as close to preferredParallel as possible. Return values larger than availableParallel will be truncated. Most presentations will define a minimum size at all times, and a maximum size that only applies when maximized. The getSizeFlags method controls how frequently this method will be called and what information will be available when it is. Any subclass that specializes this method should also specialize getSizeFlags. computePreferredSize(width, INFINITE, someSize, 0) returns the minimum size of the control (if any). computePreferredSize(width, INFINITE, someSize, INFINITE) returns the maximum size of the control. Examples: - To maintain a constant size of 100x300 pixels: {return width ? 100 : 300}, getSizeFlags(boolean) must return SWT.MIN | SWT.MAX
- To grow without constraints: {return preferredResult;}, getSizeFlags(boolean) must return 0.
- To enforce a width that is always a multiple of 100 pixels, to a minimum
 of 100 pixels:
 
 In this case, getSizeFlags(boolean width) must return (width ? SWT.FILL | SWT.MIN: 0){ if (width && preferredResult != INFINITE) { int result = preferredResult - ((preferredResult + 50) % 100) + 50; result = Math.max(100, Math.min(result, availableParallel - (availableParallel % 100))); return result; } return preferredResult; }
- To maintain a minimum area of 100000 pixels: {return availablePerpendicular < 100 ? 1000 : 100000 / availablePerpendicular;}getSizeFlags(boolean width) must return SWT.WRAP | SWT.MIN;
 - Specified by:
- computePreferredSizein interface- ISizeProvider
- Parameters:
- width- indicates whether a width (if- true) or a height (if- false) is being computed
- availableParallel- available space. This is a width (pixels) if width == true, and a height (pixels) if width == false. A return value larger than this will be ignored.
- availablePerpendicular- available space perpendicular to the direction being measured or INFINITE if unbounded (pixels). This is a height if width == true, or a height if width == false. Implementations will generally ignore this argument unless they contain wrapping widgets. Note this argument will only contain meaningful information if the part returns the SWT.WRAP flag from getSizeFlags(width)
- preferredResult- preferred size of the control (pixels, <= availableParallel). Set to INFINITE if unknown or unbounded.
- Returns:
- returns the preferred size of the control (pixels). This is a width if width == true or a height if width == false. Callers are responsible for rounding down the return value if it is larger than availableParallel. If availableParallel is INFINITE, then a return value of INFINITE is permitted, indicating that the preferred size of the control is unbounded.
- See Also:
 
- 
getSizeFlagspublic int getSizeFlags(boolean width) Description copied from interface:ISizeProviderReturns a bitwise combination of flags indicating how and when computePreferredSize should be used. When called with horizontal=true, this indicates the usage of computePreferredSize(true,...) for computing widths. When called with horizontal=false, this indicates the usage of computeSize(false,...) for computing heights. These flags are used for optimization. Each flag gives the part more control over its preferred size but slows down the layout algorithm. Parts should return the minimum set of flags necessary to specify their constraints.If the return value of this function ever changes, the part must call flushLayoutbefore the changes will take effect.- SWT.MAX: The part has a maximum size that will be returned by computePreferredSize(horizontal, INFINITE, someWidth, INFINITE)
- SWT.MIN: The part has a minimum size that will be returned by computePreferredSize(horizontal, INFINITE, someWidth, 0)
- SWT.WRAP: Indicates that computePreferredSize makes use of the availablePerpendicular argument. If this flag is not specified, then the third argument to computePreferredSize will always be set to INFINITE. The perpendicular size is expensive to compute, and it is usually only used for wrapping parts.
- SWT.FILL: The part may not return the preferred size verbatim when computePreferredSize is is given a value between the minimum and maximum sizes. This is commonly used if the part wants to use a set of predetermined sizes instead of using the workbench-provided size. For example, computePreferredSize(horizontal, availableSpace, someWidth, preferredSize) may return the nearest predetermined size. Note that this flag should be used sparingly. It can prevent layout caching and cause the workbench layout algorithm to degrade to exponential worst-case runtime. If this flag is omitted, then computePreferredSize may be used to compute the minimum and maximum sizes, but not for anything in between.
 - Specified by:
- getSizeFlagsin interface- ISizeProvider
- Parameters:
- width- a value of true or false determines whether the return value applies when computing widths or heights respectively. That is, getSizeFlags(true) will be used when calling computePreferredSize(true,...)
- Returns:
- any bitwise combination of SWT.MAX, SWT.MIN, SWT.WRAP, and SWT.FILL
 
- 
getPage- Specified by:
- getPagein interface- IWorkbenchPartReference
- Returns:
- the workbench page that contains this part
 
- 
setPage
- 
getPartNameDescription copied from interface:IWorkbenchPartReferenceReturns the name of the part, as it should be shown in tabs.- Specified by:
- getPartNamein interface- IWorkbenchPartReference
- Returns:
- the part name
 
- 
getContentDescriptionDescription copied from interface:IWorkbenchPartReferenceReturns the content description for the part (or the empty string if none)- Specified by:
- getContentDescriptionin interface- IWorkbenchPartReference
- Returns:
- the content description for the part
 
- 
isDirtypublic boolean isDirty()Description copied from interface:IWorkbenchPartReferenceReturns whether the part is dirty (i.e. has unsaved changes).- Specified by:
- isDirtyin interface- IWorkbenchPartReference
- Returns:
- trueif the part is dirty,- falseotherwise
 
- 
invalidatepublic void invalidate()
- 
getPane
 
-