當前位置: 首頁>>代碼示例>>Java>>正文


Java ContentAssistant類代碼示例

本文整理匯總了Java中org.eclipse.jface.text.contentassist.ContentAssistant的典型用法代碼示例。如果您正苦於以下問題:Java ContentAssistant類的具體用法?Java ContentAssistant怎麽用?Java ContentAssistant使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ContentAssistant類屬於org.eclipse.jface.text.contentassist包,在下文中一共展示了ContentAssistant類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BatchSourceViewerConfiguration

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
/**
 * Creates configuration by given adaptable
 * 
 * @param adaptable
 *            must provide {@link ColorManager} and {@link IFile}
 */
public BatchSourceViewerConfiguration(IAdaptable adaptable) {
	IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
	this.fPreferenceStore = new ChainedPreferenceStore(
			new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });

	Assert.isNotNull(adaptable, "adaptable may not be null!");
	this.annotationHoover = new BatchEditorAnnotationHoover();
	
	this.contentAssistant = new ContentAssistant();
	contentAssistProcessor = new BatchEditorSimpleWordContentAssistProcessor();
	contentAssistant.enableColoredLabels(true);
	
	contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
	for (BatchDocumentIdentifier identifier: BatchDocumentIdentifiers.values()){
		contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
	}
	
	contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());

	this.colorManager = adaptable.getAdapter(ColorManager.class);
	Assert.isNotNull(colorManager, " adaptable must support color manager");
	this.defaultTextAttribute = new TextAttribute(
			colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
	this.adaptable=adaptable;
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:32,代碼來源:BatchSourceViewerConfiguration.java

示例2: BashSourceViewerConfiguration

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
/**
 * Creates configuration by given adaptable
 * 
 * @param adaptable
 *            must provide {@link ColorManager} and {@link IFile}
 */
public BashSourceViewerConfiguration(IAdaptable adaptable) {
	IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
	this.fPreferenceStore = new ChainedPreferenceStore(
			new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });

	Assert.isNotNull(adaptable, "adaptable may not be null!");
	this.annotationHoover = new BashEditorAnnotationHoover();
	
	this.contentAssistant = new ContentAssistant();
	contentAssistProcessor = new BashEditorSimpleWordContentAssistProcessor();
	contentAssistant.enableColoredLabels(true);
	
	contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
	for (BashDocumentIdentifier identifier: BashDocumentIdentifiers.values()){
		contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
	}
	
	contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());

	this.colorManager = adaptable.getAdapter(ColorManager.class);
	Assert.isNotNull(colorManager, " adaptable must support color manager");
	this.defaultTextAttribute = new TextAttribute(
			colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
	this.adaptable=adaptable;
}
 
開發者ID:de-jcup,項目名稱:eclipse-bash-editor,代碼行數:32,代碼來源:BashSourceViewerConfiguration.java

示例3: GradleSourceViewerConfiguration

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:31,代碼來源:GradleSourceViewerConfiguration.java

示例4: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
@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;
}
 
開發者ID:Imhotup,項目名稱:LibertyEiffel-Eclipse-Plugin,代碼行數:20,代碼來源:EiffelSourceViewerConfiguration.java

示例5: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
@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;
}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:17,代碼來源:FtcSourceViewerConfiguration.java

示例6: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
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;
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:18,代碼來源:BibSourceViewerConfiguration.java

示例7: createViewer

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:23,代碼來源:E4TemplatePreferencePage.java

示例8: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
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;
}
 
開發者ID:ninneko,項目名稱:velocity-edit,代碼行數:17,代碼來源:VelocityConfiguration.java

示例9: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
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;
  }
 
開發者ID:ninneko,項目名稱:velocity-edit,代碼行數:26,代碼來源:Configuration.java

示例10: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
@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;
}
 
開發者ID:RepreZen,項目名稱:KaiZen-OpenAPI-Editor,代碼行數:21,代碼來源:JsonSourceViewerConfiguration.java

示例11: createContentAssistProcessor

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
protected JsonContentAssistProcessor createContentAssistProcessor(ContentAssistant ca) {
 	return new JsonContentAssistProcessor(ca, null){

@Override
protected TemplateStore getTemplateStore() {
	return null;
}

@Override
protected ContextTypeRegistry getContextTypeRegistry() {
	return null;
}

@Override
protected String getContextTypeId(Model model, String path) {
	return null;
}};
 }
 
開發者ID:RepreZen,項目名稱:KaiZen-OpenAPI-Editor,代碼行數:19,代碼來源:JsonSourceViewerConfiguration.java

示例12: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
@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;
}
 
開發者ID:nullquery,項目名稱:BYONDclipse,代碼行數:22,代碼來源:DMConfiguration.java

示例13: getContentAssistant

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
@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;
}
 
開發者ID:RichardBirenheide,項目名稱:brainfuck,代碼行數:26,代碼來源:BfSourceViewerConfiguration.java

示例14: assistSessionEnded

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
public void assistSessionEnded(ContentAssistEvent event) {
	if (event.processor != ContentAssistProcessor.this)
		return;

	for (CompletionProposalCategory cat : getCategoriesToNotify()) {
		cat.sessionEnded();
	}

	fCategoryIteration= null;
	fRepetition= -1;
	fIterationGesture= null;
	if (event.assistant instanceof IContentAssistantExtension2) {
		IContentAssistantExtension2 extension= (IContentAssistantExtension2) event.assistant;
		extension.setShowEmptyList(false);
		extension.setRepeatedInvocationMode(false);
		extension.setStatusLineVisible(false);
		if (extension instanceof IContentAssistantExtension3) {
			IContentAssistantExtension3 ext3= (IContentAssistantExtension3) extension;
			((ContentAssistant) ext3).setRepeatedInvocationTrigger(null);
		}
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:23,代碼來源:ContentAssistProcessor.java

示例15: assistSessionEnded

import org.eclipse.jface.text.contentassist.ContentAssistant; //導入依賴的package包/類
public void assistSessionEnded(ContentAssistEvent event) {
	if (event.processor != ContentAssistProcessor.this)
		return;

	for (Iterator<CompletionProposalCategory> it= getCategoriesToNotify().iterator(); it.hasNext();) {
		CompletionProposalCategory cat= it.next();
		cat.sessionEnded();
	}

	fCategoryIteration= null;
	fRepetition= -1;
	fIterationGesture= null;
	if (event.assistant instanceof IContentAssistantExtension2) {
		IContentAssistantExtension2 extension= (IContentAssistantExtension2) event.assistant;
		extension.setShowEmptyList(false);
		extension.setRepeatedInvocationMode(false);
		extension.setStatusLineVisible(false);
		if (extension instanceof IContentAssistantExtension3) {
			IContentAssistantExtension3 ext3= (IContentAssistantExtension3) extension;
			((ContentAssistant) ext3).setRepeatedInvocationTrigger(null);
		}
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:24,代碼來源:ContentAssistProcessor.java


注:本文中的org.eclipse.jface.text.contentassist.ContentAssistant類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。