Search in sources :

Example 1 with IControlContentAdapter

use of org.eclipse.jface.fieldassist.IControlContentAdapter in project tdi-studio-se by Talend.

the class PigExpressionComposite method createEditorProposal.

/**
     * Creates proposal for editor.
     */
private void createEditorProposal() {
    try {
        // create KeyStroke use Ctrl+Space as default
        KeyStroke keyStroke = HotKeyUtil.getHotKey(HotKeyUtil.contentAssist);
        IControlContentAdapter controlContentAdapter = new StyledTextContentAdapter();
        // TDI-25309 :expression builder UDF autocompletion need add the inputTable node
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IPigMapService.class)) {
            final IPigMapService service = (IPigMapService) GlobalServiceRegister.getDefault().getService(IPigMapService.class);
            ContentProposalAdapterExtended proposalAdaptor = ProposalUtils.getCommonProposal(textControl, service.createExpressionProposalProvider(dataBean));
            new ContentProposalAdapter(textControl, controlContentAdapter, service.createExpressionProposalProvider(dataBean), keyStroke, new char[] { ' ', '.' });
        }
    } catch (Exception e) {
    //
    }
}
Also used : ContentProposalAdapterExtended(org.talend.commons.ui.swt.proposal.ContentProposalAdapterExtended) IControlContentAdapter(org.eclipse.jface.fieldassist.IControlContentAdapter) KeyStroke(org.eclipse.jface.bindings.keys.KeyStroke) StyledTextContentAdapter(org.talend.commons.ui.swt.proposal.StyledTextContentAdapter) IPigMapService(org.talend.core.service.IPigMapService) ContentProposalAdapter(org.eclipse.jface.fieldassist.ContentProposalAdapter)

Example 2 with IControlContentAdapter

use of org.eclipse.jface.fieldassist.IControlContentAdapter in project tdi-studio-se by Talend.

the class SqlEditDialog method createEditorProposal.

/**
     * Creates proposal for editor.
     */
private void createEditorProposal() {
    try {
        // create KeyStroke use Ctrl+Space as default
        KeyStroke keyStroke = HotKeyUtil.getHotKey(HotKeyUtil.contentAssist);
        IControlContentAdapter controlContentAdapter = new StyledTextContentAdapter();
        IContentProposalProvider contentProposalProvider = new SQLEditorProposalProvider(repositoryNode, language);
        SQLEditorProposalAdapter contentProposalAdapter = new SQLEditorProposalAdapter(colorText, controlContentAdapter, contentProposalProvider, keyStroke, new char[] { ' ', '.' });
        contentProposalAdapter.setPropagateKeys(true);
        contentProposalAdapter.setFilterStyle(ContentProposalAdapter.FILTER_CUMULATIVE);
        contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
        contentProposalAdapter.setLabelProvider(new SQLEditorLabelProvider());
        contentProposalAdapter.setAutoActivationDelay(10);
        contentProposalAdapter.setPopupSize(new Point(300, 200));
    } catch (Exception e) {
        //$NON-NLS-1$
        SqlBuilderPlugin.log(Messages.getString("SQLBuilderEditorComposite.logMessage"), e);
    }
}
Also used : IContentProposalProvider(org.eclipse.jface.fieldassist.IContentProposalProvider) SQLEditorLabelProvider(org.talend.sqlbuilder.ui.proposal.SQLEditorLabelProvider) SQLEditorProposalAdapter(org.talend.sqlbuilder.ui.proposal.SQLEditorProposalAdapter) IControlContentAdapter(org.eclipse.jface.fieldassist.IControlContentAdapter) KeyStroke(org.eclipse.jface.bindings.keys.KeyStroke) StyledTextContentAdapter(org.talend.commons.ui.swt.proposal.StyledTextContentAdapter) Point(org.eclipse.swt.graphics.Point) SQLEditorProposalProvider(org.talend.sqlbuilder.ui.proposal.SQLEditorProposalProvider)

Example 3 with IControlContentAdapter

use of org.eclipse.jface.fieldassist.IControlContentAdapter in project tdi-studio-se by Talend.

the class SQLBuilderEditorComposite method createEditorProposal.

/**
     * Creates proposal for editor.
     */
