IDEA-332234 [NPW] new: added caption above new project and new module builders

GitOrigin-RevId: 16ed040fa84bb9a178b07ed9fa94ebf8aa6a2e12
This commit is contained in:
Sergei Vorobyov
2024-01-05 12:03:26 +00:00
committed by intellij-monorepo-bot
parent b7c7d67bc3
commit 146a4eeda6
2 changed files with 28 additions and 19 deletions
@@ -816,15 +816,26 @@ public final class ProjectTypeStep extends ModuleWizardStep implements SettingsS
@Override
public String getCaptionAboveOf(TemplatesGroup value) {
return value.getModuleBuilder() instanceof TemplateModuleBuilder
? UIBundle.message("list.caption.group.templates")
: UIBundle.message("list.caption.group.generators");
var builder = value.getModuleBuilder();
if (builder instanceof TemplateModuleBuilder) {
return UIBundle.message("list.caption.group.templates");
}
else if (builder instanceof NewProjectBuilder) {
return UIBundle.message("list.caption.group.newProject");
}
else if (builder instanceof NewModuleBuilder) {
return UIBundle.message("list.caption.group.newModule");
}
else {
return UIBundle.message("list.caption.group.generators");
}
}
@Override
public boolean hasSeparatorAboveOf(TemplatesGroup value) {
int index = groups.indexOf(value);
if (index < 1) return false;
if (index < 0) return false;
if (index == 0) return true;
TemplatesGroup upper = groups.get(index - 1);
if (value.getModuleBuilder() instanceof TemplateModuleBuilder && !(upper.getModuleBuilder() instanceof TemplateModuleBuilder)) {
return true;
@@ -842,29 +853,25 @@ public final class ProjectTypeStep extends ModuleWizardStep implements SettingsS
int index,
boolean isSelected,
boolean cellHasFocus) {
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
var component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
var leftInset = 8;
var rightInset = 0;
var bottomInset = 5;
var topInset = index == 0 ? bottomInset : 20;
mySeparatorComponent.setBorder(JBUI.Borders.empty(topInset, leftInset, bottomInset, rightInset));
mySeparatorComponent.setCaptionCentered(false);
mySeparatorComponent.setFont(JBUI.Fonts.smallFont());
myNextStepLabel.setIcon(value.isPromo() ? AllIcons.Ultimate.Lock : null);
return component;
}
@Override
protected JComponent createItemComponent() {
JComponent component = super.createItemComponent();
myTextLabel.setBorder(JBUI.Borders.empty(5, 0));
return component;
}
@Override
protected SeparatorWithText createSeparator() {
SeparatorWithText separator = createSeparatorComponent();
separator.setBorder(JBUI.Borders.empty(20, 8, 5, 0));
separator.setCaptionCentered(false);
separator.setFont(JBUI.Fonts.smallFont());
return separator;
}
@NotNull
private static SeparatorWithText createSeparatorComponent() {
return new SeparatorWithText() {
@Override
protected void paintLinePart(Graphics g, int xMin, int xMax, int hGap, int y) { }
@@ -326,6 +326,8 @@ kotlin.dsl.validation.groupId.part.allowed.symbols=Part ''{0}'' is incorrect, it
list.caption.group.generators=Generators
list.caption.group.templates=Templates
list.caption.group.newProject=New Project
list.caption.group.newModule=New Module
new.project.wizard.popup.title.install.plugin=Install Plugin