Java 类org.eclipse.jface.text.contentassist.IContentAssistant 实例源码

项目:egradle    文件:GradleTextHover.java   
/**
 * Get language at given offset
 * 
 * @param offset
 * @param textViewer
 * @return language element or <code>null</code>
 */
protected HoverDataRegion getLanguageElementAt(int offset, ITextViewer textViewer) {
    IContentAssistant assist = gradleSourceViewerConfiguration.getContentAssistant(sourceViewer);
    if (assist == null) {
        return null;
    }
    IContentAssistProcessor processor = assist.getContentAssistProcessor(contentType);
    if (!(processor instanceof GradleContentAssistProcessor)) {
        return null;
    }
    GradleContentAssistProcessor gprocessor = (GradleContentAssistProcessor) processor;
    String allText = textViewer.getDocument().get();
    RelevantCodeCutter codeCutter = this.codeCutter;
    Model model = gprocessor.getModel();
    GradleFileType fileType = gradleSourceViewerConfiguration.getFileType();
    GradleLanguageElementEstimater estimator = gprocessor.getEstimator();

    HoverData data = hoverSupport.caclulateHoverData(allText, offset, codeCutter, model, fileType, estimator);
    if (data == null) {
        return null;
    }
    return new HoverDataRegion(data);
}
项目:egradle    文件:GradleSourceViewerConfiguration.java   
/**
 * Creates configuration by given adaptable
 * 
 * @param adaptable
 *            must provide {@link ColorManager} and {@link IFile}
 */
public GradleSourceViewerConfiguration(IAdaptable adaptable) {
    super(adaptable, COLOR_NORMAL_TEXT);
    Assert.isNotNull(adaptable, "adaptable may not be null!");


    /* code completion */
    this.contentAssistant = new ContentAssistant();
    this.gradleContentAssistProcessor = new GradleContentAssistProcessor(adaptable, new RelevantCodeCutter());
    contentAssistant.setContentAssistProcessor(gradleContentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
    contentAssistant.setContentAssistProcessor(gradleContentAssistProcessor, GRADLE_APPLY_KEYWORD.getId());
    contentAssistant.setContentAssistProcessor(gradleContentAssistProcessor, GRADLE_KEYWORD.getId());
    contentAssistant.setContentAssistProcessor(gradleContentAssistProcessor, GRADLE_TASK_KEYWORD.getId());
    contentAssistant.setContentAssistProcessor(gradleContentAssistProcessor, GRADLE_VARIABLE.getId());
    contentAssistant.addCompletionListener(gradleContentAssistProcessor.getCompletionListener());

    // contentAssistant.enableColoredLabels(true); - when...
    // ICompletionProposalExtension6 implemented

    /* enable auto activation */
    contentAssistant.enableAutoActivation(true);

    /* set a propert orientation for proposal */
    contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
}
项目:LibertyEiffel-Eclipse-Plugin    文件:EiffelSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();
    IContentAssistProcessor processor = new EiffelContentAssistantProcessor();
    assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

    assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    assistant.setContentAssistProcessor(new EiffelContentAssistantProcessor(),
            IDocument.DEFAULT_CONTENT_TYPE);

    assistant.setAutoActivationDelay(100);
    assistant.enableAutoActivation(true);
    assistant.enableAutoInsert(true);

    assistant.setProposalSelectorBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    return assistant;
}
项目:http4e    文件:ParameterizeTextView.java   
private StyledText buildEditorText( Composite parent){
   final SourceViewer sourceViewer = new SourceViewer(parent, null, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
   final HConfiguration sourceConf = new HConfiguration(HContentAssistProcessor.PARAM_PROCESSOR);
   sourceViewer.configure(sourceConf);
   sourceViewer.setDocument(DocumentUtils.createDocument1());

   sourceViewer.getControl().addKeyListener(new KeyAdapter() {

      public void keyPressed( KeyEvent e){
         // if ((e.character == ' ') && ((e.stateMask & SWT.CTRL) != 0)) {
         if (Utils.isAutoAssistInvoked(e)) {
            IContentAssistant ca = sourceConf.getContentAssistant(sourceViewer);
            ca.showPossibleCompletions();
         }
      }
   });

   return sourceViewer.getTextWidget();
}
项目:ftc    文件:FtcSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    assistant.setContentAssistProcessor(new FtcCompletionProcessor(sourceViewer), IDocument.DEFAULT_CONTENT_TYPE);


    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(300);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setContextInformationPopupBackground(colorManager.getColor(new RGB(150, 150, 0)));

    return assistant;
}
项目:texlipse    文件:BibSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    assistant = new ContentAssistant();
    assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

    assistant.setContentAssistProcessor(new BibCompletionProcessor(this.editor.getDocumentModel()),
            BibPartitionScanner.BIB_ENTRY);
    assistant.setContentAssistProcessor(new BibCompletionProcessor(this.editor.getDocumentModel()),
            IDocument.DEFAULT_CONTENT_TYPE);

    assistant.enableAutoActivation(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.BIB_COMPLETION));
    assistant.enableAutoInsert(true);
    assistant.setAutoActivationDelay(TexlipsePlugin.getDefault().getPreferenceStore().getInt(TexlipseProperties.BIB_COMPLETION_DELAY));
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
    return assistant;
}
项目:dsl-devkit    文件:AcfContentAssistProcessorTestBuilder.java   
/**
 * Internally compute completion proposals.
 *
 * @param cursorPosition
 *          the position of the cursor in the {@link IXtextDocument}
 * @param xtextDocument
 *          the {@link IXtextDocument}
 * @return a pair of {@link ICompletionProposal}[] and {@link BadLocationException}. If the tail argument is not {@code null}, an exception occurred in the UI
 *         thread.
 */
