| org.eclipse.ui.part.WorkbenchPart org.eclipse.ui.part.EditorPart org.eclipse.ui.part.MultiPageEditorPart
MultiPageEditorPart | abstract public class MultiPageEditorPart extends EditorPart (Code) | | 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 the addPage methods
IEditorPart.doSave - to save contents of editor
IEditorPart.doSaveAs - to save contents of editor
IEditorPart.isSaveAsAllowed - to enable Save As
IEditorPart.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.
See Also: org.eclipse.ui.part.MultiPageEditorActionBarContributor |
Constructor Summary | |
protected | MultiPageEditorPart() Creates an empty multi-page editor with no pages. |
Method Summary | |
public int | addPage(Control control) Creates and adds a new page containing the given control to this
multi-page editor. | public void | addPage(int index, Control control) Creates and adds a new page containing the given control to this
multi-page editor. | public int | addPage(IEditorPart editor, IEditorInput input) Creates and adds a new page containing the given editor to this
multi-page editor. | public void | addPage(int index, IEditorPart editor, IEditorInput input) Creates and adds a new page containing the given editor to this
multi-page editor. | protected Composite | createPageContainer(Composite parent) Creates the parent control for the container returned by
MultiPageEditorPart.getContainer() .
Subclasses may extend and must call super implementation first.
Parameters: parent - the parent for all of the editors contents. | abstract protected void | createPages() Creates the pages of this multi-page editor. | final public void | createPartControl(Composite parent) The MultiPageEditor implementation of this
IWorkbenchPart method creates the control for the
multi-page editor by calling createContainer , then
createPages . | protected IEditorSite | createSite(IEditorPart editor) Creates the site for the given nested editor. | public void | dispose() The MultiPageEditorPart implementation of this
IWorkbenchPart method disposes all nested editors. | final public IEditorPart[] | findEditors(IEditorInput input) Find the editors contained in this multi-page editor
whose editor input match the provided input. | protected 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. | public Object | getAdapter(Class adapter) If there is an adapter registered against the subclass of
MultiPageEditorPart return that. | protected 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. | protected Control | getControl(int pageIndex) Returns the control for the given page index, or null if
no control has been set for the page. | protected IEditorPart | getEditor(int pageIndex) Returns the editor for the given page index. | protected int | getPageCount() Returns the number of pages in this multi-page editor. | protected 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 String | getPageText(int pageIndex) Returns the text label for the page with the given index. | protected void | handlePropertyChange(int propertyId) Handles a property change notification from a nested editor. | public void | init(IEditorSite site, 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 . | public 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. | public void | removePage(int pageIndex) Removes the page with the given index from this multi-page editor. | final public void | setActiveEditor(IEditorPart editorPart) Set the active page of this multi-page editor to the
page that contains the given editor part. | protected void | setActivePage(int pageIndex) Sets the currently active page. | protected void | setControl(int pageIndex, Control control) Sets the control for the given page index. | public void | setFocus() The MultiPageEditor implementation of this
IWorkbenchPart method sets focus on the active nested
editor, if there is one. | protected void | setPageImage(int pageIndex, 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, String text) Sets the text label for the page with the given index. |
MultiPageEditorPart | protected MultiPageEditorPart()(Code) | | Creates an empty multi-page editor with no pages.
|
addPage | public int addPage(Control control)(Code) | | 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 using setControl .
Parameters: control - the control, or null the index of the new page See Also: MultiPageEditorPart.setControl(intControl) |
addPage | public void addPage(int index, Control control)(Code) | | Creates and adds a new page containing the given control to this
multi-page editor. The page is added at the given index. The control may
be null , allowing it to be created and set later using
setControl .
Parameters: index - the index at which to add the page (0-based) Parameters: control - the control, or null See Also: MultiPageEditorPart.setControl(intControl) |
addPage | public int addPage(IEditorPart editor, IEditorInput input) throws PartInitException(Code) | | 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.
Parameters: editor - the nested editor Parameters: input - the input for the nested editor the index of the new page exception: PartInitException - if a new page could not be created See Also: MultiPageEditorPart.handlePropertyChange(int) See Also: the handler for See Also: property change events from the nested editor |
addPage | public void addPage(int index, IEditorPart editor, IEditorInput input) throws PartInitException(Code) | | Creates and adds a new page containing the given editor to this
multi-page editor. The page is added at the given index. This also hooks
a property change listener on the nested editor.
Parameters: index - the index at which to add the page (0-based) Parameters: editor - the nested editor Parameters: input - the input for the nested editor exception: PartInitException - if a new page could not be created See Also: MultiPageEditorPart.handlePropertyChange(int) See Also: the handler for See Also: property change events from the nested editor |
createPageContainer | protected Composite createPageContainer(Composite parent)(Code) | | Creates the parent control for the container returned by
MultiPageEditorPart.getContainer() .
Subclasses may extend and must call super implementation first.
Parameters: parent - the parent for all of the editors contents. the parent for this editor's container. Must not benull . since: 3.2 |
createPages | abstract protected void createPages()(Code) | | Creates the pages of this multi-page editor.
Subclasses must implement this method.
|
createPartControl | final public void createPartControl(Composite parent)(Code) | | The MultiPageEditor implementation of this
IWorkbenchPart method creates the control for the
multi-page editor by calling createContainer , then
createPages . Subclasses should implement
createPages rather than overriding this method.
Parameters: parent - The parent in which the editor should be created; must not benull . |
createSite | protected IEditorSite createSite(IEditorPart editor)(Code) | | Creates the site for the given nested editor. The
MultiPageEditorPart implementation of this method creates
an instance of MultiPageEditorSite . Subclasses may
reimplement to create more specialized sites.
Parameters: editor - the nested editor the editor site |
dispose | public void dispose()(Code) | | The MultiPageEditorPart implementation of this
IWorkbenchPart method disposes all nested editors.
Subclasses may extend.
|
findEditors | final public IEditorPart[] findEditors(IEditorInput input)(Code) | | Find the editors contained in this multi-page editor
whose editor input match the provided input.
Parameters: input - the editor input the editors contained in this multi-page editorwhose editor input match the provided input since: 3.3 |
getActiveEditor | protected IEditorPart getActiveEditor()(Code) | | Returns the active nested editor if there is one.
Subclasses should not override this method
the active nested editor, or null if none |
getActivePage | protected int getActivePage()(Code) | | Returns the index of the currently active page, or -1 if there is no
active page.
Subclasses should not override this method
the index of the active page, or -1 if there is no active page |
getContainer | protected Composite getContainer()(Code) | | 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
the composite, or null ifcreatePartControl has not been called yet |
getControl | protected Control getControl(int pageIndex)(Code) | | Returns the control for the given page index, or null if
no control has been set for the page. The page index must be valid.
Subclasses should not override this method
Parameters: pageIndex - the index of the page the control for the specified page, or null ifnone has been set |
getEditor | protected IEditorPart getEditor(int pageIndex)(Code) | | Returns the editor for the given page index. The page index must be
valid.
Parameters: pageIndex - the index of the page the editor for the specified page, or null if thespecified page was not created withaddPage(IEditorPart,IEditorInput) |
getPageCount | protected int getPageCount()(Code) | | Returns the number of pages in this multi-page editor.
the number of pages |
getPageImage | protected Image getPageImage(int pageIndex)(Code) | | Returns the image for the page with the given index, or null
if no image has been set for the page. The page index must be valid.
Parameters: pageIndex - the index of the page the image, or null if none |
getPageText | protected String getPageText(int pageIndex)(Code) | | 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.
Parameters: pageIndex - the index of the page the text label for the page |
handlePropertyChange | protected void handlePropertyChange(int propertyId)(Code) | | 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 firePropertyChange with the same
property id. For example, if the dirty state of a nested editor changes
(property id IEditorPart.PROP_DIRTY ), this method handles
it by firing a property change event for
IEditorPart.PROP_DIRTY to property listeners on this
multi-page editor.
Subclasses may extend or reimplement this method.
Parameters: propertyId - the id of the property that changed |
init | public void init(IEditorSite site, IEditorInput input) throws PartInitException(Code) | | 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 . Subclasses may extend this
method.
Parameters: site - The site for which this part is being created; must not benull . Parameters: input - The input on which this editor should be created; must not benull . throws: PartInitException - If the initialization of the part fails -- currently never. |
isDirty | public boolean isDirty()(Code) | | 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.
Pages created with addPage(Control) are ignored.
Subclasses may extend or reimplement this method.
true if any of the nested editors are dirty;false otherwise. |
pageChange | protected void pageChange(int newPageIndex)(Code) | | 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 MultiPageEditorPart implementation 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 of
MultiPageEditorActionBarContributor , and, if so, calls
setActivePage with the active nested editor. This also
fires a selection change event if required.
Subclasses may extend this method.
Parameters: newPageIndex - the index of the activated page |
setActiveEditor | final public void setActiveEditor(IEditorPart editorPart)(Code) | | Set the active page of this multi-page editor to the
page that contains the given editor part. This method has
no effect of the given editor part is not contained in this
multi-page editor.
Parameters: editorPart - the editor part since: 3.3 |
setActivePage | protected void setActivePage(int pageIndex)(Code) | | Sets the currently active page.
Parameters: pageIndex - the index of the page to be activated; the index must be valid |
setControl | protected void setControl(int pageIndex, Control control)(Code) | | Sets the control for the given page index. The page index must be valid.
Parameters: pageIndex - the index of the page Parameters: control - the control for the specified page, or null toclear the control |
setFocus | public void setFocus()(Code) | | The MultiPageEditor implementation of this
IWorkbenchPart method sets focus on the active nested
editor, if there is one.
Subclasses may extend or reimplement.
|
setPageImage | protected void setPageImage(int pageIndex, Image image)(Code) | | Sets the image for the page with the given index, or null
to clear the image for the page. The page index must be valid.
Parameters: pageIndex - the index of the page Parameters: image - the image, or null |
setPageText | protected void setPageText(int pageIndex, String text)(Code) | | Sets the text label for the page with the given index. The page index
must be valid. The text label must not be null.
Parameters: pageIndex - the index of the page Parameters: text - the text label |
|
|