// }
// Server[] servers = getServersByIndexes(selected_rows);
// for(Server server : servers) {
// System.out.println(server);
// }
JPopupMenu popup_menu = null;
switch( whichCondition() ) {
case A : popup_menu = new JPopupMenu();
popup_menu.add(connect_to);
popup_menu.add(disconnect);
popup_menu.addSeparator();
popup_menu.add(add);
popup_menu.add(remove_selected);
popup_menu.add(remove_all);
popup_menu.addSeparator();
popup_menu.add(copy_ed2k_links);
popup_menu.add(paste_ed2k_links);
popup_menu.addSeparator();
popup_menu.add(add_to_static_list);
popup_menu.add(remove_from_static_list);
// popup_menu.addSeparator();
// popup_menu.add(column_setup);
popup_menu.addSeparator();
popup_menu.add(properties); break;
case B : popup_menu = new JPopupMenu();
popup_menu.add(remove_selected);
popup_menu.add(remove_all);
popup_menu.add(add);
popup_menu.add(disconnect);
popup_menu.addSeparator();
popup_menu.add(copy_ed2k_links);
popup_menu.add(paste_ed2k_links);
popup_menu.addSeparator();
popup_menu.add(add_to_static_list);
popup_menu.add(remove_from_static_list);
// popup_menu.addSeparator();
// popup_menu.add(column_setup);
break;
case D : popup_menu = new JPopupMenu();
popup_menu.add(connect_to);
popup_menu.addSeparator();
popup_menu.add(add);
popup_menu.add(remove_selected);
popup_menu.add(remove_all);
popup_menu.addSeparator();
popup_menu.add(copy_ed2k_links);
popup_menu.add(paste_ed2k_links);
popup_menu.addSeparator();
popup_menu.add(add_to_static_list);
popup_menu.add(remove_from_static_list);
// popup_menu.addSeparator();
// popup_menu.add(column_setup);
popup_menu.addSeparator();
popup_menu.add(properties); break;
case E : popup_menu = new JPopupMenu();
popup_menu.add(remove_selected);
popup_menu.add(add);
popup_menu.add(remove_all);
popup_menu.addSeparator();
popup_menu.add(copy_ed2k_links);
popup_menu.add(paste_ed2k_links);
popup_menu.addSeparator();
popup_menu.add(add_to_static_list);
popup_menu.add(remove_from_static_list);
// popup_menu.addSeparator();
// popup_menu.add(column_setup);
break;
case F : popup_menu = new JPopupMenu();
popup_menu.add(add);
popup_menu.add(paste_ed2k_links);
popup_menu.addSeparator();
popup_menu.add(column_setup); break;
case G : popup_menu = new JPopupMenu();
popup_menu.add(remove_selected);
popup_menu.add(add);
popup_menu.add(remove_all);
popup_menu.add(disconnect);
popup_menu.addSeparator();
popup_menu.add(copy_ed2k_links);
popup_menu.add(paste_ed2k_links);
popup_menu.addSeparator();
popup_menu.add(add_to_static_list);
popup_menu.add(remove_from_static_list);
// popup_menu.addSeparator();
// popup_menu.add(column_setup);
popup_menu.addSeparator();
popup_menu.add(properties); break;
case H : popup_menu = new JPopupMenu();
popup_menu.add(remove_selected);
popup_menu.add(add);
popup_menu.add(remove_all);
popup_menu.add(disconnect);
popup_menu.addSeparator();
popup_menu.add(copy_ed2k_links);
popup_menu.add(paste_ed2k_links);
popup_menu.addSeparator();
popup_menu.add(add_to_static_list);
popup_menu.add(remove_from_static_list);
// popup_menu.addSeparator();
// popup_menu.add(column_setup); break;
}
// set enabled/disabled for static list commands
Server[] selected_servers = getSelectedServers();
add_to_static_list.setEnabled(true);
remove_from_static_list.setEnabled(true);
boolean add_to_static_enabled = true;
boolean remove_from_static_enabled = true;
for(Server server : selected_servers) {
if(server.isStatic()) {
add_to_static_enabled = false;
} else {
remove_from_static_enabled = false;
}
}
if( ( add_to_static_enabled == false ) && ( remove_from_static_enabled != false ) ) {
add_to_static_list.setEnabled(false);
}
if( ( add_to_static_enabled != false ) && ( remove_from_static_enabled == false ) ) {
remove_from_static_list.setEnabled(false);
}
popup_menu.show(e.getComponent(), e.getX(), e.getY());
}
}
}
this.addMouseListener(new PopupListener());