Class FormPage
- All Implemented Interfaces:
IAdaptable,IExecutableExtension,IFormPage,IEditorPart,ISaveablePart,IWorkbenchPart,IWorkbenchPart2,IWorkbenchPart3,IWorkbenchPartOrientation
- Since:
- 3.0
-
Field Summary
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUTFields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanBy default, editor will be allowed to flip the page.protected voidcreateFormContent(IManagedForm managedForm) Subclasses should override this method to create content in the form hosted in this page.voidcreatePartControl(Composite parent) Creates the part control by creating the managed form using the parent editor's toolkit.voiddispose()Disposes the managed form.voiddoSave(IProgressMonitor monitor) Saves the contents of this part.voiddoSaveAs()Saves the contents of this part to another object.Returns the parent editor.getId()Returns the unique identifier that can be used to reference this page.intgetIndex()Returns the saved page index.Returns the managed form owned by this page.Returns the form page control.Returnsnull- form page has no title image.voidinit(IEditorSite site, IEditorInput input) Initializes the form page.voidinitialize(FormEditor editor) Primes the form page with the parent editor instance.booleanisActive()Tests if the page is active by asking the parent editor if this page is the currently active page.booleanisDirty()Implemented by testing if the managed form is dirty.booleanisEditor()Form pages are not editors.booleanReturns whether the "Save As" operation is supported by this part.booleanselectReveal(Object object) Attempts to select and reveal the given object by passing the request to the managed form.voidsetActive(boolean active) Implements the required method by refreshing the form when set active.voidsetFocus()Sets the focus by delegating to the managed form.voidsetIndex(int index) Preserves the page index.Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartNameMethods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusyMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapterMethods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSiteMethods inherited from interface org.eclipse.ui.ISaveablePart
isSaveOnCloseNeededMethods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleToolTip, removePropertyListener
-
Constructor Details
-
FormPage
A constructor that creates the page and initializes it with the editor.- Parameters:
editor- the parent editorid- the unique identifiertitle- the page title
-
FormPage
The constructor. The parent editor need to be passed in theinitializemethod if this constructor is used.- Parameters:
id- a unique page identifiertitle- a user-friendly page title
-
-
Method Details
-
init
Initializes the form page.- Specified by:
initin interfaceIEditorPart- Specified by:
initin classEditorPart- Parameters:
site- the editor siteinput- the editor input- See Also:
-
initialize
Primes the form page with the parent editor instance.- Specified by:
initializein interfaceIFormPage- Parameters:
editor- the parent editor
-
getEditor
Returns the parent editor. -
getManagedForm
Returns the managed form owned by this page.- Specified by:
getManagedFormin interfaceIFormPage- Returns:
- the managed form
-
setActive
public void setActive(boolean active) Implements the required method by refreshing the form when set active. Subclasses must call super when overriding this method. -
isActive
public boolean isActive()Tests if the page is active by asking the parent editor if this page is the currently active page. -
createPartControl
Creates the part control by creating the managed form using the parent editor's toolkit. Subclasses should overridecreateFormContent(IManagedForm)to populate the form with content.- Specified by:
createPartControlin interfaceIWorkbenchPart- Specified by:
createPartControlin classWorkbenchPart- Parameters:
parent- the page parent composite
-
createFormContent
Subclasses should override this method to create content in the form hosted in this page.- Parameters:
managedForm- the form hosted in this page.
-
getPartControl
Returns the form page control.- Specified by:
getPartControlin interfaceIFormPage- Returns:
- managed form's control
-
dispose
public void dispose()Disposes the managed form.- Specified by:
disposein interfaceIWorkbenchPart- Overrides:
disposein classWorkbenchPart
-
getId
Returns the unique identifier that can be used to reference this page. -
getTitleImage
Returnsnull- form page has no title image. Subclasses may override.- Specified by:
getTitleImagein interfaceIWorkbenchPart- Overrides:
getTitleImagein classWorkbenchPart- Returns:
null
-
setFocus
public void setFocus()Sets the focus by delegating to the managed form.- Specified by:
setFocusin interfaceIWorkbenchPart- Specified by:
setFocusin classWorkbenchPart
-
doSave
Description copied from interface:ISaveablePartSaves the contents of this part.If the save is successful, the part should fire a property changed event reflecting the new dirty state (
PROP_DIRTYproperty).If the save is cancelled through user action, or for any other reason, the part should invoke
setCancelledon theIProgressMonitorto inform the caller.This method is long-running; progress and cancellation are provided by the given progress monitor.
- Specified by:
doSavein interfaceISaveablePart- Specified by:
doSavein classEditorPart- Parameters:
monitor- the progress monitor- See Also:
-
doSaveAs
public void doSaveAs()Description copied from interface:ISaveablePartSaves the contents of this part to another object.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
IProgressMonitorshould be used to indicate progress.If the save is successful, the part fires a property changed event reflecting the new dirty state (
PROP_DIRTYproperty).- Specified by:
doSaveAsin interfaceISaveablePart- Specified by:
doSaveAsin classEditorPart- See Also:
-
isSaveAsAllowed
public boolean isSaveAsAllowed()Description copied from interface:ISaveablePartReturns whether the "Save As" operation is supported by this part.- Specified by:
isSaveAsAllowedin interfaceISaveablePart- Specified by:
isSaveAsAllowedin classEditorPart- Returns:
trueif "Save As" is supported, andfalseif not supported- See Also:
-
isDirty
public boolean isDirty()Implemented by testing if the managed form is dirty.- Specified by:
isDirtyin interfaceISaveablePart- Specified by:
isDirtyin classEditorPart- Returns:
trueif the managed form is dirty,falseotherwise.- See Also:
-
setIndex
public void setIndex(int index) Preserves the page index. -
getIndex
public int getIndex()Returns the saved page index. -
isEditor
public boolean isEditor()Form pages are not editors. -
selectReveal
Attempts to select and reveal the given object by passing the request to the managed form.- Specified by:
selectRevealin interfaceIFormPage- Parameters:
object- the object to select and reveal in the page if possible.- Returns:
trueif the page has been successfully selected and revealed by one of the managed form parts,falseotherwise.
-
canLeaveThePage
public boolean canLeaveThePage()By default, editor will be allowed to flip the page.- Specified by:
canLeaveThePagein interfaceIFormPage- Returns:
true
-