use of com.biglybt.pif.ui.UIInstanceFactory in project BiglyBT by BiglySoftware.
the class MainMenuV3 method builFileMenu.
/**
* Builds the File menu dynamically
* @param fileMenu
*/
private void builFileMenu(Menu fileMenu) {
MenuItem openMenuItem = MenuFactory.createOpenMenuItem(fileMenu);
Menu openSubMenu = openMenuItem.getMenu();
MenuFactory.addOpenTorrentMenuItem(openSubMenu);
MenuFactory.addOpenURIMenuItem(openSubMenu);
MenuFactory.addOpenTorrentForTrackingMenuItem(openSubMenu);
MenuFactory.addOpenVuzeFileMenuItem(openSubMenu);
int userMode = COConfigurationManager.getIntParameter("User Mode");
if (userMode > 0) {
Menu shareSubMenu = MenuFactory.createShareMenuItem(fileMenu).getMenu();
MenuFactory.addShareFileMenuItem(shareSubMenu);
MenuFactory.addShareFolderMenuItem(shareSubMenu);
MenuFactory.addShareFolderContentMenuItem(shareSubMenu);
MenuFactory.addShareFolderContentRecursiveMenuItem(shareSubMenu);
}
MenuFactory.addCreateMenuItem(fileMenu);
if (!Constants.isOSX) {
MenuFactory.addSeparatorMenuItem(fileMenu);
MenuFactory.addCloseWindowMenuItem(fileMenu);
MenuFactory.addCloseDetailsMenuItem(fileMenu);
MenuFactory.addCloseDownloadBarsToMenu(fileMenu);
}
MenuFactory.addSeparatorMenuItem(fileMenu);
MenuFactory.createTransfersMenuItem(fileMenu);
/*
* No need for restart and exit on OS X since it's already handled on the application menu
*/
if (!Constants.isOSX) {
MenuFactory.addSeparatorMenuItem(fileMenu);
MenuFactory.addRestartMenuItem(fileMenu);
}
if (Constants.isCVSVersion() && !UI.isFirstUI()) {
MenuItem itemLogout = new MenuItem(fileMenu, SWT.PUSH);
itemLogout.setText("Shutdown UI (Keep " + Constants.APP_NAME + " running)");
itemLogout.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstance uiSWTInstance = uiFunctions.getUISWTInstance();
if (uiSWTInstance instanceof UIInstanceFactory) {
try {
PluginInterface pi = PluginInitializer.getDefaultInterface();
pi.getUIManager().detachUI((UIInstanceFactory) uiSWTInstance);
} catch (UIException e1) {
e1.printStackTrace();
}
}
}
}
});
}
if (!Constants.isOSX) {
MenuFactory.addExitMenuItem(fileMenu);
}
}
Aggregations