当前位置: 首页>>代码示例>>Java>>正文


Java ContentAssistInvocationContext类代码示例

本文整理汇总了Java中org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext的典型用法代码示例。如果您正苦于以下问题:Java ContentAssistInvocationContext类的具体用法?Java ContentAssistInvocationContext怎么用?Java ContentAssistInvocationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContentAssistInvocationContext类属于org.eclipse.wst.jsdt.ui.text.java包,在下文中一共展示了ContentAssistInvocationContext类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeCompletionProposals

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@Override
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
	List<ICompletionProposal> list	= new ArrayList<ICompletionProposal>();
	ITextViewer viewer				= context.getViewer();
	int offset						= context.getInvocationOffset();
       IDocument document				= viewer.getDocument();
       String input					= getInputString(document, offset);
   	int length						= input.length();
   	boolean is_new					= getInputString(document, offset - 1).equalsIgnoreCase("new");
   	
       // Calculate actual class
       if(input.equals("") || input.startsWith("this.")) {
       	System.err.println("Can't find actual functions context!");
       } else {
       	if(this.autocomplete != null) {
       		List<APIEntry> result = this.autocomplete.find(input);
       		
       		for(APIEntry entry : result) {
       			String trigger	= entry.getName();
       			String desc		= entry.getDescription();
       			Image image		= null;
       			
       			if(entry instanceof APIClass) {
       				image		= Activator.getImageDescriptor("icons/class.gif").createImage();
       			} else if(entry instanceof APIMethod) {
       				image		= Activator.getImageDescriptor("icons/method.gif").createImage();        				
       			}
       			
       			list.add(new CompletionProposal(trigger, offset - length, length, trigger.length(), image, trigger, null, desc));
       		}
       	}
       }
       
       System.err.println("Compute: " + input);
       
	return list;
}
 
开发者ID:MyChannel-Apps,项目名称:Extensions,代码行数:38,代码来源:Completion.java

示例2: computeContextInformation

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
	return null;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:6,代码来源:MyJScriptCompletionProcessor.java

示例3: computeCompletionProposals

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@Override
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context,
		IProgressMonitor monitor) {
	if (!(context instanceof TypeScriptContentAssistInvocationContext)) {
		return Collections.emptyList();
	}
	TypeScriptContentAssistInvocationContext javaContext = (TypeScriptContentAssistInvocationContext) context;

	fEngine = computeCompletionEngine(javaContext);
	if (fEngine == null)
		return Collections.emptyList();

	fEngine.reset();
	fEngine.complete(context.getViewer(), context.getInvocationOffset());

	TemplateProposal[] templateProposals = fEngine.getResults();
	List<ICompletionProposal> result = new ArrayList<ICompletionProposal>(Arrays.asList(templateProposals));

	/*
	 * IJavaCompletionProposal[] keyWordResults =
	 * javaContext.getKeywordProposals(); if (keyWordResults.length > 0) {
	 * List<TemplateProposal> removals = new ArrayList<TemplateProposal>();
	 * 
	 * // update relevance of template proposals that match with a keyword
	 * // give those templates slightly more relevance than the keyword to
	 * // sort them first // remove keyword templates that don't have an
	 * equivalent // keyword proposal if (keyWordResults.length > 0) {
	 * outer: for (int k = 0; k < templateProposals.length; k++) {
	 * TemplateProposal curr = templateProposals[k]; String name =
	 * curr.getTemplate().getName();
	 * 
	 * for (int i = 0; i < keyWordResults.length; i++) { String keyword =
	 * keyWordResults[i].getDisplayString(); if (name.startsWith(keyword)) {
	 * curr.setRelevance(keyWordResults[i].getRelevance() + 1); continue
	 * outer; } }
	 * 
	 * if (isKeyword(name)) { removals.add(curr); } } }
	 * 
	 * result.removeAll(removals); }
	 */
	return result;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:43,代码来源:AbstractTemplateCompletionProposalComputer.java

示例4: computeContextInformation

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@Override
public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context,
		IProgressMonitor monitor) {
	return Collections.emptyList();
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:6,代码来源:AbstractTemplateCompletionProposalComputer.java

示例5: createContext

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@Override
protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) {
	return new TypeScriptJavadocContentAssistInvocationContext(viewer, offset, fEditor, fSubProcessorFlags);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:5,代码来源:TypeScriptJavadocCompletionProcessor.java

示例6: createContext

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@Override
protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) {
	return new TypeScriptContentAssistInvocationContext(viewer, offset, fEditor);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:5,代码来源:TypeScriptCompletionProcessor.java

示例7: computeContextInformation

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
	return Collections.EMPTY_LIST;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:4,代码来源:TypeScriptCompletionProposalComputer.java

示例8: computeContextInformation

import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@Override
public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
	return new ArrayList<IContextInformation>();
}
 
开发者ID:MyChannel-Apps,项目名称:Extensions,代码行数:5,代码来源:Completion.java


注:本文中的org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。