String () { if (!myElement.isValid()) return "<unknown>"; try { ElementPresentation presentation = myElement.getPresentation(); String name = presentation.getElementName(); return name != null? name : presentation.getTypeName(); } catch (IndexNotReadyException e) { return "Name not available during indexing"; } }