use of com.intellij.ide.util.newProjectWizard.AddModuleWizard in project intellij-community by JetBrains.
the class GradleProjectOpenProcessor method doQuickImport.
@Override
protected boolean doQuickImport(VirtualFile file, WizardContext wizardContext) {
final GradleProjectImportProvider projectImportProvider = new GradleProjectImportProvider(getBuilder());
getBuilder().setFileToImport(file.getPath());
getBuilder().prepare(wizardContext);
final String pathToUse;
if (!file.isDirectory() && file.getParent() != null) {
pathToUse = file.getParent().getPath();
} else {
pathToUse = file.getPath();
}
getBuilder().getControl(null).setLinkedProjectPath(pathToUse);
final boolean result;
if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
result = setupGradleProjectSettingsInHeadlessMode(projectImportProvider, wizardContext);
} else {
AddModuleWizard dialog = new AddModuleWizard(null, file.getPath(), projectImportProvider);
dialog.getWizardContext().setProjectBuilder(getBuilder());
dialog.navigateToStep(step -> step instanceof SelectExternalProjectStep);
result = dialog.showAndGet();
}
if (result && getBuilder().getExternalProjectNode() != null) {
wizardContext.setProjectName(getBuilder().getExternalProjectNode().getData().getInternalName());
}
return result;
}
Aggregations