// File menu
MenuItem fileItem = new MenuItem (this, SWT.CASCADE);
fileItem.setText (Localizer._("mainwindow.mainmenu.file"));
Menu submenu = new Menu (shell, SWT.DROP_DOWN);
fileItem.setMenu (submenu);
MenuItem new_item = new MenuItem(submenu,SWT.CASCADE);
new_item.setText(_._("mainwindow.mainmenu.file.new"));
Menu new_submenu = new Menu(shell,SWT.DROP_DOWN);
new_item.setMenu(new_submenu);
MenuItem new_server_item = new MenuItem(new_submenu,SWT.PUSH);
new_server_item.setText(_._("mainwindow.mainmenu.file.new.new_server"));
new_server_item.setImage(SWTImageRepository.getMenuImage("server_add.png"));
new_server_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
new NewWindow(NewWindow.WindowType.SERVER);
}
});
MenuItem new_download_item = new MenuItem(new_submenu,SWT.PUSH);
new_download_item.setText(_._("mainwindow.mainmenu.file.new.new_download"));
new_download_item.setImage(SWTImageRepository.getMenuImage("folder_down.png"));
new_download_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
new NewWindow(NewWindow.WindowType.DOWNLOAD);
}
});
MenuItem new_shared_folder_item = new MenuItem(new_submenu,SWT.PUSH);
new_shared_folder_item.setText(_._("mainwindow.mainmenu.file.new.new_shared_dir"));
new_shared_folder_item.setImage(SWTImageRepository.getMenuImage("share_folder.png"));
new_shared_folder_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
new NewWindow(NewWindow.WindowType.SHARED_DIR);
}
});
MenuItem import_servers = new MenuItem (submenu, SWT.PUSH);
import_servers.setText(Localizer._("mainwindow.mainmenu.file.import"));
import_servers.setImage(SWTImageRepository.getMenuImage("import.png"));
import_servers.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ServerListImportWindow window = new ServerListImportWindow();
window.getCoreComponents();
window.initUIComponents();
}
});
new MenuItem (submenu, SWT.SEPARATOR);
MenuItem exit_item = new MenuItem (submenu, SWT.PUSH);
exit_item.setText(Localizer._("mainwindow.mainmenu.file.exit"));
exit_item.setImage(SWTImageRepository.getMenuImage("door_in.png"));
exit_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.close();
}
});
// View menu
MenuItem viewItem = new MenuItem (this, SWT.CASCADE);
viewItem.setText (Localizer._("mainwindow.mainmenu.view"));
submenu = new Menu (shell, SWT.DROP_DOWN);
viewItem.setMenu (submenu);
MenuItem tabs_item = new MenuItem (submenu, SWT.CASCADE);
tabs_item.setText(Localizer._("mainwindow.mainmenu.view.tabs"));
Menu tabs_menu = new Menu (submenu);
tabs_item.setMenu(tabs_menu);
MenuItem servers_item = new MenuItem (tabs_menu, SWT.RADIO);
servers_item.setText(Localizer._("mainwindow.mainmenu.view.tabs.servers"));
tab_map.put(JMULE_TABS.SERVERLIST,servers_item);
servers_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.setTab(JMULE_TABS.SERVERLIST);
}
});
MenuItem kad_item = new MenuItem (tabs_menu, SWT.RADIO);
kad_item.setText(Localizer._("mainwindow.mainmenu.view.tabs.kad"));
tab_map.put(JMULE_TABS.KAD,kad_item);
kad_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.setTab(JMULE_TABS.KAD);
}
});
MenuItem transfers_item = new MenuItem (tabs_menu, SWT.RADIO);
transfers_item.setText(Localizer._("mainwindow.mainmenu.view.tabs.transfers"));
tab_map.put(JMULE_TABS.TRANSFERS,transfers_item);
transfers_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.setTab(JMULE_TABS.TRANSFERS);
}
});
MenuItem search_item = new MenuItem (tabs_menu, SWT.RADIO);
search_item.setText(Localizer._("mainwindow.mainmenu.view.tabs.search"));
tab_map.put(JMULE_TABS.SEARCH ,search_item);
search_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.setTab(JMULE_TABS.SEARCH);
}
});
MenuItem shared_item = new MenuItem (tabs_menu, SWT.RADIO);
shared_item.setText(Localizer._("mainwindow.mainmenu.view.tabs.shared"));
tab_map.put(JMULE_TABS.SHARED,shared_item);
shared_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.setTab(JMULE_TABS.SHARED);
}
});
MenuItem stats_item = new MenuItem (tabs_menu, SWT.RADIO);
stats_item.setText(Localizer._("mainwindow.mainmenu.view.tabs.stats"));
tab_map.put(JMULE_TABS.STATISTICS,stats_item);
stats_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.setTab(JMULE_TABS.STATISTICS);
}
});
MenuItem log_item = new MenuItem (tabs_menu, SWT.RADIO);
log_item.setText(Localizer._("mainwindow.mainmenu.view.tabs.logs"));
tab_map.put(JMULE_TABS.LOGS,log_item);
log_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.setTab(JMULE_TABS.LOGS);
}
});
MenuItem toolbar_item = new MenuItem (submenu, SWT.CHECK);
if (!SWTPreferences.getInstance().isToolBarVisible())
toolbar_item.setSelection(false);
else
toolbar_item.setSelection(true);
toolbar_item.setText(Localizer._("mainwindow.mainmenu.view.toolbar"));
toolbar_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.toolbarToogleVisibility();
}
});
MenuItem status_item = new MenuItem (submenu, SWT.CHECK);
if (!SWTPreferences.getInstance().isStatusBarVisible())
status_item.setSelection(false);
else
status_item.setSelection(true);
status_item.setText(Localizer._("mainwindow.mainmenu.view.statusbar"));
status_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
main_window.statusBarToogleVisibility();
}
});
//Tools menu
MenuItem toolsItem = new MenuItem (this, SWT.CASCADE);
toolsItem.setText (Localizer._("mainwindow.mainmenu.tools"));
submenu = new Menu (shell, SWT.DROP_DOWN);
toolsItem.setMenu (submenu);
MenuItem gui_chooser_item = new MenuItem (submenu, SWT.PUSH);
gui_chooser_item.setImage(SWTImageRepository.getMenuImage("switchui.png"));
gui_chooser_item.setText(Localizer._("mainwindow.mainmenu.tools.uichooser"));
gui_chooser_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
UIChooserWizad ui_chooser_wizard = new UIChooserWizad(new JFrame());
ui_chooser_wizard.setSize(500, 400);
ui_chooser_wizard.setVisible(true);
}
});
MenuItem wizard_item = new MenuItem (submenu, SWT.PUSH);
wizard_item.setImage(SWTImageRepository.getMenuImage("wizard.png"));
wizard_item.setText(Localizer._("mainwindow.mainmenu.tools.wizard"));
wizard_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
SetupWizard setup_wizard = new SetupWizard();
setup_wizard.setVisible(true);
}
});
new MenuItem (submenu, SWT.SEPARATOR);
MenuItem options_item = new MenuItem (submenu, SWT.PUSH);
options_item.setImage(SWTImageRepository.getMenuImage("cog_edit.png"));
options_item.setText(Localizer._("mainwindow.mainmenu.tools.options"));
options_item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
SettingsWindow window = new SettingsWindow();
window.getCoreComponents();
window.initUIComponents();
}
});
// Help menu
MenuItem helpItem = new MenuItem (this, SWT.CASCADE);
helpItem.setText (Localizer._("mainwindow.mainmenu.help"));
submenu = new Menu (shell, SWT.DROP_DOWN);
helpItem.setMenu (submenu);
MenuItem open_support_item = new MenuItem (submenu, SWT.PUSH);
open_support_item.setText(Localizer._("mainwindow.mainmenu.help.open_support"));
open_support_item.setImage(SWTImageRepository.getMenuImage("world_link.png"));