private void createEditorProposal() {
    try {
        // create KeyStroke use Ctrl+Space as default
        KeyStroke keyStroke = HotKeyUtil.getHotKey(HotKeyUtil.contentAssist);
        IControlContentAdapter controlContentAdapter = new StyledTextContentAdapter();
        IContentProposalProvider contentProposalProvider = new SQLEditorProposalProvider(repositoryNode, language);
        SQLEditorProposalAdapter contentProposalAdapter = new SQLEditorProposalAdapter(colorText, controlContentAdapter, contentProposalProvider, keyStroke, new char[] { ' ', '.' });
        contentProposalAdapter.setPropagateKeys(true);
        contentProposalAdapter.setFilterStyle(ContentProposalAdapter.FILTER_CUMULATIVE);
        contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
        contentProposalAdapter.setLabelProvider(new SQLEditorLabelProvider());
        contentProposalAdapter.setAutoActivationDelay(10);
        contentProposalAdapter.setPopupSize(new Point(300, 200));
    } catch (Exception e) {
        //$NON-NLS-1$
        SqlBuilderPlugin.log(Messages.getString("SQLBuilderEditorComposite.logMessage"), e);
    }
}
Also used : IContentProposalProvider(org.eclipse.jface.fieldassist.IContentProposalProvider) SQLEditorLabelProvider(org.talend.sqlbuilder.ui.proposal.SQLEditorLabelProvider) SQLEditorProposalAdapter(org.talend.sqlbuilder.ui.proposal.SQLEditorProposalAdapter) IControlContentAdapter(org.eclipse.jface.fieldassist.IControlContentAdapter) KeyStroke(org.eclipse.jface.bindings.keys.KeyStroke) StyledTextContentAdapter(org.talend.commons.ui.swt.proposal.StyledTextContentAdapter) Point(org.eclipse.swt.graphics.Point) SQLEditorProposalProvider(org.talend.sqlbuilder.ui.proposal.SQLEditorProposalProvider)

Example 4 with IControlContentAdapter

use of org.eclipse.jface.fieldassist.IControlContentAdapter in project tdi-studio-se by Talend.

the class BatchExpressionComposite method createEditorProposal.

/**
     * Creates proposal for editor.
     */
private void createEditorProposal() {
    try {
        // create KeyStroke use Ctrl+Space as default
        KeyStroke keyStroke = HotKeyUtil.getHotKey(HotKeyUtil.contentAssist);
        IControlContentAdapter controlContentAdapter = new StyledTextContentAdapter();
        // TDI-25309 :expression builder UDF autocompletion need add the inputTable node
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IPigMapService.class)) {
            final IPigMapService service = (IPigMapService) GlobalServiceRegister.getDefault().getService(IPigMapService.class);
            ContentProposalAdapterExtended proposalAdaptor = ProposalUtils.getCommonProposal(textControl, service.createExpressionProposalProvider(dataBean));
            new ContentProposalAdapter(textControl, controlContentAdapter, service.createExpressionProposalProvider(dataBean), keyStroke, new char[] { ' ', '.' });
        }
    } catch (Exception e) {
    //
    }
}
Also used : ContentProposalAdapterExtended(org.talend.commons.ui.swt.proposal.ContentProposalAdapterExtended) IControlContentAdapter(org.eclipse.jface.fieldassist.IControlContentAdapter) KeyStroke(org.eclipse.jface.bindings.keys.KeyStroke) StyledTextContentAdapter(org.talend.commons.ui.swt.proposal.StyledTextContentAdapter) IPigMapService(org.talend.core.service.IPigMapService) ContentProposalAdapter(org.eclipse.jface.fieldassist.ContentProposalAdapter)

Aggregations

KeyStroke (org.eclipse.jface.bindings.keys.KeyStroke)4 IControlContentAdapter (org.eclipse.jface.fieldassist.IControlContentAdapter)4 StyledTextContentAdapter (org.talend.commons.ui.swt.proposal.StyledTextContentAdapter)4 ContentProposalAdapter (org.eclipse.jface.fieldassist.ContentProposalAdapter)2 IContentProposalProvider (org.eclipse.jface.fieldassist.IContentProposalProvider)2 Point (org.eclipse.swt.graphics.Point)2 ContentProposalAdapterExtended (org.talend.commons.ui.swt.proposal.ContentProposalAdapterExtended)2 IPigMapService (org.talend.core.service.IPigMapService)2 SQLEditorLabelProvider (org.talend.sqlbuilder.ui.proposal.SQLEditorLabelProvider)2 SQLEditorProposalAdapter (org.talend.sqlbuilder.ui.proposal.SQLEditorProposalAdapter)2 SQLEditorProposalProvider (org.talend.sqlbuilder.ui.proposal.SQLEditorProposalProvider)2