예제 #1
0
 public void clearMenu() {
   for (org.eclipse.swt.widgets.MenuItem item : menu.getItems()) {
     if (!item.isDisposed()) {
       item.dispose();
     }
   }
   if (isIconReloadEnqueued) {
     IconFactory.getInstance().cleanup();
     IconFactory.getInstance().loadResources();
     isIconReloadEnqueued = false;
   }
 }
예제 #2
0
 /**
  * Adds an executable menu item
  *
  * @param name Item name
  * @param text Text on menu item
  * @param command Command to execute
  */
 public void addExecutableMenuItem(final String name, final String text, final Command command) {
   final ExecutableMenuItem item = MenuFactory.newExecutableMenuItem();
   item.setCommand(command);
   item.setText(text);
   item.setIcon(IconFactory.getInstance().getIcon(name));
   addMenuItem(item);
 }
예제 #3
0
 /** 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();
 }