private void setDefaultNameIfNeeded() {
   if (!StringUtils.hasText(nameItem.getValue()) && selection.size() == 1) {
     // Cast is valid because selection predicate supplied to TreeOptions
     // precludes non TropixObjectTreeItems
     final TropixObjectLocation selectionItem =
         (TropixObjectLocation) Iterables.getOnlyElement(selection);
     nameItem.setValue(selectionItem.getObject().getName());
   }
 }
 private boolean validIdentification(final Location treeItem) {
   if (!(treeItem instanceof TropixObjectTreeItem)) {
     return true;
   }
   final TropixObjectLocation tropixObjectTreeItem = (TropixObjectLocation) treeItem;
   final TropixObject tropixObject = tropixObjectTreeItem.getObject();
   if (!(tropixObject instanceof IdentificationAnalysis)) {
     return true;
   }
   final IdentificationAnalysis analysis = (IdentificationAnalysis) tropixObject;
   final IdentificationType analysisType =
       IdentificationType.fromParameterType(analysis.getIdentificationProgram());
   return validAnalysisTypes.contains(analysisType);
 }