本文整理匯總了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>();
}