@Override public void actionPerformed(ActionEvent event){
switch (event.getActionCommand()) {
case NEW_ALIAS:
    addAlias(new Alias("New Alias"));
  break;
case COPY_ALIAS:
for (Alias alias : getSelectedAliases()) {
  addAlias(AliasFactory.copyOf(alias));
}
break;
case DELETE_ALIAS:
List<Alias> toDelete=getSelectedAliases();
if (toDelete != null && !toDelete.isEmpty()) {
String title=toDelete.size() == 1 ? "Delete Alias?" : "Delete Aliases?";
String prompt=toDelete.size() == 1 ? "Do you want to delete this alias?" : "Do you want to delete these " + toDelete.size() + " aliases?";
int choice=JOptionPane.showConfirmDialog(AliasController.this,prompt,title,JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
if (choice == JOptionPane.YES_OPTION) {
for (Alias alias : toDelete) {
mAliasModel.removeAlias(alias);
}
}
}
break;
default :
break;
}
}

@ Override public void actionPerformed ( ActionEvent event ) { switch ( event . getActionCommand ( ) ) { case NEW_ALIAS : addAlias ( new Alias ( "New Alias" ) ) ; break ; case COPY_ALIAS : for ( Alias alias : getSelectedAliases ( ) ) { addAlias ( AliasFactory . copyOf ( alias ) ) ; } break ; case DELETE_ALIAS : List < Alias > toDelete = getSelectedAliases ( ) ; if ( toDelete != null && ! toDelete . isEmpty ( ) ) { String title = toDelete . size ( ) == 1 ? "Delete Alias?" : "Delete Aliases?" ; String prompt = toDelete . size ( ) == 1 ? "Do you want to delete this alias?" : "Do you want to delete these " + toDelete . size ( ) + " aliases?" ; int choice = JOptionPane . showConfirmDialog ( AliasController . this , prompt , title , JOptionPane . YES_NO_OPTION , JOptionPane . WARNING_MESSAGE ) ; if ( choice == JOptionPane . YES_OPTION ) { for ( Alias alias : toDelete ) { mAliasModel . removeAlias ( alias ) ; } } } break ; default : break ; } }
responds to new , copy and delete channel button invocations
