diff --git a/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java b/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java index a6997b918a5a..49bedf73067a 100644 --- a/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java +++ b/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java @@ -190,7 +190,7 @@ public abstract class FinderRecursivePanel extends OnePixelSplitter implement ScrollPaneFactory.createScrollPane(myList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - return ListWithFilter.wrap(myList, pane, (Function)o -> getItemText(o)); + return ListWithFilter.wrap(myList, pane, o -> getItemText(o)); } protected JBList createList() { @@ -298,13 +298,8 @@ public abstract class FinderRecursivePanel extends OnePixelSplitter implement } private void installSpeedSearch(JBList list) { - final ListSpeedSearch search = new ListSpeedSearch(list, new Function() { - @Override - public String fun(Object o) { - //noinspection unchecked - return getItemText((T)o); - } - }); + //noinspection unchecked + final ListSpeedSearch search = new ListSpeedSearch(list, (Function)o -> getItemText((T)o)); search.setComparator(new SpeedSearchComparator(false)); } @@ -346,6 +341,7 @@ public abstract class FinderRecursivePanel extends OnePixelSplitter implement try { setIcon(getItemIcon(t)); append(getItemText(t)); + this.setToolTipText(getItemTooltipText(t)); } catch (IndexNotReadyException e) { append("loading..."); @@ -379,6 +375,7 @@ public abstract class FinderRecursivePanel extends OnePixelSplitter implement : AllIcons.Icons.Ide.NextStepGrayed); result.add(this, BorderLayout.CENTER); result.add(childrenLabel, BorderLayout.EAST); + result.setToolTipText(this.getToolTipText()); return result; } return this; @@ -393,6 +390,20 @@ public abstract class FinderRecursivePanel extends OnePixelSplitter implement protected void doCustomizeCellRenderer(SimpleColoredComponent comp, JList list, T value, int index, boolean selected, boolean hasFocus) { } + /** + * This method is invoked by panel's list cell render in order to set a tool tip text for the list cell render component. + * It is invoked before {@link #doCustomizeCellRenderer(SimpleColoredComponent, JList, Object, int, boolean, boolean)}, + * thus the tool tip may still be reset in {@link #doCustomizeCellRenderer(SimpleColoredComponent, JList, Object, int, boolean, boolean)}. + * + * @param t the list item + * @return the text to display in a tool tip for the given list item + * @since 2017.2 + */ + @Nullable + protected String getItemTooltipText(T t) { + return null; + } + @Nullable @Override public Object getData(@NonNls String dataId) {