public class FormPage extends EditorPart implements IFormPage
PROP_DIRTY, PROP_INPUT
PROP_TITLE
Constructor and Description |
---|
FormPage(FormEditor editor,
String id,
String title)
A constructor that creates the page and initializes it with the editor.
|
FormPage(String id,
String title)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canLeaveThePage()
By default, editor will be allowed to flip the page.
|
protected void |
createFormContent(IManagedForm managedForm)
Subclasses should override this method to create content in the form
hosted in this page.
|
void |
createPartControl(Composite parent)
Creates the part control by creating the managed form using the parent
editor's toolkit.
|
void |
dispose()
Disposes the managed form.
|
void |
doSave(IProgressMonitor monitor)
Saves the contents of this part.
|
void |
doSaveAs()
Saves the contents of this part to another object.
|
FormEditor |
getEditor()
Returns the parent editor.
|
String |
getId()
Returns the unique identifier that can be used to reference this page.
|
int |
getIndex()
Returns the saved page index.
|
IManagedForm |
getManagedForm()
Returns the managed form owned by this page.
|
Control |
getPartControl()
Returns the form page control.
|
Image |
getTitleImage()
Returns
null - form page has no title image. |
void |
init(IEditorSite site,
IEditorInput input)
Initializes the form page.
|
void |
initialize(FormEditor editor)
Primes the form page with the parent editor instance.
|
boolean |
isActive()
Tests if the page is active by asking the parent editor if this page is
the currently active page.
|
boolean |
isDirty()
Implemented by testing if the managed form is dirty.
|
boolean |
isEditor()
Form pages are not editors.
|
boolean |
isSaveAsAllowed()
Returns whether the "Save As" operation is supported by this part.
|
boolean |
selectReveal(Object object)
Attempts to select and reveal the given object by passing the request to
the managed form.
|
void |
setActive(boolean active)
Implements the required method by refreshing the form when set active.
|
void |
setFocus()
Sets the focus by delegating to the managed form.
|
void |
setIndex(int index)
Preserves the page index.
|
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEditorInput, getEditorSite
addPropertyListener, getSite, getTitle, getTitleToolTip, removePropertyListener
getAdapter
isSaveOnCloseNeeded
public FormPage(FormEditor editor, String id, String title)
editor
- the parent editorid
- the unique identifiertitle
- the page titlepublic void init(IEditorSite site, IEditorInput input)
init
in interface IEditorPart
init
in class EditorPart
site
- the editor siteinput
- the editor inputIEditorPart.init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
public void initialize(FormEditor editor)
initialize
in interface IFormPage
editor
- the parent editorpublic FormEditor getEditor()
public IManagedForm getManagedForm()
getManagedForm
in interface IFormPage
public void setActive(boolean active)
public boolean isActive()
public void createPartControl(Composite parent)
createFormContent(IManagedForm)
to populate the form with
content.createPartControl
in interface IWorkbenchPart
createPartControl
in class WorkbenchPart
parent
- the page parent compositeprotected void createFormContent(IManagedForm managedForm)
managedForm
- the form hosted in this page.public Control getPartControl()
getPartControl
in interface IFormPage
public void dispose()
dispose
in interface IWorkbenchPart
dispose
in class WorkbenchPart
public String getId()
public Image getTitleImage()
null
- form page has no title image. Subclasses
may override.getTitleImage
in interface IWorkbenchPart
getTitleImage
in class WorkbenchPart
null
public void setFocus()
setFocus
in interface IWorkbenchPart
setFocus
in class WorkbenchPart
public void doSave(IProgressMonitor monitor)
ISaveablePart
If the save is successful, the part should fire a property changed event
reflecting the new dirty state (PROP_DIRTY
property).
If the save is cancelled through user action, or for any other reason, the
part should invoke setCancelled
on the IProgressMonitor
to inform the caller.
This method is long-running; progress and cancellation are provided by the given progress monitor.
doSave
in interface ISaveablePart
doSave
in class EditorPart
monitor
- the progress monitorISaveablePart.doSave(org.eclipse.core.runtime.IProgressMonitor)
public void doSaveAs()
ISaveablePart
Implementors are expected to open a "Save As" dialog where the user will
be able to select a new name for the contents. After the selection is made,
the contents should be saved to that new name. During this operation a
IProgressMonitor
should be used to indicate progress.
If the save is successful, the part fires a property changed event
reflecting the new dirty state (PROP_DIRTY
property).
doSaveAs
in interface ISaveablePart
doSaveAs
in class EditorPart
ISaveablePart.doSaveAs()
public boolean isSaveAsAllowed()
ISaveablePart
isSaveAsAllowed
in interface ISaveablePart
isSaveAsAllowed
in class EditorPart
true
if "Save As" is supported, and false
if not supportedISaveablePart.isSaveAsAllowed()
public boolean isDirty()
isDirty
in interface ISaveablePart
isDirty
in class EditorPart
true
if the managed form is dirty,
false
otherwise.ISaveablePart.isDirty()
public void setIndex(int index)
public int getIndex()
public boolean isEditor()
public boolean selectReveal(Object object)
selectReveal
in interface IFormPage
object
- the object to select and reveal in the page if possible.true
if the page has been successfully selected
and revealed by one of the managed form parts, false
otherwise.public boolean canLeaveThePage()
canLeaveThePage
in interface IFormPage
true
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.