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

java.lang.Object
  extended by org.eclipse.datatools.sqltools.schemaobjecteditor.ui.core.DefaultSchemaObjectEditorHandler
All Implemented Interfaces:
IResourceChangeHandler, ISchemaObjectEditorHandler
Direct Known Subclasses:
ASATableSchemaEditorHandler, ProceduralObjectEditorHandler

public class DefaultSchemaObjectEditorHandler
extends java.lang.Object
implements ISchemaObjectEditorHandler

Instead of implementing the ISchemaEditorConfiguration from scratch, the consumer should extend this class, and rewrite some methods.

Author:
Idull

Constructor Summary
DefaultSchemaObjectEditorHandler()
           
 
Method Summary
 boolean checkSchemaObjectExistence(boolean doCheck)
          Do check based on the parameter doCheck.
 void dispose()
          Does something when the editor part is disposing
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
          Saves the content of the editor part.
 void doSaveAs()
          Does nothing
 void forceFocusObject(SQLObject object)
          Should be invoked in UI thread
 java.lang.String generateScript()
          Generates script for the current editor.
 java.lang.Object getAdapter(java.lang.Class adapter)
          Returns the adapter.
 java.lang.String getDisplayName()
          Returns the display name of the current edited object (a meaningful name), this will be used for saving purpose.
 ISchemaObjectEditorInput getEditorInput()
           
 java.lang.String getGroupExecDisplayString()
           
 SchemaObjectEditorModelListenersNotifier getNotifier()
          Returns the editor model listeners notifier.
 boolean getOpenFileAfterSaveasOption()
           
 void hookInitialization()
          Does some initialization jobs, this will be invoked by the editor after all pages are loaded
 boolean inSavingProcess()
          Checks if the editor is in saving process, since the saving process may take time
 boolean isSaveAsAllowed()
          Tests if savesa is allowed for this editor part
 void pageChanged(int newPageIndex)
          Does something with the editor when the page is changed.
 void refreshFromDB(org.eclipse.core.runtime.IProgressMonitor monitor)
          SubClass should override this method to refresh the model first, then refresh each page
 void resouceChanged(IResourceChangeEvent event)
          The consumer need to call this method when the resouce is changed outside of the schema editor's scope
 void revert()
          Reverts the editor to the original model (no need to refresh the model)
 void setEditor(ISchemaObjectEditor editor)
          Since the instance of this class will be created using the Eclipse extension API, so that we need to set the editor to the hanlder for it to use
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSchemaObjectEditorHandler

public DefaultSchemaObjectEditorHandler()
Method Detail

dispose

public void dispose()
Description copied from interface: ISchemaObjectEditorHandler
Does something when the editor part is disposing

Specified by:
dispose in interface ISchemaObjectEditorHandler

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface: ISchemaObjectEditorHandler
Saves the content of the editor part.

Specified by:
doSave in interface ISchemaObjectEditorHandler

doSaveAs

public void doSaveAs()
Does nothing

Specified by:
doSaveAs in interface ISchemaObjectEditorHandler

generateScript

public java.lang.String generateScript()
Description copied from interface: ISchemaObjectEditorHandler
Generates script for the current editor. This method will be invoked by doSave() to get the script

Specified by:
generateScript in interface ISchemaObjectEditorHandler
Returns:

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Description copied from interface: ISchemaObjectEditorHandler
Returns the adapter. This will be called when the super.getAdapter in SchemaObjectEditor returns null.

Specified by:
getAdapter in interface ISchemaObjectEditorHandler
Returns:

isSaveAsAllowed

public boolean isSaveAsAllowed()
Description copied from interface: ISchemaObjectEditorHandler
Tests if savesa is allowed for this editor part

Specified by:
isSaveAsAllowed in interface ISchemaObjectEditorHandler
Returns:

pageChanged

public void pageChanged(int newPageIndex)
Description copied from interface: ISchemaObjectEditorHandler
Does something with the editor when the page is changed. This method will be called before all the obsevers of page change event get notified.

Specified by:
pageChanged in interface ISchemaObjectEditorHandler

refreshFromDB

public void refreshFromDB(org.eclipse.core.runtime.IProgressMonitor monitor)
SubClass should override this method to refresh the model first, then refresh each page

Specified by:
refreshFromDB in interface ISchemaObjectEditorHandler

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

revert

public void revert()
Description copied from interface: ISchemaObjectEditorHandler
Reverts the editor to the original model (no need to refresh the model)

Specified by:
revert in interface ISchemaObjectEditorHandler

setEditor

public void setEditor(ISchemaObjectEditor editor)
Description copied from interface: ISchemaObjectEditorHandler
Since the instance of this class will be created using the Eclipse extension API, so that we need to set the editor to the hanlder for it to use

Specified by:
setEditor in interface ISchemaObjectEditorHandler

getDisplayName

public java.lang.String getDisplayName()
Description copied from interface: ISchemaObjectEditorHandler
Returns the display name of the current edited object (a meaningful name), this will be used for saving purpose. If nothing is returned, the editor part name will be used for saving purpose

Specified by:
getDisplayName in interface ISchemaObjectEditorHandler
Returns:

getEditorInput

public ISchemaObjectEditorInput getEditorInput()

hookInitialization

public void hookInitialization()
Description copied from interface: ISchemaObjectEditorHandler
Does some initialization jobs, this will be invoked by the editor after all pages are loaded

Specified by:
hookInitialization in interface ISchemaObjectEditorHandler

getNotifier

public SchemaObjectEditorModelListenersNotifier getNotifier()
Returns the editor model listeners notifier. The notifier is registered as the listener of the schema object editor model.

Specified by:
getNotifier in interface ISchemaObjectEditorHandler
Returns:

inSavingProcess

public boolean inSavingProcess()
Description copied from interface: ISchemaObjectEditorHandler
Checks if the editor is in saving process, since the saving process may take time

Specified by:
inSavingProcess in interface ISchemaObjectEditorHandler
Returns:
true if the editor is in saving process

getGroupExecDisplayString

public java.lang.String getGroupExecDisplayString()

getOpenFileAfterSaveasOption

public boolean getOpenFileAfterSaveasOption()

forceFocusObject

public void forceFocusObject(SQLObject object)
Should be invoked in UI thread

Specified by:
forceFocusObject in interface ISchemaObjectEditorHandler

checkSchemaObjectExistence

public boolean checkSchemaObjectExistence(boolean doCheck)
Do check based on the parameter doCheck.

Specified by:
checkSchemaObjectExistence in interface ISchemaObjectEditorHandler
Parameters:
doCheck -
Returns: