@Override public void menuSelected(MenuEvent menuEvent) { recentFiles.removeAll(); File openFile = wrapper.getOpenFile(); String currentFile = openFile == null ? "" : openFile.getAbsolutePath(); for (final String file : settings.getRecentFiles()) { if (file.equals(currentFile)) { continue; } JMenuItem menuItem = new JMenuItem(file); recentFiles.add(menuItem); menuItem.addActionListener(e -> openFile(new File(file))); } if (recentFiles.getItemCount() == 0) { recentFiles.add(new JMenuItem(NLS.str("menu.no_recent_files"))); } }
/** * Removes old file list and creates a new file list * with the updated MRU list. */ protected void updateMRUList() { JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0); menu.removeAll(); menu.add(createOpenMI()); menu.add(createOpenURLMI()); menu.addSeparator(); menu.add(createCloseMI()); createMRUFileListMI(menu); menu.addSeparator(); menu.add(createExitMI()); }
recentFiles.removeAll(); ListIterator<String> li = RecentFiles.paths.listIterator(RecentFiles.paths.size()); boolean rfSaveNeeded = false;
private void buildHelpMenu(JMenu helpMenu) { helpMenu.removeAll(); JMenuItem menuItem = new JMenuItem("Legal"); menuItem.addActionListener(new ActionListener() {
@Override public void menuSelected(MenuEvent me) { List<File> recentFiles = recentFilesHelper.getRecentFiles(); jm_open_recent.removeAll(); for(final File f: recentFiles) { JMenuItem jmi = new JMenuItem(f.getName()); jmi.setToolTipText(f.getAbsolutePath()); jmi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { FileOpenUtil.open(view, f); } }); jm_open_recent.add(jmi); } // Add clear option: if(!recentFilesHelper.isEmpty()) { jm_open_recent.addSeparator(); JMenuItem jmi = new JMenuItem("Clear"); jmi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { recentFilesHelper.clear(); } }); jm_open_recent.add(jmi); } }
private void buildEditMenu(JMenu editMenu) { editMenu.removeAll(); JMenuItem menuItem = new JMenuItem("Cut"); menuItem.setAccelerator(
private void buildFileMenu(final JMenu fileMenu) { fileMenu.removeAll(); JMenuItem menuItem = new JMenuItem("Open File..."); menuItem.setAccelerator(
private void buildOperationMenu(JMenu operationMenu) { operationMenu.removeAll(); packageExplorerStyle = new JCheckBoxMenuItem("Package Explorer Style"); packageExplorerStyle.setSelected(luytenPrefs.isPackageExplorerStyle());
private void buildThemesMenu(JMenu themesMenu) { themesMenu.removeAll(); themesGroup = new ButtonGroup(); JRadioButtonMenuItem a = new JRadioButtonMenuItem(new ThemeAction("Default", "default.xml")); a.setSelected("default.xml".equals(luytenPrefs.getThemeXml())); themesGroup.add(a); themesMenu.add(a); a = new JRadioButtonMenuItem(new ThemeAction("Default-Alt", "default-alt.xml")); a.setSelected("default-alt.xml".equals(luytenPrefs.getThemeXml())); themesGroup.add(a); themesMenu.add(a); a = new JRadioButtonMenuItem(new ThemeAction("Dark", "dark.xml")); a.setSelected("dark.xml".equals(luytenPrefs.getThemeXml())); themesGroup.add(a); themesMenu.add(a); a = new JRadioButtonMenuItem(new ThemeAction("Eclipse", "eclipse.xml")); a.setSelected("eclipse.xml".equals(luytenPrefs.getThemeXml())); themesGroup.add(a); themesMenu.add(a); a = new JRadioButtonMenuItem(new ThemeAction("Visual Studio", "vs.xml")); a.setSelected("vs.xml".equals(luytenPrefs.getThemeXml())); themesGroup.add(a); themesMenu.add(a); a = new JRadioButtonMenuItem(new ThemeAction("IntelliJ", "idea.xml")); a.setSelected("idea.xml".equals(luytenPrefs.getThemeXml())); themesGroup.add(a); themesMenu.add(a); }
private void buildSettingsMenu(JMenu settingsMenu, ConfigSaver configSaver) { settingsMenu.removeAll(); ActionListener settingsChanged = new ActionListener() { @Override
private static void buildRecentFileMenu() { for (JMenu recentFileMenu : recentFileMenus) { recentFileMenu.removeAll(); for (File f : getRecentFiles()) { recentFileMenu.add(new OpenRecentAction(f)); } } }
/** * Removes old file list and creates a new file list * with the updated MRU list. */ protected void updateMRUList() { JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0); menu.removeAll(); menu.add(createOpenMI()); menu.add(createOpenURLMI()); menu.addSeparator(); menu.add(createCloseMI()); createMRUFileListMI(menu); menu.addSeparator(); menu.add(createExitMI()); }
if (!recentFiles.isEmpty()) recentFilesMenu.removeAll(); List<String> files = recentFiles.getFiles(); for (int i = files.size() - 1; i >= 0; i--)
} else { currentOnes.add(multi); multi.removeAll();
public void initErrorMethods(Vendor vendor) { this.itemRadioStrategyError[0].removeAll(); Integer[] i = { 0 }; if (vendor != Vendor.AUTO && vendor.instance().getXmlModel().getStrategy().getError() != null) { for (Method methodError: vendor.instance().getXmlModel().getStrategy().getError().getMethod()) { JMenuItem itemRadioVendor = new JRadioButtonMenuItem(methodError.getName()); itemRadioVendor.setEnabled(false); this.itemRadioStrategyError[0].add(itemRadioVendor); this.groupStrategy.add(itemRadioVendor); final int indexError = i[0]; itemRadioVendor.addActionListener(actionEvent -> { ManagerDatabase.this.menuStrategy.setText(methodError.getName()); MediatorModel.model().setStrategy(StrategyInjection.ERROR); ((StrategyInjectionError) StrategyInjection.ERROR.instance()).setIndexMethod(indexError); }); i[0]++; } } }
MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setEnabled(false); ((JMenu) MediatorGui.managerDatabase().getMenuStrategy().getItem(2)).removeAll(); MediatorGui.managerDatabase().getGroupStrategy().clearSelection();
private void updateMenu() { if (menu != null) { menu.removeAll(); if (menuNewWindow != null) menuNewWindow.removeAll(); for (File f : files) { menu.add(new FileOpenEntry(f, opener, false).createJMenuItem()); if (menuNewWindow != null) menuNewWindow.add(new FileOpenEntry(f, opener, true).createJMenuItem()); } } }
@Override public void run() { if (popup != null) popup.removeAll(); if (menu != null) menu.removeAll(); Collection objects0 = objects; TriggerMenuController.this.objects = new ArrayList(); for (Object o : objects0) { addMenuFromObject(o); } } });
/** * Update/rebuild the content of menu. */ public final void updateMenu () { menu.removeAll(); // List of Steps classes in proper order for (Step step : Step.values()) { menu.add(new StepItem(step)); } }
public void menuSelected(MenuEvent e) { final JMenu menu = (JMenu) e.getSource(); menu.removeAll(); removeActionsOfType(coll,IndexDefragAction.class); app.getThreadPool().addTask(new IteratorIndexesTask(menu)); } public void menuDeselected(MenuEvent e) { }