Exemplo n.º 1
0
 @NotNull
 private ICompletionProposal[] makeTemplateProposals(
     ITextViewer viewer, int documentOffset, String wordPart) {
   wordPart = wordPart.toLowerCase();
   final List<SQLTemplateCompletionProposal> templateProposals = new ArrayList<>();
   // Templates
   for (Template template : editor.getTemplatesPage().getTemplateStore().getTemplates()) {
     if (template.getName().toLowerCase().startsWith(wordPart)) {
       templateProposals.add(
           new SQLTemplateCompletionProposal(
               template,
               new SQLContext(
                   SQLTemplatesRegistry.getInstance()
                       .getTemplateContextRegistry()
                       .getContextType(template.getContextTypeId()),
                   viewer.getDocument(),
                   new Position(wordDetector.getStartOffset(), wordDetector.getLength()),
                   editor),
               new Region(documentOffset, 0),
               null));
     }
   }
   return templateProposals.toArray(new ICompletionProposal[templateProposals.size()]);
 }