Skip to content

Commit

Permalink
IJPL-175226 Update New Element empty text
Browse files Browse the repository at this point in the history
Almost according to the new mockups except the gap after
the first line. There's currently no API for such a gap.

GitOrigin-RevId: 305b64b0309e70d1d54600e3b098ab8c57b27049
  • Loading branch information
Sergei Tachenov authored and intellij-monorepo-bot committed Jan 20, 2025
1 parent 4808ef5 commit 0512503
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.jetbrains.annotations.Nullable;

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;

/**
Expand Down Expand Up @@ -225,22 +226,19 @@ protected void customize(@NotNull ListPopup popup) {
var emptyText = list.getEmptyText();
emptyText.clear();
emptyText.appendLine(IdeBundle.message("popup.new.element.empty.text.1"));
emptyText.appendLine(
IdeBundle.message("popup.new.element.empty.text.2"),
SimpleTextAttributes.LINK_ATTRIBUTES,
linkActionEvent -> {
Disposer.dispose(popup);
var component = event.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT);
if (component != null) {
var inputEvent = linkActionEvent.getSource() instanceof InputEvent linkInputEvent ? linkInputEvent : null;
var actionManager = ActionManager.getInstance();
actionManager.tryToExecute(actionManager.getAction("NewFile"), inputEvent, component, EMPTY_TEXT_LINK_PLACE, true);
}
ActionListener emptyTextAction = linkActionEvent -> {
Disposer.dispose(popup);
var component = event.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT);
if (component != null) {
var inputEvent = linkActionEvent.getSource() instanceof InputEvent linkInputEvent ? linkInputEvent : null;
var actionManager = ActionManager.getInstance();
actionManager.tryToExecute(actionManager.getAction("NewFile"), inputEvent, component, EMPTY_TEXT_LINK_PLACE, true);
}
);
};
emptyText.appendLine(IdeBundle.message("popup.new.element.empty.text.2"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES, emptyTextAction);
// The capitalization is wrong here because this line continues the previous one.
//noinspection DialogTitleCapitalization
emptyText.appendLine(IdeBundle.message("popup.new.element.empty.text.3"));
emptyText.appendLine(IdeBundle.message("popup.new.element.empty.text.3"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES, emptyTextAction);
}
}

Expand Down
4 changes: 2 additions & 2 deletions platform/platform-api/resources/messages/IdeBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ title.restart.needed=Restart Needed
title.error.reading.file=Error Reading File
title.popup.new.element=New
popup.new.element.empty.text.1=File type not found.
popup.new.element.empty.text.2=Create the file manually
popup.new.element.empty.text.3=by specifying the extension.
popup.new.element.empty.text.2=Create new file
popup.new.element.empty.text.3=with any extension
title.popup.new.element.same.place=New in This Directory
message.occurrence.N.of.M=Occurrence {0} of {1}
error.dir.contains.no.project=''{0}'' does not contain a project
Expand Down

0 comments on commit 0512503

Please sign in to comment.