diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java index f0cad199d59f..96be30519e45 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java @@ -645,7 +645,7 @@ public class FindDialog extends DialogWrapper implements FindUI { int index = myResultsPreviewTable.getSelectionModel().getLeadSelectionIndex(); if (index != -1) { UsageInfo usageInfo = ((UsageInfo2UsageAdapter)myResultsPreviewTable.getModel().getValueAt(index, 0)).getUsageInfo(); - myUsagePreviewPanel.updateLayout(Collections.singletonList(usageInfo)); + myUsagePreviewPanel.updateLayout(usageInfo.isValid() ? Collections.singletonList(usageInfo) : null); VirtualFile file = usageInfo.getVirtualFile(); myUsagePreviewPanel.setBorder(IdeBorderFactory.createTitledBorder(file != null ? file.getPath() : "", false)); } @@ -1597,6 +1597,9 @@ public class FindDialog extends DialogWrapper implements FindUI { @Override protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) { if (value instanceof UsageInfo2UsageAdapter) { + if (!((UsageInfo2UsageAdapter)value).isValid()) { + myUsageRenderer.append(" "+UsageViewBundle.message("node.invalid") + " ", SimpleTextAttributes.ERROR_ATTRIBUTES); + } TextChunk[] text = ((UsageInfo2UsageAdapter)value).getPresentation().getText(); // skip line number / file info @@ -1605,9 +1608,6 @@ public class FindDialog extends DialogWrapper implements FindUI { SimpleTextAttributes attributes = getAttributes(textChunk); myUsageRenderer.append(textChunk.getText(), attributes); } - if (!((UsageInfo2UsageAdapter)value).isValid()) { - myUsageRenderer.append(" "+UsageViewBundle.message("node.invalid"), SimpleTextAttributes.ERROR_ATTRIBUTES); - } } setBorder(null); }