Skip to content

Commit 709e247

Browse files
committed
AbstractUIDetails: use identifier in getTitle
If there is a unique identifier string for the object (i.e., it implements the Identifiable interface), and none of the more friendly options are set (i.e.: no label, no menu leaf, no name), then let's use the identifier over the raw class name.
1 parent 01c68f1 commit 709e247

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/org/scijava/AbstractUIDetails.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ public String getTitle() {
103103
// use object name, if available
104104
if (getName() != null && !getName().isEmpty()) return getName();
105105

106+
// use the unique identifier, if available
107+
if (this instanceof Identifiable) {
108+
return ((Identifiable) this).getIdentifier();
109+
}
110+
106111
// use class name as a last resort
107112
return getClass().getSimpleName();
108113
}

0 commit comments

Comments
 (0)