use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project intellij-community by JetBrains.
the class AbstractProjectWizard method doPreviousAction.
@Override
protected void doPreviousAction() {
if (myDelegate != null) {
myDelegate.doPreviousAction();
return;
}
final ModuleWizardStep step = getCurrentStepObject();
step.onStepLeaving();
if (step instanceof StepWithSubSteps) {
((StepWithSubSteps) step).doPreviousAction();
}
super.doPreviousAction();
}
use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project intellij-community by JetBrains.
the class CloudModuleBuilderSourceContribution method detectModuleStructure.
private void detectModuleStructure(Module module, final String contentPath) {
final Project project = module.getProject();
final CreateFromSourcesMode mode = new CreateFromSourcesMode() {
@Override
public boolean isAvailable(WizardContext context) {
return true;
}
@Override
public void addSteps(WizardContext context, ModulesProvider modulesProvider, StepSequence sequence, String specific) {
super.addSteps(context, modulesProvider, sequence, specific);
myProjectBuilder.setFileToImport(contentPath);
}
};
final WizardContext context = new WizardContext(project);
final StepSequence stepSequence = mode.getSteps(context, DefaultModulesProvider.createForProject(context.getProject()));
if (stepSequence == null) {
return;
}
Disposer.register(project, new Disposable() {
@Override
public void dispose() {
for (ModuleWizardStep step : stepSequence.getAllSteps()) {
step.disposeUIResources();
}
}
});
ProgressManager.getInstance().run(new Task.Backgroundable(project, CloudBundle.getText("detect.module.structure", getCloudType().getPresentableName()), false) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
for (ModuleWizardStep step = ContainerUtil.getFirstItem(stepSequence.getSelectedSteps()); step != null; step = stepSequence.getNextStep(step)) {
if (step instanceof AbstractStepWithProgress<?>) {
((AbstractStepWithProgress) step).performStep();
} else {
step.updateDataModel();
}
}
CloudAccountSelectionEditor.unsetAccountOnContext(context, getCloudType());
}
@Override
public boolean shouldStartInBackground() {
return false;
}
@Override
public void onSuccess() {
ProjectBuilder moduleBuilder = mode.getModuleBuilder();
if (moduleBuilder == null) {
return;
}
moduleBuilder.commit(project);
getNotifier().showMessage(CloudBundle.getText("cloud.support.added", getCloudType().getPresentableName()), MessageType.INFO);
}
});
}
use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project intellij-community by JetBrains.
the class CreateFromSourcesMode method addSteps.
public void addSteps(WizardContext context, ModulesProvider modulesProvider, StepSequence sequence, String specific) {
final ProjectFromSourcesBuilderImpl projectBuilder = new ProjectFromSourcesBuilderImpl(context, modulesProvider);
myProjectBuilder = projectBuilder;
final Icon icon = context.getStepIcon();
if (context.isCreatingNewProject()) {
addStep(sequence, new ProjectNameStep(context, this), specific);
}
addStep(sequence, new RootsDetectionStep(projectBuilder, context, sequence, icon, "reference.dialogs.new.project.fromCode.source"), specific);
Set<String> detectorTypes = new HashSet<>();
for (ProjectStructureDetector detector : ProjectStructureDetector.EP_NAME.getExtensions()) {
detectorTypes.add(detector.getDetectorId());
for (ModuleWizardStep step : detector.createWizardSteps(projectBuilder, projectBuilder.getProjectDescriptor(detector), icon)) {
sequence.addSpecificStep(detector.getDetectorId(), step);
}
}
if (FrameworkDetectionStep.isEnabled()) {
FrameworkDetectionStep frameworkDetectionStep = new FrameworkDetectionStep(icon, projectBuilder) {
public List<ModuleDescriptor> getModuleDescriptors() {
final List<ModuleDescriptor> moduleDescriptors = new ArrayList<>();
for (ProjectDescriptor descriptor : projectBuilder.getSelectedDescriptors()) {
moduleDescriptors.addAll(descriptor.getModules());
}
return moduleDescriptors;
}
};
projectBuilder.addConfigurationUpdater(frameworkDetectionStep);
sequence.addCommonFinishingStep(frameworkDetectionStep, detectorTypes);
}
}
use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project intellij-community by JetBrains.
the class AbstractProjectWizard method doFinishAction.
@VisibleForTesting
public boolean doFinishAction() {
if (myDelegate != null) {
myDelegate.doFinishAction();
return true;
}
int idx = getCurrentStep();
try {
do {
final ModuleWizardStep step = mySteps.get(idx);
if (step != getCurrentStepObject()) {
step.updateStep();
}
if (!commitStepData(step)) {
return false;
}
step.onStepLeaving();
try {
step._commit(true);
} catch (CommitStepException e) {
handleCommitException(e);
return false;
}
if (!isLastStep(idx)) {
idx = getNextStep(idx);
} else {
for (ModuleWizardStep wizardStep : mySteps) {
try {
wizardStep.onWizardFinished();
} catch (CommitStepException e) {
handleCommitException(e);
return false;
}
}
break;
}
} while (true);
} finally {
myCurrentStep = idx;
updateStep();
}
return true;
}
use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project intellij-community by JetBrains.
the class AbstractProjectWizard method getNextStep.
@Override
protected final int getNextStep(final int step) {
ModuleWizardStep nextStep = null;
final StepSequence stepSequence = getSequence();
if (stepSequence != null) {
ModuleWizardStep current = mySteps.get(step);
if (isStepWithNotCompletedSubSteps(current)) {
return step;
}
nextStep = stepSequence.getNextStep(current);
while (nextStep != null && !nextStep.isStepVisible()) {
nextStep = stepSequence.getNextStep(nextStep);
}
}
return nextStep == null ? step : mySteps.indexOf(nextStep);
}
Aggregations