private Pair<ICompletionProposal[], BadLocationException> internalComputeCompletionProposals(final int cursorPosition, final IXtextDocument xtextDocument) {
  XtextSourceViewerConfiguration configuration = get(XtextSourceViewerConfiguration.class);
  Shell shell = new Shell();
  try {
    ISourceViewer sourceViewer = getSourceViewer(shell, xtextDocument, configuration);
    IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
    String contentType = xtextDocument.getContentType(cursorPosition);
    IContentAssistProcessor processor = contentAssistant.getContentAssistProcessor(contentType);
    if (processor != null) {
      return Tuples.create(processor.computeCompletionProposals(sourceViewer, cursorPosition), null);
    }
    return Tuples.create(new ICompletionProposal[0], null);
  } catch (BadLocationException e) {
    return Tuples.create(new ICompletionProposal[0], e);
  } finally {
    shell.dispose();
  }
}
项目:bts    文件:E4TemplatePreferencePage.java   
/**
 * Creates the viewer to be used to display the pattern. Subclasses may override.
 *
 * @param parent the parent composite of the viewer
 * @return a configured <code>SourceViewer</code>
 */
protected SourceViewer createViewer(Composite parent) {
    SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
        @Override
        public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

            ContentAssistant assistant= new ContentAssistant();
            assistant.enableAutoActivation(true);
            assistant.enableAutoInsert(true);
            assistant.setContentAssistProcessor(fTemplateProcessor, IDocument.DEFAULT_CONTENT_TYPE);
            return assistant;
        }
    };
    viewer.configure(configuration);
    return viewer;
}
项目:velocity-edit    文件:VelocityConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer aSourceViewer)
{
    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, true), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, false), IEditorConfiguration.PARSED_STRING);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, false), IEditorConfiguration.CDATA_PARTITION);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, false), IEditorConfiguration.DOC_COMMENT);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, false), IEditorConfiguration.MULTI_LINE_COMMENT);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, false), IEditorConfiguration.PROC_PARTITION);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, true), IEditorConfiguration.SCRIPT_PARTITION);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, false), IEditorConfiguration.SINGLE_LINE_COMMENT);
    assistant.setContentAssistProcessor(new VelocityCompletionProcessor(fEditor, true), IEditorConfiguration.TAG_PARTITION);
    assistant.enableAutoInsert(true);
    assistant.enableAutoActivation(true);
    return assistant;
}
项目:velocity-edit    文件:Configuration.java   
public IContentAssistant getContentAssistant(ISourceViewer aSourceViewer)
  {
      ContentAssistant assistant = new ContentAssistant();
      CompletionProcessor completionProcessor = new CompletionProcessor(editor);
      XMLCompletionProcessor xmlProcessor = new XMLCompletionProcessor(editor.getFile());
      assistant.setContentAssistProcessor(completionProcessor, IDocument.DEFAULT_CONTENT_TYPE);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.FOREACH_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.IF_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.MACRO_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.MACRO_INSTANCE_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.INCLUDE_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.PARSE_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.SET_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.STOP_PARTITION);
      assistant.setContentAssistProcessor(completionProcessor, PartitionScanner.VARIABLE_PARTITION);
      assistant.setContentAssistProcessor(xmlProcessor, PartitionScanner.XML_TAG);
      assistant.setContentAssistProcessor(xmlProcessor, PartitionScanner.XML_DEFAULT);
      assistant.enableAutoInsert(true);
      assistant.enableAutoActivation(true);
