mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-118601 New Module: Maven: click on "Create from archetype" reverts typed coordinates.
This commit is contained in:
+13
-6
@@ -25,6 +25,7 @@ import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.model.MavenArchetype;
|
||||
import org.jetbrains.idea.maven.model.MavenId;
|
||||
@@ -209,6 +210,12 @@ public class MavenModuleWizardStep extends ModuleWizardStep {
|
||||
return MavenProjectsManager.getInstance(project).findProject(parentPom);
|
||||
}
|
||||
|
||||
private static void setTestIfEmpty(@NotNull JTextField artifactIdField, @Nullable String text) {
|
||||
if (StringUtil.isEmpty(artifactIdField.getText())) {
|
||||
artifactIdField.setText(StringUtil.notNullize(text));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStep() {
|
||||
if (myArchetypes != null && myArchetypes.isSkipUpdateUI()) return;
|
||||
@@ -222,14 +229,14 @@ public class MavenModuleWizardStep extends ModuleWizardStep {
|
||||
MavenId projectId = myBuilder.getProjectId();
|
||||
|
||||
if (projectId == null) {
|
||||
myArtifactIdField.setText(myBuilder.getName());
|
||||
myGroupIdField.setText(myParent == null ? myBuilder.getName() : myParent.getMavenId().getGroupId());
|
||||
myVersionField.setText(myParent == null ? "1.0-SNAPSHOT" : myParent.getMavenId().getVersion());
|
||||
setTestIfEmpty(myArtifactIdField, myBuilder.getName());
|
||||
setTestIfEmpty(myGroupIdField, myParent == null ? myBuilder.getName() : myParent.getMavenId().getGroupId());
|
||||
setTestIfEmpty(myVersionField, myParent == null ? "1.0-SNAPSHOT" : myParent.getMavenId().getVersion());
|
||||
}
|
||||
else {
|
||||
myArtifactIdField.setText(projectId.getArtifactId());
|
||||
myGroupIdField.setText(projectId.getGroupId());
|
||||
myVersionField.setText(projectId.getVersion());
|
||||
setTestIfEmpty(myArtifactIdField, projectId.getArtifactId());
|
||||
setTestIfEmpty(myGroupIdField, projectId.getGroupId());
|
||||
setTestIfEmpty(myVersionField, projectId.getVersion());
|
||||
}
|
||||
|
||||
myInheritGroupIdCheckBox.setSelected(myBuilder.isInheritGroupId());
|
||||
|
||||
Reference in New Issue
Block a user