Search in sources :

Example 1 with WrapArchiveWizardPath

use of com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath in project android by JetBrains.

the class TemplateWizardModuleBuilder method setupWizardPaths.

@Override
protected Iterable<WizardPath> setupWizardPaths(Project project, Icon sidePanelIcon, Disposable disposable) {
    List<WizardPath> paths = Lists.newArrayList(super.setupWizardPaths(project, sidePanelIcon, disposable));
    paths.add(new WrapArchiveWizardPath(myWizardState, project, this, sidePanelIcon));
    return paths;
}
Also used : WrapArchiveWizardPath(com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath) WrapArchiveWizardPath(com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath)

Example 2 with WrapArchiveWizardPath

use of com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath in project android by JetBrains.

the class NewModuleWizardTest method testBuildChooseModuleStep.

public void testBuildChooseModuleStep() throws Exception {
    File otherTemplateDir = new File(TemplateManager.getTemplateRootFolder(), Template.CATEGORY_PROJECTS);
    List<String> templateDirFiles = Arrays.asList(otherTemplateDir.list((file, name) -> !name.startsWith(".")));
    int expectedCount = templateDirFiles.size() - 3 + 3;
    WrapArchiveWizardPath wrapArchiveWizardPath = new WrapArchiveWizardPath(new NewModuleWizardState(), getProject(), () -> {
    }, null);
    expectedCount += wrapArchiveWizardPath.getBuiltInTemplates().size();
    ArrayList<ModuleWizardStep> steps = Lists.newArrayList();
    TemplateWizardModuleBuilder myModuleBuilder = new TemplateWizardModuleBuilder(null, myModule.getProject(), AndroidIcons.Wizards.NewModuleSidePanel, steps, getTestRootDisposable(), false) {

        @Override
        public void update() {
        // Do nothing
        }
    };
    assertInstanceOf(steps.get(0), ChooseTemplateStep.class);
    ChooseTemplateStep chooseTemplateStep = (ChooseTemplateStep) steps.get(0);
    // Make sure we've got an actual object
    assertNotNull(chooseTemplateStep);
    DefaultListModel templateMetadatas = (DefaultListModel) chooseTemplateStep.myTemplateList.getModel();
    Set<String> templateNames = new HashSet<>(templateMetadatas.getSize());
    for (Object o : templateMetadatas.toArray()) {
        templateNames.add(o.toString());
    }
    // Make sure we have the right number of choices
    assertEquals(expectedCount, templateMetadatas.getSize());
    // Ensure we're not offering duplicate elements in the list
    assertEquals(templateNames.size(), templateMetadatas.getSize());
}
Also used : Arrays(java.util.Arrays) HashSet(com.intellij.util.containers.HashSet) Set(java.util.Set) IOException(java.io.IOException) JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) File(java.io.File) ArrayList(java.util.ArrayList) List(java.util.List) Lists(com.google.common.collect.Lists) SystemProperties(com.intellij.util.SystemProperties) AndroidIcons(icons.AndroidIcons) Template(com.android.tools.idea.templates.Template) TemplateManager(com.android.tools.idea.templates.TemplateManager) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) WrapArchiveWizardPath(com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath) FileUtil(com.intellij.openapi.util.io.FileUtil) AndroidTestCase(org.jetbrains.android.AndroidTestCase) javax.swing(javax.swing) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) File(java.io.File) WrapArchiveWizardPath(com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath) HashSet(com.intellij.util.containers.HashSet)

Aggregations

WrapArchiveWizardPath (com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath)2 Template (com.android.tools.idea.templates.Template)1 TemplateManager (com.android.tools.idea.templates.TemplateManager)1 Lists (com.google.common.collect.Lists)1 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)1 JavaSdk (com.intellij.openapi.projectRoots.JavaSdk)1 FileUtil (com.intellij.openapi.util.io.FileUtil)1 SystemProperties (com.intellij.util.SystemProperties)1 HashSet (com.intellij.util.containers.HashSet)1 AndroidIcons (icons.AndroidIcons)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Set (java.util.Set)1 javax.swing (javax.swing)1 AndroidTestCase (org.jetbrains.android.AndroidTestCase)1