Search in sources :

Example 1 with MetadataListItem

use of com.android.tools.idea.npw.ChooseTemplateStep.MetadataListItem in project android by JetBrains.

the class ImportSourceModulePath method createImportTemplateWithCustomName.

@NotNull
protected static MetadataListItem createImportTemplateWithCustomName(@NotNull final String importTemplateName, @Nullable final String description) {
    // Now, we're going to add in two pointers to the same template
    File moduleTemplate = new File(TemplateManager.getTemplateRootFolder(), FileUtil.join(Template.CATEGORY_PROJECTS, "ImportExistingProject"));
    TemplateManager manager = TemplateManager.getInstance();
    TemplateMetadata metadata = manager.getTemplateMetadata(moduleTemplate);
    assert metadata != null;
    return new MetadataListItem(moduleTemplate, metadata) {

        @Override
        public String toString() {
            return importTemplateName;
        }

        @Nullable
        @Override
        public String getDescription() {
            return description == null ? super.getDescription() : description;
        }
    };
}
Also used : MetadataListItem(com.android.tools.idea.npw.ChooseTemplateStep.MetadataListItem) TemplateManager(com.android.tools.idea.templates.TemplateManager) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) TemplateMetadata(com.android.tools.idea.templates.TemplateMetadata) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

MetadataListItem (com.android.tools.idea.npw.ChooseTemplateStep.MetadataListItem)1 TemplateManager (com.android.tools.idea.templates.TemplateManager)1 TemplateMetadata (com.android.tools.idea.templates.TemplateMetadata)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1