assistant.setAutoActivationDelay(Plugin.getDefault().getPreferenceStore()
        .getInt(MainPreferences.AUTO_COMPLETE_DEPLAY));

assistant.enableColoredLabels(true);
      return assistant;
  }
项目:KaiZen-OpenAPI-Editor    文件:JsonSourceViewerConfiguration.java   
@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;
}
项目:BYONDclipse    文件:DMConfiguration.java   
@Override public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer)
{
    // Create content assistant
    final ContentAssistant assistant                                                        = new ContentAssistant();

    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setInformationControlCreator(this.getInformationControlCreator(sourceViewer));

    // Create content assistant processor
    final IContentAssistProcessor processor                                                 = new DMContentAssistProcessor();

    // Set this processor for each supported content type
    assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    assistant.setContentAssistProcessor(processor, DMPartitionScanner.DM_STRING);

    // Return the content assistant
    return assistant;
}
项目:brainfuck    文件:BfSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();
    assistant.setDocumentPartitioning(this.getConfiguredDocumentPartitioning(sourceViewer));
    CompletionProposalToggler toggler = new CompletionProposalToggler();
    assistant.setContentAssistProcessor(toggler, IDocument.DEFAULT_CONTENT_TYPE);
    assistant.setContentAssistProcessor(toggler, EditorConstants.PARTITION_TYPE_BRAINFUCK_CODE);
    assistant.addCompletionListener(toggler);       
    assistant.setStatusLineVisible(true);
    assistant.setRepeatedInvocationMode(true);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setAutoActivationDelay(500);
    assistant.enableAutoActivation(false);

    assistant.setInformationControlCreator(new AbstractReusableInformationControlCreator() {

        @Override
        protected IInformationControl doCreateInformationControl(Shell parent) {
            return new DefaultInformationControl(parent);
        }
    });
    assistant.setContentAssistProcessor(null, EditorConstants.PARTITION_TYPE_MULTILINE_COMMENT);
    return assistant;
}
项目:ant-ivyde    文件:XMLConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    // Create content assistant
    ContentAssistant assistant = new ContentAssistant();

    // required to display additional info
    assistant.setInformationControlCreator(new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            return new DefaultInformationControl(parent, true);
        }
    });

    processor.setFile(file);
    // Set this processor for each supported content type
    assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
    assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_DEFAULT);
    assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);

    // Return the content assistant
    return assistant;
}
项目:rustyeclipse    文件:RustEditorConfig.java   
@Override
public IContentAssistant getContentAssistant(@Nullable ISourceViewer sourceViewer) {
    ContentAssistant a = assistant;
    if (a == null) {
        assistant = a = new ContentAssistant();
        a.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
        a.setContentAssistProcessor(new RustContentAssistant(editor), IDocument.DEFAULT_CONTENT_TYPE);

        a.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
        a.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
//      assistant.setContextInformationPopupBackground(...);
        a.setInformationControlCreator(getInformationControlCreator(sourceViewer));
        a.enableAutoInsert(true);
    }
    if (RustPrefs.get().autocompleteEnabled()) {
        a.enableAutoActivation(true);
        a.setAutoActivationDelay((int) (1000*RustPrefs.get().autocompleteDelay()));
    } else {
        a.enableAutoActivation(false);
    }
    return a;
}
项目:codeexamples-eclipse    文件:TaskSourceViewerConfiguration.java   
public TaskSourceViewerConfiguration(IPreferenceStore preferenceStore) {
    super(preferenceStore);

    // Initialize ContentAssistant
    contentAssistant = new ContentAssistant();

    // define a default ContentAssistProcessor
    contentAssistant.setContentAssistProcessor (new TaskCompletionProcessor(), 
            IDocument.DEFAULT_CONTENT_TYPE);

    // enable auto activation
    contentAssistant.enableAutoActivation(true);

    // set a proper orientation for the content assist proposal
    contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
}
项目:birt    文件:SQLSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant( ISourceViewer sourceViewer )
{
    if ( !enableCodeAssist )
    {
        return null;
    }
    ContentAssistant assistant = new ContentAssistant( );
    JdbcSQLContentAssistProcessor contentAssist = new JdbcSQLContentAssistProcessor( timeout );
    contentAssist.setDataSourceHandle( dsd );
    assistant.setContentAssistProcessor( contentAssist,
            IDocument.DEFAULT_CONTENT_TYPE );
    assistant.enableAutoActivation( true );
    assistant.setAutoActivationDelay( 500 );
    assistant.setProposalPopupOrientation( IContentAssistant.PROPOSAL_OVERLAY );
    return assistant;
}
项目:Pydev    文件:SetupContentAssist.java   
public static IContentAssistant configContentAssistant(IPySyntaxHighlightingAndCodeCompletionEditor edit,
        PyContentAssistant pyContentAssistant) {
    // next create a content assistant processor to populate the completions window
    IContentAssistProcessor processor = new SimpleAssistProcessor(edit, new PythonCompletionProcessor(edit,
            pyContentAssistant), pyContentAssistant);

    PythonStringCompletionProcessor stringProcessor = new PythonStringCompletionProcessor(edit, pyContentAssistant);

    // No code completion in comments and strings
    for (String s : STRING_PROCESSOR_PARTITIONS) {
        pyContentAssistant.setContentAssistProcessor(stringProcessor, s);
    }

    pyContentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    pyContentAssistant.enableAutoActivation(true); //always true, but the chars depend on whether it is activated or not in the preferences

    //note: delay and auto activate are set on PyContentAssistant constructor.

    pyContentAssistant.setDocumentPartitioning(IPythonPartitions.PYTHON_PARTITION_TYPE);
    pyContentAssistant.setAutoActivationDelay(PyCodeCompletionPreferencesPage.getAutocompleteDelay());

    return pyContentAssistant;
}
项目:goclipse    文件:LangCompletionProposal.java   
@Override
public void selected(ITextViewer viewer, boolean smartToggle) {
    if(viewer instanceof ISourceViewerExt) {
        ISourceViewerExt sourceViewer = (ISourceViewerExt) viewer;
        IContentAssistant ca = sourceViewer.getContentAssistant();
        if(ca instanceof ContentAssistantExt) {
            caext = (ContentAssistantExt) ca;
            if(!isAutoInsertable()) {
                caext.setAdditionalStatusMessage("Press 'Ctrl+Enter' for name-only insertion;");
            } else {
                caext.setAdditionalStatusMessage(null);
                caext = null;
            }
        }
    }
}
项目:goclipse    文件:AbstractLangSourceViewerConfiguration.java   
@Override
public ContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    if(sourceViewer instanceof LangSourceViewer) {
        LangSourceViewer langSourceViewer = (LangSourceViewer) sourceViewer;

        ContentAssistantExt assistant = createContentAssitant(langSourceViewer);
        assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

        assistant.setRestoreCompletionProposalSize(LangUIPlugin.getDialogSettings("completion_proposal_size"));
        assistant.setInformationControlCreator(
            getInformationControl_ContentAsssist(getAdditionalInfoAffordanceString()));
        assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
        assistant.enableColoredLabels(true);

        configureContentAssistantProcessors(assistant);
        // Note: configuration must come after processors are created
        assistant.configure();

        return assistant;
    }

    return null;
}
项目:pgcodekeeper    文件:SQLEditorSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    if (editor == null) {
        return null;
    }
    ContentAssistant assistant= new ContentAssistant();
    assistant.setContentAssistProcessor(new SQLEditorCompletionProcessor(editor), SQLEditorCommonDocumentProvider.SQL_CODE);
    assistant.enableAutoActivation(true);
    assistant.enableAutoInsert(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    return assistant;
}
项目:vertigo-chroma-kspplugin    文件:KspSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();
    assistant.setDocumentPartitioning(KspRegionType.PARTITIONING);
    assistant.setContentAssistProcessor(new KspDefaultContentAssistProcessor(), KspRegionType.DEFAULT.getContentType());
    assistant.setContentAssistProcessor(new KspStringContentAssistProcessor(), KspRegionType.STRING.getContentType());
    assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
    assistant.enableAutoActivation(true);
    assistant.enableAutoInsert(true);
    return assistant;
}
项目:Tarski    文件:RelationModelEditorSourceViewerConfiguration.java   
/**
 * Create and set some specifications of content assistant. We define our completion processor
 * as @CodeCompletionProcessor.
 */
