use of com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog in project android by JetBrains.
the class AndroidArtifactUtil method chooseAndroidApplicationModule.
@Nullable
public static AndroidFacet chooseAndroidApplicationModule(@NotNull Project project, @NotNull List<AndroidFacet> facets) {
final Map<Module, AndroidFacet> map = new HashMap<Module, AndroidFacet>();
for (AndroidFacet facet : facets) {
map.put(facet.getModule(), facet);
}
String message = "Selected Android application module will be included in the created artifact with all dependencies";
final ChooseModulesDialog dialog = new ChooseModulesDialog(project, new ArrayList<Module>(map.keySet()), "Select Module", message);
dialog.setSingleSelectionMode();
dialog.show();
final List<Module> selected = dialog.getChosenElements();
if (selected.isEmpty()) {
return null;
}
assert selected.size() == 1;
final Module module = selected.get(0);
final String moduleName = module.getName();
final AndroidFacet facet = map.get(module);
if (facet == null) {
message = "Cannot find Android facet for module " + moduleName;
Messages.showErrorDialog(project, message, CommonBundle.getErrorTitle());
return null;
}
return facet;
}
Aggregations