Search in sources :

Example 6 with Parameter

use of com.android.tools.idea.templates.Parameter in project android by JetBrains.

the class NewFormFactorModulePath method renderActivity.

private boolean renderActivity(boolean dryRun, Map<String, Object> templateState, File projectRoot, File moduleRoot) {
    TemplateEntry templateEntry = myState.get(KEY_SELECTED_TEMPLATE);
    if (templateEntry == null) {
        return true;
    }
    Template activityTemplate = templateEntry.getTemplate();
    for (Parameter parameter : templateEntry.getMetadata().getParameters()) {
        templateState.put(parameter.id, myState.get(myParameterStep.getParameterKey(parameter)));
    }
    RenderingContext activityContext = RenderingContext.Builder.newContext(activityTemplate, myWizard.getProject()).withCommandName("New Module").withDryRun(dryRun).withShowErrors(true).withOutputRoot(projectRoot).withModuleRoot(moduleRoot).withParams(templateState).withGradleSync(myGradleSyncIfNecessary).intoTargetFiles(myState.get(TARGET_FILES_KEY)).intoOpenFiles(myState.get(FILES_TO_OPEN_KEY)).intoDependencies(myState.get(DEPENDENCIES_KEY)).build();
    return activityTemplate.render(activityContext);
}
Also used : RenderingContext(com.android.tools.idea.templates.recipe.RenderingContext) Parameter(com.android.tools.idea.templates.Parameter) Template(com.android.tools.idea.templates.Template)

Aggregations

Parameter (com.android.tools.idea.templates.Parameter)6 ApiComboBoxItem (com.android.tools.idea.ui.ApiComboBoxItem)2 Template (com.android.tools.idea.templates.Template)1 TemplateMetadata (com.android.tools.idea.templates.TemplateMetadata)1 RenderingContext (com.android.tools.idea.templates.recipe.RenderingContext)1 Pair (com.android.utils.Pair)1 BiMap (com.google.common.collect.BiMap)1 HashBiMap (com.google.common.collect.HashBiMap)1 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)1 ColorPanel (com.intellij.ui.ColorPanel)1 Map (java.util.Map)1