/** Loads the menu */ public void loadMenu() { PluginManager.getInstance().beforeQuickAccess(this); loadQuickAccessMenu(); boolean addSeparator = false; for (final File root : roots) { if (cfg.getBlackList().contains(root)) { continue; } if (cfg.isFloppyDrivesDisplayed() || !PathUtils.isFloppy(root)) { if (log.isDebugEnabled()) { log.debug("Generating menu for: " + root.getAbsolutePath()); } final FolderMenu item = MenuFactory.newFolderMenu(root); item.setText(PathUtils.getFileName(root)); item.setIcon(IconFactory.getInstance().getIcon(root)); addMenuItem(item); addSeparator = true; } } if (addSeparator) { addSeparator(); } addStaticItems(); reloadRoots(); }
/** Adds static menu items */ private void addStaticItems() { if (cfg.checkForUpdates()) { if (Version.isUpdateAvailable() != null && Version.isUpdateAvailable()) { addExecutableMenuItem( "update", "Update Available! (" + Version.VERSION_NUMBER + " to " + Version.updateVersion + ")", new UpdateCommand(Version.DOWNLOAD_URL)); } for (final Entry<String, String> plugUp : PluginManager.getInstance().getAvailableUpdates().entrySet()) { addExecutableMenuItem( "update", "Plugin Update! (" + plugUp.getKey() + " " + plugUp.getValue() + ")", new UpdateCommand(Version.PLUGINS_URL)); } } addExecutableMenuItem("hide", "Hide", new HideCommand()); PluginManager.getInstance().beforeAboutMenuItem(this); addExecutableMenuItem("about", "About", new AboutCommand()); addExecutableMenuItem("settings", "Settings", new SettingsCommand()); addExecutableMenuItem("help", "Help", new HelpCommand()); addExecutableMenuItem("exit", "Exit", new ExitCommand()); }
/** Loads quick access menu */ private void loadQuickAccessMenu() { final List<File> quick = cfg.getQuickAccessList(); if (quick != null && quick.size() > 0) { final List<String> quickRaw = cfg.getRawQuickAccessList(); final Map<String, String> qaNames = cfg.getQuickAccessNames(); for (int i = 0; i < quick.size(); i++) { File custom = quick.get(i); String customEntry = quickRaw.get(i); try { final FolderMenu fm = MenuFactory.newFolderMenu(custom); if (qaNames.containsKey(customEntry)) { fm.setText(qaNames.get(customEntry)); } PluginManager.getInstance().enhanceQuickAccessItem(fm, custom); addMenuItem(fm); } catch (final Exception e) { log.warn("Skipping unloadable Quick Access List item", e); } } addSeparator(); } }