mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-115398 New Project Wizard: libraries downloading doesn't work
This commit is contained in:
@@ -33,8 +33,6 @@ public class NewProjectWizard extends AbstractProjectWizard {
|
||||
|
||||
public NewProjectWizard(@Nullable Project project, @NotNull ModulesProvider modulesProvider, @Nullable String defaultPath) {
|
||||
super("New Project", project, defaultPath);
|
||||
// addStep();
|
||||
// addStep(new ProjectSummaryStep(myWizardContext));
|
||||
myWizardContext.setNewWizard(true);
|
||||
mySequence = new StepSequence();
|
||||
mySequence.addCommonStep(new ProjectTypeStep(myWizardContext, this, modulesProvider));
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide.projectWizard;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider;
|
||||
import com.intellij.ide.util.frameworkSupport.FrameworkRole;
|
||||
import com.intellij.ide.util.frameworkSupport.FrameworkSupportUtil;
|
||||
@@ -25,13 +26,16 @@ import com.intellij.ide.util.newProjectWizard.modes.CreateFromTemplateMode;
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.ide.wizard.CommitStepException;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -81,6 +85,7 @@ public class ProjectTypeStep extends ModuleWizardStep {
|
||||
|
||||
private final AddSupportForFrameworksPanel myFrameworksPanel;
|
||||
private final ModuleBuilder.ModuleConfigurationUpdater myConfigurationUpdater;
|
||||
private boolean myCommitted;
|
||||
|
||||
public ProjectTypeStep(WizardContext context, NewProjectWizard wizard, ModulesProvider modulesProvider) {
|
||||
myContext = context;
|
||||
@@ -231,6 +236,22 @@ public class ProjectTypeStep extends ModuleWizardStep {
|
||||
myList.saveSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWizardFinished() throws CommitStepException {
|
||||
if (!myCommitted) {
|
||||
boolean ok = myFrameworksPanel.downloadLibraries();
|
||||
if (!ok) {
|
||||
int answer = Messages.showYesNoDialog(getComponent(),
|
||||
ProjectBundle.message("warning.message.some.required.libraries.wasn.t.downloaded"),
|
||||
CommonBundle.getWarningTitle(), Messages.getWarningIcon());
|
||||
if (answer != 0) {
|
||||
throw new CommitStepException(null);
|
||||
}
|
||||
}
|
||||
myCommitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myProjectTypeList;
|
||||
|
||||
@@ -156,15 +156,21 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
step._commit(true);
|
||||
}
|
||||
catch (CommitStepException e) {
|
||||
String message = e.getMessage();
|
||||
if (message != null) {
|
||||
Messages.showErrorDialog(getCurrentStepComponent(), message);
|
||||
}
|
||||
handleCommitException(e);
|
||||
return;
|
||||
}
|
||||
if (!isLastStep(idx)) {
|
||||
idx = getNextStep(idx);
|
||||
} else {
|
||||
for (ModuleWizardStep wizardStep : mySteps) {
|
||||
try {
|
||||
wizardStep.onWizardFinished();
|
||||
}
|
||||
catch (CommitStepException e) {
|
||||
handleCommitException(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
@@ -176,6 +182,13 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
super.doOKAction();
|
||||
}
|
||||
|
||||
private void handleCommitException(CommitStepException e) {
|
||||
String message = e.getMessage();
|
||||
if (message != null) {
|
||||
Messages.showErrorDialog(getCurrentStepComponent(), message);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean commitStepData(final ModuleWizardStep step) {
|
||||
try {
|
||||
if (!step.validate()) {
|
||||
|
||||
Reference in New Issue
Block a user