public ElementDescription searchAndSelect ( boolean showEmptySelectionError , Object ... scope ) { try { final List < ElementDescription > elements = findElements ( scope , PlatformUI . getWorkbench ( ) . getProgressService ( ) ) ; ElementDescription element = null ; if ( elements == null || elements . isEmpty ( ) ) { if ( showEmptySelectionError ) { SARLEclipsePlugin . getDefault ( ) . openError ( getShell ( ) , Messages . AbstractSarlScriptInteractiveSelector_1 , MessageFormat . format ( Messages . AbstractSarlScriptInteractiveSelector_2 , getElementLabel ( ) ) , null ) ; } } else if ( elements . size ( ) > 1 ) { element = chooseElement ( elements ) ; } else { element = elements . get ( 0 ) ; } return element ; } catch ( InterruptedException exception ) { // } catch ( Exception exception ) { SARLEclipsePlugin . getDefault ( ) . openError ( getShell ( ) , Messages . AbstractSarlScriptInteractiveSelector_1 , null , exception ) ; } return null ; }
Search the elements based on the given scope and select one . If more than one element was found the user selects interactively one .