## org.eclipse.datatools.sqltools.schemaobjecteditor.ui.core
Class SchemaObjectEditor

    java.lang.Object
      org.eclipse.core.commands.common.EventManager
          org.eclipse.ui.part.WorkbenchPart
              org.eclipse.ui.part.EditorPart
                  org.eclipse.ui.part.MultiPageEditorPart
                      org.eclipse.ui.forms.editor.FormEditor
                          org.eclipse.datatools.sqltools.schemaobjecteditor.ui.core.SchemaObjectEditor

All Implemented Interfaces:
  org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, IResourceChangeHandler, ISchemaObjectEditor, org.eclipse.jface.dialogs.IPageChangeProvider, 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

    public class SchemaObjectEditor

extends org.eclipse.ui.forms.editor.FormEditor
implements ISchemaObjectEditor

The base editor, which is responsible for loading the pages defined by the consumers according to the end-user's setting (visibility & order). Through this class, consumer can get the run-time page and static page instance.

To define the run-time behaviour of the multi-page eidtor, the consumer need to extend `DefaultSchemaObjectEditorHandler` and set it in the extension accordingly.

The editor input of this base editor is defined as `SchemeObjectEditorInput`, which contains a model object, the consumer can use that field to store the domain model, for example the Table object.

Some methods defined in the parent classes are overrided to emplify the visibility since the consumer can not extend and override this class.

Author:
  Idull

Field Summary
`java.lang.Object` `_data` The consumer can store application data in this field
`java.lang.Object` `_editModel` The edit model of this editor, this is always a "dirty" one compared with the orginal model

Fields inherited from interface org.eclipse.ui.IEditorPart
`PROP_DIRTY, PROP_INPUT`

Fields inherited from interface org.eclipse.ui.IWorkbenchPart
`PROP_TITLE`

Constructor Summary
`SchemaObjectEditor()`

Method Summary
`void` `addPage(int index, NestedEditorPage page)` Creates and adds a new page containing the given editor to this multi-page editor.
`void` `clearDirty()` Clear the dirty status of the editor
`void` `dispose()`
`void` `doSave(org.eclipse.core.runtime.IProgressMonitor monitor)`
`void` `doSaveAs()`
`void` `fireDirtyPropertyChange()` A short-cut method
`void` `fireSchemaEditorProperChanged(int propertyId)`
`ISchemaObjectEditorPage` `getActiveEditorPage()` Returns the active page instance
`java.lang.Object` `getAdapter(java.lang.Class adapter)`
`ISchemaObjectEditorPage[]` `getAllPages()` Returns all pages loaded
`int` `getCurrentPageIndex()` Returns the current page's index
`java.lang.Object` `getData()` Returns the application data
`java.lang.String` `getDisplayName()` Tries to return a meaningful name
`java.lang.Object` `getEditModel()` Returns the edit model
`org.eclipse.swt.widgets.Composite` `getEditorContainer()`
`IEditorDescriptor` `getEditorDescriptor()` Returns the static editor instance
`ISchemaObjectEditorHandler` `getEditorHandler()` Returns the handler
`org.eclipse.swt.widgets.Control` `getEditorPageControl(int pageIndex)`
`int` `getEditorPageCount()`
`ISchemaObjectEditorPage` `getPageById(java.lang.String id)` Returns the page by id
`ISchemaObjectEditorPage` `getPageByName(java.lang.String name)` Returns the page by name
`void` `init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)`
`boolean` `isDirty()`
`boolean` `isSaveAsAllowed()`
`boolean` `isSyncSave()` Checks if current save mode is sync save
`void` `markDirty()` Mark the editor as dirty status
`boolean` `needRefreshAfterSave()`
`void` `resouceChanged(IResourceChangeEvent event)` The consumer need to call this method when the resouce is changed outside of the schema editor's scope
`void` `setActivePage(int pageIndex)` Widen the visibility
`org.eclipse.ui.forms.editor.IFormPage` `setActivePage(java.lang.String pageId)`
`void` `setData(java.lang.Object _data)` Sets the application data
`void` `setEditModel(java.lang.Object model)` Sets the edit model
`void` `setEditorPageImage(int pageIndex, org.eclipse.swt.graphics.Image image)`
`void` `setEditorPageText(int pageIndex, java.lang.String text)`
`void` `setEditorPartName(java.lang.String name)` Sets the part name for the schema object editor
`void` `setNeedRefreshAfterSave(boolean needRefresh)` Sets if the editor needs to be refreshed after it is saved
`void` `setSyncSaveMode()` Sets sync save mode for the next save process
`java.util.Map` `validate()` Validates the editor to see if there are errors

