private String processLAST(final String jmlogfile, final String suffix) { if (USE_LAST_JMX.equals(jmlogfile) || USE_LAST_JMX.concat(suffix).equals(jmlogfile)){ String last = LoadRecentProject.getRecentFile(0);// most recent if (last.toUpperCase(Locale.ENGLISH).endsWith(JMX_SUFFIX)){ return last.substring(0, last.length() - JMX_SUFFIX.length()).concat(suffix); } } return jmlogfile; }
/** * Get the recent file for the menu item */ private File getRecentFile(ActionEvent e) { JMenuItem menuItem = (JMenuItem)e.getSource(); // Get the preference for the recent files return new File(getRecentFile(Integer.parseInt(menuItem.getName()))); }
@Override public void doActionAfterCheck(ActionEvent e) { // We must ask the user if it is ok to close current project if (!Close.performAction(e)) { return; } // Load the file for this recent file command loadProjectFile(e, getRecentFile(e), false); }
String recentFilePath = getRecentFile(i); if(!loadedFileName.equals(recentFilePath)) { newRecentFiles.add(recentFilePath);
/** * Set the content and visibility of menu items and menu separator, * based on the recent file stored user preferences. */ private static void updateMenuItems(List<JComponent> menuItems) { // Update the menu items for (int i = 0; i < NUMBER_OF_MENU_ITEMS; i++) { // Get the menu item JMenuItem recentFile = (JMenuItem) menuItems.get(i); // Find and set the file for this recent file command String recentFilePath = getRecentFile(i); if (recentFilePath != null) { File file = new File(recentFilePath); String sb = String.valueOf(i + 1) + " " + //$NON-NLS-1$ getMenuItemDisplayName(file); // Index before file name recentFile.setText(sb); recentFile.setToolTipText(recentFilePath); recentFile.setEnabled(true); recentFile.setVisible(true); } else { recentFile.setEnabled(false); recentFile.setVisible(false); } } }
testFile = testFileOpt.getArgument(); if (USE_LAST_JMX.equals(testFile)) { testFile = LoadRecentProject.getRecentFile(0);// most recent