UsagePresentation () { return new UsagePresentation() { @Override @Nullable public Icon getIcon() { PyPsiUtils.assertValid(myElement); return myElement.isValid() ? myElement.getIcon(0) : null; } @Override public TextChunk @NotNull [] getText() { PyPsiUtils.assertValid(myElement); if (myElement.isValid()) { PsiFile file = myElement.getContainingFile(); String line_id = "..."; final Document document = file.getViewProvider().getDocument(); if (document != null) { line_id = String.valueOf(document.getLineNumber(myElement.getTextOffset())); } TextChunk[] chunks = new TextChunk[3]; chunks[0] = new TextChunk(SLANTED, "(" + line_id + ") "); chunks[1] = new TextChunk(TextAttributes.ERASE_MARKER, myElement.getText()); StringBuilder sb = new StringBuilder(" would become ").append(myName); if (myIsPrefix) sb.append(".").append(myElement.getText()); chunks[2] = new TextChunk(SLANTED, sb.toString()); return chunks; } else { return new TextChunk[]{new TextChunk(SLANTED, "?")}; } } @Override @NotNull public String getPlainText() { return myElement.getText(); } @Override public String getTooltipText() { return myElement.getText(); } }; }