|
|||||||||
| Home >> All >> org >> eclipse >> ui >> [ part overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.ui.part
Class MultiPageEditorPart

java.lang.Objectorg.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
org.eclipse.ui.part.MultiPageEditorPart
- All Implemented Interfaces:
- org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2
- public abstract class MultiPageEditorPart
- extends EditorPart
A multi-page editor is an editor with multiple pages, each of which may contain an editor or an arbitrary SWT control.
Subclasses must implement the following methods:
createPages- to create the required pages by calling one of theaddPagemethodsIEditorPart.doSave- to save contents of editorIEditorPart.doSaveAs- to save contents of editorIEditorPart.isSaveAsAllowed- to enable Save AsIEditorPart.gotoMarker- to scroll to a marker
Multi-page editors have a single action bar contributor, which manages
contributions for all the pages. The contributor must be a subclass of
AbstractMultiPageEditorActionBarContributor.
Note that since any nested editors are created directly in code by callers of
addPage(IEditorPart,IEditorInput), nested editors do not have
their own contributors.
| Field Summary | |
private org.eclipse.swt.custom.CTabFolder |
container
The container widget. |
private java.util.ArrayList |
nestedEditors
List of nested editors. |
| Fields inherited from class org.eclipse.ui.part.EditorPart |
|
| Fields inherited from class org.eclipse.ui.part.WorkbenchPart |
|
| Fields inherited from interface org.eclipse.ui.IEditorPart |
PROP_DIRTY, PROP_INPUT |
| Fields inherited from interface org.eclipse.ui.IWorkbenchPart |
PROP_TITLE |
| Constructor Summary | |
protected |
MultiPageEditorPart()
Creates an empty multi-page editor with no pages. |
| Method Summary | |
int |
addPage(org.eclipse.swt.widgets.Control control)
Creates and adds a new page containing the given control to this multi-page editor. |
int |
addPage(org.eclipse.ui.IEditorPart editor,
org.eclipse.ui.IEditorInput input)
Creates and adds a new page containing the given editor to this multi-page editor. |
private org.eclipse.swt.custom.CTabFolder |
createContainer(org.eclipse.swt.widgets.Composite parent)
Creates an empty container. |
private org.eclipse.swt.custom.CTabItem |
createItem(org.eclipse.swt.widgets.Control control)
Creates a tab item and places control in the new item. |
protected abstract void |
createPages()
Creates the pages of this multi-page editor. |
void |
createPartControl(org.eclipse.swt.widgets.Composite parent)
The MultiPageEditor implementation of this IWorkbenchPart
method creates the control for the multi-page editor by calling createContainer,
then createPages. |
protected org.eclipse.ui.IEditorSite |
createSite(org.eclipse.ui.IEditorPart editor)
Creates the site for the given nested editor. |
void |
dispose()
The MultiPageEditorPart implementation of this
IWorkbenchPart method disposes all nested editors. |
private void |
disposePart(org.eclipse.ui.IWorkbenchPart part)
Disposes the given part and its site. |
protected org.eclipse.ui.IEditorPart |
getActiveEditor()
Returns the active nested editor if there is one. |
protected int |
getActivePage()
Returns the index of the currently active page, or -1 if there is no active page. |
protected org.eclipse.swt.widgets.Composite |
getContainer()
Returns the composite control containing this multi-page editor's pages. |
protected org.eclipse.swt.widgets.Control |
getControl(int pageIndex)
Returns the control for the given page index, or null
if no control has been set for the page. |
protected org.eclipse.ui.IEditorPart |
getEditor(int pageIndex)
Returns the editor for the given page index. |
private org.eclipse.swt.custom.CTabItem |
getItem(int pageIndex)
Returns the tab item for the given page index (page index is 0-based). |
protected int |
getPageCount()
Returns the number of pages in this multi-page editor. |
protected org.eclipse.swt.graphics.Image |
getPageImage(int pageIndex)
Returns the image for the page with the given index, or null if no image has been set for the page. |
protected java.lang.String |
getPageText(int pageIndex)
Returns the text label for the page with the given index. |
private org.eclipse.swt.custom.CTabFolder |
getTabFolder()
Returns the tab folder containing this multi-page editor's pages. |
protected void |
handlePropertyChange(int propertyId)
Handles a property change notification from a nested editor. |
void |
init(org.eclipse.ui.IEditorSite site,
org.eclipse.ui.IEditorInput input)
The MultiPageEditorPart implementation of this IEditorPart
method sets its site to the given site, its input to the given input, and
the site's selection provider to a MultiPageSelectionProvider. |
boolean |
isDirty()
The MultiPageEditorPart implementation of this IEditorPart
method returns whether the contents of any of this multi-page editor's
nested editors have changed since the last save. |
protected void |
pageChange(int newPageIndex)
Notifies this multi-page editor that the page with the given id has been activated. |
void |
removePage(int pageIndex)
Removes the page with the given index from this multi-page editor. |
protected void |
setActivePage(int pageIndex)
Sets the currently active page. |
protected void |
setControl(int pageIndex,
org.eclipse.swt.widgets.Control control)
Sets the control for the given page index. |
void |
setFocus()
The MultiPageEditor implementation of this
IWorkbenchPart method sets focus on the active nested editor,
if there is one. |
private void |
setFocus(int pageIndex)
Sets focus to the control for the given page. |
protected void |
setPageImage(int pageIndex,
org.eclipse.swt.graphics.Image image)
Sets the image for the page with the given index, or null
to clear the image for the page. |
protected void |
setPageText(int pageIndex,
java.lang.String text)
Sets the text label for the page with the given index. |
| Methods inherited from class org.eclipse.ui.part.EditorPart |
doSave, doSaveAs, getEditorInput, getEditorSite, getTitleToolTip, isSaveAsAllowed, isSaveOnCloseNeeded, setContentDescription, setDefaultTitle, setInitializationData, setInput, setPartName |
| Methods inherited from class org.eclipse.ui.part.WorkbenchPart |
addPropertyListener, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, internalSetContentDescription, internalSetPartName, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.ui.IWorkbenchPart |
addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener |
| Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
getAdapter |
| Field Detail |
container
private org.eclipse.swt.custom.CTabFolder container
- The container widget.
nestedEditors
private java.util.ArrayList nestedEditors
- List of nested editors. Element type: IEditorPart.
Need to hang onto them here, in addition to using get/setData on the items,
because dispose() needs to access them, but widgetry has already been disposed at that point.
| Constructor Detail |
MultiPageEditorPart
protected MultiPageEditorPart()
- Creates an empty multi-page editor with no pages.
| Method Detail |
addPage
public int addPage(org.eclipse.swt.widgets.Control control)
- Creates and adds a new page containing the given control to this multi-page
editor. The control may be
null, allowing it to be created and set later usingsetControl.
addPage
public int addPage(org.eclipse.ui.IEditorPart editor, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
- Creates and adds a new page containing the given editor to this multi-page
editor. This also hooks a property change listener on the nested editor.
createContainer
private org.eclipse.swt.custom.CTabFolder createContainer(org.eclipse.swt.widgets.Composite parent)
- Creates an empty container. Creates a CTabFolder with no style bits set, and
hooks a selection listener which calls
pageChange()whenever the selected tab changes.
createItem
private org.eclipse.swt.custom.CTabItem createItem(org.eclipse.swt.widgets.Control control)
- Creates a tab item and places control in the new item.
The item is a CTabItem with no style bits set.
createPages
protected abstract void createPages()
- Creates the pages of this multi-page editor.
Subclasses must implement this method.
createPartControl
public final void createPartControl(org.eclipse.swt.widgets.Composite parent)
- The
MultiPageEditorimplementation of thisIWorkbenchPartmethod creates the control for the multi-page editor by callingcreateContainer, thencreatePages. Subclasses should implementcreatePagesrather than overriding this method.- Specified by:
createPartControlin interfaceorg.eclipse.ui.IWorkbenchPart- Specified by:
createPartControlin classWorkbenchPart
createSite
protected org.eclipse.ui.IEditorSite createSite(org.eclipse.ui.IEditorPart editor)
- Creates the site for the given nested editor.
The
MultiPageEditorPartimplementation of this method creates an instance ofMultiPageEditorSite. Subclasses may reimplement to create more specialized sites.
dispose
public void dispose()
- The
MultiPageEditorPartimplementation of thisIWorkbenchPartmethod disposes all nested editors. Subclasses may extend.- Specified by:
disposein interfaceorg.eclipse.ui.IWorkbenchPart- Overrides:
disposein classWorkbenchPart
getActiveEditor
protected org.eclipse.ui.IEditorPart getActiveEditor()
- Returns the active nested editor if there is one.
Subclasses should not override this method
getActivePage
protected int getActivePage()
- Returns the index of the currently active page,
or -1 if there is no active page.
Subclasses should not override this method
getContainer
protected org.eclipse.swt.widgets.Composite getContainer()
- Returns the composite control containing this multi-page editor's pages.
This should be used as the parent when creating controls for the individual pages.
That is, when calling
addPage(Control), the passed control should be a child of this container.Warning: Clients should not assume that the container is any particular subclass of Composite. The actual class used may change in order to improve the look and feel of multi-page editors. Any code making assumptions on the particular subclass would thus be broken.
Subclasses should not override this method
getControl
protected org.eclipse.swt.widgets.Control getControl(int pageIndex)
- Returns the control for the given page index, or
nullif no control has been set for the page. The page index must be valid.Subclasses should not override this method
getEditor
protected org.eclipse.ui.IEditorPart getEditor(int pageIndex)
- Returns the editor for the given page index.
The page index must be valid.
getItem
private org.eclipse.swt.custom.CTabItem getItem(int pageIndex)
- Returns the tab item for the given page index (page index is 0-based).
The page index must be valid.
getPageCount
protected int getPageCount()
- Returns the number of pages in this multi-page editor.
getPageImage
protected org.eclipse.swt.graphics.Image getPageImage(int pageIndex)
- Returns the image for the page with the given index,
or
nullif no image has been set for the page. The page index must be valid.
getPageText
protected java.lang.String getPageText(int pageIndex)
- Returns the text label for the page with the given index.
Returns the empty string if no text label has been set for the page.
The page index must be valid.
getTabFolder
private org.eclipse.swt.custom.CTabFolder getTabFolder()
- Returns the tab folder containing this multi-page editor's pages.
handlePropertyChange
protected void handlePropertyChange(int propertyId)
- Handles a property change notification from a nested editor.
The default implementation simply forwards the change to listeners
on this multi-page editor by calling
firePropertyChangewith the same property id. For example, if the dirty state of a nested editor changes (property idIEditorPart.PROP_DIRTY), this method handles it by firing a property change event forIEditorPart.PROP_DIRTYto property listeners on this multi-page editor.Subclasses may extend or reimplement this method.
init
public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
- The
MultiPageEditorPartimplementation of thisIEditorPartmethod sets its site to the given site, its input to the given input, and the site's selection provider to aMultiPageSelectionProvider. Subclasses may extend this method.- Specified by:
initin interfaceorg.eclipse.ui.IEditorPart- Specified by:
initin classEditorPart
isDirty
public boolean isDirty()
- The
MultiPageEditorPartimplementation of thisIEditorPartmethod returns whether the contents of any of this multi-page editor's nested editors have changed since the last save. Pages created withaddPage(Control)are ignored.Subclasses may extend or reimplement this method.
- Specified by:
isDirtyin interfaceorg.eclipse.ui.ISaveablePart- Specified by:
isDirtyin classEditorPart
pageChange
protected void pageChange(int newPageIndex)
- Notifies this multi-page editor that the page with the given id has been
activated. This method is called when the user selects a different tab.
The
MultiPageEditorPartimplementation of this method sets focus to the new page, and notifies the action bar contributor (if there is one). This checks whether the action bar contributor is an instance ofMultiPageEditorActionBarContributor, and, if so, callssetActivePagewith the active nested editor. This also fires a selection change event if required.Subclasses may extend this method.
disposePart
private void disposePart(org.eclipse.ui.IWorkbenchPart part)
- Disposes the given part and its site.
removePage
public void removePage(int pageIndex)
- Removes the page with the given index from this multi-page editor. The
controls for the page are disposed of; if the page has an editor, it is
disposed of too. The page index must be valid.
setActivePage
protected void setActivePage(int pageIndex)
- Sets the currently active page.
setControl
protected void setControl(int pageIndex,
org.eclipse.swt.widgets.Control control)
- Sets the control for the given page index.
The page index must be valid.
setFocus
public void setFocus()
- The
MultiPageEditorimplementation of thisIWorkbenchPartmethod sets focus on the active nested editor, if there is one.Subclasses may extend or reimplement.
- Specified by:
setFocusin interfaceorg.eclipse.ui.IWorkbenchPart- Specified by:
setFocusin classWorkbenchPart
setFocus
private void setFocus(int pageIndex)
- Sets focus to the control for the given page. If the page has an editor,
this calls its
setFocus()method. Otherwise, this callssetFocuson the control for the page.
setPageImage
protected void setPageImage(int pageIndex,
org.eclipse.swt.graphics.Image image)
- Sets the image for the page with the given index, or
nullto clear the image for the page. The page index must be valid.
setPageText
protected void setPageText(int pageIndex,
java.lang.String text)
- Sets the text label for the page with the given index.
The page index must be valid.
The text label must not be null.
|
|||||||||
| Home >> All >> org >> eclipse >> ui >> [ part overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC