From b1ff9cdcbac13a00ca1f088da010900d2db80571 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 24 Jan 2017 18:51:21 +0300 Subject: [PATCH] reuse StackFrameItem.customizePresentation --- .../intellij/debugger/memory/ui/StackFrameList.java | 12 ++++-------- .../debugger/memory/utils/StackFrameItem.java | 6 +++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/memory/ui/StackFrameList.java b/java/debugger/impl/src/com/intellij/debugger/memory/ui/StackFrameList.java index 7201ffd57987..05e2b9fa50d7 100644 --- a/java/debugger/impl/src/com/intellij/debugger/memory/ui/StackFrameList.java +++ b/java/debugger/impl/src/com/intellij/debugger/memory/ui/StackFrameList.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.intellij.debugger.memory.ui; import com.intellij.debugger.engine.DebuggerUtils; +import com.intellij.debugger.memory.utils.StackFrameItem; import com.intellij.execution.filters.OpenFileHyperlinkInfo; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.ScrollType; @@ -30,10 +31,8 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.util.PsiUtilCore; import com.intellij.ui.ColoredListCellRenderer; -import com.intellij.ui.SimpleTextAttributes; import com.intellij.ui.components.JBList; import org.jetbrains.annotations.NotNull; -import com.intellij.debugger.memory.utils.StackFrameItem; import javax.swing.*; import java.util.ArrayList; @@ -65,11 +64,8 @@ class StackFrameList extends JBList { @Override protected void customizeCellRenderer(@NotNull JList list, StackFrameItem value, int index, boolean isSelected, boolean hasFocus) { - append(String.format("%s:%d, %s", value.methodName(), value.line(), value.className())); - String packageName = value.packageName(); - if (packageName.trim().isEmpty() /*!StringUtils.isEmpty(packageName)*/) { - append(String.format(" (%s)", value.packageName()), SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES); - } + value.customizePresentation(this); + setIcon(null); // no icons in the list } }); } diff --git a/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java b/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java index bdeee8912788..c2af88e834fa 100644 --- a/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java +++ b/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java @@ -119,7 +119,11 @@ public class StackFrameItem extends XStackFrame { @Override public void customizePresentation(@NotNull ColoredTextContainer component) { component.setIcon(myFirst ? AllIcons.Actions.Menu_cut : JBUI.scale(EmptyIcon.create(6))); - component.append(String.format("%s:%d, %s", myMethodName, myLineNumber, myFilePath), SimpleTextAttributes.REGULAR_ATTRIBUTES); + component.append(String.format("%s:%d, %s", myMethodName, myLineNumber, className()), SimpleTextAttributes.REGULAR_ATTRIBUTES); + String packageName = packageName(); + if (!packageName.trim().isEmpty()) { + component.append(String.format(" (%s)", packageName), SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES); + } } @Nullable