Search in sources :

Example 1 with ProjectionSupport

use of org.eclipse.jface.text.source.projection.ProjectionSupport in project dbeaver by serge-rider.

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)

Example 2 with ProjectionSupport

use of org.eclipse.jface.text.source.projection.ProjectionSupport in project KaiZen-OpenAPI-Editor by RepreZen.

the class JsonEditor method createPartControl.

@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    ProjectionViewer viewer = getProjectionViewer();
    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();
    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    annotationModel = viewer.getProjectionAnnotationModel();
    preferenceStore.addPropertyChangeListener(preferenceChangeListener);
}
Also used : ProjectionSupport(org.eclipse.jface.text.source.projection.ProjectionSupport) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer)

Example 3 with ProjectionSupport

use of org.eclipse.jface.text.source.projection.ProjectionSupport in project tdi-studio-se by Talend.

the class ReconcilerViewer method initializeModel.

protected void initializeModel() {
    ProjectionSupport projectionSupport = new ProjectionSupport(this, annotationAccess, sharedColors);
    //$NON-NLS-1$
    projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
    //$NON-NLS-1$
    projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
    projectionSupport.setHoverControlCreator(new IInformationControlCreator() {

        @Override
        public IInformationControl createInformationControl(Shell shell) {
            return new SourceViewerInformationControl(shell, false, SWT.LEFT_TO_RIGHT, EditorsUI.getTooltipAffordanceString());
        }
    });
    projectionSupport.setInformationPresenterControlCreator(new IInformationControlCreator() {

        @Override
        public IInformationControl createInformationControl(Shell shell) {
            int shellStyle = SWT.RESIZE | SWT.TOOL | SWT.LEFT_TO_RIGHT;
            int style = SWT.V_SCROLL | SWT.H_SCROLL;
            return new SourceViewerInformationControl(shell, true, SWT.LEFT_TO_RIGHT, null);
        }
    });
    projectionSupport.install();
}
Also used : ProjectionSupport(org.eclipse.jface.text.source.projection.ProjectionSupport) IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) Shell(org.eclipse.swt.widgets.Shell) IInformationControl(org.eclipse.jface.text.IInformationControl) SourceViewerInformationControl(org.eclipse.jdt.internal.ui.text.java.hover.SourceViewerInformationControl)

Aggregations

ProjectionSupport (org.eclipse.jface.text.source.projection.ProjectionSupport)3 ProjectionViewer (org.eclipse.jface.text.source.projection.ProjectionViewer)2 SourceViewerInformationControl (org.eclipse.jdt.internal.ui.text.java.hover.SourceViewerInformationControl)1 IInformationControl (org.eclipse.jface.text.IInformationControl)1 IInformationControlCreator (org.eclipse.jface.text.IInformationControlCreator)1 Shell (org.eclipse.swt.widgets.Shell)1 DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)1 SQLSymbolInserter (org.jkiss.dbeaver.ui.editors.sql.util.SQLSymbolInserter)1