Search in sources :

Example 1 with IInformationPresenter

use of org.eclipse.jface.text.information.IInformationPresenter in project KaiZen-OpenAPI-Editor by RepreZen.

the class JsonSourceViewerConfiguration method getOutlinePresenter.

public IInformationPresenter getOutlinePresenter(ISourceViewer sourceViewer) {
    if (informationPresenter == null) {
        IInformationControlCreator controlCreator = getOutlineInformationControlCreator();
        informationPresenter = new InformationPresenter(controlCreator);
        informationPresenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
        // Register information provider
        IInformationProvider provider = new InformationProvider(controlCreator);
        String[] contentTypes = getConfiguredContentTypes(sourceViewer);
        for (String contentType : contentTypes) {
            informationPresenter.setInformationProvider(provider, contentType);
        }
        informationPresenter.setSizeConstraints(60, 20, true, true);
    }
    return informationPresenter;
}
Also used : IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) IInformationProvider(org.eclipse.jface.text.information.IInformationProvider) IInformationProvider(org.eclipse.jface.text.information.IInformationProvider) IInformationPresenter(org.eclipse.jface.text.information.IInformationPresenter) InformationPresenter(org.eclipse.jface.text.information.InformationPresenter)

Example 2 with IInformationPresenter

use of org.eclipse.jface.text.information.IInformationPresenter in project tdi-studio-se by Talend.

the class SQLSourceViewerConfiguration method getInformationPresenter.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getInformationPresenter(org.eclipse.jface.text.source.ISourceViewer)
	 */
public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
    if (iPresenter == null) {
        IInformationControlCreator informationControlCreator = new IInformationControlCreator() {

            public IInformationControl createInformationControl(Shell parent) {
                // SWT.H_SCROLL);
                return new DefaultInformationControl(parent);
            // SWT.RESIZE,,
            // style,
            // new
            // HTMLTextPresenter(cutDown));
            }
        };
        iPresenter = new InformationPresenter(informationControlCreator);
        iPresenter.setSizeConstraints(60, 10, true, true);
    }
    return iPresenter;
}
Also used : IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) Shell(org.eclipse.swt.widgets.Shell) DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) InformationPresenter(org.eclipse.jface.text.information.InformationPresenter) IInformationPresenter(org.eclipse.jface.text.information.IInformationPresenter)

Example 3 with IInformationPresenter

use of org.eclipse.jface.text.information.IInformationPresenter in project dbeaver by serge-rider.

the class SQLEditorSourceViewerConfiguration method getInformationPresenter.

@Override
public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
    InformationPresenter presenter = new InformationPresenter(getInformationControlCreator(sourceViewer));
    presenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    // Register information provider
    IInformationProvider provider = new SQLInformationProvider(getSQLEditor());
    String[] contentTypes = getConfiguredContentTypes(sourceViewer);
    for (String contentType : contentTypes) {
        presenter.setInformationProvider(provider, contentType);
    }
    presenter.setSizeConstraints(60, 10, true, true);
    return presenter;
}
Also used : IInformationProvider(org.eclipse.jface.text.information.IInformationProvider) IInformationPresenter(org.eclipse.jface.text.information.IInformationPresenter) InformationPresenter(org.eclipse.jface.text.information.InformationPresenter) SQLInformationProvider(org.jkiss.dbeaver.ui.editors.sql.syntax.SQLInformationProvider)

Example 4 with IInformationPresenter

use of org.eclipse.jface.text.information.IInformationPresenter in project KaiZen-OpenAPI-Editor by RepreZen.

the class JsonEditor method doCreateSourceViewer.

protected ISourceViewer doCreateSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ProjectionViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) {

        private IInformationPresenter outlinePresenter;

        @Override
        public void doOperation(int operation) {
            if (operation == OpenQuickOutlineHandler.QUICK_OUTLINE && outlinePresenter != null) {
                outlinePresenter.showInformation();
                return;
            }
            super.doOperation(operation);
        }

        @Override
        public boolean canDoOperation(int operation) {
            if (operation == OpenQuickOutlineHandler.QUICK_OUTLINE && outlinePresenter != null) {
                return true;
            }
            return super.canDoOperation(operation);
        }

        @Override
        public void configure(SourceViewerConfiguration configuration) {
            super.configure(configuration);
            if (configuration instanceof JsonSourceViewerConfiguration) {
                JsonSourceViewerConfiguration c = (JsonSourceViewerConfiguration) configuration;
                outlinePresenter = c.getOutlinePresenter(this);
                if (outlinePresenter != null) {
                    outlinePresenter.install(this);
                }
            }
        }
    };
    IFocusService focusService = (IFocusService) PlatformUI.getWorkbench().getService(IFocusService.class);
    if (focusService != null) {
        focusService.addFocusTracker(viewer.getTextWidget(), "com.reprezen.swagedit.editor.sourceViewer");
    }
    viewer.getTextWidget().addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
        // detectOutlineLocationChanged();
        }
    });
    viewer.getTextWidget().setData(ISourceViewer.class.getName(), viewer);
    getSourceViewerDecorationSupport(viewer);
    return viewer;
}
Also used : YEditSourceViewerConfiguration(org.dadacoalition.yedit.editor.YEditSourceViewerConfiguration) SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IInformationPresenter(org.eclipse.jface.text.information.IInformationPresenter) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer) IFocusService(org.eclipse.ui.swt.IFocusService) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer)

Aggregations

IInformationPresenter (org.eclipse.jface.text.information.IInformationPresenter)4 InformationPresenter (org.eclipse.jface.text.information.InformationPresenter)3 IInformationControlCreator (org.eclipse.jface.text.IInformationControlCreator)2 IInformationProvider (org.eclipse.jface.text.information.IInformationProvider)2 YEditSourceViewerConfiguration (org.dadacoalition.yedit.editor.YEditSourceViewerConfiguration)1 DefaultInformationControl (org.eclipse.jface.text.DefaultInformationControl)1 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1 SourceViewerConfiguration (org.eclipse.jface.text.source.SourceViewerConfiguration)1 ProjectionViewer (org.eclipse.jface.text.source.projection.ProjectionViewer)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Shell (org.eclipse.swt.widgets.Shell)1 IFocusService (org.eclipse.ui.swt.IFocusService)1 SQLInformationProvider (org.jkiss.dbeaver.ui.editors.sql.syntax.SQLInformationProvider)1