use of com.intellij.ide.fileTemplates.actions.CreateFromTemplateGroup 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();
}
}
use of com.intellij.ide.fileTemplates.actions.CreateFromTemplateGroup in project intellij-community by JetBrains.
the class JavaFileTemplatesTest method testCreateFromTemplateGroup.
public void testCreateFromTemplateGroup() {
myFixture.configureByText("foo.java", "");
AnAction[] children = new CreateFromTemplateGroup().getChildren(new TestActionEvent(new TestDataProvider(getProject())));
assertTrue(Stream.of(children).noneMatch(action -> isTemplateAction(action, "Class")));
assertTrue(Stream.of(children).anyMatch(action -> isTemplateAction(action, "Singleton")));
}
Aggregations