]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/ModuleEditor/src/org/tianocore/packaging/module/ui/ModuleMain.java
1. Modify start script to
[mirror_edk2.git] / Tools / Source / ModuleEditor / src / org / tianocore / packaging / module / ui / ModuleMain.java
1 /** @file
2
3 The main GUI for module editor.
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 package org.tianocore.packaging.module.ui;
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.MouseEvent;
20 import java.awt.event.MouseListener;
21 import java.awt.event.WindowEvent;
22 import java.io.File;
23 import java.io.IOException;
24
25 import javax.swing.JButton;
26 import javax.swing.JDesktopPane;
27 import javax.swing.JFileChooser;
28 import javax.swing.JInternalFrame;
29 import javax.swing.JMenu;
30 import javax.swing.JMenuBar;
31 import javax.swing.JMenuItem;
32 import javax.swing.JOptionPane;
33 import javax.swing.JPanel;
34 import javax.swing.JPopupMenu;
35 import javax.swing.JScrollPane;
36 import javax.swing.border.BevelBorder;
37 import javax.swing.event.TreeSelectionEvent;
38 import javax.swing.event.TreeSelectionListener;
39
40 import org.apache.xmlbeans.XmlCursor;
41 import org.apache.xmlbeans.XmlException;
42 import org.apache.xmlbeans.XmlObject;
43 import org.apache.xmlbeans.XmlOptions;
44 import org.tianocore.BootModesDocument;
45 import org.tianocore.BuildOptionsDocument;
46 import org.tianocore.DataHubsDocument;
47 import org.tianocore.EventsDocument;
48 import org.tianocore.ExternsDocument;
49 import org.tianocore.FormsetsDocument;
50 import org.tianocore.GuidsDocument;
51 import org.tianocore.HobsDocument;
52 import org.tianocore.IncludesDocument;
53 import org.tianocore.LibrariesDocument;
54 import org.tianocore.LibraryClassDefinitionsDocument;
55 import org.tianocore.LibraryModuleBuildDescriptionDocument;
56 import org.tianocore.LibraryModuleSurfaceAreaDocument;
57 import org.tianocore.MbdHeaderDocument;
58 import org.tianocore.MbdLibHeaderDocument;
59 import org.tianocore.ModuleBuildDescriptionDocument;
60 import org.tianocore.ModuleSurfaceAreaDocument;
61 import org.tianocore.MsaHeaderDocument;
62 import org.tianocore.MsaLibHeaderDocument;
63 import org.tianocore.PCDsDocument;
64 import org.tianocore.PPIsDocument;
65 import org.tianocore.ProtocolsDocument;
66 import org.tianocore.SourceFilesDocument;
67 import org.tianocore.SystemTablesDocument;
68 import org.tianocore.VariablesDocument;
69 import org.tianocore.common.IFileFilter;
70 import org.tianocore.common.Log;
71 import org.tianocore.packaging.common.ui.IDefaultMutableTreeNode;
72 import org.tianocore.packaging.common.ui.IDesktopManager;
73 import org.tianocore.packaging.common.ui.IFrame;
74 import org.tianocore.packaging.common.ui.ITree;
75 import org.tianocore.packaging.workspace.common.Workspace;
76
77 /**
78 The class is used to show main GUI of ModuleEditor
79 It extends IFrame implements MouseListener, TreeSelectionListener
80
81 @since ModuleEditor 1.0
82
83 **/
84 public class ModuleMain extends IFrame implements MouseListener, TreeSelectionListener {
85 ///
86 /// Define class Serial Version UID
87 ///
88 private static final long serialVersionUID = -7103240960573031772L;
89
90 //
91 //Define class members
92 //
93 private String currentModule = "";
94
95 private String saveFileName = "";
96
97 ///
98 /// 0 - reserved; 1 - msa; 2 - mbd; 3 - lmsa; 4 - lmbd;
99 ///
100 private int currentModuleType = 0;
101
102 private int currentNodeType = -1;
103
104 private String windowTitle = "ModuleEditor 1.0 ";
105
106 private ModuleSurfaceAreaDocument xmlMsaDoc = null;
107
108 private ModuleBuildDescriptionDocument xmlMbdDoc = null;
109
110 private LibraryModuleSurfaceAreaDocument xmlMlsaDoc = null;
111
112 private LibraryModuleBuildDescriptionDocument xmlMlbdDoc = null;
113
114 private MsaHeaderDocument.MsaHeader xmlmh = null;
115
116 private MbdHeaderDocument.MbdHeader xmlmbdh = null;
117
118 private MsaLibHeaderDocument.MsaLibHeader xmlmlh = null;
119
120 private MbdLibHeaderDocument.MbdLibHeader xmlmlbdh = null;
121
122 private LibraryClassDefinitionsDocument.LibraryClassDefinitions xmllcd = null;
123
124 private LibrariesDocument.Libraries xmllib = null;
125
126 private SourceFilesDocument.SourceFiles xmlsf = null;
127
128 private IncludesDocument.Includes xmlic = null;
129
130 private ProtocolsDocument.Protocols xmlpl = null;
131
132 private EventsDocument.Events xmlen = null;
133
134 private HobsDocument.Hobs xmlhob = null;
135
136 private PPIsDocument.PPIs xmlppi = null;
137
138 private VariablesDocument.Variables xmlvb = null;
139
140 private BootModesDocument.BootModes xmlbm = null;
141
142 private SystemTablesDocument.SystemTables xmlst = null;
143
144 private DataHubsDocument.DataHubs xmldh = null;
145
146 private FormsetsDocument.Formsets xmlfs = null;
147
148 private GuidsDocument.Guids xmlgu = null;
149
150 private ExternsDocument.Externs xmlet = null;
151
152 private PCDsDocument.PCDs xmlpcd = null;
153
154 private BuildOptionsDocument.BuildOptions xmlbo = null;
155
156 IDefaultMutableTreeNode dmtnRoot = null;
157
158 private JPanel jContentPane = null;
159
160 private JMenuBar jMenuBar = null;
161
162 private JMenu jMenuModule = null;
163
164 private JMenu jMenuModuleNew = null;
165
166 private JMenuItem jMenuItemModuleNewModule = null;
167
168 private JMenuItem jMenuItemModuleSaveAs = null;
169
170 private JMenuItem jMenuItemModuleExit = null;
171
172 private JMenu jMenuEdit = null;
173
174 private JMenuItem jMenuItemEditAddLibraryClassDefinitions = null;
175
176 private JMenuItem jMenuItemEditAddSourceFiles = null;
177
178 private JMenuItem jMenuItemEditAddIncludes = null;
179
180 private JMenuItem jMenuItemEditAddProtocols = null;
181
182 private JMenuItem jMenuItemEditAddEvents = null;
183
184 private JMenuItem jMenuItemEditAddHobs = null;
185
186 private JMenuItem jMenuItemEditAddPPIs = null;
187
188 private JMenuItem jMenuItemEditAddVariables = null;
189
190 private JMenuItem jMenuItemEditAddBootModes = null;
191
192 private JMenuItem jMenuItemEditAddSystemTables = null;
193
194 private JMenuItem jMenuItemEditAddDataHubs = null;
195
196 private JMenuItem jMenuItemEditAddFormsets = null;
197
198 private JMenuItem jMenuItemEditAddGuids = null;
199
200 private JMenuItem jMenuItemEditAddExterns = null;
201
202 private JMenuItem jMenuItemEditAddPCDs = null;
203
204 private JDesktopPane jDesktopPane = null;
205
206 private IDesktopManager iDesktopManager = new IDesktopManager();
207
208 private JScrollPane jScrollPaneTree = null;
209
210 private ITree iTree = null;
211
212 private JMenu jMenuHelp = null;
213
214 private JMenuItem jMenuItemHelpAbout = null;
215
216 private JMenu jMenuEditAdd = null;
217
218 private JMenuItem jMenuItemEditDelete = null;
219
220 private JMenuItem jMenuItemEditUpdate = null;
221
222 private JPopupMenu jPopupMenu = null;
223
224 private JMenuItem jMenuItemPopupAdd = null;
225
226 private JMenuItem jMenuItemPopupUpdate = null;
227
228 private JMenuItem jMenuItemPopupDelete = null;
229
230 private Workspace ws = new Workspace();
231
232 private static final int OPENED = 0;
233
234 private static final int CLOSED = 1;
235
236 private static final int NEW_WITHOUT_CHANGE = 2;
237
238 private static final int NEW_WITH_CHANGE = 3;
239
240 private static final int UPDATE_WITHOUT_CHANGE = 4;
241
242 private static final int UPDATE_WITH_CHANGE = 5;
243
244 private static final int SAVE_WITHOUT_CHANGE = 6;
245
246 private static final int SAVE_WITH_CHANGE = 7;
247
248 private static final int ADD = 1;
249
250 private static final int UPDATE = 2;
251
252 //private static final int DELETE = 3;
253
254 private static final int VIEW = 4;
255
256 private MsaHeader msa = null;
257
258 private MbdHeader mbd = null;
259
260 private MsaLibHeader mlsa = null;
261
262 private MbdLibHeader mlbd = null;
263
264 private ModuleLibraryClassDefinitions mlcd = null;
265
266 private MbdLibraries mlib = null;
267
268 private ModuleSourceFiles msf = null;
269
270 private ModuleIncludes mic = null;
271
272 private ModuleProtocols mp = null;
273
274 private ModuleEvents mev = null;
275
276 private ModuleHobs mh = null;
277
278 private ModulePpis mpp = null;
279
280 private ModuleVariables mv = null;
281
282 private ModuleBootModes mbm = null;
283
284 private ModuleSystemTables mst = null;
285
286 private ModuleDataHubs mdh = null;
287
288 private ModuleFormsets mf = null;
289
290 private ModuleGuids mg = null;
291
292 private ModuleExterns met = null;
293
294 private ModulePCDs mpcd = null;
295
296 private JMenuItem jMenuItemModuleOpenModule = null;
297
298 private JMenuItem jMenuItemModuleNewModuleBuildDescription = null;
299
300 private JMenuItem jMenuItemModuleNewLibraryModule = null;
301
302 private JMenuItem jMenuItemModuleNewLibraryModuleBuildDescription = null;
303
304 private JMenu jMenuModuleOpen = null;
305
306 private JMenuItem jMenuItemModuleOpenModuleBuildDescription = null;
307
308 private JMenuItem jMenuItemModuleOpenLibraryModule = null;
309
310 private JMenuItem jMenuItemModuleOpenLibraryModuleBuildDescription = null;
311
312 private JMenuItem jMenuItemModuleSave = null;
313
314 private JMenuItem jMenuItemModuleClose = null;
315
316 private JMenu jMenuTools = null;
317
318 private JMenu jMenuWindow = null;
319
320 private JMenuItem jMenuItemEditAddLibraries = null;
321
322 private JPanel jPanelOperation = null;
323
324 private JButton jButtonOk = null;
325
326 private JButton jButtonCancel = null;
327
328 /**
329 This method initializes jMenuBar
330
331 @return javax.swing.JMenuBar Main menu bar for the entire GUI
332
333 **/
334 private JMenuBar getjJMenuBar() {
335 if (jMenuBar == null) {
336 jMenuBar = new JMenuBar();
337 jMenuBar.setPreferredSize(new java.awt.Dimension(0, 18));
338 jMenuBar.add(getJMenuModule());
339 jMenuBar.add(getJMenuEdit());
340 jMenuBar.add(getJMenuTools());
341 jMenuBar.add(getJMenuWindow());
342 jMenuBar.add(getJMenuHelp());
343 }
344 return jMenuBar;
345 }
346
347 /**
348 This method initializes jMenuFile
349
350 @return javax.swing.JMenu jMenuModule
351
352 **/
353 private JMenu getJMenuModule() {
354 if (jMenuModule == null) {
355 jMenuModule = new JMenu();
356 jMenuModule.setText("Module");
357 jMenuModule.add(getJMenuModuleNew());
358 jMenuModule.addSeparator();
359 jMenuModule.add(getJMenuModuleOpen());
360 jMenuModule.addSeparator();
361 jMenuModule.add(getJMenuItemModuleSave());
362 jMenuModule.add(getJMenuItemModuleSaveAs());
363 jMenuModule.addSeparator();
364 jMenuModule.add(getJMenuItemModuleClose());
365 jMenuModule.addSeparator();
366 jMenuModule.add(getJMenuItemModuleExit());
367 }
368 return jMenuModule;
369 }
370
371 /**
372 This method initializes jMenuItemModuleNewModule
373
374 @return javax.swing.JMenuItem jMenuItemModuleNewModule
375
376 **/
377 private JMenuItem getJMenuItemModuleNewModule() {
378 if (jMenuItemModuleNewModule == null) {
379 jMenuItemModuleNewModule = new JMenuItem();
380 jMenuItemModuleNewModule.setText("Module (.msa)");
381 jMenuItemModuleNewModule.addActionListener(this);
382 }
383 return jMenuItemModuleNewModule;
384 }
385
386 /**
387 This method initializes jMenuItemModuleSaveAs
388
389 @return javax.swing.JMenuItem jMenuItemModuleSaveAs
390
391 **/
392 private JMenuItem getJMenuItemModuleSaveAs() {
393 if (jMenuItemModuleSaveAs == null) {
394 jMenuItemModuleSaveAs = new JMenuItem();
395 jMenuItemModuleSaveAs.setText("Save As...");
396 jMenuItemModuleSaveAs.addActionListener(this);
397 jMenuItemModuleSaveAs.setEnabled(false);
398 }
399 return jMenuItemModuleSaveAs;
400 }
401
402 /**
403 This method initializes jMenuItemModuleExit
404
405 @return javax.swing.JMenuItem jMenuItemModuleExit
406
407 **/
408 private JMenuItem getJMenuItemModuleExit() {
409 if (jMenuItemModuleExit == null) {
410 jMenuItemModuleExit = new JMenuItem();
411 jMenuItemModuleExit.setText("Exit");
412 jMenuItemModuleExit.addActionListener(this);
413 }
414 return jMenuItemModuleExit;
415 }
416
417 /**
418 This method initializes jMenuEdit
419
420 @return javax.swing.JMenu jMenuEdit
421
422 **/
423 private JMenu getJMenuEdit() {
424 if (jMenuEdit == null) {
425 jMenuEdit = new JMenu();
426 jMenuEdit.setText("Edit");
427 jMenuEdit.add(getJMenu());
428 jMenuEdit.add(getJMenuItemEditUpdate());
429 jMenuEdit.add(getJMenuItemEditDelete());
430 }
431 return jMenuEdit;
432 }
433
434 /**
435 This method initializes jMenuItemEditAddLibraryClassDefinitions
436
437 @return javax.swing.JMenuItem jMenuItemEditAddLibraryClassDefinitions
438
439 **/
440 private JMenuItem getJMenuItemEditAddLibraryClassDefinitions() {
441 if (jMenuItemEditAddLibraryClassDefinitions == null) {
442 jMenuItemEditAddLibraryClassDefinitions = new JMenuItem();
443 jMenuItemEditAddLibraryClassDefinitions.setText("Library Class Definitions");
444 jMenuItemEditAddLibraryClassDefinitions.addActionListener(this);
445 }
446 return jMenuItemEditAddLibraryClassDefinitions;
447 }
448
449 /**
450 This method initializes jMenuItemEditAddSourceFiles
451
452 @return javax.swing.JMenuItem jMenuItemEditAddSourceFiles
453
454 **/
455 private JMenuItem getJMenuItemEditAddSourceFiles() {
456 if (jMenuItemEditAddSourceFiles == null) {
457 jMenuItemEditAddSourceFiles = new JMenuItem();
458 jMenuItemEditAddSourceFiles.setText("Source Files");
459 jMenuItemEditAddSourceFiles.addActionListener(this);
460 }
461 return jMenuItemEditAddSourceFiles;
462 }
463
464 /**
465 This method initializes jMenuItemEditAddIncludes
466
467 @return javax.swing.JMenuItem jMenuItemEditAddIncludes
468
469 **/
470 private JMenuItem getJMenuItemEditAddIncludes() {
471 if (jMenuItemEditAddIncludes == null) {
472 jMenuItemEditAddIncludes = new JMenuItem();
473 jMenuItemEditAddIncludes.setText("Includes");
474 jMenuItemEditAddIncludes.addActionListener(this);
475 }
476 return jMenuItemEditAddIncludes;
477 }
478
479 /**
480 This method initializes jMenuItemEditAddProtocols
481
482 @return javax.swing.JMenuItem jMenuItemEditAddProtocols
483
484 **/
485 private JMenuItem getJMenuItemEditAddProtocols() {
486 if (jMenuItemEditAddProtocols == null) {
487 jMenuItemEditAddProtocols = new JMenuItem();
488 jMenuItemEditAddProtocols.setText("Protocols");
489 jMenuItemEditAddProtocols.addActionListener(this);
490 }
491 return jMenuItemEditAddProtocols;
492 }
493
494 /**
495 This method initializes jMenuItemEditAddEvents
496
497 @return javax.swing.JMenuItem jMenuItemEditAddEvents
498
499 **/
500 private JMenuItem getJMenuItemEditAddEvents() {
501 if (jMenuItemEditAddEvents == null) {
502 jMenuItemEditAddEvents = new JMenuItem();
503 jMenuItemEditAddEvents.setText("Events");
504 jMenuItemEditAddEvents.addActionListener(this);
505 }
506 return jMenuItemEditAddEvents;
507 }
508
509 /**
510 This method initializes jMenuItemEditAddHobs
511
512 @return javax.swing.JMenuItem jMenuItemEditAddHobs
513
514 **/
515 private JMenuItem getJMenuItemEditAddHobs() {
516 if (jMenuItemEditAddHobs == null) {
517 jMenuItemEditAddHobs = new JMenuItem();
518 jMenuItemEditAddHobs.setText("Hobs");
519 jMenuItemEditAddHobs.addActionListener(this);
520 }
521 return jMenuItemEditAddHobs;
522 }
523
524 /**
525 This method initializes jMenuItemEditAddPPIs
526
527 @return javax.swing.JMenuItem jMenuItemEditAddPPIs
528
529 **/
530 private JMenuItem getJMenuItemEditAddPPIs() {
531 if (jMenuItemEditAddPPIs == null) {
532 jMenuItemEditAddPPIs = new JMenuItem();
533 jMenuItemEditAddPPIs.setText("PPIs");
534 jMenuItemEditAddPPIs.addActionListener(this);
535 }
536 return jMenuItemEditAddPPIs;
537 }
538
539 /**
540 This method initializes jMenuItemEditAddVariables
541
542 @return javax.swing.JMenuItem jMenuItemEditAddVariables
543
544 **/
545 private JMenuItem getJMenuItemEditAddVariables() {
546 if (jMenuItemEditAddVariables == null) {
547 jMenuItemEditAddVariables = new JMenuItem();
548 jMenuItemEditAddVariables.setText("Variables");
549 jMenuItemEditAddVariables.addActionListener(this);
550 }
551 return jMenuItemEditAddVariables;
552 }
553
554 /**
555 This method initializes jMenuItemEditAddBootModes
556
557 @return javax.swing.JMenuItem jMenuItemEditAddBootModes
558
559 **/
560 private JMenuItem getJMenuItemAddBootModes() {
561 if (jMenuItemEditAddBootModes == null) {
562 jMenuItemEditAddBootModes = new JMenuItem();
563 jMenuItemEditAddBootModes.setText("Boot Modes");
564 jMenuItemEditAddBootModes.addActionListener(this);
565 }
566 return jMenuItemEditAddBootModes;
567 }
568
569 /**
570 This method initializes jMenuItemEditAddSystemTables
571
572 @return javax.swing.JMenuItem jMenuItemEditAddSystemTables
573
574 **/
575 private JMenuItem getJMenuItemAddSystemTables() {
576 if (jMenuItemEditAddSystemTables == null) {
577 jMenuItemEditAddSystemTables = new JMenuItem();
578 jMenuItemEditAddSystemTables.setText("System Tables");
579 jMenuItemEditAddSystemTables.addActionListener(this);
580 }
581 return jMenuItemEditAddSystemTables;
582 }
583
584 /**
585 This method initializes jMenuItemEditAddDataHubs
586
587 @return javax.swing.JMenuItem jMenuItemEditAddDataHubs
588
589 **/
590 private JMenuItem getJMenuItemEditAddDataHubs() {
591 if (jMenuItemEditAddDataHubs == null) {
592 jMenuItemEditAddDataHubs = new JMenuItem();
593 jMenuItemEditAddDataHubs.setText("Data Hubs");
594 jMenuItemEditAddDataHubs.addActionListener(this);
595 }
596 return jMenuItemEditAddDataHubs;
597 }
598
599 /**
600 This method initializes jMenuItemEditAddFormsets
601
602 @return javax.swing.JMenuItem jMenuItemEditAddFormsets
603
604 **/
605 private JMenuItem getJMenuItemEditAddFormsets() {
606 if (jMenuItemEditAddFormsets == null) {
607 jMenuItemEditAddFormsets = new JMenuItem();
608 jMenuItemEditAddFormsets.setText("Formsets");
609 jMenuItemEditAddFormsets.addActionListener(this);
610 }
611 return jMenuItemEditAddFormsets;
612 }
613
614 /**
615 This method initializes jMenuItemEditAddGuids
616
617 @return javax.swing.JMenuItem jMenuItemEditAddGuids
618
619 **/
620 private JMenuItem getJMenuItemEditAddGuids() {
621 if (jMenuItemEditAddGuids == null) {
622 jMenuItemEditAddGuids = new JMenuItem();
623 jMenuItemEditAddGuids.setText("Guids");
624 jMenuItemEditAddGuids.addActionListener(this);
625 }
626 return jMenuItemEditAddGuids;
627 }
628
629 /**
630 This method initializes jMenuItemEditAddExterns
631
632 @return javax.swing.JMenuItem jMenuItemEditAddExterns
633
634 **/
635 private JMenuItem getJMenuItemEditAddExterns() {
636 if (jMenuItemEditAddExterns == null) {
637 jMenuItemEditAddExterns = new JMenuItem();
638 jMenuItemEditAddExterns.setText("Externs");
639 jMenuItemEditAddExterns.addActionListener(this);
640 }
641 return jMenuItemEditAddExterns;
642 }
643
644 /**
645 This method initializes jMenuItemEditAddPCDs
646
647 @return javax.swing.JMenuItem jMenuItemEditAddPCDs
648
649 **/
650 private JMenuItem getJMenuItemEditAddPCDs() {
651 if (jMenuItemEditAddPCDs == null) {
652 jMenuItemEditAddPCDs = new JMenuItem();
653 jMenuItemEditAddPCDs.setText("PCDs");
654 jMenuItemEditAddPCDs.addActionListener(this);
655 }
656 return jMenuItemEditAddPCDs;
657 }
658
659 /**
660 This method initializes jDesktopPane
661
662 @return javax.swing.JDesktopPane jDesktopPane
663
664 **/
665 private JDesktopPane getJDesktopPane() {
666 if (jDesktopPane == null) {
667 jDesktopPane = new JDesktopPane();
668 jDesktopPane.setBounds(new java.awt.Rectangle(295, 1, 500, 515));
669 jDesktopPane.setDesktopManager(iDesktopManager);
670 }
671 return jDesktopPane;
672 }
673
674 /**
675 This method initializes jScrollPaneTree
676
677 @return javax.swing.JScrollPane jScrollPaneTree
678
679 **/
680 private JScrollPane getJScrollPaneTree() {
681 if (jScrollPaneTree == null) {
682 jScrollPaneTree = new JScrollPane();
683 jScrollPaneTree.setBounds(new java.awt.Rectangle(0, 1, 290, 545));
684 jScrollPaneTree.setViewportView(getITree());
685 }
686 return jScrollPaneTree;
687 }
688
689 /**
690 This method initializes iTree
691
692 @return org.tianocore.packaging.common.ui.ITree iTree
693
694 **/
695 private ITree getITree() {
696 //
697 //Before open a real module, use an empty root node for the tree
698 //
699 IDefaultMutableTreeNode root = new IDefaultMutableTreeNode("No Msa/Mbd file opened", -1, -1);
700 iTree = new ITree(root);
701 return iTree;
702 }
703
704 /**
705 This method initializes jMenuHelp
706
707 @return javax.swing.JMenu jMenuHelp
708
709 **/
710 private JMenu getJMenuHelp() {
711 if (jMenuHelp == null) {
712 jMenuHelp = new JMenu();
713 jMenuHelp.setText("Help");
714 jMenuHelp.add(getJMenuItemHelpAbout());
715 }
716 return jMenuHelp;
717 }
718
719 /**
720 This method initializes jMenuItemHelpAbout
721
722 @return javax.swing.JMenuItem jMenuItemHelpAbout
723
724 **/
725 private JMenuItem getJMenuItemHelpAbout() {
726 if (jMenuItemHelpAbout == null) {
727 jMenuItemHelpAbout = new JMenuItem();
728 jMenuItemHelpAbout.setText("About...");
729 jMenuItemHelpAbout.addActionListener(this);
730 }
731 return jMenuItemHelpAbout;
732 }
733
734 /**
735 This method initializes jMenuEditAdd
736
737 @return javax.swing.JMenu jMenuEditAdd
738
739 **/
740 private JMenu getJMenu() {
741 if (jMenuEditAdd == null) {
742 jMenuEditAdd = new JMenu();
743 jMenuEditAdd.setText("Add");
744 //
745 //Add all menu items of menu "Add"
746 //
747 jMenuEditAdd.add(getJMenuItemEditAddLibraries());
748 jMenuEditAdd.add(getJMenuItemEditAddLibraryClassDefinitions());
749 jMenuEditAdd.add(getJMenuItemEditAddSourceFiles());
750 jMenuEditAdd.add(getJMenuItemEditAddIncludes());
751 jMenuEditAdd.add(getJMenuItemEditAddProtocols());
752 jMenuEditAdd.add(getJMenuItemEditAddEvents());
753 jMenuEditAdd.add(getJMenuItemEditAddHobs());
754 jMenuEditAdd.add(getJMenuItemEditAddPPIs());
755 jMenuEditAdd.add(getJMenuItemEditAddVariables());
756 jMenuEditAdd.add(getJMenuItemAddBootModes());
757 jMenuEditAdd.add(getJMenuItemAddSystemTables());
758 jMenuEditAdd.add(getJMenuItemEditAddDataHubs());
759 jMenuEditAdd.add(getJMenuItemEditAddFormsets());
760 jMenuEditAdd.add(getJMenuItemEditAddGuids());
761 jMenuEditAdd.add(getJMenuItemEditAddExterns());
762 jMenuEditAdd.add(getJMenuItemEditAddPCDs());
763 jMenuEditAdd.setEnabled(false);
764 }
765 return jMenuEditAdd;
766 }
767
768 /**
769 This method initializes jMenuItemEditDelete
770
771 @return javax.swing.JMenuItem jMenuItemEditDelete
772
773 **/
774 private JMenuItem getJMenuItemEditDelete() {
775 if (jMenuItemEditDelete == null) {
776 jMenuItemEditDelete = new JMenuItem();
777 jMenuItemEditDelete.setText("Delete");
778 jMenuItemEditDelete.addActionListener(this);
779 //
780 //Disabled when no module is open
781 //
782 jMenuItemEditDelete.setEnabled(false);
783 }
784 return jMenuItemEditDelete;
785 }
786
787 /**
788 This method initializes jMenuItemEditUpdate
789
790 @return javax.swing.JMenuItem jMenuItemEditUpdate
791
792 **/
793 private JMenuItem getJMenuItemEditUpdate() {
794 if (jMenuItemEditUpdate == null) {
795 jMenuItemEditUpdate = new JMenuItem();
796 jMenuItemEditUpdate.setText("Update");
797 jMenuItemEditUpdate.addActionListener(this);
798 //
799 //Disabled when no module is open
800 //
801 jMenuItemEditUpdate.setEnabled(false);
802 }
803 return jMenuItemEditUpdate;
804 }
805
806 /**
807 This method initializes jPopupMenu
808
809 @return javax.swing.JPopupMenu jPopupMenu
810
811 **/
812 private JPopupMenu getJPopupMenu() {
813 if (jPopupMenu == null) {
814 jPopupMenu = new JPopupMenu();
815 //
816 //Add menu items of popup menu
817 //
818 jPopupMenu.add(getJMenuItemPopupAdd());
819 jPopupMenu.add(getJMenuItemPopupUpdate());
820 jPopupMenu.add(getJMenuItemPopupDelete());
821 jPopupMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
822 jPopupMenu.addMouseListener(this);
823 }
824 return jPopupMenu;
825 }
826
827 /**
828 This method initializes jMenuItemPopupAdd
829
830 @return javax.swing.JMenuItem jMenuItemPopupAdd
831
832 **/
833 private JMenuItem getJMenuItemPopupAdd() {
834 if (jMenuItemPopupAdd == null) {
835 jMenuItemPopupAdd = new JMenuItem();
836 jMenuItemPopupAdd.setText("Add");
837 jMenuItemPopupAdd.addActionListener(this);
838 jMenuItemPopupAdd.setEnabled(false);
839 }
840 return jMenuItemPopupAdd;
841 }
842
843 /**
844 This method initializes jMenuItemPopupUpdate
845
846 @return javax.swing.JMenuItem jMenuItemPopupUpdate
847
848 **/
849 private JMenuItem getJMenuItemPopupUpdate() {
850 if (jMenuItemPopupUpdate == null) {
851 jMenuItemPopupUpdate = new JMenuItem();
852 jMenuItemPopupUpdate.setText("Update");
853 jMenuItemPopupUpdate.addActionListener(this);
854 jMenuItemPopupUpdate.setEnabled(false);
855 }
856 return jMenuItemPopupUpdate;
857 }
858
859 /**
860 This method initializes jMenuItemPopupDelete
861
862 @return javax.swing.JMenuItem jMenuItemPopupDelete
863
864 **/
865 private JMenuItem getJMenuItemPopupDelete() {
866 if (jMenuItemPopupDelete == null) {
867 jMenuItemPopupDelete = new JMenuItem();
868 jMenuItemPopupDelete.setText("Delete");
869 jMenuItemPopupDelete.addActionListener(this);
870 jMenuItemPopupDelete.setEnabled(false);
871 }
872 return jMenuItemPopupDelete;
873 }
874
875 /**
876 This method initializes jMenuModuleNew
877
878 @return javax.swing.JMenu jMenuModuleNew
879
880 **/
881 private JMenu getJMenuModuleNew() {
882 if (jMenuModuleNew == null) {
883 jMenuModuleNew = new JMenu();
884 jMenuModuleNew.setText("New");
885 jMenuModuleNew.add(getJMenuItemModuleNewModule());
886 jMenuModuleNew.add(getJMenuItemModuleNewModuleBuildDescription());
887 jMenuModuleNew.add(getJMenuItemModuleNewLibraryModule());
888 jMenuModuleNew.add(getJMenuItemModuleNewLibraryModuleBuildDescription());
889 }
890 return jMenuModuleNew;
891 }
892
893 /**
894 This method initializes jMenuItemModuleOpenModule
895
896 @return javax.swing.JMenuItem jMenuItemModuleOpenModule
897
898 **/
899 private JMenuItem getJMenuItemModuleOpenModule() {
900 if (jMenuItemModuleOpenModule == null) {
901 jMenuItemModuleOpenModule = new JMenuItem();
902 jMenuItemModuleOpenModule.setText("Module (.msa)");
903 jMenuItemModuleOpenModule.addActionListener(this);
904 }
905 return jMenuItemModuleOpenModule;
906 }
907
908 /**
909 This method initializes jMenuItemFileNewModuleBuildDescription
910
911 @return javax.swing.JMenuItem jMenuItemModuleNewModuleBuildDescription
912
913 **/
914 private JMenuItem getJMenuItemModuleNewModuleBuildDescription() {
915 if (jMenuItemModuleNewModuleBuildDescription == null) {
916 jMenuItemModuleNewModuleBuildDescription = new JMenuItem();
917 jMenuItemModuleNewModuleBuildDescription.setText("Module Build Description (.mbd)");
918 jMenuItemModuleNewModuleBuildDescription.addActionListener(this);
919 }
920 return jMenuItemModuleNewModuleBuildDescription;
921 }
922
923 /**
924 This method initializes jMenuItemFileNewLibraryModule
925
926 @return javax.swing.JMenuItem jMenuItemModuleNewLibraryModule
927
928 **/
929 private JMenuItem getJMenuItemModuleNewLibraryModule() {
930 if (jMenuItemModuleNewLibraryModule == null) {
931 jMenuItemModuleNewLibraryModule = new JMenuItem();
932 jMenuItemModuleNewLibraryModule.setText("Library Module (*.msa)");
933 jMenuItemModuleNewLibraryModule.addActionListener(this);
934 }
935 return jMenuItemModuleNewLibraryModule;
936 }
937
938 /**
939 This method initializes jMenuItemFileNewLibraryModuleBuildDescription
940
941 @return javax.swing.JMenuItem jMenuItemModuleNewLibraryModuleBuildDescription
942
943 **/
944 private JMenuItem getJMenuItemModuleNewLibraryModuleBuildDescription() {
945 if (jMenuItemModuleNewLibraryModuleBuildDescription == null) {
946 jMenuItemModuleNewLibraryModuleBuildDescription = new JMenuItem();
947 jMenuItemModuleNewLibraryModuleBuildDescription.setText("Library Module Build Description (.mbd)");
948 jMenuItemModuleNewLibraryModuleBuildDescription.addActionListener(this);
949 }
950 return jMenuItemModuleNewLibraryModuleBuildDescription;
951 }
952
953 /**
954 This method initializes jMenuOpen
955
956 @return javax.swing.JMenu jMenuModuleOpen
957
958 **/
959 private JMenu getJMenuModuleOpen() {
960 if (jMenuModuleOpen == null) {
961 jMenuModuleOpen = new JMenu();
962 jMenuModuleOpen.setText("Open");
963 jMenuModuleOpen.add(getJMenuItemModuleOpenModule());
964 jMenuModuleOpen.add(getJMenuItemModuleOpenModuleBuildDescription());
965 jMenuModuleOpen.add(getJMenuItemModuleOpenLibraryModule());
966 jMenuModuleOpen.add(getJMenuItemModuleOpenLibraryModuleBuildDescription());
967 }
968 return jMenuModuleOpen;
969 }
970
971 /**
972 This method initializes jMenuItemFileOpenModuleBuildDescription
973
974 @return javax.swing.JMenuItem jMenuItemModuleOpenModuleBuildDescription
975
976 **/
977 private JMenuItem getJMenuItemModuleOpenModuleBuildDescription() {
978 if (jMenuItemModuleOpenModuleBuildDescription == null) {
979 jMenuItemModuleOpenModuleBuildDescription = new JMenuItem();
980 jMenuItemModuleOpenModuleBuildDescription.setText("Module Build Description (.mbd)");
981 jMenuItemModuleOpenModuleBuildDescription.addActionListener(this);
982 }
983 return jMenuItemModuleOpenModuleBuildDescription;
984 }
985
986 /**
987 This method initializes jMenuItemFileOpenLibraryModule
988
989 @return javax.swing.JMenuItem jMenuItemModuleOpenLibraryModule
990
991 **/
992 private JMenuItem getJMenuItemModuleOpenLibraryModule() {
993 if (jMenuItemModuleOpenLibraryModule == null) {
994 jMenuItemModuleOpenLibraryModule = new JMenuItem();
995 jMenuItemModuleOpenLibraryModule.setText("Library Module (.msa)");
996 jMenuItemModuleOpenLibraryModule.addActionListener(this);
997 }
998 return jMenuItemModuleOpenLibraryModule;
999 }
1000
1001 /**
1002 This method initializes jMenuItemFileOpenLibraryModuleBuildDescription
1003
1004 @return javax.swing.JMenuItem jMenuItemModuleOpenLibraryModuleBuildDescription
1005
1006 **/
1007 private JMenuItem getJMenuItemModuleOpenLibraryModuleBuildDescription() {
1008 if (jMenuItemModuleOpenLibraryModuleBuildDescription == null) {
1009 jMenuItemModuleOpenLibraryModuleBuildDescription = new JMenuItem();
1010 jMenuItemModuleOpenLibraryModuleBuildDescription.setText("Library Module Build Description (.mbd)");
1011 jMenuItemModuleOpenLibraryModuleBuildDescription.addActionListener(this);
1012 }
1013 return jMenuItemModuleOpenLibraryModuleBuildDescription;
1014 }
1015
1016 /**
1017 This method initializes jMenuItemFileSave
1018
1019 @return javax.swing.JMenuItem jMenuItemModuleSave
1020
1021 **/
1022 private JMenuItem getJMenuItemModuleSave() {
1023 if (jMenuItemModuleSave == null) {
1024 jMenuItemModuleSave = new JMenuItem();
1025 jMenuItemModuleSave.setText("Save");
1026 jMenuItemModuleSave.addActionListener(this);
1027 jMenuItemModuleSave.setEnabled(false);
1028 }
1029 return jMenuItemModuleSave;
1030 }
1031
1032 /**
1033 This method initializes jMenuItemModuleClose
1034
1035 @return javax.swing.JMenuItem jMenuItemModuleClose
1036
1037 **/
1038 private JMenuItem getJMenuItemModuleClose() {
1039 if (jMenuItemModuleClose == null) {
1040 jMenuItemModuleClose = new JMenuItem();
1041 jMenuItemModuleClose.setText("Close");
1042 jMenuItemModuleClose.setEnabled(false);
1043 jMenuItemModuleClose.addActionListener(this);
1044 }
1045 return jMenuItemModuleClose;
1046 }
1047
1048 /**
1049 This method initializes jMenuTools
1050 Reserved
1051
1052 @return javax.swing.JMenu jMenuTools
1053
1054 **/
1055 private JMenu getJMenuTools() {
1056 if (jMenuTools == null) {
1057 jMenuTools = new JMenu();
1058 jMenuTools.setText("Tools");
1059 jMenuTools.addActionListener(this);
1060 jMenuTools.setEnabled(false);
1061 }
1062 return jMenuTools;
1063 }
1064
1065 /**
1066 This method initializes jMenuWindow
1067 Reserved
1068
1069 @return javax.swing.JMenu jMenuWindow
1070
1071 **/
1072 private JMenu getJMenuWindow() {
1073 if (jMenuWindow == null) {
1074 jMenuWindow = new JMenu();
1075 jMenuWindow.setText("Window");
1076 jMenuWindow.setEnabled(false);
1077 jMenuWindow.addActionListener(this);
1078 }
1079 return jMenuWindow;
1080 }
1081
1082 /**
1083 This method initializes jMenuItemEditAddLibraries
1084
1085 @return javax.swing.JMenuItem jMenuItemEditAddLibraries
1086
1087 **/
1088 private JMenuItem getJMenuItemEditAddLibraries() {
1089 if (jMenuItemEditAddLibraries == null) {
1090 jMenuItemEditAddLibraries = new JMenuItem();
1091 jMenuItemEditAddLibraries.setText("Libraries");
1092 jMenuItemEditAddLibraries.addActionListener(this);
1093 }
1094 return jMenuItemEditAddLibraries;
1095 }
1096
1097 /**
1098 This method initializes jPanelOperation
1099
1100 @return javax.swing.JPanel jPanelOperation
1101
1102 **/
1103 private JPanel getJPanelOperation() {
1104 if (jPanelOperation == null) {
1105 jPanelOperation = new JPanel();
1106 jPanelOperation.setLayout(null);
1107 jPanelOperation.setBounds(new java.awt.Rectangle(295, 520, 500, 25));
1108 jPanelOperation.add(getJButtonOk(), null);
1109 jPanelOperation.add(getJButtonCancel(), null);
1110 }
1111 return jPanelOperation;
1112 }
1113
1114 /**
1115 This method initializes jButtonOk
1116
1117 @return javax.swing.JButton jButtonOk
1118
1119 **/
1120 private JButton getJButtonOk() {
1121 if (jButtonOk == null) {
1122 jButtonOk = new JButton();
1123 jButtonOk.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
1124 jButtonOk.setText("Ok");
1125 jButtonOk.setEnabled(false);
1126 jButtonOk.addActionListener(this);
1127 }
1128 return jButtonOk;
1129 }
1130
1131 /**
1132 This method initializes jButtonCancel
1133
1134 @return javax.swing.JButton jButtonCancel
1135
1136 **/
1137 private JButton getJButtonCancel() {
1138 if (jButtonCancel == null) {
1139 jButtonCancel = new JButton();
1140 jButtonCancel.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
1141 jButtonCancel.setText("Cancel");
1142 jButtonCancel.setEnabled(false);
1143 jButtonCancel.addActionListener(this);
1144 jButtonCancel.setVisible(false);
1145 }
1146 return jButtonCancel;
1147 }
1148
1149 /* (non-Javadoc)
1150 * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
1151 *
1152 * Main class, start the GUI
1153 *
1154 */
1155 public static void main(String[] args) {
1156 ModuleMain module = new ModuleMain();
1157 module.setVisible(true);
1158 }
1159
1160 /**
1161 This is the default constructor
1162
1163 **/
1164 public ModuleMain() {
1165 super();
1166 init();
1167 }
1168
1169 /**
1170 This method initializes this
1171
1172
1173 **/
1174 private void init() {
1175 //
1176 // Check if exists WORKSPACE
1177 //
1178 //
1179 if (!ws.checkCurrentWorkspace()) {
1180 JOptionPane.showConfirmDialog(null, "You haven't a workspace yet. Please setup first.", "Warning",
1181 JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
1182 this.dispose();
1183 System.exit(0);
1184 }
1185
1186 this.setSize(800, 600);
1187 this.setResizable(false);
1188 this.setJMenuBar(getjJMenuBar());
1189 this.setContentPane(getJContentPane());
1190 this.setTitle(windowTitle + "- [" + ws.getCurrentWorkspace() + "]");
1191 this.setExitType(1);
1192 this.centerWindow();
1193 }
1194
1195 /**
1196 This method initializes jContentPane
1197
1198 @return javax.swing.JPanel jContentPane
1199
1200 **/
1201 private JPanel getJContentPane() {
1202 if (jContentPane == null) {
1203 jContentPane = new JPanel();
1204 jContentPane.setLayout(null);
1205 jContentPane.add(getJPanelOperation(), null);
1206 jContentPane.add(getJDesktopPane(), null);
1207 jContentPane.add(getJScrollPaneTree(), null);
1208 jContentPane.add(getJPopupMenu(), null);
1209 }
1210 return jContentPane;
1211 }
1212
1213 /* (non-Javadoc)
1214 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1215 *
1216 * Override actionPerformed to listen all actions
1217 *
1218 */
1219 public void actionPerformed(ActionEvent arg0) {
1220 //
1221 // Open relevant frame via clicking different menu items
1222 //
1223 if (arg0.getSource() == jMenuItemHelpAbout) {
1224 ModuleAbout ma = new ModuleAbout();
1225 ma.setEdited(false);
1226 }
1227
1228 if (arg0.getSource() == jMenuItemEditAddLibraries) {
1229 showLibraries(ModuleMain.ADD, IDefaultMutableTreeNode.LIBRARIES, -1);
1230 }
1231
1232 if (arg0.getSource() == jMenuItemEditAddLibraryClassDefinitions) {
1233 showLibraryClassDefinitions(ModuleMain.ADD, IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS);
1234 }
1235
1236 if (arg0.getSource() == jMenuItemEditAddSourceFiles) {
1237 showSourceFiles(ModuleMain.ADD, IDefaultMutableTreeNode.SOURCEFILES, -1);
1238 }
1239
1240 if (arg0.getSource() == jMenuItemEditAddIncludes) {
1241 showIncludes(ModuleMain.ADD, IDefaultMutableTreeNode.INCLUDES, -1);
1242 }
1243
1244 if (arg0.getSource() == jMenuItemEditAddProtocols) {
1245 showProtocols(ModuleMain.ADD, IDefaultMutableTreeNode.PROTOCOLS, -1);
1246 }
1247
1248 if (arg0.getSource() == jMenuItemEditAddEvents) {
1249 showEvents(ModuleMain.ADD, IDefaultMutableTreeNode.EVENTS, -1);
1250 }
1251
1252 if (arg0.getSource() == jMenuItemEditAddHobs) {
1253 showHobs(ModuleMain.ADD, IDefaultMutableTreeNode.HOBS, -1);
1254 }
1255
1256 if (arg0.getSource() == jMenuItemEditAddPPIs) {
1257 showPpis(ModuleMain.ADD, IDefaultMutableTreeNode.PPIS, -1);
1258 }
1259
1260 if (arg0.getSource() == jMenuItemEditAddVariables) {
1261 showVariables(ModuleMain.ADD, IDefaultMutableTreeNode.VARIABLES, -1);
1262 }
1263
1264 if (arg0.getSource() == jMenuItemEditAddBootModes) {
1265 showBootModes(ModuleMain.ADD, IDefaultMutableTreeNode.BOOTMODES, -1);
1266 }
1267
1268 if (arg0.getSource() == jMenuItemEditAddSystemTables) {
1269 showSystemTables(ModuleMain.ADD, IDefaultMutableTreeNode.SYSTEMTABLES, -1);
1270 }
1271
1272 if (arg0.getSource() == jMenuItemEditAddDataHubs) {
1273 showDataHubs(ModuleMain.ADD, IDefaultMutableTreeNode.DATAHUBS, -1);
1274 }
1275
1276 if (arg0.getSource() == jMenuItemEditAddFormsets) {
1277 showFormsets(ModuleMain.ADD, IDefaultMutableTreeNode.FORMSETS, -1);
1278 }
1279
1280 if (arg0.getSource() == jMenuItemEditAddGuids) {
1281 showGuids(ModuleMain.ADD, IDefaultMutableTreeNode.GUIDS, -1);
1282 }
1283
1284 if (arg0.getSource() == jMenuItemEditAddExterns) {
1285 showExterns(ModuleMain.ADD, IDefaultMutableTreeNode.EXTERNS, -1);
1286 }
1287
1288 if (arg0.getSource() == jMenuItemEditAddPCDs) {
1289 showPCDs(ModuleMain.ADD, IDefaultMutableTreeNode.PCDS, -1);
1290 }
1291
1292 if (arg0.getSource() == jMenuItemModuleNewModule) {
1293 this.closeCurrentModule();
1294 showMsaHeader(ModuleMain.ADD);
1295 }
1296
1297 if (arg0.getSource() == jMenuItemModuleNewModuleBuildDescription) {
1298 this.closeCurrentModule();
1299 showMbdHeader(ModuleMain.ADD);
1300 }
1301
1302 if (arg0.getSource() == jMenuItemModuleNewLibraryModule) {
1303 this.closeCurrentModule();
1304 showMlsaHeader(ModuleMain.ADD);
1305 }
1306
1307 if (arg0.getSource() == jMenuItemModuleNewLibraryModuleBuildDescription) {
1308 this.closeCurrentModule();
1309 showMlbdHeader(ModuleMain.ADD);
1310 }
1311
1312 //
1313 // Open Msa, Mbd, Lmsa and Lmbd
1314 //
1315 if (arg0.getSource() == jMenuItemModuleOpenModule) {
1316 openFile(1, 1);
1317 }
1318
1319 if (arg0.getSource() == jMenuItemModuleOpenModuleBuildDescription) {
1320 openFile(1, 2);
1321 }
1322
1323 if (arg0.getSource() == jMenuItemModuleOpenLibraryModule) {
1324 openFile(1, 3);
1325 }
1326
1327 if (arg0.getSource() == jMenuItemModuleOpenLibraryModuleBuildDescription) {
1328 openFile(1, 4);
1329 }
1330
1331 //
1332 // Listen popup menu items
1333 //
1334 if (arg0.getSource() == jMenuItemPopupAdd) {
1335 int intCategory = iTree.getSelectCategory();
1336 int intLocation = iTree.getSelectLoaction();
1337 addCurrentModule(intCategory, intLocation);
1338 }
1339
1340 if (arg0.getSource() == jMenuItemPopupUpdate || arg0.getSource() == jMenuItemEditUpdate) {
1341 int intCategory = iTree.getSelectCategory();
1342 int intLocation = iTree.getSelectLoaction();
1343 updateCurrentModule(intCategory, intLocation);
1344 }
1345
1346 if (arg0.getSource() == jMenuItemPopupDelete || arg0.getSource() == jMenuItemEditDelete) {
1347 int intCategory = iTree.getSelectCategory();
1348 int intLocation = iTree.getSelectLoaction();
1349 deleteCurrentModule(intCategory, intLocation);
1350 }
1351
1352 if (arg0.getSource() == jMenuItemModuleExit) {
1353 this.onExit();
1354 }
1355
1356 if (arg0.getSource() == jMenuItemModuleClose) {
1357 closeCurrentModule();
1358 }
1359
1360 if (arg0.getSource() == jMenuItemModuleSaveAs) {
1361 saveAsCurrentModule();
1362 }
1363
1364 if (arg0.getSource() == jMenuItemModuleSave) {
1365 saveCurrentModule();
1366 }
1367
1368 if (arg0.getSource() == jButtonOk) {
1369 save();
1370 }
1371
1372 if (arg0.getSource() == jButtonCancel) {
1373
1374 }
1375 }
1376
1377 /**
1378 Open file
1379
1380 @param intOperationType Open - 1 or Save - 2
1381 @param intFileType Msa - 1, Mbd - 2, Lmsa - 3, Lmbd - 4
1382 @return opened file path
1383
1384 **/
1385 private void openFile(int intOperationType, int intFileType) {
1386 String strCurrentPath = "";
1387 if (this.currentModule == "") {
1388 strCurrentPath = ws.getCurrentWorkspace();
1389 } else {
1390 strCurrentPath = this.currentModule
1391 .substring(
1392 0,
1393 this.currentModule
1394 .lastIndexOf(System
1395 .getProperty("file.separator")));
1396 }
1397
1398 JFileChooser fc = new JFileChooser(strCurrentPath);
1399 fc.setAcceptAllFileFilterUsed(false);
1400 switch (intOperationType) {
1401 case 1:
1402 fc.setDialogTitle("Open");
1403 break;
1404 case 2:
1405 fc.setDialogTitle("Save As");
1406 break;
1407 }
1408 //
1409 // Config File Filter via different file types
1410 //
1411 switch (intFileType) {
1412 case 1:
1413 fc.addChoosableFileFilter(new IFileFilter("msa"));
1414 break;
1415 case 2:
1416 fc.addChoosableFileFilter(new IFileFilter("mbd"));
1417 break;
1418 case 3:
1419 fc.addChoosableFileFilter(new IFileFilter("msa"));
1420 break;
1421 case 4:
1422 fc.addChoosableFileFilter(new IFileFilter("mbd"));
1423 break;
1424 }
1425
1426 int result = fc.showOpenDialog(new JPanel());
1427 //
1428 // Open relevanf file after click "OK"
1429 //
1430 if (result == JFileChooser.APPROVE_OPTION) {
1431 switch (intOperationType) {
1432 case 1:
1433 closeCurrentModule();
1434 switch (intFileType) {
1435 case 1:
1436 openMsaFile(fc.getSelectedFile().getPath());
1437 break;
1438 case 2:
1439 openMbdFile(fc.getSelectedFile().getPath());
1440 break;
1441 case 3:
1442 openMlsaFile(fc.getSelectedFile().getPath());
1443 break;
1444 case 4:
1445 openMlbdFile(fc.getSelectedFile().getPath());
1446 break;
1447 }
1448 break;
1449 case 2:
1450 switch (intFileType) {
1451 case 1:
1452 this.saveFileName = fc.getSelectedFile().getPath();
1453 break;
1454 case 2:
1455 this.saveFileName = fc.getSelectedFile().getPath();
1456 break;
1457 case 3:
1458 this.saveFileName = fc.getSelectedFile().getPath();
1459 break;
1460 case 4:
1461 this.saveFileName = fc.getSelectedFile().getPath();
1462 break;
1463 }
1464 break;
1465 }
1466 } else {
1467 if (intOperationType == 2) {
1468 this.saveFileName = "";
1469 }
1470 }
1471 }
1472
1473 /**
1474 Open specificed Msa file and read its content
1475
1476 @param strMsaFilePath The input data of Msa File Path
1477
1478 **/
1479 private void openMsaFile(String strMsaFilePath) {
1480 Log.log("Open Msa", strMsaFilePath);
1481 try {
1482 File msaFile = new File(strMsaFilePath);
1483 xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);
1484 this.currentModule = strMsaFilePath;
1485 this.saveFileName = strMsaFilePath;
1486 this.currentModuleType = 1;
1487 } catch (IOException e) {
1488 Log.err("Open Msa " + strMsaFilePath, e.getMessage());
1489 return;
1490 } catch (XmlException e) {
1491 Log.err("Open Msa " + strMsaFilePath, e.getMessage());
1492 return;
1493 } catch (Exception e) {
1494 Log.err("Open Msa " + strMsaFilePath, "Invalid file type");
1495 return;
1496 }
1497
1498 xmlmh = xmlMsaDoc.getModuleSurfaceArea().getMsaHeader();
1499 xmllcd = xmlMsaDoc.getModuleSurfaceArea().getLibraryClassDefinitions();
1500 xmlsf = xmlMsaDoc.getModuleSurfaceArea().getSourceFiles();
1501 xmlic = xmlMsaDoc.getModuleSurfaceArea().getIncludes();
1502 xmlpl = xmlMsaDoc.getModuleSurfaceArea().getProtocols();
1503 xmlen = xmlMsaDoc.getModuleSurfaceArea().getEvents();
1504 xmlhob = xmlMsaDoc.getModuleSurfaceArea().getHobs();
1505 xmlppi = xmlMsaDoc.getModuleSurfaceArea().getPPIs();
1506 xmlvb = xmlMsaDoc.getModuleSurfaceArea().getVariables();
1507 xmlbm = xmlMsaDoc.getModuleSurfaceArea().getBootModes();
1508 xmlst = xmlMsaDoc.getModuleSurfaceArea().getSystemTables();
1509 xmldh = xmlMsaDoc.getModuleSurfaceArea().getDataHubs();
1510 xmlfs = xmlMsaDoc.getModuleSurfaceArea().getFormsets();
1511 xmlgu = xmlMsaDoc.getModuleSurfaceArea().getGuids();
1512 xmlet = xmlMsaDoc.getModuleSurfaceArea().getExterns();
1513 xmlpcd = xmlMsaDoc.getModuleSurfaceArea().getPCDs();
1514 xmlbo = xmlMsaDoc.getModuleSurfaceArea().getBuildOptions();
1515
1516 this.showMsaHeader(ModuleMain.VIEW);
1517 reloadTreeAndTable(ModuleMain.OPENED);
1518 jMenuEditAdd.setEnabled(true);
1519 }
1520
1521 /**
1522 Open specificed Mbd file and read its content
1523
1524 @param strMbdFilePath The input data of Mbd File Path
1525
1526 **/
1527 private void openMbdFile(String strMbdFilePath) {
1528 Log.log("Open Mbd", strMbdFilePath);
1529 try {
1530 File mbdFile = new File(strMbdFilePath);
1531 xmlMbdDoc = (ModuleBuildDescriptionDocument) XmlObject.Factory.parse(mbdFile);
1532 this.currentModule = strMbdFilePath;
1533 this.saveFileName = strMbdFilePath;
1534 this.currentModuleType = 2;
1535 } catch (IOException e) {
1536 Log.err("Open Mbd " + strMbdFilePath, e.getMessage());
1537 return;
1538 } catch (XmlException e) {
1539 Log.err("Open Mbd " + strMbdFilePath, e.getMessage());
1540 return;
1541 } catch (Exception e) {
1542 Log.err("Open Mbd " + strMbdFilePath, "Invalid file type");
1543 return;
1544 }
1545
1546 xmlmbdh = xmlMbdDoc.getModuleBuildDescription().getMbdHeader();
1547 xmllib = xmlMbdDoc.getModuleBuildDescription().getLibraries();
1548 xmlsf = xmlMbdDoc.getModuleBuildDescription().getSourceFiles();
1549 xmlic = xmlMbdDoc.getModuleBuildDescription().getIncludes();
1550 xmlpl = xmlMbdDoc.getModuleBuildDescription().getProtocols();
1551 xmlen = xmlMbdDoc.getModuleBuildDescription().getEvents();
1552 xmlhob = xmlMbdDoc.getModuleBuildDescription().getHobs();
1553 xmlppi = xmlMbdDoc.getModuleBuildDescription().getPPIs();
1554 xmlvb = xmlMbdDoc.getModuleBuildDescription().getVariables();
1555 xmlbm = xmlMbdDoc.getModuleBuildDescription().getBootModes();
1556 xmlst = xmlMbdDoc.getModuleBuildDescription().getSystemTables();
1557 xmldh = xmlMbdDoc.getModuleBuildDescription().getDataHubs();
1558 xmlfs = xmlMbdDoc.getModuleBuildDescription().getFormsets();
1559 xmlgu = xmlMbdDoc.getModuleBuildDescription().getGuids();
1560 xmlet = xmlMbdDoc.getModuleBuildDescription().getExterns();
1561 xmlpcd = xmlMbdDoc.getModuleBuildDescription().getPCDs();
1562 xmlbo = xmlMbdDoc.getModuleBuildDescription().getBuildOptions();
1563
1564 this.showMbdHeader(ModuleMain.VIEW);
1565 reloadTreeAndTable(ModuleMain.OPENED);
1566 jMenuEditAdd.setEnabled(true);
1567 }
1568
1569 /**
1570 Open specificed Mlsa file and read its content
1571
1572 @param strMlsaFilePath The input data of Mlsa File Path
1573
1574 **/
1575 private void openMlsaFile(String strMlsaFilePath) {
1576 Log.log("Open Mlsa", strMlsaFilePath);
1577 try {
1578 File mlsaFile = new File(strMlsaFilePath);
1579 xmlMlsaDoc = (LibraryModuleSurfaceAreaDocument) XmlObject.Factory.parse(mlsaFile);
1580 this.currentModule = strMlsaFilePath;
1581 this.saveFileName = strMlsaFilePath;
1582 this.currentModuleType = 3;
1583 } catch (IOException e) {
1584 Log.err("Open Mlsa " + strMlsaFilePath, e.getMessage());
1585 return;
1586 } catch (XmlException e) {
1587 Log.err("Open Mlsa " + strMlsaFilePath, e.getMessage());
1588 return;
1589 } catch (Exception e) {
1590 Log.err("Open Mlsa " + strMlsaFilePath, "Invalid file type");
1591 return;
1592 }
1593
1594 xmlmlh = xmlMlsaDoc.getLibraryModuleSurfaceArea().getMsaLibHeader();
1595 xmllcd = xmlMlsaDoc.getLibraryModuleSurfaceArea().getLibraryClassDefinitions();
1596 xmlsf = xmlMlsaDoc.getLibraryModuleSurfaceArea().getSourceFiles();
1597 xmlic = xmlMlsaDoc.getLibraryModuleSurfaceArea().getIncludes();
1598 xmlpl = xmlMlsaDoc.getLibraryModuleSurfaceArea().getProtocols();
1599 xmlen = xmlMlsaDoc.getLibraryModuleSurfaceArea().getEvents();
1600 xmlhob = xmlMlsaDoc.getLibraryModuleSurfaceArea().getHobs();
1601 xmlppi = xmlMlsaDoc.getLibraryModuleSurfaceArea().getPPIs();
1602 xmlvb = xmlMlsaDoc.getLibraryModuleSurfaceArea().getVariables();
1603 xmlbm = xmlMlsaDoc.getLibraryModuleSurfaceArea().getBootModes();
1604 xmlst = xmlMlsaDoc.getLibraryModuleSurfaceArea().getSystemTables();
1605 xmldh = xmlMlsaDoc.getLibraryModuleSurfaceArea().getDataHubs();
1606 xmlfs = xmlMlsaDoc.getLibraryModuleSurfaceArea().getFormsets();
1607 xmlgu = xmlMlsaDoc.getLibraryModuleSurfaceArea().getGuids();
1608 xmlet = xmlMlsaDoc.getLibraryModuleSurfaceArea().getExterns();
1609 xmlpcd = xmlMlsaDoc.getLibraryModuleSurfaceArea().getPCDs();
1610 xmlbo = xmlMlsaDoc.getLibraryModuleSurfaceArea().getBuildOptions();
1611
1612 this.showMlsaHeader(ModuleMain.VIEW);
1613 reloadTreeAndTable(ModuleMain.OPENED);
1614 jMenuEditAdd.setEnabled(true);
1615 }
1616
1617 /**
1618 Open specificed Mlbd file and read its content
1619
1620 @param strMlbdFilePath The input data of Mlbd File Path
1621
1622 **/
1623 private void openMlbdFile(String strMlbdFilePath) {
1624 Log.log("Open Mlbd", strMlbdFilePath);
1625 try {
1626 File mlbdFile = new File(strMlbdFilePath);
1627 xmlMlbdDoc = (LibraryModuleBuildDescriptionDocument) XmlObject.Factory.parse(mlbdFile);
1628 this.currentModule = strMlbdFilePath;
1629 this.saveFileName = strMlbdFilePath;
1630 this.currentModuleType = 4;
1631 } catch (IOException e) {
1632 Log.err("Open Mlbd " + strMlbdFilePath, e.getMessage());
1633 return;
1634 } catch (XmlException e) {
1635 Log.err("Open Mlbd " + strMlbdFilePath, e.getMessage());
1636 return;
1637 } catch (Exception e) {
1638 Log.err("Open Mlbd " + strMlbdFilePath, "Invalid file type");
1639 return;
1640 }
1641
1642 xmlmlbdh = xmlMlbdDoc.getLibraryModuleBuildDescription().getMbdLibHeader();
1643 xmllib = xmlMlbdDoc.getLibraryModuleBuildDescription().getLibraries();
1644 xmlsf = xmlMlbdDoc.getLibraryModuleBuildDescription().getSourceFiles();
1645 xmlic = xmlMlbdDoc.getLibraryModuleBuildDescription().getIncludes();
1646 xmlpl = xmlMlbdDoc.getLibraryModuleBuildDescription().getProtocols();
1647 xmlen = xmlMlbdDoc.getLibraryModuleBuildDescription().getEvents();
1648 xmlhob = xmlMlbdDoc.getLibraryModuleBuildDescription().getHobs();
1649 xmlppi = xmlMlbdDoc.getLibraryModuleBuildDescription().getPPIs();
1650 xmlvb = xmlMlbdDoc.getLibraryModuleBuildDescription().getVariables();
1651 xmlbm = xmlMlbdDoc.getLibraryModuleBuildDescription().getBootModes();
1652 xmlst = xmlMlbdDoc.getLibraryModuleBuildDescription().getSystemTables();
1653 xmldh = xmlMlbdDoc.getLibraryModuleBuildDescription().getDataHubs();
1654 xmlfs = xmlMlbdDoc.getLibraryModuleBuildDescription().getFormsets();
1655 xmlgu = xmlMlbdDoc.getLibraryModuleBuildDescription().getGuids();
1656 xmlet = xmlMlbdDoc.getLibraryModuleBuildDescription().getExterns();
1657 xmlpcd = xmlMlbdDoc.getLibraryModuleBuildDescription().getPCDs();
1658 xmlbo = xmlMlbdDoc.getLibraryModuleBuildDescription().getBuildOptions();
1659
1660 this.showMlbdHeader(ModuleMain.VIEW);
1661 reloadTreeAndTable(ModuleMain.OPENED);
1662 jMenuEditAdd.setEnabled(true);
1663 }
1664
1665 /**
1666 Create an empty tree if no file is open
1667
1668 **/
1669 private void makeEmptyTree() {
1670 dmtnRoot = new IDefaultMutableTreeNode("No Msa/Mbd file opened", -1, -1);
1671 iTree = new ITree(dmtnRoot);
1672 jScrollPaneTree.setViewportView(iTree);
1673 }
1674
1675 /**
1676 Create the tree to display all components of current open file.
1677 First to check if the component is null or not
1678 If not null, hangs it to the tree
1679 If null, skip it
1680
1681 **/
1682 private void makeTree() {
1683 iTree.removeAll();
1684
1685 //
1686 //Make an empty tree when closing
1687 //
1688 if (this.currentModuleType == 0) {
1689 makeEmptyTree();
1690 return;
1691 }
1692
1693 //
1694 //Msa File
1695 //
1696 if (this.currentModuleType == 1) {
1697 //
1698 //Add MsaHeader Node
1699 //
1700 if (xmlmh != null) {
1701 dmtnRoot = new IDefaultMutableTreeNode(xmlmh.getBaseName().getStringValue(),
1702 IDefaultMutableTreeNode.MSA_HEADER,
1703 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);
1704 } else {
1705 makeEmptyTree();
1706 return;
1707 }
1708
1709 //
1710 //Add LibraryClassDefinitions Node
1711 //
1712 if (xmllcd != null && xmllcd.getLibraryClassList().size() > 0) {
1713 IDefaultMutableTreeNode libraryClassDefinitions = new IDefaultMutableTreeNode(
1714 "Library Class Definitions",
1715 IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS,
1716 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);
1717 for (int indexI = 0; indexI < xmllcd.getLibraryClassList().size(); indexI++) {
1718 libraryClassDefinitions
1719 .add(new IDefaultMutableTreeNode(
1720 xmllcd.getLibraryClassArray(indexI)
1721 .getStringValue(),
1722 IDefaultMutableTreeNode.LIBRARY_CLASS_DEFINITION,
1723 IDefaultMutableTreeNode.OPERATION_NULL));
1724 }
1725 dmtnRoot.add(libraryClassDefinitions);
1726 }
1727 }
1728
1729 //
1730 //Mbd File
1731 //
1732 if (this.currentModuleType == 2) {
1733 //
1734 //Add MsaHeader Node
1735 //
1736 if (xmlmbdh != null) {
1737 dmtnRoot = new IDefaultMutableTreeNode(xmlmbdh.getBaseName().getStringValue(),
1738 IDefaultMutableTreeNode.MBD_HEADER,
1739 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);
1740 } else {
1741 makeEmptyTree();
1742 return;
1743 }
1744
1745 //
1746 //Add Libraries Node
1747 //
1748 if (xmllib != null) {
1749 IDefaultMutableTreeNode libraries = new IDefaultMutableTreeNode(
1750 "Libraries",
1751 IDefaultMutableTreeNode.LIBRARIES,
1752 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1753 if (xmllib.getArchList().size() > 0) {
1754 IDefaultMutableTreeNode librariesArch = new IDefaultMutableTreeNode(
1755 "Arch",
1756 IDefaultMutableTreeNode.LIBRARIES_ARCH,
1757 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1758 for (int indexI = 0; indexI < xmllib.getArchList().size(); indexI++) {
1759 librariesArch.add(new IDefaultMutableTreeNode(xmllib.getArchArray(indexI).getArchType()
1760 .toString(),
1761 IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM,
1762 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
1763 indexI));
1764 }
1765 libraries.add(librariesArch);
1766 }
1767 if (xmllib.getLibraryList().size() > 0) {
1768 IDefaultMutableTreeNode library = new IDefaultMutableTreeNode(
1769 "Library",
1770 IDefaultMutableTreeNode.LIBRARIES_LIBRARY,
1771 IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);
1772 for (int indexI = 0; indexI < xmllib.getLibraryList().size(); indexI++) {
1773 library.add(new IDefaultMutableTreeNode(xmllib.getLibraryArray(indexI).getStringValue(),
1774 IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM,
1775 IDefaultMutableTreeNode.OPERATION_DELETE));
1776 }
1777 libraries.add(library);
1778 }
1779 dmtnRoot.add(libraries);
1780 }
1781 }
1782
1783 //
1784 //MLsa File
1785 //
1786 if (this.currentModuleType == 3) {
1787 //
1788 //Add MsaHeader Node
1789 //
1790 if (xmlmlh != null) {
1791 dmtnRoot = new IDefaultMutableTreeNode(xmlmlh.getBaseName().getStringValue(),
1792 IDefaultMutableTreeNode.MLSA_HEADER,
1793 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);
1794 } else {
1795 makeEmptyTree();
1796 return;
1797 }
1798
1799 //
1800 //Add LibraryClassDefinitions Node
1801 //
1802 if (xmllcd != null && xmllcd.getLibraryClassList().size() > 0) {
1803 IDefaultMutableTreeNode libraryClassDefinitions = new IDefaultMutableTreeNode(
1804 "Library Class Definitions",
1805 IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS,
1806 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);
1807 for (int indexI = 0; indexI < xmllcd.getLibraryClassList().size(); indexI++) {
1808 libraryClassDefinitions
1809 .add(new IDefaultMutableTreeNode(
1810 xmllcd.getLibraryClassArray(indexI)
1811 .getStringValue(),
1812 IDefaultMutableTreeNode.LIBRARY_CLASS_DEFINITION,
1813 IDefaultMutableTreeNode.OPERATION_NULL));
1814 }
1815 dmtnRoot.add(libraryClassDefinitions);
1816 }
1817 }
1818
1819 //
1820 //Mlbd File
1821 //
1822 if (this.currentModuleType == 4) {
1823 //
1824 //Add MsaHeader Node
1825 //
1826 if (xmlmlbdh != null) {
1827 dmtnRoot = new IDefaultMutableTreeNode(xmlmlbdh.getBaseName().getStringValue(),
1828 IDefaultMutableTreeNode.MLBD_HEADER,
1829 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE);
1830 } else {
1831 makeEmptyTree();
1832 return;
1833 }
1834
1835 //
1836 //Add Libraries Node
1837 //
1838 if (xmllib != null) {
1839 IDefaultMutableTreeNode libraries = new IDefaultMutableTreeNode(
1840 "Libraries",
1841 IDefaultMutableTreeNode.LIBRARIES,
1842 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1843 if (xmllib.getArchList().size() > 0) {
1844 IDefaultMutableTreeNode librariesArch = new IDefaultMutableTreeNode(
1845 "Arch",
1846 IDefaultMutableTreeNode.LIBRARIES_ARCH,
1847 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1848 for (int indexI = 0; indexI < xmllib.getArchList().size(); indexI++) {
1849 librariesArch.add(new IDefaultMutableTreeNode(xmllib.getArchArray(indexI).getArchType()
1850 .toString(),
1851 IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM,
1852 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
1853 indexI));
1854 }
1855 libraries.add(librariesArch);
1856 }
1857 if (xmllib.getLibraryList().size() > 0) {
1858 IDefaultMutableTreeNode library = new IDefaultMutableTreeNode(
1859 "Library",
1860 IDefaultMutableTreeNode.LIBRARIES_LIBRARY,
1861 IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);
1862 for (int indexI = 0; indexI < xmllib.getLibraryList().size(); indexI++) {
1863 library.add(new IDefaultMutableTreeNode(xmllib.getLibraryArray(indexI).getStringValue(),
1864 IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM,
1865 IDefaultMutableTreeNode.OPERATION_DELETE));
1866 }
1867 libraries.add(library);
1868 }
1869 dmtnRoot.add(libraries);
1870 }
1871 }
1872
1873 //
1874 //Add SourceFiles Node
1875 //
1876 if (xmlsf != null) {
1877 IDefaultMutableTreeNode sourceFiles = new IDefaultMutableTreeNode(
1878 "Source Files",
1879 IDefaultMutableTreeNode.SOURCEFILES,
1880 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1881 if (xmlsf.getArchList().size() > 0) {
1882 IDefaultMutableTreeNode sourceFilesArch = new IDefaultMutableTreeNode(
1883 "Arch",
1884 IDefaultMutableTreeNode.SOURCEFILES_ARCH,
1885 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1886 for (int indexI = 0; indexI < xmlsf.getArchList().size(); indexI++) {
1887 sourceFilesArch
1888 .add(new IDefaultMutableTreeNode(
1889 xmlsf.getArchArray(indexI).getArchType().toString(),
1890 IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM,
1891 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
1892 indexI));
1893 }
1894 sourceFiles.add(sourceFilesArch);
1895 }
1896 if (xmlsf.getFilenameList().size() > 0) {
1897 IDefaultMutableTreeNode sourceFilesFileName = new IDefaultMutableTreeNode(
1898 "File Name",
1899 IDefaultMutableTreeNode.SOURCEFILES_FILENAME,
1900 IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);
1901 for (int indexI = 0; indexI < xmlsf.getFilenameList().size(); indexI++) {
1902 sourceFilesFileName
1903 .add(new IDefaultMutableTreeNode(
1904 xmlsf.getFilenameArray(indexI).getStringValue(),
1905 IDefaultMutableTreeNode.SOURCEFILES_FILENAME_ITEM,
1906 IDefaultMutableTreeNode.OPERATION_DELETE));
1907 }
1908 sourceFiles.add(sourceFilesFileName);
1909 }
1910 dmtnRoot.add(sourceFiles);
1911 }
1912
1913 //
1914 //Add includes
1915 //
1916 if (xmlic != null) {
1917 IDefaultMutableTreeNode includes = new IDefaultMutableTreeNode("Includes",
1918 IDefaultMutableTreeNode.INCLUDES,
1919 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1920 if (xmlic.getArchList().size() > 0) {
1921 IDefaultMutableTreeNode includesArch = new IDefaultMutableTreeNode(
1922 "Arch",
1923 IDefaultMutableTreeNode.INCLUDES_ARCH,
1924 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1925 for (int indexI = 0; indexI < xmlic.getArchList().size(); indexI++) {
1926 includesArch.add(new IDefaultMutableTreeNode(xmlic.getArchArray(indexI).getArchType().toString(),
1927 IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM,
1928 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
1929 indexI));
1930 }
1931 includes.add(includesArch);
1932 }
1933 if (xmlic.getPackageNameList().size() > 0) {
1934 IDefaultMutableTreeNode includesPackageName = new IDefaultMutableTreeNode(
1935 "Package Name",
1936 IDefaultMutableTreeNode.INCLUDES_PACKAGENAME,
1937 IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE);
1938 for (int indexI = 0; indexI < xmlic.getPackageNameList().size(); indexI++) {
1939 includesPackageName
1940 .add(new IDefaultMutableTreeNode(
1941 xmlic.getPackageNameArray(indexI)
1942 .getStringValue(),
1943 IDefaultMutableTreeNode.INCLUDES_PACKAGENAME_ITEM,
1944 IDefaultMutableTreeNode.OPERATION_DELETE));
1945 }
1946 includes.add(includesPackageName);
1947 }
1948 dmtnRoot.add(includes);
1949 }
1950
1951 //
1952 //Add protocols
1953 //
1954 if (xmlpl != null) {
1955 IDefaultMutableTreeNode dmtnProtocols = new IDefaultMutableTreeNode(
1956 "Protocols",
1957 IDefaultMutableTreeNode.PROTOCOLS,
1958 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1959 IDefaultMutableTreeNode dmtnProtocol = new IDefaultMutableTreeNode(
1960 "Protocol",
1961 IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL,
1962 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1963 IDefaultMutableTreeNode dmtnProtocolNotify = new IDefaultMutableTreeNode(
1964 "Protocol Notify",
1965 IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY,
1966 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1967 if (xmlpl.getProtocolList().size() > 0) {
1968 for (int indexI = 0; indexI < xmlpl.getProtocolList().size(); indexI++) {
1969 dmtnProtocol.add(new IDefaultMutableTreeNode(xmlpl.getProtocolArray(indexI).getStringValue(),
1970 IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM,
1971 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
1972 indexI));
1973 }
1974 dmtnProtocols.add(dmtnProtocol);
1975 }
1976 if (xmlpl.getProtocolNotifyList().size() > 0) {
1977 for (int indexI = 0; indexI < xmlpl.getProtocolNotifyList().size(); indexI++) {
1978 dmtnProtocolNotify
1979 .add(new IDefaultMutableTreeNode(
1980 xmlpl.getProtocolNotifyArray(indexI)
1981 .getStringValue(),
1982 IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM,
1983 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
1984 indexI));
1985 }
1986 dmtnProtocols.add(dmtnProtocolNotify);
1987 }
1988 dmtnRoot.add(dmtnProtocols);
1989 }
1990
1991 //
1992 //Add events
1993 //
1994 if (xmlen != null) {
1995 IDefaultMutableTreeNode dmtnEvents = new IDefaultMutableTreeNode(
1996 "Events",
1997 IDefaultMutableTreeNode.EVENTS,
1998 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
1999 IDefaultMutableTreeNode dmtnCreateEvents = new IDefaultMutableTreeNode(
2000 "Create",
2001 IDefaultMutableTreeNode.EVENTS_CREATEEVENTS,
2002 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2003 IDefaultMutableTreeNode dmtnSignalEvents = new IDefaultMutableTreeNode(
2004 "Signal",
2005 IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS,
2006 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2007 if (xmlen.getCreateEvents() != null && xmlen.getCreateEvents().getEventList().size() > 0) {
2008 for (int indexI = 0; indexI < xmlen.getCreateEvents().getEventList().size(); indexI++) {
2009 dmtnCreateEvents.add(new IDefaultMutableTreeNode(xmlen.getCreateEvents().getEventArray(indexI)
2010 .getCName(),
2011 IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM,
2012 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2013 indexI));
2014 }
2015 dmtnEvents.add(dmtnCreateEvents);
2016 }
2017 if (xmlen.getSignalEvents() != null && xmlen.getSignalEvents().getEventList().size() > 0) {
2018 for (int indexI = 0; indexI < xmlen.getSignalEvents().getEventList().size(); indexI++) {
2019 dmtnSignalEvents.add(new IDefaultMutableTreeNode(xmlen.getSignalEvents().getEventArray(indexI)
2020 .getCName(),
2021 IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM,
2022 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2023 indexI));
2024 }
2025 dmtnEvents.add(dmtnSignalEvents);
2026 }
2027 dmtnRoot.add(dmtnEvents);
2028 }
2029
2030 //
2031 //Add hobs
2032 //
2033 if (xmlhob != null) {
2034 IDefaultMutableTreeNode dmtnHobs = new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode.HOBS,
2035 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2036 if (xmlhob.getHobList().size() > 0) {
2037 for (int indexI = 0; indexI < xmlhob.getHobList().size(); indexI++) {
2038 dmtnHobs.add(new IDefaultMutableTreeNode(xmlhob.getHobArray(indexI).getName(),
2039 IDefaultMutableTreeNode.HOBS_HOB_ITEM,
2040 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));
2041 }
2042 }
2043 dmtnRoot.add(dmtnHobs);
2044 }
2045
2046 //
2047 //Add ppis
2048 //
2049 if (xmlppi != null) {
2050 IDefaultMutableTreeNode dmtnPpis = new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode.PPIS,
2051 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2052 IDefaultMutableTreeNode dmtnPpi = new IDefaultMutableTreeNode("Ppi", IDefaultMutableTreeNode.PPIS_PPI,
2053 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2054 IDefaultMutableTreeNode dmtnPpiNotify = new IDefaultMutableTreeNode(
2055 "Ppi Notify",
2056 IDefaultMutableTreeNode.PPIS_PPINOTIFY,
2057 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2058 if (xmlppi.getPpiList().size() > 0) {
2059 for (int indexI = 0; indexI < xmlppi.getPpiList().size(); indexI++) {
2060 dmtnPpi.add(new IDefaultMutableTreeNode(xmlppi.getPpiArray(indexI).getStringValue(),
2061 IDefaultMutableTreeNode.PPIS_PPI_ITEM,
2062 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));
2063 }
2064 dmtnPpis.add(dmtnPpi);
2065 }
2066 if (xmlppi.getPpiNotifyList().size() > 0) {
2067 for (int indexI = 0; indexI < xmlppi.getPpiNotifyList().size(); indexI++) {
2068 dmtnPpiNotify.add(new IDefaultMutableTreeNode(xmlppi.getPpiNotifyArray(indexI).getStringValue(),
2069 IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM,
2070 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2071 indexI));
2072 }
2073 dmtnPpis.add(dmtnPpiNotify);
2074 }
2075 dmtnRoot.add(dmtnPpis);
2076 }
2077
2078 //
2079 //Add variables
2080 //
2081 if (xmlvb != null) {
2082 IDefaultMutableTreeNode dmtnVariables = new IDefaultMutableTreeNode(
2083 "Variables",
2084 IDefaultMutableTreeNode.VARIABLES,
2085 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2086 if (xmlvb.getVariableList().size() > 0) {
2087 for (int indexI = 0; indexI < xmlvb.getVariableList().size(); indexI++) {
2088 dmtnVariables.add(new IDefaultMutableTreeNode(xmlvb.getVariableArray(indexI).getString(),
2089 IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM,
2090 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2091 indexI));
2092 }
2093 }
2094 dmtnRoot.add(dmtnVariables);
2095 }
2096
2097 //
2098 //Add bootmodes
2099 //
2100 if (xmlbm != null) {
2101 IDefaultMutableTreeNode dmtnBootModes = new IDefaultMutableTreeNode(
2102 "BootModes",
2103 IDefaultMutableTreeNode.BOOTMODES,
2104 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2105 if (xmlbm.getBootModeList().size() > 0) {
2106 for (int indexI = 0; indexI < xmlbm.getBootModeList().size(); indexI++) {
2107 dmtnBootModes.add(new IDefaultMutableTreeNode(xmlbm.getBootModeArray(indexI).getBootModeName()
2108 .toString(),
2109 IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM,
2110 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2111 indexI));
2112 }
2113 }
2114 dmtnRoot.add(dmtnBootModes);
2115 }
2116
2117 //
2118 //Add systemtables
2119 //
2120 if (xmlst != null) {
2121 IDefaultMutableTreeNode dmtnSystemTables = new IDefaultMutableTreeNode(
2122 "SystemTables",
2123 IDefaultMutableTreeNode.SYSTEMTABLES,
2124 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2125 if (xmlst.getSystemTableList().size() > 0) {
2126 for (int indexI = 0; indexI < xmlst.getSystemTableList().size(); indexI++) {
2127 dmtnSystemTables
2128 .add(new IDefaultMutableTreeNode(
2129 xmlst.getSystemTableArray(indexI).getEntry(),
2130 IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM,
2131 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2132 indexI));
2133 }
2134 }
2135 dmtnRoot.add(dmtnSystemTables);
2136 }
2137
2138 //
2139 //Add datahubs
2140 //
2141 if (xmldh != null) {
2142 IDefaultMutableTreeNode dmtnDataHubs = new IDefaultMutableTreeNode(
2143 "DataHubs",
2144 IDefaultMutableTreeNode.DATAHUBS,
2145 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2146 if (xmldh.getDataHubRecordList().size() > 0) {
2147 for (int indexI = 0; indexI < xmldh.getDataHubRecordList().size(); indexI++) {
2148 dmtnDataHubs.add(new IDefaultMutableTreeNode(xmldh.getDataHubRecordArray(indexI).getStringValue(),
2149 IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM,
2150 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2151 indexI));
2152 }
2153 }
2154 dmtnRoot.add(dmtnDataHubs);
2155 }
2156
2157 //
2158 //Add formsets
2159 //
2160 if (xmlfs != null) {
2161 IDefaultMutableTreeNode dmtnFormsets = new IDefaultMutableTreeNode(
2162 "Formsets",
2163 IDefaultMutableTreeNode.FORMSETS,
2164 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2165 if (xmlfs.getFormsetList().size() > 0) {
2166 for (int indexI = 0; indexI < xmlfs.getFormsetList().size(); indexI++) {
2167 dmtnFormsets.add(new IDefaultMutableTreeNode(xmlfs.getFormsetArray(indexI).getStringValue(),
2168 IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM,
2169 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE,
2170 indexI));
2171 }
2172 }
2173 dmtnRoot.add(dmtnFormsets);
2174 }
2175
2176 //
2177 //Add guids
2178 //
2179 if (xmlgu != null) {
2180 IDefaultMutableTreeNode dmtnGuids = new IDefaultMutableTreeNode(
2181 "Guids",
2182 IDefaultMutableTreeNode.GUIDS,
2183 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2184 if (xmlgu.getGuidEntryList().size() > 0) {
2185 for (int indexI = 0; indexI < xmlgu.getGuidEntryList().size(); indexI++) {
2186 dmtnGuids.add(new IDefaultMutableTreeNode(xmlgu.getGuidEntryArray(indexI).getCName(),
2187 IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM,
2188 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));
2189 }
2190 }
2191 dmtnRoot.add(dmtnGuids);
2192 }
2193
2194 //
2195 //Add externs
2196 //
2197 if (xmlet != null) {
2198 IDefaultMutableTreeNode dmtnExterns = new IDefaultMutableTreeNode(
2199 "Externs",
2200 IDefaultMutableTreeNode.EXTERNS,
2201 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2202 if (xmlet.getExternList().size() > 0) {
2203 for (int indexI = 0; indexI < xmlet.getExternList().size(); indexI++) {
2204 dmtnExterns
2205 .add(new IDefaultMutableTreeNode("Extern " + Integer.valueOf(indexI + 1),
2206 IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM,
2207 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));
2208 }
2209 }
2210 dmtnRoot.add(dmtnExterns);
2211 }
2212
2213 //
2214 //Add pcds
2215 //
2216 if (xmlpcd != null) {
2217 IDefaultMutableTreeNode dmtnPCDs = new IDefaultMutableTreeNode("PCDs", IDefaultMutableTreeNode.PCDS,
2218 IDefaultMutableTreeNode.OPERATION_ADD_DELETE);
2219 if (xmlpcd.getPcdDataList().size() > 0) {
2220 for (int indexI = 0; indexI < xmlpcd.getPcdDataList().size(); indexI++) {
2221 dmtnPCDs.add(new IDefaultMutableTreeNode(xmlpcd.getPcdDataArray(indexI).getCName(),
2222 IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM,
2223 IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE, indexI));
2224 }
2225 }
2226 dmtnRoot.add(dmtnPCDs);
2227 }
2228
2229 iTree = new ITree(dmtnRoot);
2230 iTree.addMouseListener(this);
2231 iTree.addTreeSelectionListener(this);
2232 jScrollPaneTree.setViewportView(iTree);
2233 }
2234
2235 /* (non-Javadoc)
2236 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
2237 *
2238 * Override windowClosing to popup warning message to confirm quit
2239 *
2240 */
2241 public void windowClosing(WindowEvent arg0) {
2242 this.onExit();
2243 }
2244
2245 /* (non-Javadoc)
2246 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
2247 *
2248 * Override mouseClicked to check if need display popup menu
2249 *
2250 */
2251 public void mouseClicked(MouseEvent arg0) {
2252 if (arg0.getButton() == MouseEvent.BUTTON1) {
2253
2254 }
2255 if (arg0.getButton() == MouseEvent.BUTTON3) {
2256 jPopupMenu.show(arg0.getComponent(), arg0.getX(), arg0.getY());
2257 }
2258 }
2259
2260 public void mouseEntered(MouseEvent arg0) {
2261 // TODO Auto-generated method stub
2262 }
2263
2264 public void mouseExited(MouseEvent arg0) {
2265 // TODO Auto-generated method stub
2266 }
2267
2268 public void mousePressed(MouseEvent arg0) {
2269 // TODO Auto-generated method stub
2270 }
2271
2272 public void mouseReleased(MouseEvent arg0) {
2273 // TODO Auto-generated method stub
2274 }
2275
2276 /**
2277 Init popup menu
2278
2279 **/
2280 public void valueChanged(TreeSelectionEvent arg0) {
2281 int intOperation = iTree.getSelectOperation();
2282 if (intOperation == IDefaultMutableTreeNode.OPERATION_NULL) {
2283 setMenuItemAddEnabled(false);
2284 setMenuItemUpdateEnabled(false);
2285 setMenuItemDeleteEnabled(false);
2286 }
2287 if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD) {
2288 setMenuItemAddEnabled(true);
2289 setMenuItemUpdateEnabled(false);
2290 setMenuItemDeleteEnabled(false);
2291 }
2292 if (intOperation == IDefaultMutableTreeNode.OPERATION_UPDATE) {
2293 setMenuItemAddEnabled(false);
2294 setMenuItemUpdateEnabled(true);
2295 setMenuItemDeleteEnabled(false);
2296 }
2297 if (intOperation == IDefaultMutableTreeNode.OPERATION_DELETE) {
2298 setMenuItemAddEnabled(false);
2299 setMenuItemUpdateEnabled(false);
2300 setMenuItemDeleteEnabled(true);
2301 }
2302 if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD_UPDATE) {
2303 setMenuItemAddEnabled(true);
2304 setMenuItemUpdateEnabled(true);
2305 setMenuItemDeleteEnabled(false);
2306 }
2307 if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD_DELETE) {
2308 setMenuItemAddEnabled(true);
2309 setMenuItemUpdateEnabled(false);
2310 setMenuItemDeleteEnabled(true);
2311 }
2312 if (intOperation == IDefaultMutableTreeNode.OPERATION_UPDATE_DELETE) {
2313 setMenuItemAddEnabled(false);
2314 setMenuItemUpdateEnabled(true);
2315 setMenuItemDeleteEnabled(true);
2316 }
2317 if (intOperation == IDefaultMutableTreeNode.OPERATION_ADD_UPDATE_DELETE) {
2318 setMenuItemAddEnabled(true);
2319 setMenuItemUpdateEnabled(true);
2320 setMenuItemDeleteEnabled(true);
2321 }
2322 viewCurrentModule();
2323 }
2324
2325 /**
2326 Enable/Disable add menu item
2327
2328 **/
2329 private void setMenuItemAddEnabled(boolean isEnable) {
2330 jMenuItemPopupAdd.setEnabled(isEnable);
2331 }
2332
2333 /**
2334 Enable/Disable update menu item
2335
2336 **/
2337 private void setMenuItemUpdateEnabled(boolean isEnable) {
2338 jMenuItemPopupUpdate.setEnabled(isEnable);
2339 jMenuItemEditUpdate.setEnabled(isEnable);
2340 }
2341
2342 /**
2343 Enable/Disable delete menu item
2344
2345 **/
2346 private void setMenuItemDeleteEnabled(boolean isEnable) {
2347 jMenuItemPopupDelete.setEnabled(isEnable);
2348 jMenuItemEditDelete.setEnabled(isEnable);
2349 }
2350
2351 /**
2352 Close current open module
2353
2354 **/
2355 private void closeCurrentModule() {
2356 cleanAllXml();
2357
2358 reloadTreeAndTable(ModuleMain.CLOSED);
2359 setMenuItemAddEnabled(false);
2360 setMenuItemUpdateEnabled(false);
2361 setMenuItemDeleteEnabled(false);
2362 cleanDesktopPane();
2363 }
2364
2365 /**
2366 Remove all Internal Frame of Desktop Pane
2367
2368 **/
2369 private void cleanDesktopPane() {
2370 JInternalFrame[] iif = this.jDesktopPane.getAllFrames();
2371 for (int index = 0; index < iif.length; index++) {
2372 iif[index].dispose();
2373 }
2374 }
2375
2376 /**
2377 Set all xml document null
2378
2379 **/
2380 private void cleanAllXml() {
2381 this.currentModule = "";
2382 this.saveFileName = "";
2383 this.currentModuleType = 0;
2384 this.currentNodeType = 0;
2385
2386 xmlMsaDoc = null;
2387 xmlMbdDoc = null;
2388 xmlMlsaDoc = null;
2389 xmlMlbdDoc = null;
2390 xmlmh = null;
2391 xmllcd = null;
2392 xmllib = null;
2393 xmlsf = null;
2394 xmlic = null;
2395 xmlpl = null;
2396 xmlen = null;
2397 xmlhob = null;
2398 xmlppi = null;
2399 xmlvb = null;
2400 xmlbm = null;
2401 xmlst = null;
2402 xmldh = null;
2403 xmlfs = null;
2404 xmlgu = null;
2405 xmlet = null;
2406 xmlpcd = null;
2407 xmlbo = null;
2408 }
2409
2410 /**
2411 Execute add operation for current node
2412
2413 @param intCategory The category of current node
2414 @param intLocation The location of current node
2415
2416 **/
2417 private void addCurrentModule(int intCategory, int intLocation) {
2418 //
2419 //Add new libraries
2420 //
2421 if (intCategory == IDefaultMutableTreeNode.LIBRARIES
2422 || intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY
2423 || intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH) {
2424 showLibraries(ModuleMain.ADD, intCategory, -1);
2425 }
2426
2427 //
2428 //Add new sourcefiles
2429 //
2430 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES
2431 || intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME
2432 || intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH) {
2433 showSourceFiles(ModuleMain.ADD, intCategory, -1);
2434 }
2435
2436 //
2437 //Add new includes
2438 //
2439 if (intCategory == IDefaultMutableTreeNode.INCLUDES
2440 || intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME
2441 || intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH) {
2442 showIncludes(ModuleMain.ADD, intCategory, -1);
2443 }
2444
2445 //
2446 //Add new protocols
2447 //
2448 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS
2449 || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL
2450 || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY) {
2451 showProtocols(ModuleMain.ADD, intCategory, -1);
2452 }
2453
2454 //
2455 //Add new events
2456 //
2457 if (intCategory == IDefaultMutableTreeNode.EVENTS || intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS
2458 || intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS) {
2459 showEvents(ModuleMain.ADD, intCategory, -1);
2460 }
2461
2462 //
2463 //Add new hobs
2464 //
2465 if (intCategory == IDefaultMutableTreeNode.HOBS || intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {
2466 showHobs(ModuleMain.ADD, intCategory, -1);
2467 }
2468
2469 //
2470 //Add new ppis
2471 //
2472 if (intCategory == IDefaultMutableTreeNode.PPIS || intCategory == IDefaultMutableTreeNode.PPIS_PPI
2473 || intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY) {
2474 showPpis(ModuleMain.ADD, intCategory, -1);
2475 }
2476
2477 //
2478 //Add new variables
2479 //
2480 if (intCategory == IDefaultMutableTreeNode.VARIABLES
2481 || intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {
2482 showVariables(ModuleMain.ADD, intCategory, -1);
2483 }
2484
2485 //
2486 //Add new BootModes
2487 //
2488 if (intCategory == IDefaultMutableTreeNode.BOOTMODES
2489 || intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {
2490 showBootModes(ModuleMain.ADD, intCategory, -1);
2491 }
2492
2493 //
2494 //Add new SystemTables
2495 //
2496 if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES
2497 || intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {
2498 showSystemTables(ModuleMain.ADD, intCategory, -1);
2499 }
2500
2501 //
2502 //Add new DataHubs
2503 //
2504 if (intCategory == IDefaultMutableTreeNode.DATAHUBS
2505 || intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {
2506 showDataHubs(ModuleMain.ADD, intCategory, -1);
2507 }
2508
2509 //
2510 //Add new Formsets
2511 //
2512 if (intCategory == IDefaultMutableTreeNode.FORMSETS
2513 || intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {
2514 showFormsets(ModuleMain.ADD, intCategory, -1);
2515 }
2516
2517 //
2518 //Add new Guids
2519 //
2520 if (intCategory == IDefaultMutableTreeNode.GUIDS || intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {
2521 showGuids(ModuleMain.ADD, intCategory, -1);
2522 }
2523
2524 //
2525 //Add new Externs
2526 //
2527 if (intCategory == IDefaultMutableTreeNode.EXTERNS
2528 || intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {
2529 showExterns(ModuleMain.ADD, intCategory, -1);
2530 }
2531
2532 //
2533 //Add new PCDs
2534 //
2535 if (intCategory == IDefaultMutableTreeNode.PCDS || intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {
2536 showPCDs(ModuleMain.ADD, intCategory, -1);
2537 }
2538 }
2539
2540 /**
2541 Execute delete operation of current node
2542
2543 @param intCategory The category of current node
2544 @param intLocation The location of current node
2545
2546 **/
2547 private void deleteCurrentModule(int intCategory, int intLocation) {
2548 //
2549 // Delete Msa Header
2550 //
2551 if (intCategory == IDefaultMutableTreeNode.MSA_HEADER || intCategory == IDefaultMutableTreeNode.MBD_HEADER
2552 || intCategory == IDefaultMutableTreeNode.MLSA_HEADER || intCategory == IDefaultMutableTreeNode.MLBD_HEADER) {
2553 if (JOptionPane.showConfirmDialog(null, "The module will be deleted permanently, do you want to continue?") == JOptionPane.YES_OPTION) {
2554 try {
2555 File f = new File(currentModule);
2556 f.delete();
2557 closeCurrentModule();
2558 } catch (Exception e) {
2559 Log.err("Delete " + currentModule, e.getMessage());
2560 }
2561 } else {
2562 return;
2563 }
2564 }
2565
2566 //
2567 //Delete LIBRARY CLASS DEFINITIONS
2568 //
2569 if (intCategory == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS) {
2570 xmllcd = null;
2571 }
2572
2573 //
2574 //Delete Libraries
2575 //
2576 if (intCategory == IDefaultMutableTreeNode.LIBRARIES) {
2577 xmllib = null;
2578 }
2579 if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY) {
2580 for (int indexI = xmllib.getLibraryList().size() - 1; indexI > -1; indexI--) {
2581 xmllib.removeLibrary(indexI);
2582 }
2583 if (xmllib.getArchList().size() < 1 && xmllib.getLibraryList().size() < 1) {
2584 xmllib = null;
2585 }
2586 }
2587 if (intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH) {
2588 for (int indexI = xmllib.getArchList().size() - 1; indexI > -1; indexI--) {
2589 xmllib.removeArch(indexI);
2590 }
2591 if (xmllib.getArchList().size() < 1 && xmllib.getLibraryList().size() < 1) {
2592 xmllib = null;
2593 }
2594 }
2595 if (intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM) {
2596 xmllib.removeArch(intLocation);
2597 }
2598 if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM) {
2599 xmllib.removeLibrary(intLocation);
2600 }
2601
2602 //
2603 //Delete SourceFiles
2604 //
2605 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES) {
2606 xmlsf = null;
2607 }
2608 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME) {
2609 for (int indexI = xmlsf.getFilenameList().size() - 1; indexI > -1; indexI--) {
2610 xmlsf.removeFilename(indexI);
2611 }
2612 if (xmlsf.getArchList().size() < 1 && xmlsf.getFilenameList().size() < 1) {
2613 xmlsf = null;
2614 }
2615 }
2616 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH) {
2617 for (int indexI = xmlsf.getArchList().size() - 1; indexI > -1; indexI--) {
2618 xmlsf.removeArch(indexI);
2619 }
2620 if (xmlsf.getArchList().size() < 1 && xmlsf.getFilenameList().size() < 1) {
2621 xmlsf = null;
2622 }
2623 }
2624 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM) {
2625 xmlsf.removeArch(intLocation);
2626 }
2627 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME_ITEM) {
2628 xmlsf.removeFilename(intLocation);
2629 }
2630
2631 //
2632 //Delete Includes
2633 //
2634 if (intCategory == IDefaultMutableTreeNode.INCLUDES) {
2635 xmlic = null;
2636 }
2637 if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME) {
2638 for (int indexI = xmlic.getPackageNameList().size() - 1; indexI > -1; indexI--) {
2639 xmlic.removePackageName(indexI);
2640 }
2641 if (xmlic.getArchList().size() < 1 && xmlic.getPackageNameList().size() < 1) {
2642 xmlic = null;
2643 }
2644 }
2645 if (intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH) {
2646 for (int indexI = xmlic.getArchList().size() - 1; indexI > -1; indexI--) {
2647 xmlic.removeArch(indexI);
2648 }
2649 if (xmlic.getArchList().size() < 1 && xmlic.getPackageNameList().size() < 1) {
2650 xmlic = null;
2651 }
2652 }
2653 if (intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM) {
2654 xmlic.removeArch(intLocation);
2655 }
2656 if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME_ITEM) {
2657 xmlic.removePackageName(intLocation);
2658 }
2659
2660 //
2661 //Delete Protocols
2662 //
2663 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS) {
2664 xmlpl = null;
2665 }
2666 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL) {
2667 for (int indexI = xmlpl.getProtocolList().size() - 1; indexI > -1; indexI--) {
2668 xmlpl.removeProtocol(indexI);
2669 }
2670 if (xmlpl.getProtocolList().size() < 1 && xmlpl.getProtocolNotifyList().size() < 1) {
2671 xmlpl = null;
2672 }
2673 }
2674 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY) {
2675 for (int indexI = xmlpl.getProtocolList().size() - 1; indexI > -1; indexI--) {
2676 xmlpl.removeProtocolNotify(indexI);
2677 }
2678 if (xmlpl.getProtocolList().size() < 1 && xmlpl.getProtocolNotifyList().size() < 1) {
2679 xmlpl = null;
2680 }
2681 }
2682 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM) {
2683 xmlpl.removeProtocol(intLocation);
2684 }
2685 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {
2686 xmlpl.removeProtocolNotify(intLocation);
2687 }
2688
2689 //
2690 //Delete Events
2691 //
2692 if (intCategory == IDefaultMutableTreeNode.EVENTS) {
2693 xmlen = null;
2694 }
2695 if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS) {
2696 for (int indexI = xmlen.getCreateEvents().getEventList().size() - 1; indexI > -1; indexI--) {
2697 xmlen.getCreateEvents().removeEvent(indexI);
2698 }
2699 if (xmlen.getCreateEvents().getEventList().size() < 1 && xmlen.getSignalEvents().getEventList().size() < 1) {
2700 xmlen = null;
2701 }
2702 }
2703 if (intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS) {
2704 for (int indexI = xmlen.getSignalEvents().getEventList().size() - 1; indexI > -1; indexI--) {
2705 xmlen.getSignalEvents().removeEvent(indexI);
2706 }
2707 if (xmlen.getCreateEvents().getEventList().size() < 1 && xmlen.getSignalEvents().getEventList().size() < 1) {
2708 xmlen = null;
2709 }
2710 }
2711 if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM) {
2712 xmlen.getCreateEvents().removeEvent(intLocation);
2713 }
2714 if (intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {
2715 xmlen.getSignalEvents().removeEvent(intLocation);
2716 }
2717
2718 //
2719 //Delete Hobs
2720 //
2721 if (intCategory == IDefaultMutableTreeNode.HOBS) {
2722 xmlhob = null;
2723 }
2724 if (intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {
2725 xmlhob.removeHob(intLocation);
2726 if (xmlhob.getHobList().size() < 1) {
2727 xmlhob = null;
2728 }
2729 }
2730
2731 //
2732 //Delete Ppis
2733 //
2734 if (intCategory == IDefaultMutableTreeNode.PPIS) {
2735 xmlppi = null;
2736 }
2737 if (intCategory == IDefaultMutableTreeNode.PPIS_PPI) {
2738 for (int indexI = xmlppi.getPpiList().size() - 1; indexI > -1; indexI--) {
2739 xmlppi.removePpi(indexI);
2740 }
2741 if (xmlppi.getPpiList().size() < 1 && xmlppi.getPpiNotifyList().size() < 1) {
2742 xmlppi = null;
2743 }
2744 }
2745 if (intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY) {
2746 for (int indexI = xmlppi.getPpiNotifyList().size() - 1; indexI > -1; indexI--) {
2747 xmlppi.removePpiNotify(indexI);
2748 }
2749 if (xmlppi.getPpiList().size() < 1 && xmlppi.getPpiNotifyList().size() < 1) {
2750 xmlppi = null;
2751 }
2752 }
2753 if (intCategory == IDefaultMutableTreeNode.PPIS_PPI_ITEM) {
2754 xmlppi.removePpi(intLocation);
2755 }
2756 if (intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {
2757 xmlppi.removePpiNotify(intLocation);
2758 }
2759
2760 //
2761 //Delete Variables
2762 //
2763 if (intCategory == IDefaultMutableTreeNode.VARIABLES) {
2764 xmlvb = null;
2765 }
2766 if (intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {
2767 xmlvb.removeVariable(intLocation);
2768 if (xmlvb.getVariableList().size() < 1) {
2769 xmlvb = null;
2770 }
2771 }
2772
2773 //
2774 //Delete BootModes
2775 //
2776 if (intCategory == IDefaultMutableTreeNode.BOOTMODES) {
2777 xmlbm = null;
2778 }
2779 if (intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {
2780 xmlbm.removeBootMode(intLocation);
2781 if (xmlbm.getBootModeList().size() < 1) {
2782 xmlbm = null;
2783 }
2784 }
2785
2786 //
2787 //Delete SystemTables
2788 //
2789 if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES) {
2790 xmlst = null;
2791 }
2792 if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {
2793 xmlst.removeSystemTable(intLocation);
2794 if (xmlst.getSystemTableList().size() < 1) {
2795 xmlst = null;
2796 }
2797 }
2798
2799 //
2800 //Delete DataHubs
2801 //
2802 if (intCategory == IDefaultMutableTreeNode.DATAHUBS) {
2803 xmldh = null;
2804 }
2805 if (intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {
2806 xmldh.removeDataHubRecord(intLocation);
2807 if (xmldh.getDataHubRecordList().size() < 1) {
2808 xmldh = null;
2809 }
2810 }
2811
2812 //
2813 //Delete Formsets
2814 //
2815 if (intCategory == IDefaultMutableTreeNode.FORMSETS) {
2816 xmlfs = null;
2817 }
2818 if (intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {
2819 xmlfs.removeFormset(intLocation);
2820 if (xmlfs.getFormsetList().size() < 1) {
2821 xmlfs = null;
2822 }
2823 }
2824
2825 //
2826 //Delete Guids
2827 //
2828 if (intCategory == IDefaultMutableTreeNode.GUIDS) {
2829 xmlgu = null;
2830 }
2831 if (intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {
2832 xmlgu.removeGuidEntry(intLocation);
2833 if (xmlgu.getGuidEntryList().size() < 1) {
2834 xmlgu = null;
2835 }
2836 }
2837
2838 //
2839 //Delete Externs
2840 //
2841 if (intCategory == IDefaultMutableTreeNode.EXTERNS) {
2842 xmlet = null;
2843 }
2844 if (intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {
2845 xmlet.removeExtern(intLocation);
2846 if (xmlet.getExternList().size() < 1) {
2847 xmlet = null;
2848 }
2849 }
2850
2851 //
2852 //Delete PCDs
2853 //
2854 if (intCategory == IDefaultMutableTreeNode.PCDS) {
2855 xmlpcd = null;
2856 }
2857 if (intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {
2858 xmlpcd.removePcdData(intLocation);
2859 if (xmlpcd.getPcdDataList().size() < 1) {
2860 xmlpcd = null;
2861 }
2862 }
2863 this.cleanDesktopPane();
2864 reloadTreeAndTable(UPDATE_WITH_CHANGE);
2865 }
2866
2867 /**
2868 View current Module
2869
2870 **/
2871 private void viewCurrentModule() {
2872 int intCategory = iTree.getSelectCategory();
2873 int intLocation = iTree.getSelectLoaction();
2874 //
2875 //View Msa Header
2876 //
2877 if (intCategory == IDefaultMutableTreeNode.MSA_HEADER) {
2878 showMsaHeader(ModuleMain.VIEW);
2879 }
2880
2881 //
2882 //View Mbd Header
2883 //
2884 if (intCategory == IDefaultMutableTreeNode.MBD_HEADER) {
2885 showMbdHeader(ModuleMain.VIEW);
2886 }
2887
2888 //
2889 //View Msa Lib Header
2890 //
2891 if (intCategory == IDefaultMutableTreeNode.MLSA_HEADER) {
2892 showMlsaHeader(ModuleMain.VIEW);
2893 }
2894
2895 //
2896 //View Mbd Lib Header
2897 //
2898 if (intCategory == IDefaultMutableTreeNode.MLBD_HEADER) {
2899 showMlbdHeader(ModuleMain.VIEW);
2900 }
2901
2902 //
2903 //View Libraries
2904 //
2905 if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY
2906 || intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM) {
2907 showLibraries(ModuleMain.VIEW, intCategory, intLocation);
2908 }
2909
2910 //
2911 //View LIBRARY CLASS DEFINITIONS
2912 //
2913 if (intCategory == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS) {
2914 showLibraryClassDefinitions(ModuleMain.VIEW, intCategory);
2915 }
2916
2917 //
2918 //View Source Files
2919 //
2920 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME
2921 || intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM) {
2922 showSourceFiles(ModuleMain.VIEW, intCategory, intLocation);
2923 }
2924
2925 //
2926 //View Includes
2927 //
2928 if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME
2929 || intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM) {
2930 showIncludes(ModuleMain.VIEW, intCategory, intLocation);
2931 }
2932
2933 //
2934 //View Protocols
2935 //
2936 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM
2937 || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {
2938 showProtocols(ModuleMain.VIEW, intCategory, intLocation);
2939 }
2940
2941 //
2942 //View Hobs
2943 //
2944 if (intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {
2945 showHobs(ModuleMain.VIEW, intCategory, intLocation);
2946 }
2947
2948 //
2949 //View Events
2950 //
2951 if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM
2952 || intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {
2953 showEvents(ModuleMain.VIEW, intCategory, intLocation);
2954 }
2955
2956 //
2957 //View Ppis
2958 //
2959 if (intCategory == IDefaultMutableTreeNode.PPIS_PPI_ITEM
2960 || intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {
2961 showPpis(ModuleMain.VIEW, intCategory, intLocation);
2962 }
2963
2964 //
2965 //View Variables
2966 //
2967 if (intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {
2968 showVariables(ModuleMain.VIEW, intCategory, intLocation);
2969 }
2970
2971 //
2972 //View BootModes
2973 //
2974 if (intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {
2975 showBootModes(ModuleMain.VIEW, intCategory, intLocation);
2976 }
2977
2978 //
2979 //View SystemTables
2980 //
2981 if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {
2982 showSystemTables(ModuleMain.VIEW, intCategory, intLocation);
2983 }
2984
2985 //
2986 //View DataHubs
2987 //
2988 if (intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {
2989 showDataHubs(ModuleMain.VIEW, intCategory, intLocation);
2990 }
2991
2992 //
2993 //View Formsets
2994 //
2995 if (intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {
2996 showFormsets(ModuleMain.VIEW, intCategory, intLocation);
2997 }
2998
2999 //
3000 //View Guids
3001 //
3002 if (intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {
3003 showGuids(ModuleMain.VIEW, intCategory, intLocation);
3004 }
3005
3006 //
3007 //View Externs
3008 //
3009 if (intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {
3010 showExterns(ModuleMain.VIEW, intCategory, intLocation);
3011 }
3012
3013 //
3014 //View PCDs
3015 //
3016 if (intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {
3017 showPCDs(ModuleMain.VIEW, intCategory, intLocation);
3018 }
3019 }
3020
3021 /**
3022 Execute update operation of current module
3023
3024 @param intCategory The category of current node
3025 @param intLocation The location of current node
3026
3027 **/
3028 private void updateCurrentModule(int intCategory, int intLocation) {
3029 //
3030 //Update Msa Header
3031 //
3032 if (intCategory == IDefaultMutableTreeNode.MSA_HEADER) {
3033 showMsaHeader(ModuleMain.UPDATE);
3034 }
3035
3036 //
3037 //Update Mbd Header
3038 //
3039 if (intCategory == IDefaultMutableTreeNode.MBD_HEADER) {
3040 showMbdHeader(ModuleMain.UPDATE);
3041 }
3042
3043 //
3044 //Update Msa Lib Header
3045 //
3046 if (intCategory == IDefaultMutableTreeNode.MLSA_HEADER) {
3047 showMlsaHeader(ModuleMain.UPDATE);
3048 }
3049
3050 //
3051 //Update Mbd Lib Header
3052 //
3053 if (intCategory == IDefaultMutableTreeNode.MLBD_HEADER) {
3054 showMlbdHeader(ModuleMain.UPDATE);
3055 }
3056
3057 //
3058 //Update Libraries
3059 //
3060 if (intCategory == IDefaultMutableTreeNode.LIBRARIES_LIBRARY
3061 || intCategory == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM) {
3062 showLibraries(ModuleMain.UPDATE, intCategory, intLocation);
3063 }
3064
3065 //
3066 //Update LIBRARY CLASS DEFINITIONS
3067 //
3068 if (intCategory == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS) {
3069 showLibraryClassDefinitions(ModuleMain.UPDATE, intCategory);
3070 }
3071
3072 //
3073 //Update Source Files
3074 //
3075 if (intCategory == IDefaultMutableTreeNode.SOURCEFILES_FILENAME
3076 || intCategory == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM) {
3077 showSourceFiles(ModuleMain.UPDATE, intCategory, intLocation);
3078 }
3079
3080 //
3081 //Update Includes
3082 //
3083 if (intCategory == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME
3084 || intCategory == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM) {
3085 showIncludes(ModuleMain.UPDATE, intCategory, intLocation);
3086 }
3087
3088 //
3089 //Update Protocols
3090 //
3091 if (intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM
3092 || intCategory == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {
3093 showProtocols(ModuleMain.UPDATE, intCategory, intLocation);
3094 }
3095
3096 //
3097 //Update Hobs
3098 //
3099 if (intCategory == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {
3100 showHobs(ModuleMain.UPDATE, intCategory, intLocation);
3101 }
3102
3103 //
3104 //Update Events
3105 //
3106 if (intCategory == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM
3107 || intCategory == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {
3108 showEvents(ModuleMain.UPDATE, intCategory, intLocation);
3109 }
3110
3111 //
3112 //Update Ppis
3113 //
3114 if (intCategory == IDefaultMutableTreeNode.PPIS_PPI_ITEM
3115 || intCategory == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {
3116 showPpis(ModuleMain.UPDATE, intCategory, intLocation);
3117 }
3118
3119 //
3120 //Update Variables
3121 //
3122 if (intCategory == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {
3123 showVariables(ModuleMain.UPDATE, intCategory, intLocation);
3124 }
3125
3126 //
3127 //Update BootModes
3128 //
3129 if (intCategory == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {
3130 showBootModes(ModuleMain.UPDATE, intCategory, intLocation);
3131 }
3132
3133 //
3134 //Update SystemTables
3135 //
3136 if (intCategory == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {
3137 showSystemTables(ModuleMain.UPDATE, intCategory, intLocation);
3138 }
3139
3140 //
3141 //Update DataHubs
3142 //
3143 if (intCategory == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {
3144 showDataHubs(ModuleMain.UPDATE, intCategory, intLocation);
3145 }
3146
3147 //
3148 //Update Formsets
3149 //
3150 if (intCategory == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {
3151 showFormsets(ModuleMain.UPDATE, intCategory, intLocation);
3152 }
3153
3154 //
3155 //Update Guids
3156 //
3157 if (intCategory == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {
3158 showGuids(ModuleMain.UPDATE, intCategory, intLocation);
3159 }
3160
3161 //
3162 //Update Externs
3163 //
3164 if (intCategory == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {
3165 showExterns(ModuleMain.UPDATE, intCategory, intLocation);
3166 }
3167
3168 //
3169 //Update PCDs
3170 //
3171 if (intCategory == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {
3172 showPCDs(ModuleMain.UPDATE, intCategory, intLocation);
3173 }
3174 }
3175
3176 /**
3177 Save current module
3178 Call relevant function via different file types
3179
3180 **/
3181 private void saveCurrentModule() {
3182 if (this.saveFileName == "") {
3183 openFile(2, this.currentModuleType);
3184 }
3185 if (this.saveFileName == "") {
3186 this.saveFileName = this.currentModule;
3187 return;
3188 } else {
3189 switch (this.currentModuleType) {
3190 case 1:
3191 saveMsa();
3192 break;
3193 case 2:
3194 saveMbd();
3195 break;
3196 case 3:
3197 saveMlsa();
3198 break;
3199 case 4:
3200 saveMlbd();
3201 break;
3202 }
3203
3204 }
3205
3206 reloadTreeAndTable(SAVE_WITH_CHANGE);
3207 }
3208
3209 /**
3210 Save current module as
3211
3212 **/
3213 private void saveAsCurrentModule() {
3214 this.saveFileName = "";
3215 saveCurrentModule();
3216 }
3217
3218 /**
3219 Save file as msa
3220
3221 **/
3222 private void saveMsa() {
3223 File f = new File(this.saveFileName);
3224 ModuleSurfaceAreaDocument msaDoc = ModuleSurfaceAreaDocument.Factory.newInstance();
3225 ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = ModuleSurfaceAreaDocument.ModuleSurfaceArea.Factory
3226 .newInstance();
3227
3228 //
3229 //Add all components into xml doc file
3230 //
3231 if (xmlmh != null) {
3232 msa.setMsaHeader(xmlmh);
3233 }
3234 if (xmllcd != null) {
3235 msa.setLibraryClassDefinitions(xmllcd);
3236 }
3237 if (xmlsf != null) {
3238 msa.setSourceFiles(xmlsf);
3239 }
3240 if (xmlic != null) {
3241 msa.setIncludes(xmlic);
3242 }
3243 if (xmlpl != null) {
3244 msa.setProtocols(xmlpl);
3245 }
3246 if (xmlen != null) {
3247 msa.setEvents(xmlen);
3248 }
3249 if (xmlhob != null) {
3250 msa.setHobs(xmlhob);
3251 }
3252 if (xmlppi != null) {
3253 msa.setPPIs(xmlppi);
3254 }
3255 if (xmlvb != null) {
3256 msa.setVariables(xmlvb);
3257 }
3258 if (xmlbm != null) {
3259 msa.setBootModes(xmlbm);
3260 }
3261 if (xmlst != null) {
3262 msa.setSystemTables(xmlst);
3263 }
3264 if (xmldh != null) {
3265 msa.setDataHubs(xmldh);
3266 }
3267 if (xmlfs != null) {
3268 msa.setFormsets(xmlfs);
3269 }
3270 if (xmlgu != null) {
3271 msa.setGuids(xmlgu);
3272 }
3273 if (xmlet != null) {
3274 msa.setExterns(xmlet);
3275 }
3276 if (xmlpcd != null) {
3277 msa.setPCDs(xmlpcd);
3278 }
3279 if (xmlbo != null) {
3280 msa.setBuildOptions(xmlbo);
3281 }
3282 //
3283 //Init namespace
3284 //
3285 XmlCursor cursor = msa.newCursor();
3286 String uri = "http://www.TianoCore.org/2006/Edk2.0";
3287 cursor.push();
3288 cursor.toNextToken();
3289 cursor.insertNamespace("", uri);
3290 cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
3291 cursor.pop();
3292
3293 //
3294 //Config file format
3295 //
3296 XmlOptions options = new XmlOptions();
3297 options.setCharacterEncoding("UTF-8");
3298 options.setSavePrettyPrint();
3299 options.setSavePrettyPrintIndent(2);
3300
3301 //
3302 //Create finial doc
3303 //
3304 msaDoc.addNewModuleSurfaceArea();
3305 msaDoc.setModuleSurfaceArea((ModuleSurfaceAreaDocument.ModuleSurfaceArea) cursor.getObject());
3306 try {
3307 //
3308 //Save the file
3309 //
3310 msaDoc.save(f, options);
3311 this.currentModule = this.saveFileName;
3312 } catch (Exception e) {
3313 Log.err("Save Msa", e.getMessage());
3314 }
3315 }
3316
3317 /**
3318 Save file as mbd
3319
3320 **/
3321 private void saveMbd() {
3322 File f = new File(this.saveFileName);
3323 ModuleBuildDescriptionDocument mbdDoc = ModuleBuildDescriptionDocument.Factory.newInstance();
3324 ModuleBuildDescriptionDocument.ModuleBuildDescription mbd = ModuleBuildDescriptionDocument.ModuleBuildDescription.Factory
3325 .newInstance();
3326 //
3327 //Add all components into xml doc file
3328 //
3329 if (xmlmbdh != null) {
3330 mbd.setMbdHeader(xmlmbdh);
3331 }
3332 if (xmllib != null) {
3333 mbd.setLibraries(xmllib);
3334 }
3335 if (xmlsf != null) {
3336 mbd.setSourceFiles(xmlsf);
3337 }
3338 if (xmlic != null) {
3339 mbd.setIncludes(xmlic);
3340 }
3341 if (xmlpl != null) {
3342 mbd.setProtocols(xmlpl);
3343 }
3344 if (xmlen != null) {
3345 mbd.setEvents(xmlen);
3346 }
3347 if (xmlhob != null) {
3348 mbd.setHobs(xmlhob);
3349 }
3350 if (xmlppi != null) {
3351 mbd.setPPIs(xmlppi);
3352 }
3353 if (xmlvb != null) {
3354 mbd.setVariables(xmlvb);
3355 }
3356 if (xmlbm != null) {
3357 mbd.setBootModes(xmlbm);
3358 }
3359 if (xmlst != null) {
3360 mbd.setSystemTables(xmlst);
3361 }
3362 if (xmldh != null) {
3363 mbd.setDataHubs(xmldh);
3364 }
3365 if (xmlfs != null) {
3366 mbd.setFormsets(xmlfs);
3367 }
3368 if (xmlgu != null) {
3369 mbd.setGuids(xmlgu);
3370 }
3371 if (xmlet != null) {
3372 mbd.setExterns(xmlet);
3373 }
3374 if (xmlpcd != null) {
3375 mbd.setPCDs(xmlpcd);
3376 }
3377 if (xmlbo != null) {
3378 mbd.setBuildOptions(xmlbo);
3379 }
3380 //
3381 //Init namespace
3382 //
3383 XmlCursor cursor = mbd.newCursor();
3384 String uri = "http://www.TianoCore.org/2006/Edk2.0";
3385 cursor.push();
3386 cursor.toNextToken();
3387 cursor.insertNamespace("", uri);
3388 cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
3389 cursor.pop();
3390
3391 //
3392 //Config file format
3393 //
3394 XmlOptions options = new XmlOptions();
3395 options.setCharacterEncoding("UTF-8");
3396 options.setSavePrettyPrint();
3397 options.setSavePrettyPrintIndent(2);
3398
3399 //
3400 //Create finial doc
3401 //
3402 mbdDoc.addNewModuleBuildDescription();
3403 mbdDoc.setModuleBuildDescription((ModuleBuildDescriptionDocument.ModuleBuildDescription) cursor.getObject());
3404 try {
3405 //
3406 //Save the file
3407 //
3408 mbdDoc.save(f, options);
3409 this.currentModule = this.saveFileName;
3410 } catch (Exception e) {
3411 Log.err("Save Mbd", e.getMessage());
3412 }
3413 }
3414
3415 /**
3416 Save file as mlsa
3417
3418 **/
3419 private void saveMlsa() {
3420 File f = new File(this.saveFileName);
3421 LibraryModuleSurfaceAreaDocument mlsaDoc = LibraryModuleSurfaceAreaDocument.Factory.newInstance();
3422 LibraryModuleSurfaceAreaDocument.LibraryModuleSurfaceArea mlsa = LibraryModuleSurfaceAreaDocument.LibraryModuleSurfaceArea.Factory
3423 .newInstance();
3424 //
3425 //Add all components into xml doc file
3426 //
3427 if (xmlmlh != null) {
3428 mlsa.setMsaLibHeader(xmlmlh);
3429 }
3430 if (xmllcd != null) {
3431 mlsa.setLibraryClassDefinitions(xmllcd);
3432 }
3433 if (xmlsf != null) {
3434 mlsa.setSourceFiles(xmlsf);
3435 }
3436 if (xmlic != null) {
3437 mlsa.setIncludes(xmlic);
3438 }
3439 if (xmlpl != null) {
3440 mlsa.setProtocols(xmlpl);
3441 }
3442 if (xmlen != null) {
3443 mlsa.setEvents(xmlen);
3444 }
3445 if (xmlhob != null) {
3446 mlsa.setHobs(xmlhob);
3447 }
3448 if (xmlppi != null) {
3449 mlsa.setPPIs(xmlppi);
3450 }
3451 if (xmlvb != null) {
3452 mlsa.setVariables(xmlvb);
3453 }
3454 if (xmlbm != null) {
3455 mlsa.setBootModes(xmlbm);
3456 }
3457 if (xmlst != null) {
3458 mlsa.setSystemTables(xmlst);
3459 }
3460 if (xmldh != null) {
3461 mlsa.setDataHubs(xmldh);
3462 }
3463 if (xmlfs != null) {
3464 mlsa.setFormsets(xmlfs);
3465 }
3466 if (xmlgu != null) {
3467 mlsa.setGuids(xmlgu);
3468 }
3469 if (xmlet != null) {
3470 mlsa.setExterns(xmlet);
3471 }
3472 if (xmlpcd != null) {
3473 mlsa.setPCDs(xmlpcd);
3474 }
3475 if (xmlbo != null) {
3476 mlsa.setBuildOptions(xmlbo);
3477 }
3478 //
3479 //Init namespace
3480 //
3481 XmlCursor cursor = mlsa.newCursor();
3482 String uri = "http://www.TianoCore.org/2006/Edk2.0";
3483 cursor.push();
3484 cursor.toNextToken();
3485 cursor.insertNamespace("", uri);
3486 cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
3487 cursor.pop();
3488
3489 //
3490 //Config file format
3491 //
3492 XmlOptions options = new XmlOptions();
3493 options.setCharacterEncoding("UTF-8");
3494 options.setSavePrettyPrint();
3495 options.setSavePrettyPrintIndent(2);
3496
3497 //
3498 //Create finial doc
3499 //
3500 mlsaDoc.addNewLibraryModuleSurfaceArea();
3501 mlsaDoc
3502 .setLibraryModuleSurfaceArea((LibraryModuleSurfaceAreaDocument.LibraryModuleSurfaceArea) cursor
3503 .getObject());
3504 try {
3505 //
3506 //Save the file
3507 //
3508 mlsaDoc.save(f, options);
3509 this.currentModule = this.saveFileName;
3510 } catch (Exception e) {
3511 Log.err("Save Mlsa", e.getMessage());
3512 }
3513 }
3514
3515 /**
3516 Save file as mbd
3517
3518 **/
3519 private void saveMlbd() {
3520 File f = new File(this.saveFileName);
3521 LibraryModuleBuildDescriptionDocument mlbdDoc = LibraryModuleBuildDescriptionDocument.Factory.newInstance();
3522 LibraryModuleBuildDescriptionDocument.LibraryModuleBuildDescription mlbd = LibraryModuleBuildDescriptionDocument.LibraryModuleBuildDescription.Factory
3523 .newInstance();
3524 //
3525 //Add all components into xml doc file
3526 //
3527 if (xmlmlbdh != null) {
3528 mlbd.setMbdLibHeader(xmlmlbdh);
3529 }
3530 if (xmllib != null) {
3531 mlbd.setLibraries(xmllib);
3532 }
3533 if (xmlsf != null) {
3534 mlbd.setSourceFiles(xmlsf);
3535 }
3536 if (xmlic != null) {
3537 mlbd.setIncludes(xmlic);
3538 }
3539 if (xmlpl != null) {
3540 mlbd.setProtocols(xmlpl);
3541 }
3542 if (xmlen != null) {
3543 mlbd.setEvents(xmlen);
3544 }
3545 if (xmlhob != null) {
3546 mlbd.setHobs(xmlhob);
3547 }
3548 if (xmlppi != null) {
3549 mlbd.setPPIs(xmlppi);
3550 }
3551 if (xmlvb != null) {
3552 mlbd.setVariables(xmlvb);
3553 }
3554 if (xmlbm != null) {
3555 mlbd.setBootModes(xmlbm);
3556 }
3557 if (xmlst != null) {
3558 mlbd.setSystemTables(xmlst);
3559 }
3560 if (xmldh != null) {
3561 mlbd.setDataHubs(xmldh);
3562 }
3563 if (xmlfs != null) {
3564 mlbd.setFormsets(xmlfs);
3565 }
3566 if (xmlgu != null) {
3567 mlbd.setGuids(xmlgu);
3568 }
3569 if (xmlet != null) {
3570 mlbd.setExterns(xmlet);
3571 }
3572 if (xmlpcd != null) {
3573 mlbd.setPCDs(xmlpcd);
3574 }
3575 if (xmlbo != null) {
3576 mlbd.setBuildOptions(xmlbo);
3577 }
3578 //
3579 //Init namespace
3580 //
3581 XmlCursor cursor = mlbd.newCursor();
3582 String uri = "http://www.TianoCore.org/2006/Edk2.0";
3583 cursor.push();
3584 cursor.toNextToken();
3585 cursor.insertNamespace("", uri);
3586 cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
3587 cursor.pop();
3588
3589 //
3590 //Config file format
3591 //
3592 XmlOptions options = new XmlOptions();
3593 options.setCharacterEncoding("UTF-8");
3594 options.setSavePrettyPrint();
3595 options.setSavePrettyPrintIndent(2);
3596
3597 //
3598 //Create finial doc
3599 //
3600 mlbdDoc.addNewLibraryModuleBuildDescription();
3601 mlbdDoc
3602 .setLibraryModuleBuildDescription((LibraryModuleBuildDescriptionDocument.LibraryModuleBuildDescription) cursor
3603 .getObject());
3604 try {
3605 //
3606 //Save the file
3607 //
3608 mlbdDoc.save(f, options);
3609 this.currentModule = this.saveFileName;
3610 } catch (Exception e) {
3611 Log.err("Save Mbd", e.getMessage());
3612 }
3613 }
3614
3615 /**
3616 Reflash the tree via current value of xml documents.
3617
3618 @param intMode The input data of current operation type
3619
3620 **/
3621 private void reloadTreeAndTable(int intMode) {
3622 makeTree();
3623 if (intMode == ModuleMain.OPENED) {
3624 this.jMenuItemModuleClose.setEnabled(true);
3625 this.jMenuItemModuleSaveAs.setEnabled(true);
3626 this.jMenuEditAdd.setEnabled(true);
3627 this.setTitle(windowTitle + "- [" + this.currentModule + "]");
3628 this.jButtonOk.setEnabled(false);
3629 this.jButtonCancel.setEnabled(false);
3630 }
3631 if (intMode == ModuleMain.CLOSED) {
3632 this.jMenuItemModuleClose.setEnabled(false);
3633 this.jMenuItemModuleSave.setEnabled(false);
3634 this.jMenuItemModuleSaveAs.setEnabled(false);
3635 this.jMenuEditAdd.setEnabled(false);
3636 this.setTitle(windowTitle + "- [" + ws.getCurrentWorkspace() + "]");
3637 this.setButtonEnable(false);
3638 }
3639 if (intMode == ModuleMain.NEW_WITHOUT_CHANGE) {
3640
3641 }
3642
3643 if (intMode == ModuleMain.NEW_WITH_CHANGE) {
3644 this.jMenuItemModuleClose.setEnabled(true);
3645 this.jMenuItemModuleSave.setEnabled(true);
3646 this.jMenuItemModuleSaveAs.setEnabled(true);
3647 this.jMenuEditAdd.setEnabled(true);
3648 setButtonEnable(false);
3649 }
3650 if (intMode == ModuleMain.UPDATE_WITHOUT_CHANGE) {
3651
3652 }
3653 if (intMode == ModuleMain.UPDATE_WITH_CHANGE) {
3654 this.jMenuItemModuleClose.setEnabled(true);
3655 this.jMenuItemModuleSave.setEnabled(true);
3656 this.jMenuItemModuleSaveAs.setEnabled(true);
3657 }
3658 if (intMode == ModuleMain.SAVE_WITHOUT_CHANGE) {
3659 this.jMenuItemModuleClose.setEnabled(true);
3660 this.jMenuItemModuleSave.setEnabled(true);
3661 this.jMenuItemModuleSaveAs.setEnabled(true);
3662 this.jButtonOk.setEnabled(false);
3663 this.jButtonCancel.setEnabled(false);
3664 }
3665 if (intMode == ModuleMain.SAVE_WITH_CHANGE) {
3666 this.jMenuItemModuleClose.setEnabled(true);
3667 this.jMenuItemModuleSave.setEnabled(false);
3668 this.jMenuItemModuleSaveAs.setEnabled(true);
3669 this.jMenuItemEditUpdate.setEnabled(false);
3670 this.jMenuItemEditDelete.setEnabled(false);
3671 this.setTitle(windowTitle + "- [" + this.currentModule + "]");
3672 this.jButtonOk.setEnabled(false);
3673 this.jButtonCancel.setEnabled(false);
3674 }
3675
3676 if (this.currentModuleType == 1 || this.currentModuleType == 3) {
3677 this.jMenuItemEditAddLibraries.setEnabled(false);
3678 this.jMenuItemEditAddLibraryClassDefinitions.setEnabled(true);
3679 }
3680 if (this.currentModuleType == 2 || this.currentModuleType == 4) {
3681 this.jMenuItemEditAddLibraries.setEnabled(true);
3682 this.jMenuItemEditAddLibraryClassDefinitions.setEnabled(false);
3683 }
3684 }
3685
3686 /**
3687 Enable/Disable button Ok and Cancel
3688
3689 @param isEnabled The input data to indicate if button is enabled or not
3690
3691 **/
3692 private void setButtonEnable(boolean isEnabled) {
3693 this.jButtonCancel.setEnabled(isEnabled);
3694 this.jButtonOk.setEnabled(isEnabled);
3695 }
3696
3697 /**
3698 Show msa header
3699 When the operation is VIEW, disable all fields of internal frame
3700
3701 @param type The input data of operation type
3702
3703 **/
3704 private void showMsaHeader(int type) {
3705 msa = null;
3706 msa = new MsaHeader(this.xmlmh);
3707 this.jDesktopPane.removeAll();
3708 this.jDesktopPane.add(msa, 1);
3709 this.currentNodeType = IDefaultMutableTreeNode.MSA_HEADER;
3710 this.currentModuleType = 1;
3711 if (type == ModuleMain.VIEW) {
3712 setButtonEnable(false);
3713 msa.setViewMode(true);
3714 } else {
3715 setButtonEnable(true);
3716 }
3717 }
3718
3719 /**
3720 Show MbdHeader
3721 When the operation is VIEW, disable all fields of internal frame
3722
3723 @param type The input data of operation type
3724
3725 **/
3726 private void showMbdHeader(int type) {
3727 mbd = null;
3728 mbd = new MbdHeader(this.xmlmbdh);
3729 this.jDesktopPane.removeAll();
3730 this.jDesktopPane.add(mbd, 1);
3731 this.currentNodeType = IDefaultMutableTreeNode.MBD_HEADER;
3732 this.currentModuleType = 2;
3733 if (type == ModuleMain.VIEW) {
3734 setButtonEnable(false);
3735 mbd.setViewMode(true);
3736 } else {
3737 setButtonEnable(true);
3738 }
3739 }
3740
3741 /**
3742 Show MlsaHeader
3743 When the operation is VIEW, disable all fields of internal frame
3744
3745 @param type The input data of operation type
3746
3747 **/
3748 private void showMlsaHeader(int type) {
3749 mlsa = null;
3750 mlsa = new MsaLibHeader(this.xmlmlh);
3751 this.jDesktopPane.removeAll();
3752 this.jDesktopPane.add(mlsa, 1);
3753 this.currentNodeType = IDefaultMutableTreeNode.MLSA_HEADER;
3754 this.currentModuleType = 3;
3755 if (type == ModuleMain.VIEW) {
3756 setButtonEnable(false);
3757 mlsa.setViewMode(true);
3758 } else {
3759 setButtonEnable(true);
3760 }
3761 }
3762
3763 /**
3764 Show MlbdHeader
3765 When the operation is VIEW, disable all fields of internal frame
3766
3767 @param type The input data of operation type
3768
3769 **/
3770 private void showMlbdHeader(int type) {
3771 mlbd = null;
3772 mlbd = new MbdLibHeader(this.xmlmlbdh);
3773 this.jDesktopPane.removeAll();
3774 this.jDesktopPane.add(mlbd, 1);
3775 this.currentNodeType = IDefaultMutableTreeNode.MLBD_HEADER;
3776 this.currentModuleType = 4;
3777 if (type == ModuleMain.VIEW) {
3778 setButtonEnable(false);
3779 mlbd.setViewMode(true);
3780 } else {
3781 setButtonEnable(true);
3782 }
3783 }
3784
3785 /**
3786 Show Libraries
3787 When the operation is VIEW, disable all fields of internal frame
3788
3789 @param type The input data of operation type
3790
3791 **/
3792 private void showLibraries(int operationType, int nodeType, int location) {
3793 mlib = null;
3794 if (operationType == ModuleMain.ADD) {
3795 mlib = new MbdLibraries(this.xmllib, -1, -1, 1);
3796 }
3797 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3798 mlib = new MbdLibraries(this.xmllib, nodeType, location, 2);
3799 }
3800 this.jDesktopPane.removeAll();
3801 this.jDesktopPane.add(mlib, 1);
3802 this.currentNodeType = nodeType;
3803 if (operationType == ModuleMain.VIEW) {
3804 setButtonEnable(false);
3805 mlib.setViewMode(true);
3806 } else {
3807 setButtonEnable(true);
3808 }
3809 }
3810
3811 /**
3812 Show LibraryClassDefinitions
3813 When the operation is VIEW, disable all fields of internal frame
3814
3815 @param type The input data of operation type
3816
3817 **/
3818 private void showLibraryClassDefinitions(int operationType, int nodeType) {
3819 mlcd = null;
3820 if (operationType == ModuleMain.ADD) {
3821 mlcd = new ModuleLibraryClassDefinitions(this.xmllcd);
3822 }
3823 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3824 mlcd = new ModuleLibraryClassDefinitions(this.xmllcd);
3825 }
3826 this.jDesktopPane.removeAll();
3827 this.jDesktopPane.add(mlcd, 1);
3828 this.currentNodeType = nodeType;
3829 if (operationType == ModuleMain.VIEW) {
3830 setButtonEnable(false);
3831 mlcd.setViewMode(true);
3832 } else {
3833 setButtonEnable(true);
3834 }
3835 }
3836
3837 /**
3838 Show SourceFiles
3839 When the operation is VIEW, disable all fields of internal frame
3840
3841 @param type The input data of operation type
3842
3843 **/
3844 private void showSourceFiles(int operationType, int nodeType, int location) {
3845 msf = null;
3846 if (operationType == ModuleMain.ADD) {
3847 msf = new ModuleSourceFiles(this.xmlsf, -1, -1, 1);
3848 }
3849 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3850 msf = new ModuleSourceFiles(this.xmlsf, nodeType, location, 2);
3851 }
3852 this.jDesktopPane.removeAll();
3853 this.jDesktopPane.add(msf, 1);
3854 this.currentNodeType = nodeType;
3855 if (operationType == ModuleMain.VIEW) {
3856 setButtonEnable(false);
3857 msf.setViewMode(true);
3858 } else {
3859 setButtonEnable(true);
3860 }
3861 }
3862
3863 /**
3864 Show Includes
3865 When the operation is VIEW, disable all fields of internal frame
3866
3867 @param type The input data of operation type
3868
3869 **/
3870 private void showIncludes(int operationType, int nodeType, int location) {
3871 mic = null;
3872 if (operationType == ModuleMain.ADD) {
3873 mic = new ModuleIncludes(this.xmlic, -1, -1, 1);
3874 }
3875 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3876 mic = new ModuleIncludes(this.xmlic, nodeType, location, 2);
3877 }
3878 this.jDesktopPane.removeAll();
3879 this.jDesktopPane.add(mic, 1);
3880 this.currentNodeType = nodeType;
3881 if (operationType == ModuleMain.VIEW) {
3882 setButtonEnable(false);
3883 mic.setViewMode(true);
3884 } else {
3885 setButtonEnable(true);
3886 }
3887 }
3888
3889 /**
3890 Show Protocols
3891 When the operation is VIEW, disable all fields of internal frame
3892
3893 @param type The input data of operation type
3894
3895 **/
3896 private void showProtocols(int operationType, int nodeType, int location) {
3897 mp = null;
3898 if (operationType == ModuleMain.ADD) {
3899 mp = new ModuleProtocols(this.xmlpl);
3900 }
3901 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3902 mp = new ModuleProtocols(this.xmlpl, nodeType, location);
3903 }
3904 this.jDesktopPane.removeAll();
3905 this.jDesktopPane.add(mp, 1);
3906 this.currentNodeType = nodeType;
3907 if (operationType == ModuleMain.VIEW) {
3908 setButtonEnable(false);
3909 mp.setViewMode(true);
3910 } else {
3911 setButtonEnable(true);
3912 }
3913 }
3914
3915 /**
3916 Show Events
3917 When the operation is VIEW, disable all fields of internal frame
3918
3919 @param type The input data of operation type
3920
3921 **/
3922 private void showEvents(int operationType, int nodeType, int location) {
3923 mev = null;
3924 if (operationType == ModuleMain.ADD) {
3925 mev = new ModuleEvents(this.xmlen);
3926 }
3927 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3928 mev = new ModuleEvents(this.xmlen, nodeType, location);
3929 }
3930 this.jDesktopPane.removeAll();
3931 this.jDesktopPane.add(mev, 1);
3932 this.currentNodeType = nodeType;
3933 if (operationType == ModuleMain.VIEW) {
3934 setButtonEnable(false);
3935 mev.setViewMode(true);
3936 } else {
3937 setButtonEnable(true);
3938 }
3939 }
3940
3941 /**
3942 Show Hobs
3943 When the operation is VIEW, disable all fields of internal frame
3944
3945 @param type The input data of operation type
3946
3947 **/
3948 private void showHobs(int operationType, int nodeType, int location) {
3949 mh = null;
3950 if (operationType == ModuleMain.ADD) {
3951 mh = new ModuleHobs(this.xmlhob);
3952 }
3953 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3954 mh = new ModuleHobs(this.xmlhob, nodeType, location);
3955 }
3956 this.jDesktopPane.removeAll();
3957 this.jDesktopPane.add(mh, 1);
3958 this.currentNodeType = nodeType;
3959 if (operationType == ModuleMain.VIEW) {
3960 setButtonEnable(false);
3961 mh.setViewMode(true);
3962 } else {
3963 setButtonEnable(true);
3964 }
3965 }
3966
3967 /**
3968 Show Ppis
3969 When the operation is VIEW, disable all fields of internal frame
3970
3971 @param type The input data of operation type
3972
3973 **/
3974 private void showPpis(int operationType, int nodeType, int location) {
3975 mpp = null;
3976 if (operationType == ModuleMain.ADD) {
3977 mpp = new ModulePpis(this.xmlppi);
3978 }
3979 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
3980 mpp = new ModulePpis(this.xmlppi, nodeType, location);
3981 }
3982 this.jDesktopPane.removeAll();
3983 this.jDesktopPane.add(mpp, 1);
3984 this.currentNodeType = nodeType;
3985 if (operationType == ModuleMain.VIEW) {
3986 setButtonEnable(false);
3987 mpp.setViewMode(true);
3988 } else {
3989 setButtonEnable(true);
3990 }
3991 }
3992
3993 /**
3994 Show Variables
3995 When the operation is VIEW, disable all fields of internal frame
3996
3997 @param type The input data of operation type
3998
3999 **/
4000 private void showVariables(int operationType, int nodeType, int location) {
4001 mv = null;
4002 if (operationType == ModuleMain.ADD) {
4003 mv = new ModuleVariables(this.xmlvb);
4004 }
4005 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4006 mv = new ModuleVariables(this.xmlvb, nodeType, location);
4007 }
4008 this.jDesktopPane.removeAll();
4009 this.jDesktopPane.add(mv, 1);
4010 this.currentNodeType = nodeType;
4011 if (operationType == ModuleMain.VIEW) {
4012 setButtonEnable(false);
4013 mv.setViewMode(true);
4014 } else {
4015 setButtonEnable(true);
4016 }
4017 }
4018
4019 /**
4020 Show BootModes
4021 When the operation is VIEW, disable all fields of internal frame
4022
4023 @param type The input data of operation type
4024
4025 **/
4026 private void showBootModes(int operationType, int nodeType, int location) {
4027 mbm = null;
4028 if (operationType == ModuleMain.ADD) {
4029 mbm = new ModuleBootModes(this.xmlbm);
4030 }
4031 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4032 mbm = new ModuleBootModes(this.xmlbm, nodeType, location);
4033 }
4034 this.jDesktopPane.removeAll();
4035 this.jDesktopPane.add(mbm, 1);
4036 this.currentNodeType = nodeType;
4037 if (operationType == ModuleMain.VIEW) {
4038 setButtonEnable(false);
4039 mbm.setViewMode(true);
4040 } else {
4041 setButtonEnable(true);
4042 }
4043 }
4044
4045 /**
4046 Show SystemTables
4047 When the operation is VIEW, disable all fields of internal frame
4048
4049 @param type The input data of operation type
4050
4051 **/
4052 private void showSystemTables(int operationType, int nodeType, int location) {
4053 mst = null;
4054 if (operationType == ModuleMain.ADD) {
4055 mst = new ModuleSystemTables(this.xmlst);
4056 }
4057 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4058 mst = new ModuleSystemTables(this.xmlst, nodeType, location);
4059 }
4060 this.jDesktopPane.removeAll();
4061 this.jDesktopPane.add(mst, 1);
4062 this.currentNodeType = nodeType;
4063 if (operationType == ModuleMain.VIEW) {
4064 setButtonEnable(false);
4065 mst.setViewMode(true);
4066 } else {
4067 setButtonEnable(true);
4068 }
4069 }
4070
4071 /**
4072 Show DataHubs
4073 When the operation is VIEW, disable all fields of internal frame
4074
4075 @param type The input data of operation type
4076
4077 **/
4078 private void showDataHubs(int operationType, int nodeType, int location) {
4079 mdh = null;
4080 if (operationType == ModuleMain.ADD) {
4081 mdh = new ModuleDataHubs(this.xmldh);
4082 }
4083 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4084 mdh = new ModuleDataHubs(this.xmldh, nodeType, location);
4085 }
4086 this.jDesktopPane.removeAll();
4087 this.jDesktopPane.add(mdh, 1);
4088 this.currentNodeType = nodeType;
4089 if (operationType == ModuleMain.VIEW) {
4090 setButtonEnable(false);
4091 mdh.setViewMode(true);
4092 } else {
4093 setButtonEnable(true);
4094 }
4095 }
4096
4097 /**
4098 Show Formsets
4099 When the operation is VIEW, disable all fields of internal frame
4100
4101 @param type The input data of operation type
4102
4103 **/
4104 private void showFormsets(int operationType, int nodeType, int location) {
4105 mf = null;
4106 if (operationType == ModuleMain.ADD) {
4107 mf = new ModuleFormsets(this.xmlfs);
4108 }
4109 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4110 mf = new ModuleFormsets(this.xmlfs, nodeType, location);
4111 }
4112 this.jDesktopPane.removeAll();
4113 this.jDesktopPane.add(mf, 1);
4114 this.currentNodeType = nodeType;
4115 if (operationType == ModuleMain.VIEW) {
4116 setButtonEnable(false);
4117 mf.setViewMode(true);
4118 } else {
4119 setButtonEnable(true);
4120 }
4121 }
4122
4123 /**
4124 Show Show Guids
4125 When the operation is VIEW, disable all fields of internal frame
4126
4127 @param type The input data of operation type
4128
4129 **/
4130 private void showGuids(int operationType, int nodeType, int location) {
4131 mg = null;
4132 if (operationType == ModuleMain.ADD || operationType == ModuleMain.VIEW) {
4133 mg = new ModuleGuids(this.xmlgu);
4134 }
4135 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4136 mg = new ModuleGuids(this.xmlgu, nodeType, location);
4137 }
4138 this.jDesktopPane.removeAll();
4139 this.jDesktopPane.add(mg, 1);
4140 this.currentNodeType = nodeType;
4141 if (operationType == ModuleMain.VIEW) {
4142 setButtonEnable(false);
4143 mg.setViewMode(true);
4144 } else {
4145 setButtonEnable(true);
4146 }
4147 }
4148
4149 /**
4150 Show Externs
4151 When the operation is VIEW, disable all fields of internal frame
4152
4153 @param type The input data of operation type
4154
4155 **/
4156 private void showExterns(int operationType, int nodeType, int location) {
4157 met = null;
4158 if (operationType == ModuleMain.ADD) {
4159 met = new ModuleExterns(this.xmlet);
4160 }
4161 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4162 met = new ModuleExterns(this.xmlet, nodeType, location);
4163 }
4164 this.jDesktopPane.removeAll();
4165 this.jDesktopPane.add(met, 1);
4166 this.currentNodeType = nodeType;
4167 if (operationType == ModuleMain.VIEW) {
4168 setButtonEnable(false);
4169 met.setViewMode(true);
4170 } else {
4171 setButtonEnable(true);
4172 }
4173 }
4174
4175 /**
4176 Show PCDs
4177 When the operation is VIEW, disable all fields of internal frame
4178
4179 @param type The input data of operation type
4180
4181 **/
4182 private void showPCDs(int operationType, int nodeType, int location) {
4183 mpcd = null;
4184 if (operationType == ModuleMain.ADD) {
4185 mpcd = new ModulePCDs(this.xmlpcd);
4186 }
4187 if (operationType == ModuleMain.UPDATE || operationType == ModuleMain.VIEW) {
4188 mpcd = new ModulePCDs(this.xmlpcd, nodeType, location);
4189 }
4190 this.jDesktopPane.removeAll();
4191 this.jDesktopPane.add(mpcd, 1);
4192 this.currentNodeType = nodeType;
4193 if (operationType == ModuleMain.VIEW) {
4194 setButtonEnable(false);
4195 mpcd.setViewMode(true);
4196 } else {
4197 setButtonEnable(true);
4198 }
4199 }
4200
4201 /**
4202 Save currentModule when press button OK
4203
4204 **/
4205 private void save() {
4206 if (this.currentNodeType == IDefaultMutableTreeNode.MSA_HEADER) {
4207 if (!msa.check()) {
4208 return;
4209 }
4210 msa.save();
4211 msa.setViewMode(true);
4212 this.xmlmh = msa.getMsaHeader();
4213 }
4214
4215 if (this.currentNodeType == IDefaultMutableTreeNode.MBD_HEADER) {
4216 if (!mbd.check()) {
4217 return;
4218 }
4219 mbd.save();
4220 mbd.setViewMode(true);
4221 this.xmlmbdh = mbd.getMbdHeader();
4222 }
4223
4224 if (this.currentNodeType == IDefaultMutableTreeNode.MLSA_HEADER) {
4225 if (!mlsa.check()) {
4226 return;
4227 }
4228 mlsa.save();
4229 mlsa.setViewMode(true);
4230 this.xmlmlh = mlsa.getMsaLibHeader();
4231 }
4232
4233 if (this.currentNodeType == IDefaultMutableTreeNode.MLBD_HEADER) {
4234 if (!mlbd.check()) {
4235 return;
4236 }
4237 mlbd.save();
4238 mlbd.setViewMode(true);
4239 this.xmlmlbdh = mlbd.getMbdLibHeader();
4240 }
4241
4242 if (this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES
4243 || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_ARCH
4244 || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_ARCH_ITEM
4245 || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_LIBRARY
4246 || this.currentNodeType == IDefaultMutableTreeNode.LIBRARIES_LIBRARY_ITEM) {
4247 if (!mlib.check()) {
4248 return;
4249 }
4250 mlib.save();
4251 mlib.setViewMode(true);
4252 this.xmllib = mlib.getLibraries();
4253 }
4254
4255 if (this.currentNodeType == IDefaultMutableTreeNode.LIBRARYCLASSDEFINITIONS
4256 || this.currentNodeType == IDefaultMutableTreeNode.LIBRARY_CLASS_DEFINITION) {
4257 if (!mlcd.check()) {
4258 return;
4259 }
4260 mlcd.save();
4261 mlcd.setViewMode(true);
4262 this.xmllcd = mlcd.getLibraryClassDefinitions();
4263 }
4264
4265 if (this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES
4266 || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_ARCH
4267 || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_ARCH_ITEM
4268 || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_FILENAME
4269 || this.currentNodeType == IDefaultMutableTreeNode.SOURCEFILES_FILENAME_ITEM) {
4270 if (!msf.check()) {
4271 return;
4272 }
4273 msf.save();
4274 msf.setViewMode(true);
4275 this.xmlsf = msf.getSourceFiles();
4276 }
4277
4278 if (this.currentNodeType == IDefaultMutableTreeNode.INCLUDES
4279 || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_ARCH
4280 || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_ARCH_ITEM
4281 || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME
4282 || this.currentNodeType == IDefaultMutableTreeNode.INCLUDES_PACKAGENAME_ITEM) {
4283 if (!mic.check()) {
4284 return;
4285 }
4286 mic.save();
4287 mic.setViewMode(true);
4288 this.xmlic = mic.getIncludes();
4289 }
4290
4291 if (this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS
4292 || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL
4293 || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOL_ITEM
4294 || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY
4295 || this.currentNodeType == IDefaultMutableTreeNode.PROTOCOLS_PROTOCOLNOTIFY_ITEM) {
4296 if (!mp.check()) {
4297 return;
4298 }
4299 mp.save();
4300 mp.setViewMode(true);
4301 this.xmlpl = mp.getProtocols();
4302 }
4303
4304 if (this.currentNodeType == IDefaultMutableTreeNode.EVENTS
4305 || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS
4306 || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_CREATEEVENTS_ITEM
4307 || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS
4308 || this.currentNodeType == IDefaultMutableTreeNode.EVENTS_SIGNALEVENTS_ITEM) {
4309 if (!mev.check()) {
4310 return;
4311 }
4312 mev.save();
4313 mev.setViewMode(true);
4314 this.xmlen = mev.getEvents();
4315 }
4316
4317 if (this.currentNodeType == IDefaultMutableTreeNode.HOBS
4318 || this.currentNodeType == IDefaultMutableTreeNode.HOBS_HOB_ITEM) {
4319 if (!mh.check()) {
4320 return;
4321 }
4322 mh.save();
4323 mh.setViewMode(true);
4324 this.xmlhob = mh.getHobs();
4325 }
4326
4327 if (this.currentNodeType == IDefaultMutableTreeNode.PPIS
4328 || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPI
4329 || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPI_ITEM
4330 || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPINOTIFY
4331 || this.currentNodeType == IDefaultMutableTreeNode.PPIS_PPINOTIFY_ITEM) {
4332 if (!mpp.check()) {
4333 return;
4334 }
4335 mpp.save();
4336 mpp.setViewMode(true);
4337 this.xmlppi = mpp.getPpis();
4338 }
4339
4340 if (this.currentNodeType == IDefaultMutableTreeNode.VARIABLES
4341 || this.currentNodeType == IDefaultMutableTreeNode.VARIABLES_VARIABLE_ITEM) {
4342 if (!mv.check()) {
4343 return;
4344 }
4345 mv.save();
4346 mv.setViewMode(true);
4347 this.xmlvb = mv.getVariables();
4348 }
4349
4350 if (this.currentNodeType == IDefaultMutableTreeNode.BOOTMODES
4351 || this.currentNodeType == IDefaultMutableTreeNode.BOOTMODES_BOOTMODE_ITEM) {
4352 if (!mbm.check()) {
4353 return;
4354 }
4355 mbm.save();
4356 mbm.setViewMode(true);
4357 this.xmlbm = mbm.getBootModes();
4358 }
4359
4360 if (this.currentNodeType == IDefaultMutableTreeNode.SYSTEMTABLES
4361 || this.currentNodeType == IDefaultMutableTreeNode.SYSTEMTABLES_SYSTEMTABLE_ITEM) {
4362 if (!mst.check()) {
4363 return;
4364 }
4365 mst.save();
4366 mst.setViewMode(true);
4367 this.xmlst = mst.getSystemTables();
4368 }
4369
4370 if (this.currentNodeType == IDefaultMutableTreeNode.DATAHUBS
4371 || this.currentNodeType == IDefaultMutableTreeNode.DATAHUBS_DATAHUB_ITEM) {
4372 if (!mdh.check()) {
4373 return;
4374 }
4375 mdh.save();
4376 mdh.setViewMode(true);
4377 this.xmldh = mdh.getDataHubs();
4378 }
4379
4380 if (this.currentNodeType == IDefaultMutableTreeNode.FORMSETS
4381 || this.currentNodeType == IDefaultMutableTreeNode.FORMSETS_FORMSET_ITEM) {
4382 if (!mf.check()) {
4383 return;
4384 }
4385 mf.save();
4386 mf.setViewMode(true);
4387 this.xmlfs = mf.getFormsets();
4388 }
4389
4390 if (this.currentNodeType == IDefaultMutableTreeNode.GUIDS
4391 || this.currentNodeType == IDefaultMutableTreeNode.GUIDS_GUIDENTRY_ITEM) {
4392 if (!mg.check()) {
4393 return;
4394 }
4395 mg.save();
4396 mg.setViewMode(true);
4397 this.xmlgu = mg.getGuids();
4398 }
4399
4400 if (this.currentNodeType == IDefaultMutableTreeNode.EXTERNS
4401 || this.currentNodeType == IDefaultMutableTreeNode.EXTERNS_EXTERN_ITEM) {
4402 if (!met.check()) {
4403 return;
4404 }
4405 met.save();
4406 met.setViewMode(true);
4407 this.xmlet = met.getExterns();
4408 }
4409
4410 if (this.currentNodeType == IDefaultMutableTreeNode.PCDS
4411 || this.currentNodeType == IDefaultMutableTreeNode.PCDS_PCDDATA_ITEM) {
4412 if (!mpcd.check()) {
4413 return;
4414 }
4415 mpcd.save();
4416 mpcd.setViewMode(true);
4417 this.xmlpcd = mpcd.getPcds();
4418 }
4419
4420 reloadTreeAndTable(NEW_WITH_CHANGE);
4421 }
4422 }