當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。