Methods inherited from class org.eclipse.ui.forms.editor.FormEditor
`addPage, addPage, addPage, addPage, addPage, addPage, addPageChangedListener, close, editorDirtyStateChanged, findPage, getActiveEditor, getActivePageInstance, getSelectedPage, getToolkit, removePage, removePageChangedListener, selectReveal, setActivePage`

Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
`createPartControl, findEditors, setActiveEditor, setFocus`

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, getContentDescription, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, 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, createPartControl, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus`

Methods inherited from interface org.eclipse.ui.ISaveablePart
`isSaveOnCloseNeeded`

Field Detail

### _data

    public java.lang.Object _data

  The consumer can store application data in this field

### _editModel

    public java.lang.Object _editModel

  The edit model of this editor, this is always a "dirty" one compared with the orginal model

Constructor Detail

### SchemaObjectEditor

    public SchemaObjectEditor()

Method Detail

### clearDirty

    public void clearDirty()

  Description copied from interface: `ISchemaObjectEditor`
  Clear the dirty status of the editor

  Specified by:
    `clearDirty` in interface `ISchemaObjectEditor`

### dispose

    public void dispose()

  Specified by:
    `dispose` in interface `org.eclipse.ui.IWorkbenchPart`
  Overrides:
    `dispose` in class `org.eclipse.ui.forms.editor.FormEditor`

### doSave

    public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)

  Specified by:
    `doSave` in interface `org.eclipse.ui.ISaveablePart`
  Specified by:
    `doSave` in class `org.eclipse.ui.part.EditorPart`

### doSaveAs

    public void doSaveAs()

  Specified by:
    `doSaveAs` in interface `org.eclipse.ui.ISaveablePart`
  Specified by:
    `doSaveAs` in class `org.eclipse.ui.part.EditorPart`

### fireDirtyPropertyChange

    public void fireDirtyPropertyChange()

  A short-cut method

  Specified by:
    `fireDirtyPropertyChange` in interface `ISchemaObjectEditor`

### fireSchemaEditorProperChanged

    public void fireSchemaEditorProperChanged(int propertyId)

### getActiveEditorPage

    public ISchemaObjectEditorPage getActiveEditorPage()

  Returns the active page instance

  Specified by:
    `getActiveEditorPage` in interface `ISchemaObjectEditor`
  Returns:

### getAdapter

    public java.lang.Object getAdapter(java.lang.Class adapter)

  Specified by:
    `getAdapter` in interface `org.eclipse.core.runtime.IAdaptable`
  Overrides:
    `getAdapter` in class `org.eclipse.ui.part.MultiPageEditorPart`

### getAllPages

    public ISchemaObjectEditorPage[] getAllPages()

  Returns all pages loaded

  Specified by:
    `getAllPages` in interface `ISchemaObjectEditor`
  Returns:

### getCurrentPageIndex

    public int getCurrentPageIndex()

  Description copied from interface: `ISchemaObjectEditor`
  Returns the current page's index

  Specified by:
    `getCurrentPageIndex` in interface `ISchemaObjectEditor`
  Returns:

### getData

    public java.lang.Object getData()

  Description copied from interface: `ISchemaObjectEditor`
  Returns the application data

  Specified by:
    `getData` in interface `ISchemaObjectEditor`
  Returns:

### getEditModel

    public java.lang.Object getEditModel()

  Description copied from interface: `ISchemaObjectEditor`
  Returns the edit model

  Specified by:
    `getEditModel` in interface `ISchemaObjectEditor`
  Returns:

### getEditorContainer

    public org.eclipse.swt.widgets.Composite getEditorContainer()

### getEditorHandler

    public ISchemaObjectEditorHandler getEditorHandler()

  Description copied from interface: `ISchemaObjectEditor`
  Returns the handler

  Specified by:
    `getEditorHandler` in interface `ISchemaObjectEditor`
  Returns:

### getEditorPageControl

    public org.eclipse.swt.widgets.Control getEditorPageControl(int pageIndex)

### getEditorPageCount

    public int getEditorPageCount()

### getPageById

    public ISchemaObjectEditorPage getPageById(java.lang.String id)

  Returns the page by id

  Specified by:
    `getPageById` in interface `ISchemaObjectEditor`
  Parameters:
    `id` - the id of a page, should be unique for an editor
  Returns:

### getPageByName

    public ISchemaObjectEditorPage getPageByName(java.lang.String name)

  Returns the page by name

  Specified by:
    `getPageByName` in interface `ISchemaObjectEditor`
  Parameters:
    `name` - name of editor pages, we suggest that the name is also unique for an editor, otherwise this method will only return the first one
  Returns:

### getEditorDescriptor

    public IEditorDescriptor getEditorDescriptor()

  Returns the static editor instance

  Specified by:
    `getEditorDescriptor` in interface `ISchemaObjectEditor`
  Returns:

### init

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

  Specified by:
    `init` in interface `org.eclipse.ui.IEditorPart`
  Overrides:
    `init` in class `org.eclipse.ui.forms.editor.FormEditor`
  Throws:
    `org.eclipse.ui.PartInitException`

### isDirty

    public boolean isDirty()

  Specified by:
    `isDirty` in interface `org.eclipse.ui.ISaveablePart`
  Overrides:
    `isDirty` in class `org.eclipse.ui.forms.editor.FormEditor`

### isSaveAsAllowed

    public boolean isSaveAsAllowed()

  Specified by:
    `isSaveAsAllowed` in interface `org.eclipse.ui.ISaveablePart`
  Specified by:
    `isSaveAsAllowed` in class `org.eclipse.ui.part.EditorPart`

### markDirty

    public void markDirty()

  Description copied from interface: `ISchemaObjectEditor`
  Mark the editor as dirty status

  Specified by:
    `markDirty` in interface `ISchemaObjectEditor`

### resouceChanged

    public void resouceChanged(IResourceChangeEvent event)

  Description copied from interface: `IResourceChangeHandler`
  The consumer need to call this method when the resouce is changed outside of the schema editor's scope

  Specified by:
    `resouceChanged` in interface `IResourceChangeHandler`

### setData

    public void setData(java.lang.Object _data)

  Description copied from interface: `ISchemaObjectEditor`
  Sets the application data

  Specified by:
    `setData` in interface `ISchemaObjectEditor`

### setEditModel

    public void setEditModel(java.lang.Object model)

  Description copied from interface: `ISchemaObjectEditor`
  Sets the edit model

  Specified by:
    `setEditModel` in interface `ISchemaObjectEditor`

### setEditorPageImage

    public void setEditorPageImage(int pageIndex,
                                   org.eclipse.swt.graphics.Image image)

### setEditorPageText

    public void setEditorPageText(int pageIndex,
                                  java.lang.String text)

### setEditorPartName

    public void setEditorPartName(java.lang.String name)

  Description copied from interface: `ISchemaObjectEditor`
  Sets the part name for the schema object editor

  Specified by:
    `setEditorPartName` in interface `ISchemaObjectEditor`

### addPage

    public void addPage(int index,
                        NestedEditorPage page)
                 throws org.eclipse.ui.PartInitException

  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)
    `editor` - the nested editor
    `input` - the input for the nested editor
  Throws:
    `org.eclipse.ui.PartInitException` - if a new page could not be created
  See Also:
    `the handler for property change events from the nested editor`

### validate

    public java.util.Map validate()

  Description copied from interface: `ISchemaObjectEditor`
  Validates the editor to see if there are errors

  Specified by:
    `validate` in interface `ISchemaObjectEditor`
  Returns:

### getDisplayName

    public java.lang.String getDisplayName()

  Tries to return a meaningful name

  Specified by:
    `getDisplayName` in interface `ISchemaObjectEditor`
  Returns:

### setActivePage

    public org.eclipse.ui.forms.editor.IFormPage setActivePage(java.lang.String pageId)

  Overrides:
    `setActivePage` in class `org.eclipse.ui.forms.editor.FormEditor`

### setActivePage

    public void setActivePage(int pageIndex)

  Widen the visibility

  Overrides:
    `setActivePage` in class `org.eclipse.ui.forms.editor.FormEditor`

### setSyncSaveMode

    public void setSyncSaveMode()

  Description copied from interface: `ISchemaObjectEditor`
  Sets sync save mode for the next save process

  Specified by:
    `setSyncSaveMode` in interface `ISchemaObjectEditor`

### isSyncSave

    public boolean isSyncSave()

  Description copied from interface: `ISchemaObjectEditor`
  Checks if current save mode is sync save

  Specified by:
    `isSyncSave` in interface `ISchemaObjectEditor`

### needRefreshAfterSave

    public boolean needRefreshAfterSave()

  Specified by:
    `needRefreshAfterSave` in interface `ISchemaObjectEditor`
  Returns:

### setNeedRefreshAfterSave

    public void setNeedRefreshAfterSave(boolean needRefresh)

  Description copied from interface: `ISchemaObjectEditor`
  Sets if the editor needs to be refreshed after it is saved

  Specified by:
    `setNeedRefreshAfterSave` in interface `ISchemaObjectEditor`