use of org.eclipse.jdt.ls.core.internal.preferences.CodeGenerationTemplate in project eclipse.jdt.ls by eclipse.
the class SnippetCompletionProposal method getClassSnippet.
private static CompletionItem getClassSnippet(SnippetCompletionContext scc, IProgressMonitor monitor) {
ICompilationUnit cu = scc.getCompilationUnit();
if (!accept(cu, scc.getCompletionContext(), true)) {
return null;
}
if (monitor.isCanceled()) {
return null;
}
final CompletionItem classSnippetItem = new CompletionItem();
classSnippetItem.setLabel(CLASS_SNIPPET_LABEL);
classSnippetItem.setFilterText(CLASS_SNIPPET_LABEL);
classSnippetItem.setSortText(SortTextHelper.convertRelevance(1));
try {
CodeGenerationTemplate template = (scc.needsPublic(monitor)) ? CodeGenerationTemplate.CLASSSNIPPET_PUBLIC : CodeGenerationTemplate.CLASSSNIPPET_DEFAULT;
classSnippetItem.setInsertText(getSnippetContent(scc, template, true));
} catch (CoreException e) {
JavaLanguageServerPlugin.log(e.getStatus());
return null;
}
return classSnippetItem;
}
Aggregations