Search in sources :

Example 1 with SQLSymbolInserter

use of org.jkiss.dbeaver.ui.editors.sql.util.SQLSymbolInserter in project dbeaver by serge-rider.

the class SQLEditorBase method createPartControl.

@Override
public void createPartControl(Composite parent) {
    setRangeIndicator(new DefaultRangeIndicator());
    editorControl = new SQLEditorControl(parent, this);
    super.createPartControl(editorControl);
    if (occurrencesHighlighter.isEnabled()) {
        occurrencesHighlighter.installOccurrencesFinder();
    }
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    // $NON-NLS-1$
    projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
    // $NON-NLS-1$
    projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
    projectionSupport.install();
    viewer.doOperation(ProjectionViewer.TOGGLE);
    annotationModel = viewer.getProjectionAnnotationModel();
    // Symbol inserter
    {
        sqlSymbolInserter = new SQLSymbolInserter(this);
        loadActivePreferenceSettings();
        ISourceViewer sourceViewer = getSourceViewer();
        if (sourceViewer instanceof ITextViewerExtension) {
            ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(sqlSymbolInserter);
        }
    }
    {
        // Context listener
        EditorUtils.trackControlContext(getSite(), getViewer().getTextWidget(), SQLEditorContributions.SQL_EDITOR_CONTROL_CONTEXT);
    }
}
Also used : ProjectionSupport(org.eclipse.jface.text.source.projection.ProjectionSupport) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer) SQLSymbolInserter(org.jkiss.dbeaver.ui.editors.sql.util.SQLSymbolInserter)

Example 2 with SQLSymbolInserter

use of org.jkiss.dbeaver.ui.editors.sql.util.SQLSymbolInserter in project dbeaver by dbeaver.

the class SQLEditorBase method createPartControl.

@Override
public void createPartControl(Composite parent) {
    setRangeIndicator(new DefaultRangeIndicator());
    super.createPartControl(new SQLEditorControl(parent, this));
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    // $NON-NLS-1$
    projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
    // $NON-NLS-1$
    projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
    projectionSupport.install();
    viewer.doOperation(ProjectionViewer.TOGGLE);
    annotationModel = viewer.getProjectionAnnotationModel();
    // Symbol inserter
    {
        SQLSymbolInserter symbolInserter = new SQLSymbolInserter(this);
        DBPPreferenceStore preferenceStore = getActivePreferenceStore();
        boolean closeSingleQuotes = preferenceStore.getBoolean(SQLPreferenceConstants.SQLEDITOR_CLOSE_SINGLE_QUOTES);
        boolean closeDoubleQuotes = preferenceStore.getBoolean(SQLPreferenceConstants.SQLEDITOR_CLOSE_DOUBLE_QUOTES);
        boolean closeBrackets = preferenceStore.getBoolean(SQLPreferenceConstants.SQLEDITOR_CLOSE_BRACKETS);
        symbolInserter.setCloseSingleQuotesEnabled(closeSingleQuotes);
        symbolInserter.setCloseDoubleQuotesEnabled(closeDoubleQuotes);
        symbolInserter.setCloseBracketsEnabled(closeBrackets);
        ISourceViewer sourceViewer = getSourceViewer();
        if (sourceViewer instanceof ITextViewerExtension) {
            ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(symbolInserter);
        }
    }
}
Also used : ProjectionSupport(org.eclipse.jface.text.source.projection.ProjectionSupport) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer) SQLSymbolInserter(org.jkiss.dbeaver.ui.editors.sql.util.SQLSymbolInserter) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Aggregations

ProjectionSupport (org.eclipse.jface.text.source.projection.ProjectionSupport)2 ProjectionViewer (org.eclipse.jface.text.source.projection.ProjectionViewer)2 SQLSymbolInserter (org.jkiss.dbeaver.ui.editors.sql.util.SQLSymbolInserter)2 DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)1