@Override
public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
  final ContentAssistant assistant = new ContentAssistant();
  assistant.setContentAssistProcessor(new CodeCompletionProcessor(),
      IDocument.DEFAULT_CONTENT_TYPE);
  assistant.setAutoActivationDelay(500);
  assistant.enableAutoActivation(true);
  assistant.enableAutoInsert(true);
  assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
  assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

  return assistant;
}
项目:Tarski    文件:ValidationConfiguration.java   
@Override
public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
  final ContentAssistant assistant = new ContentAssistant();
  assistant.setContentAssistProcessor(new DefaultCompletionProcessor(),
      IDocument.DEFAULT_CONTENT_TYPE);
  assistant.setAutoActivationDelay(500);
  assistant.enableAutoActivation(true);
  assistant.enableAutoInsert(true);
  assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
  assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

  return assistant;
}
项目:Tarski    文件:RelationModelEditorSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
    final ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new CodeCompletionProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.setAutoActivationDelay(1);
    assistant.enableAutoActivation(true);
    assistant.enableAutoInsert(true);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:Tarski    文件:MetaModelEditorViewerConfiguration.java   
/**
 * Create and set some specifications of content assistant. We define our completion processor
 * as @CodeCompletionProcessor.
 */
@Override
public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) {
  final ContentAssistant assistant = new ContentAssistant();
  assistant.setContentAssistProcessor(new DefaultCompletionProcessor(),
      IDocument.DEFAULT_CONTENT_TYPE);
  assistant.setContentAssistProcessor(new ReasonCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_REASON);
  assistant.setContentAssistProcessor(new LocateCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_LOCATE);
  assistant.setContentAssistProcessor(new LoadCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_LOADMODEL);
  assistant.setContentAssistProcessor(new LoadCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_LOADINSTANCE);
  assistant.setContentAssistProcessor(new SigCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_SIG);
  assistant.setContentAssistProcessor(new FactCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_FACT);
  assistant.setContentAssistProcessor(new DiscoverCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_DISCOVER);
  assistant.setContentAssistProcessor(new TraceCompletionProcessor(),
      MetaModelPartitionScanner.META_MODEL_TRACE);
  assistant.setAutoActivationDelay(500);
  assistant.enableAutoActivation(true);
  assistant.enableAutoInsert(true);
  assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
  assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

  return assistant;
}
项目:eclipse-asciidoctools    文件:AsciidocSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant contentAssistant = new ContentAssistant();
    IContentAssistProcessor processor = new AsciidocContentAssistProcessor();
    contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
    return contentAssistant;
}
项目:LibertyEiffel-Eclipse-Plugin    文件:EiffelSourceViewerConfiguration.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    ContentAssistant assistant = new ContentAssistant();

    assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    assistant.setContentAssistProcessor(new EiffelContentAssistantProcessor(),
            IDocument.DEFAULT_CONTENT_TYPE);

    assistant.setAutoActivationDelay(0);
    assistant.enableAutoActivation(true);

    assistant.setProposalSelectorBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    return assistant;
}
项目:DarwinSPL    文件:DwprofileSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileCompletionProcessor(resourceProvider), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:DarwinSPL    文件:HyexpressionSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionCompletionProcessor(resourceProvider), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:DarwinSPL    文件:HyvalidityformulaSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaCompletionProcessor(resourceProvider), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:DarwinSPL    文件:HydatavalueSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueCompletionProcessor(resourceProvider), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:DarwinSPL    文件:HymappingSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingCompletionProcessor(resourceProvider), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:DarwinSPL    文件:HyconstraintsSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsCompletionProcessor(resourceProvider), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:DarwinSPL    文件:HymanifestSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestCompletionProcessor(resourceProvider), IDocument.DEFAULT_CONTENT_TYPE);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);

    return assistant;
}
项目:http4e    文件:XMLConfiguration.java   
public IContentAssistant getContentAssistant( ISourceViewer sourceViewer){

    ContentAssistant assistant = new ContentAssistant();

    assistant.setContentAssistProcessor(new TagContentAssistProcessor(
            getXMLTagScanner()), XMLPartitionScanner.XML_START_TAG);
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(500);
    assistant
            .setProposalPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
    assistant
            .setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
    return assistant;

}
项目:texlipse    文件:TexSourceViewerConfiguration.java   
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

