org.eclipse.datatools.sqltools.schemaobjecteditor.ui.core
Class SchemaObjectEditorPage

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.EditorPart
              extended by org.eclipse.datatools.sqltools.common.ui.helpsystem.HelpSystemEditorPart
                  extended by org.eclipse.datatools.sqltools.schemaobjecteditor.ui.core.SchemaObjectEditorPage
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, IDisablementPart, ISchemaObjectEditorPage, org.eclipse.help.IContextProvider, org.eclipse.ui.forms.editor.IFormPage, org.eclipse.ui.IEditorPart, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation
Direct Known Subclasses:
ASAIndexesEditorPage, ASATableSchemaEditorPage, ASATriggersEditorPage, ASAUserDefinedTypeGeneralPage, DDLPage, IntroductionPage, NestedEditorPage, ProceduralObjectGeneralPage, ProceduralObjectPrivilegePage

public class SchemaObjectEditorPage
extends HelpSystemEditorPart
implements ISchemaObjectEditorPage

Copied from FormPage since some fields are private and can not be set. To add a page to an editor, the consumer need to extend this class to create the controls in the page.

Author:
Idull

Nested Class Summary
static class SchemaObjectEditorPage.PageForm
           
 
Field Summary
 
Fields inherited from interface org.eclipse.datatools.sqltools.schemaobjecteditor.ui.ISchemaObjectEditorPage
UNKNOWN_ITEM_TYPE
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Fields inherited from interface org.eclipse.help.IContextProvider
NONE, SELECTION
 
Constructor Summary
SchemaObjectEditorPage()
           
SchemaObjectEditorPage(org.eclipse.ui.forms.editor.FormEditor editor, java.lang.String id, java.lang.String title)
          A constructor that creates the page and initializes it with the editor.
SchemaObjectEditorPage(java.lang.String id, java.lang.String title)
          The constructor.
 
