private static List<TemplateImpl> listApplicableTemplates(PsiFile file, int offset) { Set<TemplateContextType> contextTypes = TemplateManagerImpl.getApplicableContextTypes(file, offset); final ArrayList<TemplateImpl> result = ContainerUtil.newArrayList(); for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) { if (!template.isDeactivated() && TemplateManagerImpl.isApplicable(template, contextTypes)) { result.add(template); } } return result; }
public static List<TemplateImpl> listApplicableTemplates( PsiFile file, int offset, boolean selectionOnly) { Set<TemplateContextType> contextTypes = getApplicableContextTypes(file, offset); final ArrayList<TemplateImpl> result = ContainerUtil.newArrayList(); for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) { if (!template.isDeactivated() && (!selectionOnly || template.isSelectionTemplate()) && isApplicable(template, contextTypes)) { result.add(template); } } return result; }