//        ContentAssistant assistant = new ContentAssistant();
        assistant = new ContentAssistant();
        assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

        // note that partitioning affects completions
        //TexCompletionProcessor tcp = new TexCompletionProcessor(this.editor.getDocumentModel());
        TexCompletionProcessor tcp = new TexCompletionProcessor(this.editor.getDocumentModel(), sourceViewer);
        TexMathCompletionProcessor tmcp = new TexMathCompletionProcessor(this.editor.getDocumentModel(), sourceViewer);
//        assistant.setContentAssistProcessor(new TexCompletionProcessor(this.editor.getDocumentModel()),
//                IDocument.DEFAULT_CONTENT_TYPE);

        assistant.setContentAssistProcessor(tcp, IDocument.DEFAULT_CONTENT_TYPE);
        //assistant.setContentAssistProcessor(tcp, TexPartitionScanner.TEX_MATH);
        assistant.setContentAssistProcessor(tmcp, FastLaTeXPartitionScanner.TEX_MATH);
        assistant.setContentAssistProcessor(tcp, FastLaTeXPartitionScanner.TEX_CURLY_BRACKETS);
        assistant.setContentAssistProcessor(tcp, FastLaTeXPartitionScanner.TEX_SQUARE_BRACKETS);
        assistant.setContentAssistProcessor(tcp, FastLaTeXPartitionScanner.TEX_TIKZPIC);

        assistant.enableAutoActivation(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.TEX_COMPLETION));
        assistant.enableAutoInsert(true);
        assistant.setAutoActivationDelay(TexlipsePlugin.getDefault().getPreferenceStore().getInt(TexlipseProperties.TEX_COMPLETION_DELAY));

        assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
        assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
        assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

        return assistant;
    }