Method Summary
 boolean aboutToSave(org.eclipse.core.runtime.IProgressMonitor monitor)
          Notifies this page that the editor is about to save, subclass should update the model if necessary
 boolean canLeaveThePage()
          By default, editor will be allowed to flip the page.
 void createPartControl(org.eclipse.swt.widgets.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(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void doSaveAs()
           
 void enable(boolean enabled)
           
 org.eclipse.datatools.sqltools.core.DatabaseIdentifier getDatabaseIdentifier()
          Returns the database identifier
 org.eclipse.ui.forms.editor.FormEditor getEditor()
          Returns the parent editor.
 IEditorDescriptor getEditorDescriptor()
          Returns an instance of IEditorDescriptor which is used to describe some static information of the scheme object editor in which this page is contained
 java.lang.String getErrorMsg()
          Returns the error message in this page which prevent to flip to other pages
 java.lang.String getId()
          Returns the unique identifier that can be used to reference this page.
 int getIndex()
          Returns the saved page index.
 org.eclipse.ui.forms.IManagedForm getManagedForm()
          Returns the managed form owned by this page.
 IEditorPageDescriptor getPageDescriptor()
          Returns an instance of IEditorPageDescriptor which is used to describe some static information of this page
 org.eclipse.swt.widgets.Control getPartControl()
          Returns the form page control.
 java.lang.String[] getPreferencePageIds()
          Returns the preference pages ids related to this editor page.
The returns preference pages will be displayed if user click "Preferences..." in the editor page's context menu
 org.eclipse.swt.graphics.Image getTitleImage()
          Returns null- form page has no title image.
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
          Initializes the form page.
 void initialize(org.eclipse.ui.forms.editor.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 isPageOpened()
          Checks if the page is opened (Controls are created)
 boolean isSaveAsAllowed()
           
 void markDirty()
          Mark the dirty status
 void menuAboutToShow(org.eclipse.jface.action.IMenuManager manager)
          Adds menu items for this page
 void modelRegenerated()
          Do something when the model is re-generated, for example, after successfully saving the dirty editor, the edit model will be re-cloned from the refreshed database model, in this case, page should be refreshed to keep it synchronized with database
 void populateSQLObjects(org.eclipse.swt.events.TypedEvent event)
          Sub class should override this method to populate the SQL objects belong to this page
 void refresh()
          Sub class should override this method to refresh the page according to the model and if this page is not opened, should not refresh it
 void revert()
          Revert this page to the original model
 boolean selectReveal(java.lang.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 setEditor(org.eclipse.ui.forms.editor.FormEditor editor)
          Sets the editor in which this paged is contained, this will be called after the schema object is opened.
 void setEditorDescriptor(IEditorDescriptor editor)
          Sets the editor descriptor for this page
 void setFocus()
          Sets the focus by delegating to the managed form.
 void setFocus(int itemType, java.lang.Object item)
          The default implementation sets the current page active
 void setId(java.lang.String id)
          Sets the id for this page
 void setIndex(int index)
          Preserves the page index.
 void setPageDescriptor(IEditorPageDescriptor page)
          Sets the page descriptor for this page
 void setPartName(java.lang.String title)
          Sets the title for this page
 IErrorItem[] validate(org.eclipse.swt.events.TypedEvent event)
          The default implementation of this method validate all the objects belong to this page and return the error items
 void validateAndShowErrors(org.eclipse.swt.events.TypedEvent event)
          Validates this page and show errors accordingly
 IErrorItem[] validateOnline(org.eclipse.swt.events.TypedEvent event)
          Online check if the page is valid
 
Methods inherited from class org.eclipse.datatools.sqltools.common.ui.helpsystem.HelpSystemEditorPart
getContext, getContextChangeMask, getSearchExpression
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setInitializationData
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, getAdapter, getContentDescription, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, removePartPropertyListener, removePropertyListener, setPartProperty, showBusy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSite
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.ui.ISaveablePart
isSaveOnCloseNeeded
 

Constructor Detail

SchemaObjectEditorPage

public SchemaObjectEditorPage()

SchemaObjectEditorPage

public SchemaObjectEditorPage(org.eclipse.ui.forms.editor.FormEditor editor,
                              java.lang.String id,
                              java.lang.String title)
A constructor that creates the page and initializes it with the editor.

Parameters:
editor - the parent editor
id - the unique identifier
title - the page title

SchemaObjectEditorPage

public SchemaObjectEditorPage(java.lang.String id,
                              java.lang.String title)
The constructor. The parent editor need to be passed in the initialize method if this constructor is used.

Parameters:
id - a unique page identifier
title - a user-friendly page title
Method Detail

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput input)
          throws org.eclipse.ui.PartInitException
Initializes the form page.

Specified by:
init in interface org.eclipse.ui.IEditorPart
Overrides:
init in class HelpSystemEditorPart
Throws:
org.eclipse.ui.PartInitException
See Also:
IEditorPart.init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)

initialize

public void initialize(org.eclipse.ui.forms.editor.FormEditor editor)
Primes the form page with the parent editor instance.

Specified by:
initialize in interface org.eclipse.ui.forms.editor.IFormPage
Parameters:
editor - the parent editor

getEditor

public org.eclipse.ui.forms.editor.FormEditor getEditor()
Returns the parent editor.

Specified by:
getEditor in interface org.eclipse.ui.forms.editor.IFormPage
Returns:
parent editor instance

getManagedForm

public org.eclipse.ui.forms.IManagedForm getManagedForm()
Returns the managed form owned by this page.

Specified by:
getManagedForm in interface org.eclipse.ui.forms.editor.IFormPage
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.

Specified by:
setActive in interface org.eclipse.ui.forms.editor.IFormPage

isActive

public boolean isActive()
Tests if the page is active by asking the parent editor if this page is the currently active page.

Specified by:
isActive in interface org.eclipse.ui.forms.editor.IFormPage
Returns:
true if the page is currently active, false otherwise.

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Creates the part control by creating the managed form using the parent editor's toolkit. Subclasses should override createFormContent(IManagedForm) to populate the form with content.

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Overrides:
createPartControl in class HelpSystemEditorPart
Parameters:
parent - the page parent composite

getPartControl

public org.eclipse.swt.widgets.Control getPartControl()
Returns the form page control.

Specified by:
getPartControl in interface org.eclipse.ui.forms.editor.IFormPage
Returns:
managed form's control

dispose

public void dispose()
Disposes the managed form.

Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.part.WorkbenchPart

getId

public java.lang.String getId()
Returns the unique identifier that can be used to reference this page.

Specified by:
getId in interface org.eclipse.ui.forms.editor.IFormPage
Returns:
the unique page identifier

getTitleImage

public org.eclipse.swt.graphics.Image getTitleImage()
Returns null- form page has no title image. Subclasses may override.

Specified by:
getTitleImage in interface org.eclipse.ui.IWorkbenchPart
Overrides:
getTitleImage in class org.eclipse.ui.part.WorkbenchPart
Returns:
null

setFocus

public void setFocus()
Sets the focus by delegating to the managed form.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Overrides:
setFocus in class HelpSystemEditorPart

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Specified by:
doSave in interface org.eclipse.ui.ISaveablePart
Overrides:
doSave in class HelpSystemEditorPart
See Also:
ISaveablePart.doSave(org.eclipse.core.runtime.IProgressMonitor)

doSaveAs

public void doSaveAs()
Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart
Overrides:
doSaveAs in class HelpSystemEditorPart
See Also:
ISaveablePart.doSaveAs()

isSaveAsAllowed

public boolean isSaveAsAllowed()
Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
Overrides:
isSaveAsAllowed in class HelpSystemEditorPart
See Also:
ISaveablePart.isSaveAsAllowed()

isDirty

public boolean isDirty()
Implemented by testing if the managed form is dirty.

Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart
Overrides:
isDirty in class HelpSystemEditorPart
Returns:
true if the managed form is dirty, false otherwise.
See Also:
ISaveablePart.isDirty()

setIndex

public void setIndex(int index)
Preserves the page index.

Specified by:
setIndex in interface org.eclipse.ui.forms.editor.IFormPage
Parameters:
index - the assigned page index

getIndex

public int getIndex()
Returns the saved page index.

Specified by:
getIndex in interface org.eclipse.ui.forms.editor.IFormPage
Returns:
the page index

isEditor

public boolean isEditor()
Form pages are not editors.

Specified by:
isEditor in interface org.eclipse.ui.forms.editor.IFormPage
Returns:
false

selectReveal

public boolean selectReveal(java.lang.Object object)
Attempts to select and reveal the given object by passing the request to the managed form.

Specified by:
selectReveal in interface org.eclipse.ui.forms.editor.IFormPage
Parameters:
object - the object to select and reveal in the page if possible.
Returns:
true if the page has been successfully selected and revealed by one of the managed form parts, false otherwise.

canLeaveThePage

public boolean canLeaveThePage()
By default, editor will be allowed to flip the page.

Specified by:
canLeaveThePage in interface org.eclipse.ui.forms.editor.IFormPage
Returns:
true

setEditor

public void setEditor(org.eclipse.ui.forms.editor.FormEditor editor)
Description copied from interface: ISchemaObjectEditorPage
Sets the editor in which this paged is contained, this will be called after the schema object is opened. Subclass of SchemaObjectPage should not override this method

Specified by:
setEditor in interface ISchemaObjectEditorPage

setId

public void setId(java.lang.String id)
Description copied from interface: ISchemaObjectEditorPage
Sets the id for this page

Specified by:
setId in interface ISchemaObjectEditorPage

setPartName

public void setPartName(java.lang.String title)
Description copied from interface: ISchemaObjectEditorPage
Sets the title for this page

Specified by:
setPartName in interface ISchemaObjectEditorPage
Overrides:
setPartName in class org.eclipse.ui.part.EditorPart

getErrorMsg

public java.lang.String getErrorMsg()
Description copied from interface: ISchemaObjectEditorPage
Returns the error message in this page which prevent to flip to other pages

Specified by:
getErrorMsg in interface ISchemaObjectEditorPage
Returns:

getEditorDescriptor

public IEditorDescriptor getEditorDescriptor()
Description copied from interface: ISchemaObjectEditorPage
Returns an instance of IEditorDescriptor which is used to describe some static information of the scheme object editor in which this page is contained

Specified by:
getEditorDescriptor in interface ISchemaObjectEditorPage
Returns:

getPageDescriptor

public IEditorPageDescriptor getPageDescriptor()
Description copied from interface: ISchemaObjectEditorPage
Returns an instance of IEditorPageDescriptor which is used to describe some static information of this page

Specified by:
getPageDescriptor in interface ISchemaObjectEditorPage
Returns:

setEditorDescriptor

public void setEditorDescriptor(IEditorDescriptor editor)
Description copied from interface: ISchemaObjectEditorPage
Sets the editor descriptor for this page

Specified by:
setEditorDescriptor in interface ISchemaObjectEditorPage

setPageDescriptor

public void setPageDescriptor(IEditorPageDescriptor page)
Description copied from interface: ISchemaObjectEditorPage
Sets the page descriptor for this page

Specified by:
setPageDescriptor in interface ISchemaObjectEditorPage

refresh

public void refresh()
Sub class should override this method to refresh the page according to the model and if this page is not opened, should not refresh it

Specified by:
refresh in interface ISchemaObjectEditorPage

revert

public void revert()
Description copied from interface: ISchemaObjectEditorPage
Revert this page to the original model

Specified by:
revert in interface ISchemaObjectEditorPage

getDatabaseIdentifier

public org.eclipse.datatools.sqltools.core.DatabaseIdentifier getDatabaseIdentifier()
Returns the database identifier

Specified by:
getDatabaseIdentifier in interface ISchemaObjectEditorPage
Returns:

markDirty

public void markDirty()
Mark the dirty status

Specified by:
markDirty in interface ISchemaObjectEditorPage

validate

public IErrorItem[] validate(org.eclipse.swt.events.TypedEvent event)
The default implementation of this method validate all the objects belong to this page and return the error items

Specified by:
validate in interface ISchemaObjectEditorPage
Parameters:
event -
Returns:
the error items if this page is not valid, otherwise return null

populateSQLObjects

public void populateSQLObjects(org.eclipse.swt.events.TypedEvent event)
Sub class should override this method to populate the SQL objects belong to this page

Specified by:
populateSQLObjects in interface ISchemaObjectEditorPage
Parameters:
event -

validateAndShowErrors

public void validateAndShowErrors(org.eclipse.swt.events.TypedEvent event)
Validates this page and show errors accordingly

Specified by:
validateAndShowErrors in interface ISchemaObjectEditorPage
Parameters:
event -

isPageOpened

public boolean isPageOpened()
Description copied from interface: ISchemaObjectEditorPage
Checks if the page is opened (Controls are created)

Specified by:
isPageOpened in interface ISchemaObjectEditorPage
Returns:

modelRegenerated

public void modelRegenerated()
Description copied from interface: ISchemaObjectEditorPage
Do something when the model is re-generated, for example, after successfully saving the dirty editor, the edit model will be re-cloned from the refreshed database model, in this case, page should be refreshed to keep it synchronized with database

Specified by:
modelRegenerated in interface ISchemaObjectEditorPage

aboutToSave

public boolean aboutToSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface: ISchemaObjectEditorPage
Notifies this page that the editor is about to save, subclass should update the model if necessary

Specified by:
aboutToSave in interface ISchemaObjectEditorPage

validateOnline

public IErrorItem[] validateOnline(org.eclipse.swt.events.TypedEvent event)
Description copied from interface: ISchemaObjectEditorPage
Online check if the page is valid

Specified by:
validateOnline in interface ISchemaObjectEditorPage
Returns:
the error items if this page is not valid, otherwise return null

menuAboutToShow

public void menuAboutToShow(org.eclipse.jface.action.IMenuManager manager)
Description copied from interface: ISchemaObjectEditorPage
Adds menu items for this page

Specified by:
menuAboutToShow in interface ISchemaObjectEditorPage

getPreferencePageIds

public java.lang.String[] getPreferencePageIds()
Description copied from interface: ISchemaObjectEditorPage
Returns the preference pages ids related to this editor page.
The returns preference pages will be displayed if user click "Preferences..." in the editor page's context menu

Specified by:
getPreferencePageIds in interface ISchemaObjectEditorPage
Returns:

setFocus

public void setFocus(int itemType,
                     java.lang.Object item)
The default implementation sets the current page active

Specified by:
setFocus in interface ISchemaObjectEditorPage
Parameters:
itemType - the type of the item, each page can define its own types
item - the object of the type, it can be null if the item type provides enough information

enable

public void enable(boolean enabled)
Specified by:
enable in interface IDisablementPart