[platform] IDEA-311347 Nonsense directory contents ordering

Caused by PresentableNodeDescriptor.apply not setting myName in case
the presentation's text is colored.

The fix is similar to how SimpleNode.fillFallbackText() works, but the priority
is weird here: we try the presentable text first and if that is null, we fall back
to the colored text. This makes little sense and is only needed because of
a lot of tests (and possibly production code as well) relying on the presentable
text and not on the colored text.

For SimpleNode, this should have no effect since it sets the presentable text
to the plain version of the colored text anyway.

GitOrigin-RevId: 1b23619122e6bd9e1d37f82b2a7a39016c938d4d
This commit is contained in:
Sergei Tachenov
2023-01-31 08:24:40 +00:00
committed by intellij-monorepo-bot
parent 8878a66833
commit f67d97e0d3
@@ -53,6 +53,9 @@ public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> {
protected final boolean apply(@NotNull PresentationData presentation, @Nullable PresentationData before) {
setIcon(presentation.getIcon(false));
myName = presentation.getPresentableText();
if (myName == null) {
myName = getColoredTextAsPlainText(presentation);
}
myColor = presentation.getForcedTextForeground();
boolean updated = !presentation.equals(before);