question: private void showFlagsDialog ( ) { int [ ] oldIndices = flagsList_ . getSelectedIndices ( ) ; String [ ] buttons = { "OK" , "Cancel" } ; int result = JOptionPane . showOptionDialog ( toolWindowContent , flagsList_ , "Select flags" , JOptionPane . YES_NO_CANCEL_OPTION , JOptionPane . PLAIN_MESSAGE , null , buttons , buttons [ 0 ] ) ; if ( result != 0 ) { flagsList_ . setSelectedIndices ( oldIndices ) ; } else { if ( flagsList_ . getSelectedIndices ( ) . length > 1 && flagsList_ . isSelectedIndex ( 0 ) ) { flagsList_ . removeSelectionInterval ( 0 , 0 ) ; } updateFlagsTextField ( ) ; } }
target:  Displays dialog with intent flags picking up flow