Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
  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);
  }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
  /** @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);
  }