Search in sources :

Example 1 with IContentAssistant

use of org.eclipse.jface.text.contentassist.IContentAssistant in project KaiZen-OpenAPI-Editor by RepreZen.

the class JsonSourceViewerConfiguration method getContentAssistant.

@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant ca = new ContentAssistant();
    JsonContentAssistProcessor processor = createContentAssistProcessor(ca);
    ca.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    ca.setInformationControlCreator(getInformationControlCreator(sourceViewer));
    ca.enableAutoInsert(false);
    ca.enablePrefixCompletion(false);
    ca.enableAutoActivation(true);
    ca.setAutoActivationDelay(100);
    ca.enableColoredLabels(true);
    ca.setShowEmptyList(true);
    ca.setRepeatedInvocationMode(true);
    ca.addCompletionListener(processor);
    ca.setStatusLineVisible(true);
    return ca;
}
Also used : JsonContentAssistProcessor(com.reprezen.swagedit.core.assist.JsonContentAssistProcessor) IContentAssistant(org.eclipse.jface.text.contentassist.IContentAssistant) ContentAssistant(org.eclipse.jface.text.contentassist.ContentAssistant)

Example 2 with IContentAssistant

use of org.eclipse.jface.text.contentassist.IContentAssistant in project tdi-studio-se by Talend.

the class TalendJavaViewerConfiguration method getContentAssistant.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer
     * )
     */
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();
    assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    //$NON-NLS-1$
    assistant.setRestoreCompletionProposalSize(getSettings("completion_proposal_size"));
    IContentAssistProcessor javaProcessor = new TalendJavaCompletionProcessor(assistant, IDocument.DEFAULT_CONTENT_TYPE);
    assistant.setContentAssistProcessor(javaProcessor, IDocument.DEFAULT_CONTENT_TYPE);
    ContentAssistProcessor singleLineProcessor = new TalendJavaCompletionProcessor(assistant, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
    assistant.setContentAssistProcessor(singleLineProcessor, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
    ContentAssistProcessor stringProcessor = new TalendJavaCompletionProcessor(assistant, IJavaPartitions.JAVA_STRING);
    assistant.setContentAssistProcessor(stringProcessor, IJavaPartitions.JAVA_STRING);
    ContentAssistProcessor multiLineProcessor = new TalendJavaCompletionProcessor(assistant, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
    assistant.setContentAssistProcessor(multiLineProcessor, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
    // ContentAssistProcessor javadocProcessor = new TalendJavaCompletionProcessor(assistant,
    // IJavaPartitions.JAVA_DOC);
    // assistant.setContentAssistProcessor(javadocProcessor, IJavaPartitions.JAVA_DOC);
    // ContentAssistProcessor javadocProcessor = new JavadocCompletionProcessor(getInternalEditor(), assistant);
    // assistant.setContentAssistProcessor(javadocProcessor, IJavaPartitions.JAVA_DOC);
    //
    ContentAssistPreference.configure(assistant, fPreferenceStore);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
    return assistant;
}
Also used : IContentAssistProcessor(org.eclipse.jface.text.contentassist.IContentAssistProcessor) ContentAssistProcessor(org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor) IContentAssistProcessor(org.eclipse.jface.text.contentassist.IContentAssistProcessor) IContentAssistant(org.eclipse.jface.text.contentassist.IContentAssistant) ContentAssistant(org.eclipse.jface.text.contentassist.ContentAssistant)

Example 3 with IContentAssistant

use of org.eclipse.jface.text.contentassist.IContentAssistant in project tdi-studio-se by Talend.

the class SQLSourceViewerConfiguration method getContentAssistant.

public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant() {

        public void uninstall() {
            SQLCompletionProcessor p1 = (SQLCompletionProcessor) getContentAssistProcessor(IConstants.SQL_STRING);
            SQLCompletionProcessor p2 = (SQLCompletionProcessor) getContentAssistProcessor(IConstants.SQL_SINGLE_LINE_COMMENT);
            p1.dispose();
            p2.dispose();
            super.uninstall();
        }
    };
    SQLCompletionProcessor processor = new SQLCompletionProcessor(fSQLTextTools.getDictionary());
    assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    // Register the same processor for strings and single line comments to
    // get code completion at the start of those partitions.
    assistant.setContentAssistProcessor(processor, IConstants.SQL_STRING);
    assistant.setContentAssistProcessor(processor, IConstants.SQL_SINGLE_LINE_COMMENT);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.enableAutoInsert(true);
    assistant.enableAutoActivation(true);
    processor.setCompletionProposalAutoActivationCharacters(//$NON-NLS-1$
    ".".toCharArray());
    /*
		 * assistant.setProposalSelectorForeground(c); c= getColor(store,
		 * PROPOSALS_BACKGROUND, manager);
		 * assistant.setProposalSelectorBackground(c);
		 * 
		 * c= getColor(store, PARAMETERS_FOREGROUND, manager);
		 * assistant.setContextInformationPopupForeground(c);
		 * assistant.setContextSelectorForeground(c);
		 * 
		 * c= getColor(store, PARAMETERS_BACKGROUND, manager);
		 * assistant.setContextInformationPopupBackground(c);
		 * assistant.setContextSelectorBackground(c);
		 */
    // ContentAssistPreference.configure(assistant, getPreferenceStore());
    assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
    return assistant;
}
Also used : IContentAssistant(org.eclipse.jface.text.contentassist.IContentAssistant) ContentAssistant(org.eclipse.jface.text.contentassist.ContentAssistant)

Aggregations

ContentAssistant (org.eclipse.jface.text.contentassist.ContentAssistant)3 IContentAssistant (org.eclipse.jface.text.contentassist.IContentAssistant)3 JsonContentAssistProcessor (com.reprezen.swagedit.core.assist.JsonContentAssistProcessor)1 ContentAssistProcessor (org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor)1 IContentAssistProcessor (org.eclipse.jface.text.contentassist.IContentAssistProcessor)1