Package com.iizigo.db.editor
Class CustomSQLBuilder
java.lang.Object
org.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
com.iizigo.db.editor.CustomSQLBuilder
- All Implemented Interfaces:
Observer
,org.eclipse.datatools.sqltools.sqlbuilder.IContentChangeListener
,org.eclipse.emf.edit.domain.IEditingDomainProvider
,org.eclipse.jface.action.IMenuListener
public class CustomSQLBuilder extends org.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
Customized UI Component of SQL Query Builder content editor.
- Author:
- Christopher Mindus
Field Summary
Fields inherited from class org.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
_actionBarContributor, _clientCreated, _contentChangeListeners, _contentOutlinePage, _currentSelection, _designViewer, _editingDomain, _editor, _editorInputUsageOptions, _executeSQLListeners, _graphControl, _iFile, _inCreateClient, _inputLoaded, _loadOnConnection, _parentControl, _sashGraphOutline, _sashMain, _sashSourceGraph, _sourceViewer, _sqlBuilderEditorInput, _sqlDomainModel, _windowStateInfo, DEFAULT_SASHGRAPHOUTLINE_WEIGHT1, DEFAULT_SASHGRAPHOUTLINE_WEIGHT2, DEFAULT_SASHMAIN_HEIGHT, DEFAULT_SASHMAIN_WEIGHT1, DEFAULT_SASHMAIN_WEIGHT2, DEFAULT_SASHMAIN_WIDTH, DEFAULT_SASHSOURCEGRAPH_WEIGHT1, DEFAULT_SASHSOURCEGRAPH_WEIGHT2
Method Summary
Modifier and TypeMethodDescriptionprotected void
changeGraphControlEnableState
(boolean enable) Overrides: Enables / disables the GraphControl to avoid message box.void
connectIfNeeded
(org.eclipse.ui.IWorkbenchPart part) Tries to make sure that we have a database connection so that the SQL model will be populated when we need it.void
createClient
(org.eclipse.swt.widgets.Composite parent) Creates the UI component for theSQLBuilder
.protected void
createSourceViewer
(org.eclipse.swt.widgets.Composite client) Creates the Source ViewerGets theGets the database editor.Gets the source viewer.Gets the text that is input in the source viewer.boolean
isDirty()
Overrides dirty state during initialization and save.void
menuAboutToShow
(org.eclipse.jface.action.IMenuManager menuManager) Menu listener.void
setDirty
(boolean isDirty) Marks this SQLBuilder's statement as "dirty" (has unsaved changes).Methods inherited from class org.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
addContentChangeListener, addExecuteSQLListener, changeStatementType, createContextMenuFor, createDesignViewer, createGraphViewer, doSave, getConnectionInfo, getContentOutlinePage, getDesignViewer, getDocumentProvider, getDomainModel, getEditingDomain, getEditorInputUsageOptions, getFile, getGraphViewer, getOmitSchemaInfo, getSQL, getSQLBuilderEditorInput, getSQLTreeViewer, getWindowStateInfo, handleContentOutlineSelection, inValidateEditCall, isContentOutlineRootSelected, isStatementProper, loadInput, notifyContentChange, notifySQLExecuted, reloadFromModel, removeContentChangeListener, removeExecuteSQLListener, reparseIfRequired, saveOmitSchemaInfo, setActionBarContributor, setInput, setLoadOnConnection, update, updateProperStatement, validateBeforeSave
Method Details
getActionBarContributor
Gets the- Overrides:
getActionBarContributor
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
getDatabaseEditor
Gets the database editor.- Returns:
- The database editor instance.
createClient
public void createClient(org.eclipse.swt.widgets.Composite parent) Creates the UI component for theSQLBuilder
. This method should be called aftersetInput(ISQLBuilderEditorInput)
.- Overrides:
createClient
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
- Parameters:
parent
- the parent composite.
createSourceViewer
protected void createSourceViewer(org.eclipse.swt.widgets.Composite client) Creates the Source Viewer- Overrides:
createSourceViewer
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
getTextInput
Gets the text that is input in the source viewer.- Returns:
- The SQL statement in the source viewer without parsing.
changeGraphControlEnableState
protected void changeGraphControlEnableState(boolean enable) Overrides: Enables / disables the GraphControl to avoid message box.- Overrides:
changeGraphControlEnableState
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
getSourceViewer
Gets the source viewer.- Overrides:
getSourceViewer
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
- Returns:
- The customized SQL source viewer.
connectIfNeeded
public void connectIfNeeded(org.eclipse.ui.IWorkbenchPart part) Tries to make sure that we have a database connection so that the SQL model will be populated when we need it. This allows us to delay connecting so that the user won't get prompted when the Workbench is coming up. This function should be called by editors based on SQLBuilder when the Workbench opens with the editor having been open when the workbench last closed.- Overrides:
connectIfNeeded
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
isDirty
public boolean isDirty()Overrides dirty state during initialization and save.- Overrides:
isDirty
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
setDirty
public void setDirty(boolean isDirty) Marks this SQLBuilder's statement as "dirty" (has unsaved changes).- Overrides:
setDirty
in classorg.eclipse.datatools.sqltools.sqlbuilder.SQLBuilder
- Parameters:
isDirty
- true when there are unsaved changes, otherwise false.