use of com.intellij.projectImport.ProjectImportBuilder in project intellij-community by JetBrains.
the class AddModuleWizard method initModuleWizard.
private void initModuleWizard(@Nullable final Project project, @Nullable final String defaultPath) {
myWizardContext.addContextListener(new WizardContext.Listener() {
public void buttonsUpdateRequested() {
updateButtons();
}
public void nextStepRequested() {
doNextAction();
}
});
myWizardMode = new ImportMode(myImportProviders);
StepSequence sequence = myWizardMode.getSteps(myWizardContext, DefaultModulesProvider.createForProject(project));
appendSteps(sequence);
for (ProjectImportProvider provider : myImportProviders) {
provider.getBuilder().setFileToImport(defaultPath);
}
if (myImportProviders.length == 1) {
final ProjectImportBuilder builder = myImportProviders[0].getBuilder();
myWizardContext.setProjectBuilder(builder);
builder.setUpdate(getWizardContext().getProject() != null);
}
init();
}
use of com.intellij.projectImport.ProjectImportBuilder in project intellij-community by JetBrains.
the class ModulesConfigurator method addModule.
@Nullable
public List<Module> addModule(Component parent, boolean anImport) {
if (myProject.isDefault())
return null;
final ProjectBuilder builder = runModuleWizard(parent, anImport);
if (builder != null) {
final List<Module> modules = new ArrayList<>();
final List<Module> committedModules;
if (builder instanceof ProjectImportBuilder<?>) {
final ModifiableArtifactModel artifactModel = ProjectStructureConfigurable.getInstance(myProject).getArtifactsStructureConfigurable().getModifiableArtifactModel();
committedModules = ((ProjectImportBuilder<?>) builder).commit(myProject, myModuleModel, this, artifactModel);
} else {
committedModules = builder.commit(myProject, myModuleModel, this);
}
if (committedModules != null) {
modules.addAll(committedModules);
}
ApplicationManager.getApplication().runWriteAction(() -> {
for (Module module : modules) {
getOrCreateModuleEditor(module);
}
});
return modules;
}
return null;
}
Aggregations