本文整理汇总了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;
}
示例2: computeContextInformation
import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
return null;
}
示例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;
}
示例4: computeContextInformation
import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
@Override
public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context,
IProgressMonitor monitor) {
return Collections.emptyList();
}
示例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);
}
示例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);
}
示例7: computeContextInformation
import org.eclipse.wst.jsdt.ui.text.java.ContentAssistInvocationContext; //导入依赖的package包/类
public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
return Collections.EMPTY_LIST;
}
示例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>();
}