项目:hybris-commerce-eclipse-plugin    文件:ImpexSourceViewerConfig.java   
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    ContentAssistant assistant = new ContentAssistant();
    assistant.enableAutoActivation(true);
    assistant.setAutoActivationDelay(300);
    assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.enableAutoInsert(true);
    assistant.enablePrefixCompletion(true);

    IContentAssistProcessor pr = new ImpexInstructionContentAssistProcessor();
    assistant.setContentAssistProcessor(pr, ImpexDocumentPartitioner.IMPEX_INSTRUCTION);

    //pr = new ImpexTypeAttributeContentAssistProcessor();
    pr = new ImpexTypeSystemContentAssistProcessor();
    assistant.setContentAssistProcessor(pr, ImpexDocumentPartitioner.IMPEX_HEADER);

    pr = new ImpexDataContentAssistProcessor();
    assistant.setContentAssistProcessor(pr, ImpexDocumentPartitioner.IMPEX_DATA);

    pr = new ImpexCommentContentAssistProcessor();
    assistant.setContentAssistProcessor(pr, ImpexDocumentPartitioner.IMPEX_COMMENT);

    pr = new ImpexCommandContentAssistProcessor();
    assistant.setContentAssistProcessor(pr, IDocument.DEFAULT_CONTENT_TYPE);

    assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
    return assistant;
}
项目:dsl-devkit    文件:AcfContentAssistProcessorTestBuilder.java   
/**
 * {@inheritDoc} Code copied from parent. Override required to run in UI because of getSourceViewer, which creates a new Shell.
 */
