/** * This method initializes jMenu * * @return javax.swing.JMenu */ private JMenu getRecentlyOpenFilesMenu() { if (recentlyOpenFilesMenu == null) { recentlyOpenFilesMenu = new JMenu(); recentlyOpenFilesMenu.getPopupMenu().setLightWeightPopupEnabled(false); recentlyOpenFilesMenu.setText("Recently opened"); RecentlyOpenedFilesUtil.constructRecentlyFilesMenuItems( recentlyOpenFilesMenu, miscFilesOpened); } else { RecentlyOpenedFilesUtil.constructRecentlyFilesMenuItems( recentlyOpenFilesMenu, miscFilesOpened); } return recentlyOpenFilesMenu; }
private void storeRecentlyOpenedFiles() { String recentlyOpenedFiles; LinkedHashMap<JMenuItem, File> hMap; String header; recentlyOpenedFiles = ConfigFetch.resolvePathBasedOnConfigFile(RECENTLY_OPENED_3D); hMap = miscFilesOpened; header = "Recently opened 3D files."; RecentlyOpenedFilesUtil.storeRecentlyOpenedFiles(recentlyOpenedFiles, hMap, header); }
public boolean update3dFilesOpened(File fx) { openedFile = fx; RecentlyOpenedFilesUtil.updateFilesOpenedMenuItems( fx, miscFilesOpened, new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { File fx; Object key = e.getSource(); File value = miscFilesOpened.get(key); if (value instanceof File) { fx = (File) value; openFile(fx); } else return; } }); getRecentlyOpenFilesMenu(); storeRecentlyOpenedFiles(); return true; }
/** @param type */ private void loadRecentlyOpenedFiles() { String recentlyOpenedFiles = ConfigFetch.resolvePath(RECENTLY_OPENED_3D); Method methodUpdate = null; try { Class<?>[] params = {File.class}; methodUpdate = this.getClass().getMethod("update3dFilesOpened", params); } catch (Exception e) { NeptusLog.pub().error(this + "loadRecentlyOpenedFiles", e); return; } if (recentlyOpenedFiles == null) { // JOptionPane.showInternalMessageDialog(this, "Cannot Load"); return; } if (!new File(recentlyOpenedFiles).exists()) return; RecentlyOpenedFilesUtil.loadRecentlyOpenedFiles(recentlyOpenedFiles, methodUpdate, this); }