View Javadoc

1   /*
2    *  nextobjects Copyright (C) 2001-2005 Emmanuel Florent
3    *  This program is free software; you can redistribute it and/or modify
4    *  it under the terms of the GNU General Public License as published by the
5    *  Free Software Foundation; either version 2 of the License, or (at your
6    *  option) any later version.
7    *  This program is distributed in the hope that it will
8    *  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
9    *  of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10   *  PURPOSE. See the GNU General Public License for more details.
11   *  You should have received a copy of the GNU General Public License along
12   *  with this program; if not, write to the Free Software Foundation, Inc., 59
13   *  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14   */
15  package org.devaki.nextobjects.ui.menus;
16  import java.awt.Event;
17  import java.awt.event.ActionEvent;
18  import java.awt.event.ActionListener;
19  import java.awt.event.KeyEvent;
20  import java.io.File;
21  import java.util.ArrayList;
22  import java.util.ListIterator;
23  import javax.swing.JCheckBoxMenuItem;
24  import javax.swing.JMenuBar;
25  import javax.swing.JSeparator;
26  import javax.swing.KeyStroke;
27  import org.devaki.nextobjects.constants.CstImages;
28  import org.devaki.nextobjects.ui.main.TaskChooser;
29  import org.devaki.nextobjects.ui.components.CustomMenu;
30  import org.devaki.nextobjects.ui.components.CustomMenuItem;
31  import org.devaki.nextobjects.ui.others.AboutNO;
32  import org.devaki.nextobjects.ui.others.HelpNO;
33  import org.devaki.nextobjects.ui.toolbars.NOToolBar1;
34  import org.devaki.nextobjects.ui.workspace.models.EditorFactory;
35  import org.devaki.nextobjects.util.MeriseTransform;
36  import org.devaki.nextobjects.util.ModelMan;
37  import org.devaki.nextobjects.util.NOFileManager;
38  import org.devaki.nextobjects.util.NOClipboard;
39  import org.devaki.nextobjects.util.NOPreferences;
40  import org.devaki.nextobjects.util.TorqueWrapper;
41  import org.devaki.nextobjects.workspace.models.ConceptualModel;
42  import org.devaki.nextobjects.workspace.models.PhysicalModel;
43  /***
44   *  Description of the Class
45   *
46   * @author     eflorent
47   * @created    December 26, 2003
48   */
49  public class NOMenuBar extends JMenuBar
50  {
51      /***  Component jMenuFile */
52      private static CustomMenu jMenuFile = new CustomMenu("File", KeyEvent.VK_F);
53      /***  Component jMenuFileNew */
54      private static CustomMenu jMenuFileNew =
55          new CustomMenu("New", KeyEvent.VK_N, CstImages.ICN_NEW);
56      /***  Component jMenuRecent */
57      private static CustomMenu jMenuRecent =
58          new CustomMenu("Recent Files", KeyEvent.VK_1, CstImages.ICN_OPEN);
59      /***  Component jMenuEdit */
60      private static CustomMenu jMenuEdit = new CustomMenu("Edit", KeyEvent.VK_E);
61      /***  Component jMenuSettings */
62      private static CustomMenu jMenuSettings =
63          new CustomMenu("Settings", KeyEvent.VK_S);
64      /***  Component jMenuModel */
65      private static CustomMenu jMenuModel =
66          new CustomMenu("Model", KeyEvent.VK_M);
67      /***  Component jMenuHelp * */
68      private static CustomMenu jMenuHelp = new CustomMenu("Help", KeyEvent.VK_H);
69      /***  Menu Item jMenuItemNewCDM * */
70      private static CustomMenuItem jMenuItemNewCDM =
71          new CustomMenuItem(
72              "New CDM",
73              CstImages.ICN_CDM,
74              KeyEvent.VK_C,
75              KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK),
76              true);
77      /***  Menu Item jMenuItemNewPDM * */
78      private static CustomMenuItem jMenuItemNewPDM =
79          new CustomMenuItem(
80              "New PDM",
81              CstImages.ICN_PDM,
82              KeyEvent.VK_P,
83              KeyStroke.getKeyStroke(
84                  KeyEvent.VK_N,
85                  Event.CTRL_MASK + Event.SHIFT_MASK),
86              true);
87      /***  Menu Item jMenuItemOpen * */
88      private static CustomMenuItem jMenuItemOpen =
89          new CustomMenuItem(
90              "Open File...",
91              CstImages.ICN_OPEN,
92              KeyEvent.VK_O,
93              KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK),
94              true);
95      /***  Menu Item jMenuItemSave * */
96      private static CustomMenuItem jMenuItemSave =
97          new CustomMenuItem(
98              "Save",
99              CstImages.ICN_SAVE,
100             KeyEvent.VK_S,
101             KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK),
102             false);
103     /***  Menu Item jMenuItemSaveAs* */
104     private static CustomMenuItem jMenuItemSaveAs =
105         new CustomMenuItem("Save As...", KeyEvent.VK_A, false);
106     /***  Menu Item jMenuItemExit * */
107     private static CustomMenuItem jMenuItemExit =
108         new CustomMenuItem(
109             "Exit",
110             KeyEvent.VK_X,
111             KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK),
112             true);
113     /***  Menu Item jMenuItemUndo */
114     private static CustomMenuItem jMenuItemUndo =
115         new CustomMenuItem(
116             "Undo",
117             null,
118             KeyEvent.VK_P,
119             KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK),
120             false);
121     /***  Menu Item jMenuItemRedo */
122     private static CustomMenuItem jMenuItemRedo =
123         new CustomMenuItem(
124             "Redo",
125             null,
126             KeyEvent.VK_Y,
127             KeyStroke.getKeyStroke(KeyEvent.VK_Y, Event.CTRL_MASK),
128             false);
129     /***  Menu Item jMenuItemCut* */
130     private static CustomMenuItem jMenuItemCut =
131         new CustomMenuItem(
132             "Cut",
133             CstImages.ICN_CUT,
134             KeyEvent.VK_T,
135             KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK),
136             false);
137     /***  Menu Item jMenuItemCopy* */
138     private static CustomMenuItem jMenuItemCopy =
139         new CustomMenuItem(
140             "Copy",
141             CstImages.ICN_COPY,
142             KeyEvent.VK_C,
143             KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK),
144             false);
145     /***  Menu Item jMenuItemPaste* */
146     private static CustomMenuItem jMenuItemPaste =
147         new CustomMenuItem(
148             "Paste",
149             CstImages.ICN_PASTE,
150             KeyEvent.VK_P,
151             KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK),
152             false);
153     /***  Menu Item jMenuItemDelete* */
154     private static CustomMenuItem jMenuItemDelete =
155         new CustomMenuItem(
156             "Delete",
157             KeyEvent.VK_D,
158             KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
159             true);
160     /***  Menu Item jMenuItemPref * */
161     private static CustomMenuItem jMenuItemPref =
162         new CustomMenuItem("Preferences ...", KeyEvent.VK_R, null, true);
163     /***  Menu Item jMenuItemVerify * */
164     private static CustomMenuItem jMenuItemVerify =
165         new CustomMenuItem(
166             "Verify...",
167             KeyEvent.VK_V,
168             KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0),
169             false);
170     /***  Menu Item jMenuItemGeneratePDM* */
171     private static CustomMenuItem jMenuItemGeneratePDM =
172         new CustomMenuItem(
173             "Generate PDM...",
174             KeyEvent.VK_P,
175             KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0),
176             false);
177     /***  Menu Item jMenuItemGenerateSQL* */
178     private static CustomMenuItem jMenuItemGenerateSQL =
179         new CustomMenuItem(
180             "Generate SQL...",
181             KeyEvent.VK_S,
182             KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0),
183             false);
184     /***  Menu Item jMenuItemGenerateObjectModel * */
185     private static CustomMenuItem jMenuItemGenerateObjectModel =
186         new CustomMenuItem(
187             "Generate Object-Model...",
188             KeyEvent.VK_O,
189             KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0),
190             false);
191     /***  Menu Item jMenuItemGenerateDoc* */
192     private static CustomMenuItem jMenuItemGenerateDoc =
193         new CustomMenuItem(
194             "Generate Docs...",
195             KeyEvent.VK_S,
196             KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0),
197             false);
198     /***  Menu Item jMenuItemGenerateDTD* */
199     private static CustomMenuItem jMenuItemGenerateDTD =
200         new CustomMenuItem(
201             "Generate Data DTD...",
202             KeyEvent.VK_O,
203             KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0),
204             false);
205     /***  Menu Item jMenuItemGenOjb * */
206     private static CustomMenuItem jMenuItemGenOjb =
207         new CustomMenuItem("Generate OJB + rep ...", KeyEvent.VK_O, false);
208     /***  Menu Item * */
209     private static CustomMenuItem mnuItCustm =
210         new CustomMenuItem("Torque-gen ...", KeyEvent.VK_F6, false);
211     /***  Menu Item jMenuItemMakeClean * */
212     private static CustomMenuItem jMenuItemMakeClean =
213         new CustomMenuItem(
214             "Make clean...",
215             KeyEvent.VK_O,
216             KeyStroke.getKeyStroke(KeyEvent.VK_MULTIPLY, 0),
217             false);
218     /***  Menu Item jMenuItemProjectPreferences * */
219     private static CustomMenuItem jMenuItemProjectPreferences =
220         new CustomMenuItem("Project Preferences", KeyEvent.VK_F, false);
221     /***  Menu Item jMenuItemHelpTopics * */
222     private static CustomMenuItem jMenuItemHelpTopics =
223         new CustomMenuItem(
224             "Help Topics",
225             CstImages.ICN_HELP,
226             KeyEvent.VK_H,
227             true);
228     /***  Menu Item jMenuItemAbout * */
229     private static CustomMenuItem jMenuItemAbout =
230         new CustomMenuItem("About nextObjects...", KeyEvent.VK_A, true);
231     /***  Check Box SAve on exit */
232     private static JCheckBoxMenuItem jCheckBoxMenuItemSaveOnExit =
233         new JCheckBoxMenuItem("Save On Exit", true);
234     /***  chekcbox enable loggin */
235     private static JCheckBoxMenuItem jCheckBoxMenuItemEnableLogging =
236         new JCheckBoxMenuItem("Enable Logging", true);
237     /***  Construct a new 'NOMenuBar' object */
238     public NOMenuBar()
239     {
240         /***  Components * */
241         // Check Box Menu Items
242         jCheckBoxMenuItemSaveOnExit.setState(true);
243         jCheckBoxMenuItemEnableLogging.setState(true);
244         /***  Listeners * */
245         // Action Listeners
246         jMenuItemDelete.addActionListener(new ActionListener()
247         {
248             public final void actionPerformed(final ActionEvent e)
249             {
250                 if (ModelMan.getCurrentModel() instanceof ConceptualModel)
251                 {
252                     ModelMan.delete();
253                     ((ConceptualModel) ModelMan.getCurrentModel())
254                         .getModelView()
255                         .repaint();
256                 }
257                 else
258                     if (ModelMan.getCurrentModel() instanceof PhysicalModel)
259                     {
260                         ModelMan.delete();
261                         ((PhysicalModel) ModelMan.getCurrentModel())
262                             .getModelView()
263                             .repaint();
264                     }
265             }
266         });
267         jMenuItemNewCDM.addActionListener(new ActionListener()
268         {
269             public final void actionPerformed(final ActionEvent e)
270             {
271                 NOFileManager.newConceptualModel();
272                 fixFileMenu();
273             }
274         });
275         jMenuItemNewPDM.addActionListener(new ActionListener()
276         {
277             public final void actionPerformed(final ActionEvent e)
278             {
279                 NOFileManager.newPhysicalModel();
280                 fixFileMenu();
281             }
282         });
283         jMenuItemOpen.addActionListener(new ActionListener()
284         {
285             public final void actionPerformed(final ActionEvent e)
286             {
287                 NOFileManager.openModel();
288                 fixFileMenu();
289             }
290         });
291         jMenuItemSave.addActionListener(new ActionListener()
292         {
293             public final void actionPerformed(final ActionEvent e)
294             {
295                 NOFileManager.save(ModelMan.getCurrentModel());
296                 fixFileMenu();
297             }
298         });
299         jMenuItemSaveAs.addActionListener(new ActionListener()
300         {
301             public final void actionPerformed(final ActionEvent e)
302             {
303                 NOFileManager.saveToFile();
304                 fixFileMenu();
305             }
306         });
307         jMenuItemExit.addActionListener(new ActionListener()
308         {
309             public final void actionPerformed(final ActionEvent e)
310             {
311                 NOFileManager.goodbye();
312             }
313         });
314         jMenuItemCut.addActionListener(new ActionListener()
315         {
316             public final void actionPerformed(final ActionEvent e)
317             {
318                 NOClipboard.cut(ModelMan.getCurrentObjects());
319                 ModelMan.getCurrentModel().getPanel().repaint();
320                 NOToolBar1.fixIcons();
321                 fixEditMenu();
322             }
323         });
324         jMenuItemCopy.addActionListener(new ActionListener()
325         {
326             public final void actionPerformed(final ActionEvent e)
327             {
328                 NOClipboard.copy(ModelMan.getCurrentObjects());
329                 ModelMan.getCurrentModel().getPanel().repaint();
330                 NOToolBar1.fixIcons();
331                 fixEditMenu();
332             }
333         });
334         jMenuItemPaste.addActionListener(new ActionListener()
335         {
336             public final void actionPerformed(final ActionEvent e)
337             {
338                 NOClipboard.pasteBaseObject(5350, 2750);
339                 ModelMan.getCurrentModel().getPanel().repaint();
340             }
341         });
342         jMenuItemRedo.addActionListener(new ActionListener()
343         {
344             public final void actionPerformed(final ActionEvent e)
345             {
346                 ModelMan.getCurrentModel().getRedoLog().redo();
347             }
348         });
349         jMenuItemUndo.addActionListener(new ActionListener()
350         {
351             public final void actionPerformed(final ActionEvent e)
352             {
353                 ModelMan.getCurrentModel().getRedoLog().undo();
354             }
355         });
356         jCheckBoxMenuItemSaveOnExit.addActionListener(new ActionListener()
357         {
358             public final void actionPerformed(final ActionEvent e)
359             {
360                 NOPreferences.setProperty(
361                     "nextobjects.io.saveOnExit",
362                     new Boolean(
363                         (!new Boolean(NOPreferences
364                             .getProperty("nextobjects.io.saveOnExit"))
365                             .booleanValue()))
366                         .toString());
367             }
368         });
369         jMenuItemPref.addActionListener(new ActionListener()
370         {
371             public final void actionPerformed(final ActionEvent e)
372             {
373                 AboutNO abo = new AboutNO();
374                 abo.showPref();
375                 abo.setVisible(true);
376             }
377         });
378         jMenuItemVerify.addActionListener(new ActionListener()
379         {
380             public final void actionPerformed(final ActionEvent e)
381             {
382                 ModelMan.verify(ModelMan.getCurrentModel());
383                 fixModelMenu();
384             }
385         });
386         jMenuItemGeneratePDM.addActionListener(new ActionListener()
387         {
388             public final void actionPerformed(final ActionEvent e)
389             {
390                 MeriseTransform.cdm2pdm(
391                     (ConceptualModel) ModelMan.getCurrentModel());
392             }
393         });
394         jMenuItemGenerateSQL.addActionListener(new ActionListener()
395         {
396             public final void actionPerformed(final ActionEvent e)
397             {
398                 if (ModelMan.getCurrentModel() instanceof PhysicalModel)
399                 {
400 					TorqueWrapper tw= new TorqueWrapper();
401                     tw.genSQL(
402                         (PhysicalModel) ModelMan.getCurrentModel());
403                     tw=null;
404                 }
405             }
406         });
407         jMenuItemGenerateObjectModel.addActionListener(new ActionListener()
408         {
409             public final void actionPerformed(final ActionEvent e)
410             {
411 				TorqueWrapper tw= new TorqueWrapper();
412 				tw.genObjectModel(
413 				(PhysicalModel) ModelMan.getCurrentModel());
414 				tw=null;
415             }
416         });
417         jMenuItemGenerateDoc.addActionListener(new ActionListener()
418         {
419             public final void actionPerformed(final ActionEvent e)
420             {
421 				TorqueWrapper tw= new TorqueWrapper();
422 				tw.genDoc(
423 				(PhysicalModel) ModelMan.getCurrentModel());
424 				tw=null;
425             }
426         });
427         jMenuItemGenOjb.addActionListener(new ActionListener()
428         {
429             public final void actionPerformed(final ActionEvent e)
430             {
431 				TorqueWrapper tw= new TorqueWrapper();
432 				tw.genOjb(
433 				(PhysicalModel) ModelMan.getCurrentModel());
434 				tw=null;                    
435             }
436         });
437         jMenuItemGenerateDTD.addActionListener(new ActionListener()
438         {
439             public final void actionPerformed(final ActionEvent e)
440             {
441 				TorqueWrapper tw= new TorqueWrapper();
442 				tw.genDTD(
443 				(PhysicalModel) ModelMan.getCurrentModel());
444 				tw=null;                      
445             }
446         });
447         mnuItCustm.addActionListener(new ActionListener()
448         {
449             public final void actionPerformed(final ActionEvent e)
450             {
451                 TaskChooser taskChoos = new TaskChooser();
452                 taskChoos.show();
453             }
454         });
455         jMenuItemMakeClean.addActionListener(new ActionListener()
456         {
457             public final void actionPerformed(final ActionEvent e)
458             {                
459 				TorqueWrapper tw= new TorqueWrapper();
460 				tw.clean();
461 				tw=null;    
462             }
463         });
464         jMenuItemProjectPreferences.addActionListener(new ActionListener()
465         {
466             public final void actionPerformed(final ActionEvent e)
467             {
468                 if (ModelMan.getCurrentModel() != null)
469                 {
470                     EditorFactory.getModelEdit();
471                 }
472             }
473         });
474         jMenuItemHelpTopics.addActionListener(new ActionListener()
475         {
476             public final void actionPerformed(final ActionEvent e)
477             {
478                 (new HelpNO()).setVisible(true);
479             }
480         });
481         jMenuItemAbout.addActionListener(new ActionListener()
482         {
483             public final void actionPerformed(final ActionEvent e)
484             {
485                 (new AboutNO()).setVisible(true);
486             }
487         });
488         /***  Assembling Components * */
489         // jMenuFileNew
490         jMenuFileNew.add(jMenuItemNewCDM);
491         jMenuFileNew.add(jMenuItemNewPDM);
492         // jMenuFile
493         jMenuFile.add(jMenuFileNew);
494         jMenuFile.add(new JSeparator());
495         jMenuFile.add(jMenuItemOpen);
496         jMenuFile.add(new JSeparator());
497         jMenuFile.add(jMenuRecent);
498         jMenuFile.add(new JSeparator());
499         jMenuFile.add(jMenuItemSave);
500         jMenuFile.add(jMenuItemSaveAs);
501         jMenuFile.add(new JSeparator());
502         jMenuFile.add(jMenuItemExit);
503         // jMenuEdit
504         jMenuEdit.add(jMenuItemDelete);
505         jMenuEdit.add(jMenuItemUndo);
506         jMenuEdit.add(jMenuItemRedo);
507         jMenuEdit.add(jMenuItemCut);
508         jMenuEdit.add(jMenuItemCopy);
509         jMenuEdit.add(jMenuItemPaste);
510         jMenuEdit.add(jMenuItemDelete);
511         // jMenuSettings
512         jMenuSettings.add(jCheckBoxMenuItemEnableLogging);
513         jCheckBoxMenuItemEnableLogging.setEnabled(false);
514         jMenuSettings.add(jCheckBoxMenuItemSaveOnExit);
515         jMenuSettings.add(jMenuItemPref);
516         // jMenuModel
517         jMenuModel.add(jMenuItemVerify);
518         jMenuModel.add(jMenuItemGeneratePDM);
519         jMenuModel.add(jMenuItemGenerateSQL);
520         jMenuModel.add(jMenuItemGenerateObjectModel);
521         jMenuModel.add(jMenuItemGenerateDTD);
522         jMenuModel.add(jMenuItemGenerateDoc);
523         jMenuModel.add(jMenuItemGenOjb);
524         jMenuModel.add(mnuItCustm);
525         jMenuModel.add(jMenuItemMakeClean);
526         jMenuModel.add(new JSeparator());
527         jMenuModel.add(jMenuItemProjectPreferences);
528         // jMenuHelp
529         jMenuHelp.add(jMenuItemHelpTopics);
530         jMenuHelp.add(jMenuItemAbout);
531         // jMenuBar
532         this.add(jMenuFile);
533         this.add(jMenuEdit);
534         this.add(jMenuSettings);
535         this.add(jMenuModel);
536         this.add(jMenuHelp);
537     }
538     /***
539      *  Is automatic save checked shoudl disapr from here profit to NOTTools
540      */
541     /***  Fix 'jMenuFile' */
542     public static void fixFileMenu()
543     {
544         // disable logging disabling.
545         jCheckBoxMenuItemEnableLogging.setEnabled(false);
546         if (ModelMan.getCurrentModel() != null)
547         {
548             jMenuItemSave.setEnabled(
549                 ModelMan.getCurrentModel().getFileForSave() != null);
550             jMenuItemSaveAs.setEnabled(ModelMan.getCurrentModel() != null);
551         }
552     }
553     /***  Fix 'jMenuEdit' */
554     public static void fixEditMenu()
555     {
556         jMenuItemUndo.setEnabled(ModelMan.getCurrentObject() != null);
557         jMenuItemRedo.setEnabled(ModelMan.getCurrentObject() != null);
558         jMenuItemCut.setEnabled(ModelMan.getCurrentObject() != null);
559         jMenuItemCopy.setEnabled(ModelMan.getCurrentObject() != null);
560         jMenuItemPaste.setEnabled(
561             NOClipboard.isBaseObjectClipped()
562                 && ModelMan.getCurrentModel() != null);
563     }
564     /***  Fix 'jMenuModel' */
565     public static void fixModelMenu()
566     {
567         jMenuItemGeneratePDM.setEnabled(
568             ModelMan.getCurrentModel() instanceof ConceptualModel
569                 && ModelMan.getCurrentModel().isVerified());
570         jMenuItemProjectPreferences.setEnabled(
571             ModelMan.getCurrentModel() != null);
572         jMenuItemGenerateSQL.setEnabled(
573             ModelMan.getCurrentModel() instanceof PhysicalModel
574                 && ModelMan.getCurrentModel().isVerified());
575         jMenuItemGenerateObjectModel.setEnabled(
576             ModelMan.getCurrentModel() instanceof PhysicalModel
577                 && ModelMan.getCurrentModel().isVerified());
578         jMenuItemGenerateDoc.setEnabled(
579             ModelMan.getCurrentModel() instanceof PhysicalModel
580                 && ModelMan.getCurrentModel().isVerified());
581         jMenuItemGenerateDTD.setEnabled(
582             ModelMan.getCurrentModel() instanceof PhysicalModel
583                 && ModelMan.getCurrentModel().isVerified());
584         jMenuItemGenOjb.setEnabled(
585             ModelMan.getCurrentModel() instanceof PhysicalModel
586                 && ModelMan.getCurrentModel().isVerified());
587         mnuItCustm.setEnabled(
588             ModelMan.getCurrentModel() instanceof PhysicalModel
589                 && ModelMan.getCurrentModel().isVerified());
590         jMenuItemVerify.setEnabled(ModelMan.getCurrentModel() != null);
591         jMenuItemMakeClean.setEnabled(true);
592     }
593     /***
594      *  Adds a feature to the Recent attribute of the NOMenuBar class
595      *
596      * @param  list  The feature to be added to the Recent attribute
597      */
598     public static void addRecent(final ArrayList list)
599     {
600         jMenuRecent.removeAll();
601         ListIterator i = list.listIterator();
602         while (i.hasNext())
603         {
604             CustomMenuItem jMenuItemRecentFile;
605             final String filePath = i.next().toString();
606             jMenuRecent.add(
607                 jMenuItemRecentFile =
608                     new CustomMenuItem(filePath, KeyEvent.VK_0, true));
609             if (filePath.endsWith("cdm"))
610             {
611                 jMenuItemRecentFile.setIcon(CstImages.ICN_CDM);
612             }
613             else
614             {
615                 jMenuItemRecentFile.setIcon(CstImages.ICN_PDM);
616             }
617             jMenuItemRecentFile.addActionListener(new ActionListener()
618             {
619                 public final void actionPerformed(final ActionEvent e)
620                 {
621                     NOFileManager.openModelFile(new File(filePath), true);
622                     fixFileMenu();
623                 }
624             });
625         }
626     }
627 }