Java Code Examples for org.eclipse.jface.text.contentassist.ContentAssistant#setStatusLineVisible()

The following examples show how to use org.eclipse.jface.text.contentassist.ContentAssistant#setStatusLineVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonSourceViewerConfiguration.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 6 votes vote down vote up
@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;
}
 
Example 2
Source File: BonitaGroovyConfiguration.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
    // returns only Groovy-approved completion proposal categories
    ContentAssistant assistant = (ContentAssistant) super.getContentAssistant(sourceViewer);
    assistant.setStatusLineVisible(false);

    // retain only relevant categories
    IContentAssistProcessor processor = assistant.getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE);

    List<CompletionProposalCategory> categories = (List<CompletionProposalCategory>) ReflectionUtils
            .getPrivateField(ContentAssistProcessor.class, "fCategories", processor);

    ReflectionUtils.setPrivateField(ContentAssistProcessor.class, "fCategories", processor, categories.stream()
            .filter(category -> ALLOWED_CATEGORIES.contains(category.getId()))
            .collect(Collectors.toList()));

    ContentAssistPreference.configure(assistant, fPreferenceStore);

    return assistant;
}
 
Example 3
Source File: ConstraintExpressionSourceViewerConfiguration.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
    // returns only Groovy-approved completion proposal categories
    ContentAssistant assistant = (ContentAssistant) super.getContentAssistant(sourceViewer);
    assistant.enableAutoActivation(true);
    assistant.setStatusLineVisible(false);

    // retain only contract input categories
    final ExtendedJavaCompletionProcessor processor = new ExtendedJavaCompletionProcessor(getEditor(), assistant,
            IDocument.DEFAULT_CONTENT_TYPE);
    assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    List<CompletionProposalCategory> categories = (List<CompletionProposalCategory>) ReflectionUtils
            .getPrivateField(ContentAssistProcessor.class, "fCategories", processor);

    ReflectionUtils.setPrivateField(ContentAssistProcessor.class, "fCategories", processor, categories.stream()
            .filter(category -> Objects.equals(category.getId(), CONSTRAINT_CONTENT_ASSIST_CATEGORY_ID))
            .collect(Collectors.toList()));

    ContentAssistPreference.configure(assistant, fPreferenceStore);

    return assistant;
}
 
Example 4
Source File: DefaultContentAssistantFactory.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void setContentAssistProcessor(ContentAssistant assistant, SourceViewerConfiguration configuration, ISourceViewer sourceViewer) {
	if (contentAssistProcessor != null) {
		for(String contentType: configuration.getConfiguredContentTypes(sourceViewer)) {
			assistant.setContentAssistProcessor(contentAssistProcessor, contentType);
		}
		if (contentAssistProcessor instanceof ICompletionListener) {
			assistant.setRepeatedInvocationMode(true);
			assistant.setStatusLineVisible(true);
			assistant.addCompletionListener((ICompletionListener) contentAssistProcessor);
		}
	}
}