use of com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl in project intellij-community by JetBrains.
the class JavaFileTemplatesTest method testManyTemplates.
public void testManyTemplates() {
FileTemplateManagerImpl templateManager = (FileTemplateManagerImpl) FileTemplateManager.getInstance(getProject());
templateManager.getState().RECENT_TEMPLATES.clear();
FileTemplate[] before = templateManager.getAllTemplates();
try {
for (int i = 0; i < 30; i++) {
templateManager.addTemplate("foo" + i, "java");
}
AnAction[] children = new CreateFromTemplateGroup().getChildren(new TestActionEvent(new TestDataProvider(getProject())));
assertEquals(3, children.length);
assertTrue(IdeBundle.message("action.from.file.template").equals(children[0].getTemplatePresentation().getText()));
} finally {
templateManager.setTemplates(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, Arrays.asList(before));
templateManager.getState().RECENT_TEMPLATES.clear();
}
}
Aggregations