use of com.intellij.ide.util.projectWizard.SettingsStep in project flutter-intellij by flutter.
the class FlutterProjectCreator method createModule.
public void createModule() {
Project project = myModel.project().getValue();
VirtualFile baseDir = project.getBaseDir();
if (baseDir == null) {
// Project was deleted.
return;
}
String baseDirPath = baseDir.getPath();
String moduleName = ProjectWizardUtil.findNonExistingFileName(baseDirPath, myModel.projectName().get(), "");
String contentRoot = baseDirPath + "/" + moduleName;
File location = new File(contentRoot);
if (!location.exists() && !location.mkdirs()) {
String message = ActionsBundle.message("action.NewDirectoryProject.cannot.create.dir", location.getAbsolutePath());
Messages.showErrorDialog(project, message, ActionsBundle.message("action.NewDirectoryProject.title"));
return;
}
// ModuleBuilder mixes UI and model code too much to easily reuse. We have to override a bunch of stuff to ensure
// that methods which expect a live UI do not get called.
FlutterModuleBuilder builder = new FlutterModuleBuilder() {
@NotNull
@Override
public FlutterCreateAdditionalSettings getAdditionalSettings() {
return makeAdditionalSettings();
}
@Override
protected FlutterSdk getFlutterSdk() {
return FlutterSdk.forPath(myModel.flutterSdk().get());
}
@Override
public boolean validate(Project current, Project dest) {
return true;
}
@Override
public ModuleWizardStep getCustomOptionsStep(final WizardContext context, final Disposable parentDisposable) {
return null;
}
@Override
public void setFlutterSdkPath(String s) {
}
@Override
public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) {
return null;
}
};
builder.setName(myModel.projectName().get());
builder.setModuleFilePath(toSystemIndependentName(contentRoot) + "/" + moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
builder.commitModule(project, null);
}
use of com.intellij.ide.util.projectWizard.SettingsStep in project intellij-community by JetBrains.
the class EduCCModuleBuilder method modifySettingsStep.
@Nullable
@Override
public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) {
ModuleWizardStep javaSettingsStep = ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, this, Conditions.alwaysTrue());
Function<JTextField, String> getValue = JTextComponent::getText;
getWizardInputField("ccname", "", "Name:", myPanel.getNameField(), getValue).addToSettings(settingsStep);
getWizardInputField("ccauthor", "", "Author:", myPanel.getAuthorField(), getValue).addToSettings(settingsStep);
LanguageExtensionPoint[] extensions = new ExtensionPointName<LanguageExtensionPoint>(EduCourseConfigurator.EP_NAME).getExtensions();
myLanguageComboBox.removeAllItems();
for (LanguageExtensionPoint extension : extensions) {
String languageId = extension.getKey();
Language language = Language.findLanguageByID(languageId);
if (language == null) {
LOG.info("Language with id " + languageId + " not found");
}
myLanguageComboBox.addItem(new LanguageWrapper(language));
}
getWizardInputField("cclang", "", "Language:", myLanguageComboBox, comboBox -> (String) comboBox.getSelectedItem()).addToSettings(settingsStep);
getWizardInputField("ccdescr", "", "Description:", myPanel.getDescriptionField(), JTextArea::getText).addToSettings(settingsStep);
return javaSettingsStep;
}
Aggregations