@Override
public ContentAssistProcessorTestBuilder assertMatchString(final String matchString) throws Exception {
  BadLocationException exception = UiThreadDispatcher.dispatchAndWait(new Function<BadLocationException>() {
    @Override
    public BadLocationException run() {
      String currentModelToParse = getModel();
      final XtextResource xtextResource = loadHelper.getResourceFor(new StringInputStream(currentModelToParse));
      final IXtextDocument xtextDocument = getDocument(xtextResource, currentModelToParse);
      XtextSourceViewerConfiguration configuration = get(XtextSourceViewerConfiguration.class);
      Shell shell = new Shell();
      try {
        ISourceViewer sourceViewer = getSourceViewer(shell, xtextDocument, configuration);
        IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
        String contentType = xtextDocument.getContentType(currentModelToParse.length());
        if (contentAssistant.getContentAssistProcessor(contentType) != null) {
          ContentAssistContext.Factory factory = get(ContentAssistContext.Factory.class);
          ContentAssistContext[] contexts = factory.create(sourceViewer, currentModelToParse.length(), xtextResource);
          for (ContentAssistContext context : contexts) {
            Assert.assertTrue("matchString = '" + matchString + "', actual: '" + context.getPrefix() + "'", "".equals(context.getPrefix())
                || matchString.equals(context.getPrefix()));
          }
        } else {
          Assert.fail("No content assistant for content type " + contentType);
        }
      } catch (BadLocationException e) {
        return e;
      } finally {
        shell.dispose();
      }
      return null;
    }
  });
  if (exception != null) {
    throw exception;
  }
  return this;
}
项目:dsl-devkit    文件:AbstractContentAssistUiTest.java   
/**
 * Helper function to find the correct CompletionProposalComputer for the given offset.
 *
 * @param offset
 *          offset in test file
 * @return language and offset specific content assist proposal computer
 */
private CompletionProposalComputer createCompletionProposalComputer(final int offset) {
  XtextSourceViewerConfiguration configuration = getEditor().getXtextSourceViewerConfiguration();
  IContentAssistant contentAssistant = configuration.getContentAssistant(getViewer());
  IContentAssistProcessor contentAssistProcessor;
  try {
    contentAssistProcessor = contentAssistant.getContentAssistProcessor(getDocument().getContentType(offset));
  } catch (BadLocationException e) {
    contentAssistProcessor = getTestUtil().get(IContentAssistProcessor.class);
  }
  if (contentAssistProcessor == null) {
    contentAssistProcessor = getTestUtil().get(IContentAssistProcessor.class);
  }
  return new CompletionProposalComputer((State) contentAssistProcessor, (ITextViewer) getViewer(), offset);
}