0e0c54c345dcb3e7f1656aeaea43b3a3a26f72c7
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / FrameworkWizardUI.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.frameworkwizard;
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ComponentEvent;
20 import java.awt.event.KeyEvent;
21 import java.awt.event.KeyListener;
22 import java.awt.event.MouseEvent;
23 import java.awt.event.MouseListener;
24 import java.awt.event.WindowEvent;
25 import java.io.BufferedWriter;
26 import java.io.File;
27 import java.io.FileWriter;
28 import java.io.IOException;
29 import java.util.Iterator;
30 import java.util.Set;
31 import java.util.Vector;
32
33 import javax.swing.JButton;
34 import javax.swing.JCheckBoxMenuItem;
35 import javax.swing.JDesktopPane;
36 import javax.swing.JFileChooser;
37 import javax.swing.JFrame;
38 import javax.swing.JInternalFrame;
39 import javax.swing.JMenu;
40 import javax.swing.JMenuBar;
41 import javax.swing.JMenuItem;
42 import javax.swing.JOptionPane;
43 import javax.swing.JPanel;
44 import javax.swing.JScrollPane;
45 import javax.swing.JSplitPane;
46 import javax.swing.JTabbedPane;
47 import javax.swing.event.MenuEvent;
48 import javax.swing.event.MenuListener;
49 import javax.swing.event.TreeSelectionEvent;
50 import javax.swing.event.TreeSelectionListener;
51 import javax.swing.tree.TreePath;
52
53 import org.apache.xmlbeans.XmlException;
54 import org.tianocore.PackageSurfaceAreaDocument;
55 import org.tianocore.frameworkwizard.common.DataType;
56 import org.tianocore.frameworkwizard.common.GlobalData;
57 import org.tianocore.frameworkwizard.common.IFileFilter;
58 import org.tianocore.frameworkwizard.common.Log;
59 import org.tianocore.frameworkwizard.common.SaveFile;
60 import org.tianocore.frameworkwizard.common.Tools;
61 import org.tianocore.frameworkwizard.common.Identifications.Identification;
62 import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
63 import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
64 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
65 import org.tianocore.frameworkwizard.common.find.FindResult;
66 import org.tianocore.frameworkwizard.common.ui.IDefaultMutableTreeNode;
67 import org.tianocore.frameworkwizard.common.ui.IDesktopManager;
68 import org.tianocore.frameworkwizard.common.ui.IFrame;
69 import org.tianocore.frameworkwizard.common.ui.ITree;
70 import org.tianocore.frameworkwizard.far.createui.CreateStepOne;
71 import org.tianocore.frameworkwizard.far.deleteui.DeleteStepOne;
72 import org.tianocore.frameworkwizard.far.installui.InstallStepOne;
73 import org.tianocore.frameworkwizard.far.updateui.UpdateStepOne;
74 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
75 import org.tianocore.frameworkwizard.module.ui.ModuleBootModes;
76 import org.tianocore.frameworkwizard.module.ui.ModuleDataHubs;
77 import org.tianocore.frameworkwizard.module.ui.ModuleEvents;
78 import org.tianocore.frameworkwizard.module.ui.ModuleExterns;
79 import org.tianocore.frameworkwizard.module.ui.ModuleGuids;
80 import org.tianocore.frameworkwizard.module.ui.ModuleHiiPackages;
81 import org.tianocore.frameworkwizard.module.ui.ModuleHobs;
82 import org.tianocore.frameworkwizard.module.ui.ModuleLibraryClassDefinitions;
83 import org.tianocore.frameworkwizard.module.ui.ModulePCDs;
84 import org.tianocore.frameworkwizard.module.ui.ModulePackageDependencies;
85 import org.tianocore.frameworkwizard.module.ui.ModulePpis;
86 import org.tianocore.frameworkwizard.module.ui.ModuleProtocols;
87 import org.tianocore.frameworkwizard.module.ui.ModuleSourceFiles;
88 import org.tianocore.frameworkwizard.module.ui.ModuleSystemTables;
89 import org.tianocore.frameworkwizard.module.ui.ModuleVariables;
90 import org.tianocore.frameworkwizard.module.ui.MsaHeader;
91 import org.tianocore.frameworkwizard.packaging.PackageIdentification;
92 import org.tianocore.frameworkwizard.packaging.ui.SpdGuidDecls;
93 import org.tianocore.frameworkwizard.packaging.ui.SpdHeader;
94 import org.tianocore.frameworkwizard.packaging.ui.SpdLibClassDecls;
95 import org.tianocore.frameworkwizard.packaging.ui.SpdMsaFiles;
96 import org.tianocore.frameworkwizard.packaging.ui.SpdPackageHeaders;
97 import org.tianocore.frameworkwizard.packaging.ui.SpdPcdDefs;
98 import org.tianocore.frameworkwizard.packaging.ui.SpdPpiDecls;
99 import org.tianocore.frameworkwizard.packaging.ui.SpdProtocolDecls;
100 import org.tianocore.frameworkwizard.platform.PlatformIdentification;
101 import org.tianocore.frameworkwizard.platform.ui.FpdBuildOptions;
102 import org.tianocore.frameworkwizard.platform.ui.FpdDynamicPcdBuildDefinitions;
103 import org.tianocore.frameworkwizard.platform.ui.FpdFlash;
104 import org.tianocore.frameworkwizard.platform.ui.FpdFrameworkModules;
105 import org.tianocore.frameworkwizard.platform.ui.FpdHeader;
106 import org.tianocore.frameworkwizard.platform.ui.FpdPlatformDefs;
107 import org.tianocore.frameworkwizard.workspace.Workspace;
108 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
109 import org.tianocore.frameworkwizard.workspace.ui.SwitchWorkspace;
110 import org.tianocore.frameworkwizard.toolchain.Preferences;
111
112 /**
113 The class is used to show main GUI of FrameworkWizard
114 It extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener and MenuListener
115
116 **/
117 public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListener, TreeSelectionListener,
118 MenuListener {
119 ///
120 /// Define class Serial Version UID
121 ///
122 private static final long serialVersionUID = -7103240960573031772L;
123
124 ///
125 /// Used to record current operation target
126 ///
127 private int currentOpeningModuleIndex = -1;
128
129 private int currentOpeningPackageIndex = -1;
130
131 private int currentOpeningPlatformIndex = -1;
132
133 ///
134 /// Used to generate tree structure
135 ///
136 private IDefaultMutableTreeNode dmtnRoot = null;
137
138 private IDefaultMutableTreeNode dmtnModuleDescription = null;
139
140 private IDefaultMutableTreeNode dmtnPackageDescription = null;
141
142 private IDefaultMutableTreeNode dmtnPlatformDescription = null;
143
144 ///
145 /// Used for UI
146 ///
147 private JPanel jContentPane = null;
148
149 private JMenuBar jMenuBar = null;
150
151 private JMenu jMenuFile = null;
152
153 private JMenuItem jMenuItemFileNew = null;
154
155 private JMenuItem jMenuItemFileRefresh = null;
156
157 private JMenuItem jMenuItemFileSaveAs = null;
158
159 private JMenuItem jMenuItemFileExit = null;
160
161 private JMenu jMenuEdit = null;
162
163 private JDesktopPane jDesktopPaneModule = null;
164
165 private JDesktopPane jDesktopPanePackage = null;
166
167 private JDesktopPane jDesktopPanePlatform = null;
168
169 private JTabbedPane jTabbedPaneTree = null;
170
171 private JTabbedPane jTabbedPaneEditor = null;
172
173 private IDesktopManager iDesktopManager = new IDesktopManager();
174
175 private JScrollPane jScrollPaneTree = null;
176
177 private ITree iTree = null;
178
179 private JMenu jMenuHelp = null;
180
181 private JMenuItem jMenuItemHelpAbout = null;
182
183 private JMenuItem jMenuItemEditDelete = null;
184
185 private WorkspaceTools wt = new WorkspaceTools();
186
187 private JMenuItem jMenuItemFileSave = null;
188
189 private JMenuItem jMenuItemFileClose = null;
190
191 private JMenu jMenuTools = null;
192
193 private JMenu jMenuWindow = null;
194
195 private JPanel jPanelOperation = null;
196
197 private JButton jButtonOk = null;
198
199 private JButton jButtonCancel = null;
200
201 private JMenuItem jMenuItemFileOpen = null;
202
203 private JMenuItem jMenuItemFileCloseAll = null;
204
205 private JMenuItem jMenuItemFileSaveAll = null;
206
207 private JMenuItem jMenuItemFilePageSetup = null;
208
209 private JMenuItem jMenuItemFilePrint = null;
210
211 private JMenuItem jMenuItemFileImport = null;
212
213 private JMenuItem jMenuItemFileProperties = null;
214
215 private JMenu jMenuFileRecentFiles = null;
216
217 private JSplitPane jSplitPane = null;
218
219 private JMenuItem jMenuItemEditUndo = null;
220
221 private JMenuItem jMenuItemEditRedo = null;
222
223 private JMenuItem jMenuItemEditCut = null;
224
225 private JMenuItem jMenuItemEditCopy = null;
226
227 private JMenuItem jMenuItemEditPaste = null;
228
229 private JMenuItem jMenuItemEditSelectAll = null;
230
231 private JMenuItem jMenuItemEditFindNext = null;
232
233 private JMenu jMenuView = null;
234
235 private JMenu jMenuViewToolbars = null;
236
237 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsFile = null;
238
239 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsEdit = null;
240
241 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsWindow = null;
242
243 private JMenuItem jMenuItemViewStandard = null;
244
245 private JMenuItem jMenuItemViewAdvanced = null;
246
247 private JMenu jMenuProject = null;
248
249 private JMenuItem jMenuItemProjectAdmin = null;
250
251 private JMenuItem jMenuItemProjectChangeWorkspace = null;
252
253 private JMenuItem jMenuItemToolsBuildPreferences = null;
254
255 // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null;
256
257 // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null;
258
259 private JMenuItem jMenuItemToolsToolChainConfiguration = null;
260
261 private JMenuItem jMenuItemToolsClone = null;
262
263 private JMenuItem jMenuItemToolsCodeScan = null;
264
265 private JMenuItem jMenuItemWindowDisplaySide = null;
266
267 private JMenuItem jMenuItemWindowDisplayTopBottom = null;
268
269 private JMenuItem jMenuItemViewXML = null;
270
271 private JMenuItem jMenuItemWindowTabView = null;
272
273 private JMenuItem jMenuItemWindowSource = null;
274
275 private JMenuItem jMenuItemWindowXML = null;
276
277 private JMenuItem jMenuItemWindowPreferences = null;
278
279 private JMenuItem jMenuItemHelpContents = null;
280
281 private JMenuItem jMenuItemHelpIndex = null;
282
283 private JMenuItem jMenuItemHelpSearch = null;
284
285 private JMenuItem jMenuItemProjectInstallFar = null;
286
287 private JMenuItem jMenuItemProjectUpdateFar = null;
288
289 private JMenuItem jMenuItemProjectRemoveFar = null;
290
291 private JMenuItem jMenuItemProjectCreateFar = null;
292
293 private JMenu jMenuEditFind = null;
294
295 private JMenuItem jMenuItemEditFindPcd = null;
296
297 private JMenuItem jMenuItemEditFindLibraryClass = null;
298
299 private JMenuItem jMenuItemEditFindPpi = null;
300
301 private JMenuItem jMenuItemEditFindProtocol = null;
302
303 private JMenuItem jMenuItemEditFindGuid = null;
304
305 private JMenuItem jMenuItemEditFindLibraryInstance = null;
306
307 ///
308 /// A static definition for this class itself
309 ///
310 private static FrameworkWizardUI fwui = null;
311
312 private JMenuItem jMenuItemToolsGenerateGuidsXref = null;
313
314 /**
315 If the class hasn't an instnace, new one.
316
317 @return FrameworkWizardUI The instance of this class
318
319 **/
320 public static FrameworkWizardUI getInstance() {
321 if (fwui == null) {
322 fwui = new FrameworkWizardUI();
323 }
324 return fwui;
325 }
326
327 /**
328 This method initializes jMenuBar
329
330 @return javax.swing.JMenuBar Main menu bar for the entire GUI
331
332 **/
333 private JMenuBar getjJMenuBar() {
334 if (jMenuBar == null) {
335 jMenuBar = new JMenuBar();
336 jMenuBar.setPreferredSize(new java.awt.Dimension(0, 18));
337 jMenuBar.add(getJMenuFile());
338 jMenuBar.add(getJMenuEdit());
339 jMenuBar.add(getJMenuView());
340 jMenuBar.add(getJMenuProject());
341 jMenuBar.add(getJMenuTools());
342 jMenuBar.add(getJMenuWindow());
343 jMenuBar.add(getJMenuHelp());
344 }
345 return jMenuBar;
346 }
347
348 /**
349 This method initializes jSplitPane
350
351 @return javax.swing.JSplitPane
352
353 **/
354 private JSplitPane getJSplitPane() {
355 if (jSplitPane == null) {
356 jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getJTabbedPaneTree(), getJTabbedPaneEditor());
357 jSplitPane.setBounds(new java.awt.Rectangle(0, 1, DataType.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH,
358 DataType.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT));
359 jSplitPane.addComponentListener(this);
360 }
361 return jSplitPane;
362 }
363
364 /**
365 This method initializes jTabbedPaneEditor
366
367 @return javax.swing.JTabbedPane
368
369 **/
370 private JTabbedPane getJTabbedPaneEditor() {
371 if (jTabbedPaneEditor == null) {
372 jTabbedPaneEditor = new JTabbedPane();
373 jTabbedPaneEditor.setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
374 DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
375 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
376 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
377 jTabbedPaneEditor
378 .setMinimumSize(new java.awt.Dimension(
379 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
380 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
381 jTabbedPaneEditor.addTab("Module", null, getJDesktopPaneModule(), null);
382 jTabbedPaneEditor.addTab("Package", null, getJDesktopPanePackage(), null);
383 jTabbedPaneEditor.addTab("Platform", null, getJDesktopPanePlatform(), null);
384 }
385 return jTabbedPaneEditor;
386 }
387
388 /**
389 This method initializes jTabbedPaneTree
390
391 @return javax.swing.JTabbedPane
392
393 **/
394 private JTabbedPane getJTabbedPaneTree() {
395 if (jTabbedPaneTree == null) {
396 jTabbedPaneTree = new JTabbedPane();
397 jTabbedPaneTree
398 .setPreferredSize(new java.awt.Dimension(
399 DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
400 DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
401 jTabbedPaneTree
402 .setMinimumSize(new java.awt.Dimension(DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
403 DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
404 jTabbedPaneTree.addTab("Workspace Explorer", null, getJScrollPaneTree(), null);
405 }
406 return jTabbedPaneTree;
407 }
408
409 /**
410 This method initializes jMenuFile
411
412 @return javax.swing.JMenu jMenuModule
413
414 **/
415 private JMenu getJMenuFile() {
416 if (jMenuFile == null) {
417 //
418 // Set jMenuFile's attributes
419 //
420 jMenuFile = new JMenu();
421 jMenuFile.setText("File");
422 jMenuFile.setMnemonic('F');
423 jMenuFile.addMenuListener(this);
424
425 //
426 // Add sub menu items
427 //
428 jMenuFile.add(getJMenuItemFileNew());
429 jMenuFile.add(getJMenuItemFileOpen());
430 jMenuFile.add(getJMenuItemFileClose());
431 jMenuFile.add(getJMenuItemFileCloseAll());
432 jMenuFile.addSeparator();
433
434 jMenuFile.add(getJMenuFileRecentFiles());
435 jMenuFile.add(getJMenuItemFileSave());
436 jMenuFile.add(getJMenuItemFileSaveAs());
437 jMenuFile.add(getJMenuItemFileSaveAll());
438 jMenuFile.addSeparator();
439
440 jMenuFile.add(getJMenuItemFileRefresh());
441 jMenuFile.addSeparator();
442
443 jMenuFile.add(getJMenuItemFilePageSetup());
444 jMenuFile.add(getJMenuItemFilePrint());
445 jMenuFile.add(getJMenuItemFileImport());
446 jMenuFile.add(getJMenuItemFileProperties());
447
448 jMenuFile.add(getJMenuItemFileExit());
449 }
450 return jMenuFile;
451 }
452
453 /**
454 This method initializes jMenuItemFileSaveAs
455
456 @return javax.swing.JMenuItem jMenuItemFileSaveAs
457
458 **/
459 private JMenuItem getJMenuItemFileSaveAs() {
460 if (jMenuItemFileSaveAs == null) {
461 jMenuItemFileSaveAs = new JMenuItem();
462 jMenuItemFileSaveAs.setText("Save As...");
463 jMenuItemFileSaveAs.setMnemonic('a');
464 jMenuItemFileSaveAs.addActionListener(this);
465 jMenuItemFileSaveAs.setEnabled(false);
466 jMenuItemFileSaveAs.setVisible(false);
467 }
468 return jMenuItemFileSaveAs;
469 }
470
471 /**
472 This method initializes jMenuItemFileRefresh
473
474 @return javax.swing.JMenuItem jMenuItemFileRefresh
475
476 **/
477 private JMenuItem getJMenuItemFileRefresh() {
478 if (jMenuItemFileRefresh == null) {
479 jMenuItemFileRefresh = new JMenuItem();
480 jMenuItemFileRefresh.setText("Refresh");
481 jMenuItemFileRefresh.setMnemonic('R');
482 jMenuItemFileRefresh.addActionListener(this);
483 jMenuItemFileRefresh.setVisible(true);
484 }
485 return jMenuItemFileRefresh;
486 }
487
488 /**
489 This method initializes jMenuItemModuleExit
490
491 @return javax.swing.JMenuItem jMenuItemModuleExit
492
493 **/
494 private JMenuItem getJMenuItemFileExit() {
495 if (jMenuItemFileExit == null) {
496 jMenuItemFileExit = new JMenuItem();
497 jMenuItemFileExit.setText("Exit");
498 jMenuItemFileExit.setMnemonic('x');
499 jMenuItemFileExit.addActionListener(this);
500 }
501 return jMenuItemFileExit;
502 }
503
504 /**
505 This method initializes jMenuEdit
506
507 @return javax.swing.JMenu jMenuEdit
508
509 **/
510 private JMenu getJMenuEdit() {
511 if (jMenuEdit == null) {
512 //
513 // Set jMenuEdit's attributes
514 //
515 jMenuEdit = new JMenu();
516 jMenuEdit.setText("Edit");
517 jMenuEdit.setMnemonic('E');
518 jMenuEdit.setVisible(true);
519
520 //
521 // Add sub menu items
522 //
523 jMenuEdit.add(getJMenuItemEditUndo());
524 jMenuEdit.add(getJMenuItemEditRedo());
525 //jMenuEdit.addSeparator();
526
527 jMenuEdit.add(getJMenuItemEditCut());
528 jMenuEdit.add(getJMenuItemEditCopy());
529 jMenuEdit.add(getJMenuItemEditPaste());
530 jMenuEdit.add(getJMenuItemEditDelete());
531 //jMenuEdit.addSeparator();
532
533 jMenuEdit.add(getJMenuItemEditSelectAll());
534 jMenuEdit.add(getJMenuEditFind());
535 jMenuEdit.add(getJMenuItemEditFindNext());
536 //jMenuEdit.addSeparator();
537 }
538 return jMenuEdit;
539 }
540
541 /**
542 This method initializes jDesktopPane
543
544 @return javax.swing.JDesktopPane jDesktopPane
545
546 **/
547 private JDesktopPane getJDesktopPaneModule() {
548 if (jDesktopPaneModule == null) {
549 jDesktopPaneModule = new JDesktopPane();
550 jDesktopPaneModule
551 .setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
552 DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
553 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
554 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
555 jDesktopPaneModule
556 .setMinimumSize(new java.awt.Dimension(
557 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
558 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
559 jDesktopPaneModule.setDesktopManager(iDesktopManager);
560 jDesktopPaneModule.addComponentListener(this);
561 }
562 return jDesktopPaneModule;
563 }
564
565 /**
566 This method initializes jDesktopPane
567
568 @return javax.swing.JDesktopPane jDesktopPane
569
570 **/
571 private JDesktopPane getJDesktopPanePackage() {
572 if (jDesktopPanePackage == null) {
573 jDesktopPanePackage = new JDesktopPane();
574 jDesktopPanePackage
575 .setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
576 DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
577 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
578 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
579 jDesktopPanePackage
580 .setMinimumSize(new java.awt.Dimension(
581 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
582 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
583 jDesktopPanePackage.setDesktopManager(iDesktopManager);
584 jDesktopPanePackage.addComponentListener(this);
585 }
586 return jDesktopPanePackage;
587 }
588
589 /**
590 This method initializes jDesktopPane
591
592 @return javax.swing.JDesktopPane jDesktopPane
593
594 **/
595 private JDesktopPane getJDesktopPanePlatform() {
596 if (jDesktopPanePlatform == null) {
597 jDesktopPanePlatform = new JDesktopPane();
598 jDesktopPanePlatform
599 .setBounds(new java.awt.Rectangle(
600 DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
601 DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
602 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
603 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
604 jDesktopPanePlatform
605 .setMinimumSize(new java.awt.Dimension(
606 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
607 DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
608 jDesktopPanePlatform.setDesktopManager(iDesktopManager);
609 jDesktopPanePlatform.addComponentListener(this);
610 }
611 return jDesktopPanePlatform;
612 }
613
614 /**
615 This method initializes jScrollPaneTree
616
617 @return javax.swing.JScrollPane jScrollPaneTree
618
619 **/
620 private JScrollPane getJScrollPaneTree() {
621 if (jScrollPaneTree == null) {
622 jScrollPaneTree = new JScrollPane();
623 jScrollPaneTree
624 .setPreferredSize(new java.awt.Dimension(
625 DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
626 DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
627 jScrollPaneTree
628 .setMinimumSize(new java.awt.Dimension(
629 DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH / 2,
630 DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
631 jScrollPaneTree.setViewportView(getITree());
632 }
633 return jScrollPaneTree;
634 }
635
636 /**
637 This method initializes iTree
638
639 @return org.tianocore.packaging.common.ui.ITree iTree
640
641 **/
642 private ITree getITree() {
643 //
644 //Before open a real module, use an empty root node for the tree
645 //
646 makeEmptyTree();
647 return iTree;
648 }
649
650 /**
651 This method initializes jMenuHelp
652
653 @return javax.swing.JMenu jMenuHelp
654
655 **/
656 private JMenu getJMenuHelp() {
657 if (jMenuHelp == null) {
658 //
659 // Set jMenuHelp's attributes
660 //
661 jMenuHelp = new JMenu();
662 jMenuHelp.setText("Help");
663 jMenuHelp.setMnemonic('H');
664
665 //
666 // Add sub menu items
667 //
668 jMenuHelp.add(getJMenuItemHelpContents());
669 jMenuHelp.add(getJMenuItemHelpIndex());
670 jMenuHelp.add(getJMenuItemHelpSearch());
671
672 jMenuHelp.add(getJMenuItemHelpAbout());
673 }
674 return jMenuHelp;
675 }
676
677 /**
678 This method initializes jMenuItemHelpAbout
679
680 @return javax.swing.JMenuItem jMenuItemHelpAbout
681
682 **/
683 private JMenuItem getJMenuItemHelpAbout() {
684 if (jMenuItemHelpAbout == null) {
685 jMenuItemHelpAbout = new JMenuItem();
686 jMenuItemHelpAbout.setText("About...");
687 jMenuItemHelpAbout.setMnemonic('A');
688 jMenuItemHelpAbout.addActionListener(this);
689 }
690 return jMenuItemHelpAbout;
691 }
692
693 /**
694 This method initializes jMenuItemEditDelete
695
696 @return javax.swing.JMenuItem jMenuItemEditDelete
697
698 **/
699 private JMenuItem getJMenuItemEditDelete() {
700 if (jMenuItemEditDelete == null) {
701 jMenuItemEditDelete = new JMenuItem();
702 jMenuItemEditDelete.setText("Delete");
703 jMenuItemEditDelete.setMnemonic('D');
704 jMenuItemEditDelete.setVisible(false);
705 jMenuItemEditDelete.setEnabled(false);
706 jMenuItemEditDelete.addActionListener(this);
707 //
708 //Disabled first when no module is open
709 //
710 jMenuItemEditDelete.setEnabled(false);
711 }
712 return jMenuItemEditDelete;
713 }
714
715 /**
716 This method initializes jMenuFileNew
717
718 @return javax.swing.JMenuItem jMenuFileNew
719
720 **/
721 private JMenuItem getJMenuItemFileNew() {
722 if (jMenuItemFileNew == null) {
723 jMenuItemFileNew = new JMenuItem();
724 jMenuItemFileNew.setText("New...");
725 jMenuItemFileNew.setMnemonic('N');
726 jMenuItemFileNew.addActionListener(this);
727 }
728 return jMenuItemFileNew;
729 }
730
731 /**
732 This method initializes jMenuItemFileSave
733
734 @return javax.swing.JMenuItem jMenuItemModuleSave
735
736 **/
737 private JMenuItem getJMenuItemFileSave() {
738 if (jMenuItemFileSave == null) {
739 jMenuItemFileSave = new JMenuItem();
740 jMenuItemFileSave.setText("Save");
741 jMenuItemFileSave.setMnemonic('S');
742 jMenuItemFileSave.addActionListener(this);
743 jMenuItemFileSave.setEnabled(true);
744 }
745 return jMenuItemFileSave;
746 }
747
748 /**
749 This method initializes jMenuItemModuleClose
750
751 @return javax.swing.JMenuItem jMenuItemModuleClose
752
753 **/
754 private JMenuItem getJMenuItemFileClose() {
755 if (jMenuItemFileClose == null) {
756 jMenuItemFileClose = new JMenuItem();
757 jMenuItemFileClose.setText("Close");
758 jMenuItemFileClose.setMnemonic('C');
759 jMenuItemFileClose.setEnabled(true);
760 jMenuItemFileClose.addActionListener(this);
761 }
762 return jMenuItemFileClose;
763 }
764
765 /**
766 This method initializes jMenuTools
767 Reserved
768
769 @return javax.swing.JMenu jMenuTools
770
771 **/
772 private JMenu getJMenuTools() {
773 if (jMenuTools == null) {
774 //
775 // Set jMenuTools's attributes
776 //
777 jMenuTools = new JMenu();
778 jMenuTools.setText("Tools");
779 jMenuTools.setMnemonic('T');
780 jMenuTools.addMenuListener(this);
781
782 //
783 // Add sub menu items
784 //
785
786 jMenuTools.add(getJMenuItemToolsClone());
787 jMenuTools.add(getJMenuItemToolsCodeScan());
788 jMenuTools.addSeparator();
789
790 jMenuTools.add(getJMenuItemToolsToolChainConfiguration());
791 jMenuTools.add(getJMenuItemToolsBuildPreferences());
792 jMenuTools.addSeparator();
793
794 jMenuTools.add(getJMenuItemToolsGenerateGuidsXref());
795 }
796 return jMenuTools;
797 }
798
799 /**
800 This method initializes jMenuWindow
801 Reserved
802
803 @return javax.swing.JMenu jMenuWindow
804
805 **/
806 private JMenu getJMenuWindow() {
807 if (jMenuWindow == null) {
808 //
809 // Set jMenuWindow's attribute
810 //
811 jMenuWindow = new JMenu();
812 jMenuWindow.setText("Window");
813 jMenuWindow.setMnemonic('W');
814 jMenuWindow.setVisible(false);
815
816 //
817 // Add sub menu items
818 //
819 jMenuWindow.add(getJMenuItemWindowDisplaySide());
820 jMenuWindow.add(getJMenuItemWindowDisplayTopBottom());
821 jMenuWindow.addSeparator();
822
823 jMenuWindow.add(getJMenuItemWindowTabView());
824 jMenuWindow.addSeparator();
825
826 jMenuWindow.add(getJMenuItemWindowSource());
827 jMenuWindow.add(getJMenuItemWindowXML());
828 jMenuWindow.addSeparator();
829
830 jMenuWindow.add(getJMenuItemWindowPreferences());
831 }
832 return jMenuWindow;
833 }
834
835 /**
836 This method initializes jPanelOperation
837 Reserved
838
839 @return javax.swing.JPanel jPanelOperation
840
841 **/
842 private JPanel getJPanelOperation() {
843 if (jPanelOperation == null) {
844 jPanelOperation = new JPanel();
845 jPanelOperation.setLayout(null);
846 jPanelOperation.setBounds(new java.awt.Rectangle(295, 520, 500, 25));
847 jPanelOperation.add(getJButtonOk(), null);
848 jPanelOperation.add(getJButtonCancel(), null);
849 jPanelOperation.setVisible(false);
850 }
851 return jPanelOperation;
852 }
853
854 /**
855 This method initializes jButtonOk
856 Reserved
857
858 @return javax.swing.JButton jButtonOk
859
860 **/
861 private JButton getJButtonOk() {
862 if (jButtonOk == null) {
863 jButtonOk = new JButton();
864 jButtonOk.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
865 jButtonOk.setText("Ok");
866 jButtonOk.setEnabled(false);
867 jButtonOk.addActionListener(this);
868 }
869 return jButtonOk;
870 }
871
872 /**
873 This method initializes jButtonCancel
874 Reserved
875
876 @return javax.swing.JButton jButtonCancel
877
878 **/
879 private JButton getJButtonCancel() {
880 if (jButtonCancel == null) {
881 jButtonCancel = new JButton();
882 jButtonCancel.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
883 jButtonCancel.setText("Cancel");
884 jButtonCancel.setEnabled(false);
885 jButtonCancel.addActionListener(this);
886 jButtonCancel.setVisible(false);
887 }
888 return jButtonCancel;
889 }
890
891 /**
892 This method initializes jMenuItemFileOpen
893
894 @return javax.swing.JMenuItem jMenuItemFileOpen
895
896 **/
897 private JMenuItem getJMenuItemFileOpen() {
898 if (jMenuItemFileOpen == null) {
899 jMenuItemFileOpen = new JMenuItem();
900 jMenuItemFileOpen.setText("Open...");
901 jMenuItemFileOpen.setMnemonic('O');
902 jMenuItemFileOpen.addActionListener(this);
903 }
904 return jMenuItemFileOpen;
905 }
906
907 /**
908 This method initializes jMenuItemFileCloseAll
909
910 @return javax.swing.JMenuItem jMenuItemFileOpen
911
912 **/
913 private JMenuItem getJMenuItemFileCloseAll() {
914 if (jMenuItemFileCloseAll == null) {
915 jMenuItemFileCloseAll = new JMenuItem();
916 jMenuItemFileCloseAll.setText("Close All");
917 jMenuItemFileCloseAll.setMnemonic('A');
918 jMenuItemFileCloseAll.setEnabled(true);
919 jMenuItemFileCloseAll.addActionListener(this);
920 }
921 return jMenuItemFileCloseAll;
922 }
923
924 /**
925 This method initializes jMenuItemFileSaveAll
926
927 @return javax.swing.JMenuItem jMenuItemFileSaveAll
928
929 **/
930 private JMenuItem getJMenuItemFileSaveAll() {
931 if (jMenuItemFileSaveAll == null) {
932 jMenuItemFileSaveAll = new JMenuItem();
933 jMenuItemFileSaveAll.setText("Save All");
934 jMenuItemFileSaveAll.setMnemonic('v');
935 jMenuItemFileSaveAll.setEnabled(true);
936 jMenuItemFileSaveAll.addActionListener(this);
937 }
938 return jMenuItemFileSaveAll;
939 }
940
941 /**
942 This method initializes jMenuItemFilePageSetup
943
944 @return javax.swing.JMenuItem
945
946 **/
947 private JMenuItem getJMenuItemFilePageSetup() {
948 if (jMenuItemFilePageSetup == null) {
949 jMenuItemFilePageSetup = new JMenuItem();
950 jMenuItemFilePageSetup.setText("Page Setup");
951 jMenuItemFilePageSetup.setMnemonic('u');
952 jMenuItemFilePageSetup.setEnabled(false);
953 jMenuItemFilePageSetup.addActionListener(this);
954 jMenuItemFilePageSetup.setVisible(false);
955 }
956 return jMenuItemFilePageSetup;
957 }
958
959 /**
960 This method initializes jMenuItemFilePrint
961
962 @return javax.swing.JMenuItem
963
964 **/
965 private JMenuItem getJMenuItemFilePrint() {
966 if (jMenuItemFilePrint == null) {
967 jMenuItemFilePrint = new JMenuItem();
968 jMenuItemFilePrint.setText("Print");
969 jMenuItemFilePrint.setMnemonic('P');
970 jMenuItemFilePrint.setEnabled(false);
971 jMenuItemFilePrint.addActionListener(this);
972 jMenuItemFilePrint.setVisible(false);
973 }
974 return jMenuItemFilePrint;
975 }
976
977 /**
978 This method initializes jMenuItemFileImport
979
980 @return javax.swing.JMenuItem
981
982 **/
983 private JMenuItem getJMenuItemFileImport() {
984 if (jMenuItemFileImport == null) {
985 jMenuItemFileImport = new JMenuItem();
986 jMenuItemFileImport.setText("Import");
987 jMenuItemFileImport.setMnemonic('I');
988 jMenuItemFileImport.setEnabled(false);
989 jMenuItemFileImport.addActionListener(this);
990 jMenuItemFileImport.setVisible(false);
991 }
992 return jMenuItemFileImport;
993 }
994
995 /**
996 This method initializes jMenuItemFileProperties
997
998 @return javax.swing.JMenuItem
999
1000 **/
1001 private JMenuItem getJMenuItemFileProperties() {
1002 if (jMenuItemFileProperties == null) {
1003 jMenuItemFileProperties = new JMenuItem();
1004 jMenuItemFileProperties.setText("Properties");
1005 jMenuItemFileProperties.setMnemonic('t');
1006 jMenuItemFileProperties.setEnabled(false);
1007 jMenuItemFileProperties.addActionListener(this);
1008 jMenuItemFileProperties.setVisible(false);
1009 }
1010 return jMenuItemFileProperties;
1011 }
1012
1013 /**
1014 This method initializes jMenuFileRecentFiles
1015
1016 @return javax.swing.JMenu
1017
1018 **/
1019 private JMenu getJMenuFileRecentFiles() {
1020 if (jMenuFileRecentFiles == null) {
1021 jMenuFileRecentFiles = new JMenu();
1022 jMenuFileRecentFiles.setText("Recent Files");
1023 jMenuFileRecentFiles.setMnemonic('F');
1024 jMenuFileRecentFiles.setEnabled(false);
1025 jMenuFileRecentFiles.addActionListener(this);
1026 jMenuFileRecentFiles.setVisible(false);
1027 }
1028 return jMenuFileRecentFiles;
1029 }
1030
1031 /**
1032 This method initializes jMenuItemEditUndo
1033
1034 @return javax.swing.JMenuItem
1035
1036 **/
1037 private JMenuItem getJMenuItemEditUndo() {
1038 if (jMenuItemEditUndo == null) {
1039 jMenuItemEditUndo = new JMenuItem();
1040 jMenuItemEditUndo.setText("Undo");
1041 jMenuItemEditUndo.setMnemonic('U');
1042 jMenuItemEditUndo.setEnabled(false);
1043 jMenuItemEditUndo.setVisible(false);
1044 jMenuItemEditUndo.addActionListener(this);
1045 }
1046 return jMenuItemEditUndo;
1047 }
1048
1049 /**
1050 This method initializes jMenuItemEditRedo
1051
1052 @return javax.swing.JMenuItem
1053
1054 **/
1055 private JMenuItem getJMenuItemEditRedo() {
1056 if (jMenuItemEditRedo == null) {
1057 jMenuItemEditRedo = new JMenuItem();
1058 jMenuItemEditRedo.setText("Redo");
1059 jMenuItemEditRedo.setMnemonic('R');
1060 jMenuItemEditRedo.setEnabled(false);
1061 jMenuItemEditRedo.setVisible(false);
1062 jMenuItemEditRedo.addActionListener(this);
1063 }
1064 return jMenuItemEditRedo;
1065 }
1066
1067 /**
1068 This method initializes jMenuItemEditCut
1069
1070 @return javax.swing.JMenuItem
1071
1072 **/
1073 private JMenuItem getJMenuItemEditCut() {
1074 if (jMenuItemEditCut == null) {
1075 jMenuItemEditCut = new JMenuItem();
1076 jMenuItemEditCut.setText("Cut");
1077 jMenuItemEditCut.setMnemonic('t');
1078 jMenuItemEditCut.setEnabled(false);
1079 jMenuItemEditCut.setVisible(false);
1080 jMenuItemEditCut.addActionListener(this);
1081 }
1082 return jMenuItemEditCut;
1083 }
1084
1085 /**
1086 This method initializes jMenuItemEditCopy
1087
1088 @return javax.swing.JMenuItem
1089
1090 **/
1091 private JMenuItem getJMenuItemEditCopy() {
1092 if (jMenuItemEditCopy == null) {
1093 jMenuItemEditCopy = new JMenuItem();
1094 jMenuItemEditCopy.setText("Copy");
1095 jMenuItemEditCopy.setMnemonic('C');
1096 jMenuItemEditCopy.setEnabled(false);
1097 jMenuItemEditCopy.setVisible(false);
1098 jMenuItemEditCopy.addActionListener(this);
1099 }
1100 return jMenuItemEditCopy;
1101 }
1102
1103 /**
1104 This method initializes jMenuItemEditPaste
1105
1106 return javax.swing.JMenuItem
1107
1108 **/
1109 private JMenuItem getJMenuItemEditPaste() {
1110 if (jMenuItemEditPaste == null) {
1111 jMenuItemEditPaste = new JMenuItem();
1112 jMenuItemEditPaste.setText("Paste");
1113 jMenuItemEditPaste.setMnemonic('P');
1114 jMenuItemEditPaste.setEnabled(false);
1115 jMenuItemEditPaste.setVisible(false);
1116 jMenuItemEditPaste.addActionListener(this);
1117 }
1118 return jMenuItemEditPaste;
1119 }
1120
1121 /**
1122 This method initializes jMenuItem
1123
1124 @return javax.swing.JMenuItem
1125
1126 **/
1127 private JMenuItem getJMenuItemEditSelectAll() {
1128 if (jMenuItemEditSelectAll == null) {
1129 jMenuItemEditSelectAll = new JMenuItem();
1130 jMenuItemEditSelectAll.setText("Select All");
1131 jMenuItemEditSelectAll.setMnemonic('A');
1132 jMenuItemEditSelectAll.setEnabled(false);
1133 jMenuItemEditSelectAll.setVisible(false);
1134 jMenuItemEditSelectAll.addActionListener(this);
1135 }
1136 return jMenuItemEditSelectAll;
1137 }
1138
1139 /**
1140 This method initializes jMenuItemEditFindNext
1141
1142 @return javax.swing.JMenuItem
1143
1144 **/
1145 private JMenuItem getJMenuItemEditFindNext() {
1146 if (jMenuItemEditFindNext == null) {
1147 jMenuItemEditFindNext = new JMenuItem();
1148 jMenuItemEditFindNext.setText("Find Next");
1149 jMenuItemEditFindNext.setMnemonic('n');
1150 jMenuItemEditFindNext.setEnabled(false);
1151 jMenuItemEditFindNext.setVisible(false);
1152 jMenuItemEditFindNext.addActionListener(this);
1153 }
1154 return jMenuItemEditFindNext;
1155 }
1156
1157 /**
1158 This method initializes jMenuView
1159
1160 @return javax.swing.JMenu
1161
1162 **/
1163 private JMenu getJMenuView() {
1164 if (jMenuView == null) {
1165 //
1166 // Set jMenuView's attributes
1167 //
1168 jMenuView = new JMenu();
1169 jMenuView.setText("View");
1170 jMenuView.setMnemonic('V');
1171 jMenuView.setVisible(false);
1172
1173 //
1174 // Add sub menu items
1175 //
1176 jMenuView.add(getJMenuViewToolbars());
1177 jMenuView.add(getJMenuItemViewAdvanced());
1178 jMenuView.add(getJMenuItemViewStandard());
1179 jMenuView.add(getJMenuItemViewXML());
1180 }
1181 return jMenuView;
1182 }
1183
1184 /**
1185 This method initializes jMenuViewToolbars
1186
1187 @return javax.swing.JMenu
1188
1189 **/
1190 private JMenu getJMenuViewToolbars() {
1191 if (jMenuViewToolbars == null) {
1192 jMenuViewToolbars = new JMenu();
1193 jMenuViewToolbars.setText("Toolbars");
1194 jMenuViewToolbars.setMnemonic('T');
1195
1196 jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsFile());
1197 jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsEdit());
1198 jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsWindow());
1199 }
1200 return jMenuViewToolbars;
1201 }
1202
1203 /**
1204 This method initializes jCheckBoxMenuItemViewToolbarsFile
1205
1206 @return javax.swing.JCheckBoxMenuItem
1207
1208 **/
1209 private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsFile() {
1210 if (jCheckBoxMenuItemViewToolbarsFile == null) {
1211 jCheckBoxMenuItemViewToolbarsFile = new JCheckBoxMenuItem();
1212 jCheckBoxMenuItemViewToolbarsFile.setText("File");
1213 jCheckBoxMenuItemViewToolbarsFile.setEnabled(false);
1214 jCheckBoxMenuItemViewToolbarsFile.addActionListener(this);
1215 }
1216 return jCheckBoxMenuItemViewToolbarsFile;
1217 }
1218
1219 /**
1220 This method initializes jCheckBoxMenuItemViewToolbarsEdit
1221
1222 @return javax.swing.JCheckBoxMenuItem
1223
1224 **/
1225 private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsEdit() {
1226 if (jCheckBoxMenuItemViewToolbarsEdit == null) {
1227 jCheckBoxMenuItemViewToolbarsEdit = new JCheckBoxMenuItem();
1228 jCheckBoxMenuItemViewToolbarsEdit.setText("Edit");
1229 jCheckBoxMenuItemViewToolbarsEdit.setEnabled(false);
1230 jCheckBoxMenuItemViewToolbarsEdit.addActionListener(this);
1231 }
1232 return jCheckBoxMenuItemViewToolbarsEdit;
1233 }
1234
1235 /**
1236 This method initializes jCheckBoxMenuItemViewToolbarsWindow
1237
1238 @return javax.swing.JCheckBoxMenuItem
1239
1240 **/
1241 private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsWindow() {
1242 if (jCheckBoxMenuItemViewToolbarsWindow == null) {
1243 jCheckBoxMenuItemViewToolbarsWindow = new JCheckBoxMenuItem();
1244 jCheckBoxMenuItemViewToolbarsWindow.setText("Window");
1245 jCheckBoxMenuItemViewToolbarsWindow.setEnabled(false);
1246 jCheckBoxMenuItemViewToolbarsWindow.addActionListener(this);
1247 }
1248 return jCheckBoxMenuItemViewToolbarsWindow;
1249 }
1250
1251 /**
1252 This method initializes jMenuItemStandard
1253
1254 @return javax.swing.JMenuItem
1255
1256 **/
1257 private JMenuItem getJMenuItemViewStandard() {
1258 if (jMenuItemViewStandard == null) {
1259 jMenuItemViewStandard = new JMenuItem();
1260 jMenuItemViewStandard.setText("Standard");
1261 jMenuItemViewStandard.setMnemonic('S');
1262 jMenuItemViewStandard.setEnabled(false);
1263 jMenuItemViewStandard.addActionListener(this);
1264 }
1265 return jMenuItemViewStandard;
1266 }
1267
1268 /**
1269 This method initializes jMenuItemAdvanced
1270
1271 @return javax.swing.JMenuItem
1272
1273 **/
1274 private JMenuItem getJMenuItemViewAdvanced() {
1275 if (jMenuItemViewAdvanced == null) {
1276 jMenuItemViewAdvanced = new JMenuItem();
1277 jMenuItemViewAdvanced.setText("Advanced");
1278 jMenuItemViewAdvanced.setMnemonic('A');
1279 jMenuItemViewAdvanced.setEnabled(false);
1280 jMenuItemViewAdvanced.addActionListener(this);
1281 }
1282 return jMenuItemViewAdvanced;
1283 }
1284
1285 /**
1286 This method initializes jMenuProject
1287
1288 @return javax.swing.JMenu
1289
1290 **/
1291 private JMenu getJMenuProject() {
1292 if (jMenuProject == null) {
1293 //
1294 // Set jMenuProject's attributes
1295 //
1296 jMenuProject = new JMenu();
1297 jMenuProject.setText("Project");
1298 jMenuProject.setMnemonic('P');
1299
1300 //
1301 // Add sub menu items
1302 //
1303 jMenuProject.add(getJMenuItemProjectAdmin());
1304
1305 jMenuProject.add(getJMenuItemProjectChangeWorkspace());
1306 jMenuProject.addSeparator();
1307
1308 jMenuProject.add(getJMenuItemProjectCreateFar());
1309 jMenuProject.add(getJMenuItemProjectInstallFar());
1310 jMenuProject.add(getJMenuItemProjectUpdateFar());
1311 jMenuProject.add(getJMenuItemProjectRemoveFar());
1312
1313 }
1314 return jMenuProject;
1315 }
1316
1317 /**
1318 This method initializes jMenuItemProjectAdmin
1319
1320 @return javax.swing.JMenuItem
1321
1322 **/
1323 private JMenuItem getJMenuItemProjectAdmin() {
1324 if (jMenuItemProjectAdmin == null) {
1325 jMenuItemProjectAdmin = new JMenuItem();
1326 jMenuItemProjectAdmin.setText("Admin...");
1327 jMenuItemProjectAdmin.setMnemonic('A');
1328 jMenuItemProjectAdmin.setEnabled(false);
1329 jMenuItemProjectAdmin.addActionListener(this);
1330 jMenuItemProjectAdmin.setVisible(false);
1331 }
1332 return jMenuItemProjectAdmin;
1333 }
1334
1335 /**
1336 This method initializes jMenuItemProjectChangeWorkspace
1337
1338 @return javax.swing.JMenuItem
1339
1340 **/
1341 private JMenuItem getJMenuItemProjectChangeWorkspace() {
1342 if (jMenuItemProjectChangeWorkspace == null) {
1343 jMenuItemProjectChangeWorkspace = new JMenuItem();
1344 jMenuItemProjectChangeWorkspace.setText("Change WORKSPACE...");
1345 jMenuItemProjectChangeWorkspace.setMnemonic('W');
1346 jMenuItemProjectChangeWorkspace.setEnabled(true);
1347 jMenuItemProjectChangeWorkspace.addActionListener(this);
1348 }
1349 return jMenuItemProjectChangeWorkspace;
1350 }
1351
1352 /**
1353 This method initializes jMenuProjectBuildPreferences
1354
1355 @return javax.swing.JMenu
1356
1357 **/
1358 private JMenuItem getJMenuItemToolsBuildPreferences() {
1359 if (jMenuItemToolsBuildPreferences == null) {
1360 jMenuItemToolsBuildPreferences = new JMenuItem();
1361 jMenuItemToolsBuildPreferences.setText("Build Preferences");
1362 jMenuItemToolsBuildPreferences.setMnemonic('P');
1363 jMenuItemToolsBuildPreferences.setEnabled(true);
1364 jMenuItemToolsBuildPreferences.addActionListener(this);
1365 }
1366 return jMenuItemToolsBuildPreferences;
1367 }
1368
1369 /**
1370 This method initializes jMenuItemToolsToolChainConfiguration
1371
1372 @return javax.swing.JMenuItem
1373
1374 **/
1375 private JMenuItem getJMenuItemToolsToolChainConfiguration() {
1376 if (jMenuItemToolsToolChainConfiguration == null) {
1377 jMenuItemToolsToolChainConfiguration = new JMenuItem();
1378 jMenuItemToolsToolChainConfiguration.setText("Tool Chain Configuration...");
1379 jMenuItemToolsToolChainConfiguration.setMnemonic('C');
1380 jMenuItemToolsToolChainConfiguration.addActionListener(this);
1381 }
1382 return jMenuItemToolsToolChainConfiguration;
1383 }
1384
1385 /**
1386 This method initializes jMenuItemToolsClone
1387
1388 @return javax.swing.JMenuItem
1389
1390 **/
1391 private JMenuItem getJMenuItemToolsClone() {
1392 if (jMenuItemToolsClone == null) {
1393 jMenuItemToolsClone = new JMenuItem();
1394 jMenuItemToolsClone.setText("Clone...");
1395 jMenuItemToolsClone.setMnemonic('l');
1396 jMenuItemToolsClone.setEnabled(true);
1397 jMenuItemToolsClone.addActionListener(this);
1398 }
1399 return jMenuItemToolsClone;
1400 }
1401
1402 /**
1403 This method initializes jMenuItemToolsCodeScan
1404
1405 @return javax.swing.JMenuItem
1406
1407 **/
1408 private JMenuItem getJMenuItemToolsCodeScan() {
1409 if (jMenuItemToolsCodeScan == null) {
1410 jMenuItemToolsCodeScan = new JMenuItem();
1411 jMenuItemToolsCodeScan.setText("Code Scan...");
1412 jMenuItemToolsCodeScan.setMnemonic('S');
1413 jMenuItemToolsCodeScan.setEnabled(false);
1414 jMenuItemToolsCodeScan.addActionListener(this);
1415 jMenuItemToolsCodeScan.setVisible(false);
1416 }
1417 return jMenuItemToolsCodeScan;
1418 }
1419
1420 /**
1421 This method initializes jMenuItemWindowSplitVertical
1422
1423 @return javax.swing.JMenuItem
1424
1425 **/
1426 private JMenuItem getJMenuItemWindowDisplaySide() {
1427 if (jMenuItemWindowDisplaySide == null) {
1428 jMenuItemWindowDisplaySide = new JMenuItem();
1429 jMenuItemWindowDisplaySide.setText("Display Side by Side");
1430 jMenuItemWindowDisplaySide.setMnemonic('S');
1431 jMenuItemWindowDisplaySide.setEnabled(false);
1432 jMenuItemWindowDisplaySide.addActionListener(this);
1433 }
1434 return jMenuItemWindowDisplaySide;
1435 }
1436
1437 /**
1438 This method initializes jMenuItemWindowSplitHorizontal
1439
1440 @return javax.swing.JMenuItem
1441
1442 **/
1443 private JMenuItem getJMenuItemWindowDisplayTopBottom() {
1444 if (jMenuItemWindowDisplayTopBottom == null) {
1445 jMenuItemWindowDisplayTopBottom = new JMenuItem();
1446 jMenuItemWindowDisplayTopBottom.setText("Display Top and Bottom");
1447 jMenuItemWindowDisplayTopBottom.setMnemonic('B');
1448 jMenuItemWindowDisplayTopBottom.setEnabled(false);
1449 jMenuItemWindowDisplayTopBottom.addActionListener(this);
1450 }
1451 return jMenuItemWindowDisplayTopBottom;
1452 }
1453
1454 /**
1455 This method initializes jMenuItemViewXML
1456
1457 @return javax.swing.JMenuItem
1458
1459 **/
1460 private JMenuItem getJMenuItemViewXML() {
1461 if (jMenuItemViewXML == null) {
1462 jMenuItemViewXML = new JMenuItem();
1463 jMenuItemViewXML.setText("XML");
1464 jMenuItemViewXML.setMnemonic('X');
1465 jMenuItemViewXML.setEnabled(false);
1466 jMenuItemViewXML.addActionListener(this);
1467 }
1468 return jMenuItemViewXML;
1469 }
1470
1471 /**
1472 This method initializes jMenuItemWindowTabView
1473
1474 @return javax.swing.JMenuItem
1475
1476 **/
1477 private JMenuItem getJMenuItemWindowTabView() {
1478 if (jMenuItemWindowTabView == null) {
1479 jMenuItemWindowTabView = new JMenuItem();
1480 jMenuItemWindowTabView.setText("Tab View");
1481 jMenuItemWindowTabView.setMnemonic('T');
1482 jMenuItemWindowTabView.setEnabled(false);
1483 jMenuItemWindowTabView.addActionListener(this);
1484 }
1485 return jMenuItemWindowTabView;
1486 }
1487
1488 /**
1489 This method initializes jMenuItemWindowSource
1490
1491 @return javax.swing.JMenuItem
1492
1493 **/
1494 private JMenuItem getJMenuItemWindowSource() {
1495 if (jMenuItemWindowSource == null) {
1496 jMenuItemWindowSource = new JMenuItem();
1497 jMenuItemWindowSource.setText("Source");
1498 jMenuItemWindowSource.setMnemonic('S');
1499 jMenuItemWindowSource.setEnabled(false);
1500 jMenuItemWindowSource.addActionListener(this);
1501 }
1502 return jMenuItemWindowSource;
1503 }
1504
1505 /**
1506 This method initializes jMenuItemWindowXML
1507
1508 @return javax.swing.JMenuItem
1509
1510 **/
1511 private JMenuItem getJMenuItemWindowXML() {
1512 if (jMenuItemWindowXML == null) {
1513 jMenuItemWindowXML = new JMenuItem();
1514 jMenuItemWindowXML.setText("XML");
1515 jMenuItemWindowXML.setMnemonic('X');
1516 jMenuItemWindowXML.setEnabled(false);
1517 jMenuItemWindowXML.addActionListener(this);
1518 }
1519 return jMenuItemWindowXML;
1520 }
1521
1522 /**
1523 This method initializes jMenuItemWindowPreferences
1524
1525 @return javax.swing.JMenuItem
1526
1527 **/
1528 private JMenuItem getJMenuItemWindowPreferences() {
1529 if (jMenuItemWindowPreferences == null) {
1530 jMenuItemWindowPreferences = new JMenuItem();
1531 jMenuItemWindowPreferences.setText("Preferences");
1532 jMenuItemWindowPreferences.setMnemonic('P');
1533 jMenuItemWindowPreferences.setEnabled(false);
1534 jMenuItemWindowPreferences.addActionListener(this);
1535 }
1536 return jMenuItemWindowPreferences;
1537 }
1538
1539 /**
1540 This method initializes jMenuItemHelpContents
1541
1542 @return javax.swing.JMenuItem
1543
1544 **/
1545 private JMenuItem getJMenuItemHelpContents() {
1546 if (jMenuItemHelpContents == null) {
1547 jMenuItemHelpContents = new JMenuItem();
1548 jMenuItemHelpContents.setText("Contents");
1549 jMenuItemHelpContents.setMnemonic('C');
1550 jMenuItemHelpContents.setEnabled(false);
1551 jMenuItemHelpContents.addActionListener(this);
1552 jMenuItemHelpContents.setVisible(false);
1553 }
1554 return jMenuItemHelpContents;
1555 }
1556
1557 /**
1558 This method initializes jMenuItemHelpIndex
1559
1560 @return javax.swing.JMenuItem
1561
1562 **/
1563 private JMenuItem getJMenuItemHelpIndex() {
1564 if (jMenuItemHelpIndex == null) {
1565 jMenuItemHelpIndex = new JMenuItem();
1566 jMenuItemHelpIndex.setText("Index");
1567 jMenuItemHelpIndex.setMnemonic('I');
1568 jMenuItemHelpIndex.setEnabled(false);
1569 jMenuItemHelpIndex.addActionListener(this);
1570 jMenuItemHelpIndex.setVisible(false);
1571 }
1572 return jMenuItemHelpIndex;
1573 }
1574
1575 /**
1576 This method initializes jMenuItemHelpSearch
1577
1578 @return javax.swing.JMenuItem
1579
1580 */
1581 private JMenuItem getJMenuItemHelpSearch() {
1582 if (jMenuItemHelpSearch == null) {
1583 jMenuItemHelpSearch = new JMenuItem();
1584 jMenuItemHelpSearch.setText("Search");
1585 jMenuItemHelpSearch.setMnemonic('S');
1586 jMenuItemHelpSearch.setEnabled(false);
1587 jMenuItemHelpSearch.addActionListener(this);
1588 jMenuItemHelpSearch.setVisible(false);
1589 }
1590 return jMenuItemHelpSearch;
1591 }
1592
1593 /**
1594 * This method initializes jMenuItemToolsInstallPackage
1595 *
1596 * @return javax.swing.JMenuItem
1597 */
1598 private JMenuItem getJMenuItemProjectInstallFar() {
1599 if (jMenuItemProjectInstallFar == null) {
1600 jMenuItemProjectInstallFar = new JMenuItem();
1601 jMenuItemProjectInstallFar.setText("Install FAR");
1602 jMenuItemProjectInstallFar.setMnemonic('I');
1603 jMenuItemProjectInstallFar.setEnabled(true);
1604 jMenuItemProjectInstallFar.addActionListener(this);
1605 }
1606 return jMenuItemProjectInstallFar;
1607 }
1608
1609 /**
1610 * This method initializes jMenuItemToolsUpdatePackage
1611 *
1612 * @return javax.swing.JMenuItem
1613 */
1614 private JMenuItem getJMenuItemProjectUpdateFar() {
1615 if (jMenuItemProjectUpdateFar == null) {
1616 jMenuItemProjectUpdateFar = new JMenuItem();
1617 jMenuItemProjectUpdateFar.setText("Update FAR");
1618 jMenuItemProjectUpdateFar.setMnemonic('U');
1619 jMenuItemProjectUpdateFar.setEnabled(true);
1620 jMenuItemProjectUpdateFar.addActionListener(this);
1621 jMenuItemProjectUpdateFar.setVisible(true);
1622 }
1623 return jMenuItemProjectUpdateFar;
1624 }
1625
1626 /**
1627 * This method initializes jMenuItemRemovePackage
1628 *
1629 * @return javax.swing.JMenuItem
1630 */
1631 private JMenuItem getJMenuItemProjectRemoveFar() {
1632 if (jMenuItemProjectRemoveFar == null) {
1633 jMenuItemProjectRemoveFar = new JMenuItem();
1634 jMenuItemProjectRemoveFar.setText("Remove FAR");
1635 jMenuItemProjectRemoveFar.setMnemonic('R');
1636 jMenuItemProjectRemoveFar.setEnabled(true);
1637 jMenuItemProjectRemoveFar.addActionListener(this);
1638 }
1639 return jMenuItemProjectRemoveFar;
1640 }
1641
1642 /**
1643 * This method initializes jMenuItemProjectCreateFar
1644 *
1645 * @return javax.swing.JMenuItem
1646 */
1647 private JMenuItem getJMenuItemProjectCreateFar() {
1648 if (jMenuItemProjectCreateFar == null) {
1649 jMenuItemProjectCreateFar = new JMenuItem();
1650 jMenuItemProjectCreateFar.setText("Create FAR");
1651 jMenuItemProjectCreateFar.setMnemonic('C');
1652 jMenuItemProjectCreateFar.addActionListener(this);
1653 }
1654 return jMenuItemProjectCreateFar;
1655 }
1656
1657 /**
1658 * This method initializes jMenuEditFind
1659 *
1660 * @return javax.swing.JMenu
1661 */
1662 private JMenu getJMenuEditFind() {
1663 if (jMenuEditFind == null) {
1664 jMenuEditFind = new JMenu();
1665 jMenuEditFind.setText("Find");
1666 jMenuEditFind.setMnemonic('F');
1667
1668 jMenuEditFind.add(getJMenuItemEditFindPpi());
1669 jMenuEditFind.add(getJMenuItemEditFindProtocol());
1670 jMenuEditFind.add(getJMenuItemEditFindGuid());
1671 jMenuEditFind.add(getJMenuItemEditFindPcd());
1672 jMenuEditFind.add(getJMenuItemEditFindLibraryClass());
1673 jMenuEditFind.add(getJMenuItemEditFindLibraryInstance());
1674 }
1675 return jMenuEditFind;
1676 }
1677
1678 /**
1679 * This method initializes jMenuItemEditFindPcd
1680 *
1681 * @return javax.swing.JMenuItem
1682 */
1683 private JMenuItem getJMenuItemEditFindPcd() {
1684 if (jMenuItemEditFindPcd == null) {
1685 jMenuItemEditFindPcd = new JMenuItem();
1686 jMenuItemEditFindPcd.setText("All PCD entries");
1687 jMenuItemEditFindPcd.setMnemonic('P');
1688 jMenuItemEditFindPcd.addActionListener(this);
1689 }
1690 return jMenuItemEditFindPcd;
1691 }
1692
1693 /**
1694 * This method initializes jMenuItemEditFindLibraryClass
1695 *
1696 * @return javax.swing.JMenuItem
1697 */
1698 private JMenuItem getJMenuItemEditFindLibraryClass() {
1699 if (jMenuItemEditFindLibraryClass == null) {
1700 jMenuItemEditFindLibraryClass = new JMenuItem();
1701 jMenuItemEditFindLibraryClass.setText("All Library Classes");
1702 jMenuItemEditFindLibraryClass.setMnemonic('C');
1703 jMenuItemEditFindLibraryClass.addActionListener(this);
1704 }
1705 return jMenuItemEditFindLibraryClass;
1706 }
1707
1708 /**
1709 * This method initializes jMenuItemEditFindPpi
1710 *
1711 * @return javax.swing.JMenuItem
1712 */
1713 private JMenuItem getJMenuItemEditFindPpi() {
1714 if (jMenuItemEditFindPpi == null) {
1715 jMenuItemEditFindPpi = new JMenuItem();
1716 jMenuItemEditFindPpi.setText("All PPIs");
1717 jMenuItemEditFindPpi.setMnemonic('I');
1718 jMenuItemEditFindPpi.addActionListener(this);
1719 }
1720 return jMenuItemEditFindPpi;
1721 }
1722
1723 /**
1724 * This method initializes jMenuItemEditFindProtocol
1725 *
1726 * @return javax.swing.JMenuItem
1727 */
1728 private JMenuItem getJMenuItemEditFindProtocol() {
1729 if (jMenuItemEditFindProtocol == null) {
1730 jMenuItemEditFindProtocol = new JMenuItem();
1731 jMenuItemEditFindProtocol.setText("All Protocols");
1732 jMenuItemEditFindProtocol.setMnemonic('r');
1733 jMenuItemEditFindProtocol.addActionListener(this);
1734 }
1735 return jMenuItemEditFindProtocol;
1736 }
1737
1738 /**
1739 * This method initializes jMenuItemEditFindGuid
1740 *
1741 * @return javax.swing.JMenuItem
1742 */
1743 private JMenuItem getJMenuItemEditFindGuid() {
1744 if (jMenuItemEditFindGuid == null) {
1745 jMenuItemEditFindGuid = new JMenuItem();
1746 jMenuItemEditFindGuid.setText("All GUIDs");
1747 jMenuItemEditFindGuid.setMnemonic('G');
1748 jMenuItemEditFindGuid.addActionListener(this);
1749 }
1750 return jMenuItemEditFindGuid;
1751 }
1752
1753 /**
1754 * This method initializes jMenuItemEditFindLibraryInstance
1755 *
1756 * @return javax.swing.JMenuItem
1757 */
1758 private JMenuItem getJMenuItemEditFindLibraryInstance() {
1759 if (jMenuItemEditFindLibraryInstance == null) {
1760 jMenuItemEditFindLibraryInstance = new JMenuItem();
1761 jMenuItemEditFindLibraryInstance.setText("All Library Instances");
1762 jMenuItemEditFindLibraryInstance.setMnemonic('n');
1763 jMenuItemEditFindLibraryInstance.addActionListener(this);
1764 jMenuItemEditFindLibraryInstance.setVisible(false);
1765 }
1766 return jMenuItemEditFindLibraryInstance;
1767 }
1768
1769 /**
1770 * This method initializes jMenuItemProjectGenerateGuidsXref
1771 *
1772 * @return javax.swing.JMenuItem
1773 */
1774 private JMenuItem getJMenuItemToolsGenerateGuidsXref() {
1775 if (jMenuItemToolsGenerateGuidsXref == null) {
1776 jMenuItemToolsGenerateGuidsXref = new JMenuItem();
1777 jMenuItemToolsGenerateGuidsXref.setText("Generate guids.xref");
1778 jMenuItemToolsGenerateGuidsXref.setMnemonic('G');
1779 jMenuItemToolsGenerateGuidsXref.addActionListener(this);
1780 }
1781 return jMenuItemToolsGenerateGuidsXref;
1782 }
1783
1784 /* (non-Javadoc)
1785 * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
1786 *
1787 * Main class, start the GUI
1788 *
1789 */
1790 public static void main(String[] args) {
1791 FrameworkWizardUI module = FrameworkWizardUI.getInstance();
1792 module.setVisible(true);
1793 }
1794
1795 /**
1796 This is the default constructor
1797
1798 **/
1799 public FrameworkWizardUI() {
1800 super();
1801 init();
1802 }
1803
1804 /**
1805 This method initializes this
1806
1807
1808 **/
1809 private void init() {
1810 //
1811 // Show splash screen
1812 //
1813 SplashScreen ss = new SplashScreen();
1814 ss.setVisible(true);
1815
1816 //
1817 // Set current workspace and check
1818 // Check if exists WORKSPACE
1819 //
1820 //
1821 Workspace.setCurrentWorkspace(System.getenv("WORKSPACE"));
1822 if (!Workspace.checkCurrentWorkspace()) {
1823 JOptionPane.showConfirmDialog(null, "Workspace is not setup correctly. Please setup first.", "Warning",
1824 JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
1825 this.dispose();
1826 System.exit(0);
1827 }
1828
1829 //
1830 // Init Global Data
1831 //
1832 GlobalData.init();
1833
1834 //
1835 // Close splash screen
1836 //
1837 ss.dispose();
1838
1839 //
1840 // Init the frame
1841 //
1842 this.setSize(DataType.MAIN_FRAME_PREFERRED_SIZE_WIDTH, DataType.MAIN_FRAME_PREFERRED_SIZE_HEIGHT);
1843 this.setResizable(true);
1844 this.setJMenuBar(getjJMenuBar());
1845 this.setContentPane(getJContentPane());
1846 this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
1847 + Workspace.getCurrentWorkspace() + "]");
1848 this.setExitType(1);
1849
1850 //
1851 // max the window
1852 //
1853 this.setExtendedState(JFrame.MAXIMIZED_BOTH);
1854 }
1855
1856 /**
1857 This method initializes jContentPane
1858
1859 @return javax.swing.JPanel jContentPane
1860
1861 **/
1862 private JPanel getJContentPane() {
1863 if (jContentPane == null) {
1864 jContentPane = new JPanel();
1865 jContentPane.setLayout(null);
1866 jContentPane.add(getJPanelOperation(), null);
1867 jContentPane.add(getJSplitPane(), null);
1868 }
1869 return jContentPane;
1870 }
1871
1872 /* (non-Javadoc)
1873 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1874 *
1875 * Override actionPerformed to listen all actions
1876 *
1877 */
1878 public void actionPerformed(ActionEvent arg0) {
1879 //
1880 // Operations of Menu
1881 //
1882 if (arg0.getSource() == this.jMenuItemFileNew) {
1883 this.fileNew();
1884 }
1885
1886 if (arg0.getSource() == this.jMenuItemFileOpen) {
1887 this.open();
1888 }
1889
1890 if (arg0.getSource() == this.jMenuItemFileClose) {
1891 this.close();
1892 }
1893
1894 if (arg0.getSource() == this.jMenuItemFileCloseAll) {
1895 this.closeAll();
1896 this.makeEmptyTree();
1897 }
1898
1899 if (arg0.getSource() == this.jMenuItemFileSave) {
1900 this.save();
1901 }
1902
1903 if (arg0.getSource() == this.jMenuItemFileSaveAs) {
1904 this.saveAs();
1905 }
1906
1907 if (arg0.getSource() == this.jMenuItemFileSaveAll) {
1908 this.saveAll();
1909 }
1910
1911 if (arg0.getSource() == this.jMenuItemFileRefresh) {
1912 this.closeAll();
1913 this.refresh();
1914 this.makeEmptyTree();
1915 }
1916
1917 if (arg0.getSource() == this.jMenuItemFileExit) {
1918 this.exit();
1919 }
1920
1921 if (arg0.getSource() == this.jMenuItemEditFindPpi) {
1922 this.findPpi();
1923 }
1924
1925 if (arg0.getSource() == this.jMenuItemEditFindProtocol) {
1926 this.findProtocol();
1927 }
1928
1929 if (arg0.getSource() == this.jMenuItemEditFindGuid) {
1930 this.findGuid();
1931 }
1932
1933 if (arg0.getSource() == this.jMenuItemEditFindPcd) {
1934 this.findPcd();
1935 }
1936
1937 if (arg0.getSource() == this.jMenuItemEditFindLibraryClass) {
1938 this.findLibraryClass();
1939 }
1940
1941 if (arg0.getSource() == this.jMenuItemEditFindLibraryInstance) {
1942 this.findLibraryInstance();
1943 }
1944
1945 if (arg0.getSource() == jMenuItemToolsBuildPreferences) {
1946 configBuildPreferences();
1947 }
1948
1949 if (arg0.getSource() == this.jMenuItemProjectChangeWorkspace) {
1950 this.changeWorkspace();
1951 }
1952
1953 if (arg0.getSource() == this.jMenuItemProjectCreateFar) {
1954 this.createFar();
1955 }
1956
1957 if (arg0.getSource() == this.jMenuItemProjectInstallFar) {
1958 this.installFar();
1959 }
1960
1961 if (arg0.getSource() == this.jMenuItemProjectRemoveFar) {
1962 this.removeFar();
1963 }
1964
1965 if (arg0.getSource() == this.jMenuItemProjectUpdateFar) {
1966 this.updateFar();
1967 }
1968
1969 if (arg0.getSource() == this.jMenuItemToolsClone) {
1970 this.cloneItem();
1971 }
1972
1973 if (arg0.getSource() == this.jMenuItemToolsToolChainConfiguration) {
1974 this.setupToolChainConfiguration();
1975 }
1976
1977 if (arg0.getSource() == this.jMenuItemToolsGenerateGuidsXref) {
1978 this.generateGuidsXref();
1979 }
1980
1981 if (arg0.getSource() == this.jMenuItemHelpAbout) {
1982 About a = new About(this, true);
1983 int result = a.showDialog();
1984 if (result == DataType.RETURN_TYPE_OK) {
1985 a.dispose();
1986 }
1987 }
1988 }
1989
1990 /**
1991 Create an empty tree if no file is open
1992
1993 **/
1994 private void makeEmptyTree() {
1995 //
1996 // Make root
1997 //
1998 dmtnRoot = new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode.WORKSPACE, false, null, null);
1999
2000 //
2001 // Make Module Description
2002 //
2003 dmtnModuleDescription = new IDefaultMutableTreeNode("Modules", IDefaultMutableTreeNode.MODULE_DESCRIPTION,
2004 false, null, dmtnRoot);
2005
2006 //
2007 // First add package
2008 //
2009 if (GlobalData.vPackageList.size() > 0) {
2010 for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
2011 IDefaultMutableTreeNode dmtnModulePackage = null;
2012 IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
2013 IDefaultMutableTreeNode dmtnModulePackageModule = null;
2014
2015 dmtnModulePackage = new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index).getName(),
2016 IDefaultMutableTreeNode.MODULE_PACKAGE, false,
2017 GlobalData.vPackageList.elementAt(index),
2018 this.dmtnModuleDescription);
2019 dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
2020 IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
2021 false, GlobalData.vPackageList.elementAt(index),
2022 this.dmtnModuleDescription);
2023 dmtnModulePackageModule = new IDefaultMutableTreeNode("Module",
2024 IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
2025 false, GlobalData.vPackageList.elementAt(index),
2026 this.dmtnModuleDescription);
2027 //
2028 // And then add each module in its package
2029 //
2030 Vector<ModuleIdentification> vModule = wt.getAllModules(GlobalData.vPackageList.elementAt(index));
2031 for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
2032 if (vModule.get(indexJ).isLibrary()) {
2033 dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
2034 IDefaultMutableTreeNode.MODULE, false,
2035 vModule.get(indexJ),
2036 this.dmtnModuleDescription));
2037 } else {
2038 dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
2039 IDefaultMutableTreeNode.MODULE, false,
2040 vModule.get(indexJ),
2041 this.dmtnModuleDescription));
2042 }
2043 }
2044 if (dmtnModulePackageModule.getChildCount() > 0) {
2045 dmtnModulePackage.add(dmtnModulePackageModule);
2046 }
2047 if (dmtnModulePackageLibrary.getChildCount() > 0) {
2048 dmtnModulePackage.add(dmtnModulePackageLibrary);
2049 }
2050
2051 dmtnModuleDescription.add(dmtnModulePackage);
2052 }
2053 }
2054
2055 //
2056 // Make Package Description
2057 //
2058 dmtnPackageDescription = new IDefaultMutableTreeNode("Packages", IDefaultMutableTreeNode.PACKAGE_DESCRIPTION,
2059 false, null, this.dmtnRoot);
2060 if (GlobalData.vPackageList.size() > 0) {
2061 for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
2062 dmtnPackageDescription.add(new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index)
2063 .getName(),
2064 IDefaultMutableTreeNode.PACKAGE, false,
2065 GlobalData.vPackageList.elementAt(index),
2066 this.dmtnPackageDescription));
2067 }
2068 }
2069
2070 //
2071 // Make Platform Description
2072 //
2073 dmtnPlatformDescription = new IDefaultMutableTreeNode("Platforms",
2074 IDefaultMutableTreeNode.PLATFORM_DESCRIPTION, false,
2075 null, this.dmtnRoot);
2076 if (GlobalData.vPlatformList.size() > 0) {
2077 for (int index = 0; index < GlobalData.vPlatformList.size(); index++) {
2078 dmtnPlatformDescription.add(new IDefaultMutableTreeNode(GlobalData.vPlatformList.elementAt(index)
2079 .getName(),
2080 IDefaultMutableTreeNode.PLATFORM, false,
2081 GlobalData.vPlatformList.elementAt(index),
2082 this.dmtnPlatformDescription));
2083 }
2084 }
2085
2086 //
2087 // Add sub nodes to root node
2088 //
2089 dmtnRoot.add(dmtnModuleDescription);
2090 dmtnRoot.add(dmtnPackageDescription);
2091 dmtnRoot.add(dmtnPlatformDescription);
2092 iTree = new ITree(dmtnRoot);
2093 iTree.addMouseListener(this);
2094 iTree.addKeyListener(this);
2095 jScrollPaneTree.setViewportView(iTree);
2096 }
2097
2098 /* (non-Javadoc)
2099 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
2100 *
2101 * Override windowClosing to popup warning message to confirm quit
2102 *
2103 */
2104 public void windowClosing(WindowEvent arg0) {
2105 this.exit();
2106 }
2107
2108 /* (non-Javadoc)
2109 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
2110 *
2111 * Override mouseClicked to check if need display popup menu
2112 *
2113 */
2114 public void mouseClicked(MouseEvent arg0) {
2115 //
2116 // When double click
2117 //
2118 if (arg0.getClickCount() == 2) {
2119 doubleClickModuleTreeNode();
2120 }
2121 }
2122
2123 public void mouseEntered(MouseEvent arg0) {
2124 // TODO Auto-generated method stub
2125 }
2126
2127 public void mouseExited(MouseEvent arg0) {
2128 // TODO Auto-generated method stub
2129 }
2130
2131 public void mousePressed(MouseEvent arg0) {
2132 // TODO Auto-generated method stub
2133 }
2134
2135 public void mouseReleased(MouseEvent arg0) {
2136 // TODO Auto-generated method stub
2137 }
2138
2139 /**
2140 Remove all Internal Frame of Module Desktop Pane
2141
2142 **/
2143 private void cleanDesktopPaneModule() {
2144 if (jDesktopPaneModule != null) {
2145 JInternalFrame[] iif = this.jDesktopPaneModule.getAllFrames();
2146 for (int index = 0; index < iif.length; index++) {
2147 iif[index].dispose();
2148 }
2149 }
2150 }
2151
2152 /**
2153 Remove all Internal Frame of package Desktop Pane
2154
2155 **/
2156 private void cleanDesktopPanePackage() {
2157 if (jDesktopPanePlatform != null) {
2158 JInternalFrame[] iif = this.jDesktopPanePackage.getAllFrames();
2159 for (int index = 0; index < iif.length; index++) {
2160 iif[index].dispose();
2161 }
2162 }
2163 }
2164
2165 /**
2166 Remove all Internal Frame of platform Desktop Pane
2167
2168 **/
2169 private void cleanDesktopPanePlatform() {
2170 if (jDesktopPanePlatform != null) {
2171 JInternalFrame[] iif = this.jDesktopPanePlatform.getAllFrames();
2172 for (int index = 0; index < iif.length; index++) {
2173 iif[index].dispose();
2174 }
2175 }
2176 }
2177
2178 /**
2179 Remove all Internal Frame of all Desktop Panes
2180
2181 **/
2182 private void cleanDesktopPane() {
2183 cleanDesktopPaneModule();
2184 cleanDesktopPanePackage();
2185 cleanDesktopPanePlatform();
2186 }
2187
2188 /**
2189 Set file filter as input ext
2190
2191 @param ext
2192 @return
2193
2194 **/
2195 private int getNewFilePath(String ext) {
2196 JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
2197 fc.setAcceptAllFileFilterUsed(false);
2198 fc.addChoosableFileFilter(new IFileFilter(ext));
2199 return fc.showSaveDialog(new JPanel());
2200 }
2201
2202 /**
2203 Add a module to tree
2204
2205 @param mid The module node to be added
2206
2207 **/
2208 private void addModuleToTree(ModuleIdentification mid) {
2209 //
2210 // Add new MsaHeader node to the tree
2211 //
2212 IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MODULE,
2213 false, mid, this.dmtnModuleDescription);
2214 //
2215 // First find the module belongs to which package
2216 //
2217 IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
2218 IDefaultMutableTreeNode.MODULE_PACKAGE);
2219 //
2220 // To check if has module node or library node
2221 //
2222 IDefaultMutableTreeNode parentModuleNode = null;
2223 IDefaultMutableTreeNode parentLibraryNode = null;
2224 boolean hasModule = false;
2225 boolean hasLibrary = false;
2226 for (int index = 0; index < packageNode.getChildCount(); index++) {
2227 IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
2228 if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
2229 hasLibrary = true;
2230 parentLibraryNode = iNode;
2231 }
2232 if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
2233 hasModule = true;
2234 parentModuleNode = iNode;
2235 }
2236 }
2237
2238 //
2239 // If is a module
2240 //
2241 if (!mid.isLibrary()) {
2242 //
2243 // Create parent node first if has no parent node
2244 //
2245 if (!hasModule) {
2246 parentModuleNode = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
2247 false, mid.getPackageId(), this.dmtnModuleDescription);
2248 iTree.addNode(packageNode, parentModuleNode);
2249 }
2250
2251 iTree.addNode(parentModuleNode, node);
2252 }
2253
2254 //
2255 // If is a Library
2256 //
2257 if (mid.isLibrary()) {
2258 //
2259 // Create parent node first if has no parent node
2260 //
2261 if (!hasLibrary) {
2262 parentLibraryNode = new IDefaultMutableTreeNode("Library",
2263 IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
2264 mid.getPackageId(), this.dmtnModuleDescription);
2265 iTree.addNode(packageNode, parentLibraryNode);
2266 }
2267
2268 iTree.addNode(parentLibraryNode, node);
2269 }
2270 }
2271
2272 /**
2273 Open Module
2274
2275 @param path input file path
2276
2277 **/
2278 private void openModule(String path, IDefaultMutableTreeNode belongNode) {
2279 ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(path);
2280 if (id == null) {
2281 //
2282 // The module is not in existing packages
2283 //
2284 Log.wrn("Open Module", "The module does not belong to any package in the current workspace!");
2285 return;
2286 }
2287
2288 //
2289 // Make the node selected
2290 //
2291 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(belongNode, id, IDefaultMutableTreeNode.MODULE)));
2292
2293 //
2294 // Update opening Module list information
2295 //
2296 if (!iTree.getSelectNode().isOpening()) {
2297 //
2298 // Insert sub node of module
2299 //
2300 insertModuleTreeNode(id, belongNode);
2301 iTree.getSelectNode().setOpening(true);
2302
2303 //
2304 // Update opening module list
2305 //
2306 GlobalData.openingModuleList.setModuleOpen(id, true);
2307 Set<TreePath> temp = GlobalData.openingModuleList.getTreePathById(id);
2308 temp.add(iTree.getSelectionPath());
2309 GlobalData.openingModuleList.setTreePathById(id, temp);
2310 }
2311 //
2312 // Select msa header node and show it in editor panel
2313 //
2314 iTree
2315 .setSelectionPath(iTree
2316 .getPathOfNode(iTree
2317 .getNodeById(belongNode, id, IDefaultMutableTreeNode.MSA_HEADER)));
2318 showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, GlobalData.openingModuleList.getOpeningModuleById(id));
2319 this.currentOpeningModuleIndex = GlobalData.openingModuleList.findIndexOfListById(id);
2320 }
2321
2322 /**
2323 Open Package
2324
2325 @param path input file path
2326
2327 **/
2328 private void openPackage(String path) {
2329 PackageIdentification id = GlobalData.openingPackageList.getIdByPath(path);
2330 if (id == null) {
2331 //
2332 // The package is not in current workspace
2333 //
2334 Log.wrn("Open Package", "The package has not been installed in the current workspace!");
2335 return;
2336 }
2337
2338 //
2339 // Make the node selected
2340 //
2341 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
2342 IDefaultMutableTreeNode.PACKAGE)));
2343 //
2344 // Update opening package list information
2345 //
2346 if (!GlobalData.openingPackageList.getPackageOpen(id)) {
2347 //
2348 // Insert sub node of module
2349 //
2350 insertPackageTreeNode(id);
2351 iTree.getSelectNode().setOpening(true);
2352
2353 //
2354 // Update opening module list
2355 //
2356 GlobalData.openingPackageList.setPackageOpen(id, true);
2357 Set<TreePath> temp = GlobalData.openingPackageList.getTreePathById(id);
2358 temp.add(iTree.getSelectionPath());
2359 GlobalData.openingPackageList.setTreePathById(id, temp);
2360 }
2361 //
2362 // Show spd header in editor panel
2363 //
2364 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
2365 IDefaultMutableTreeNode.SPD_HEADER)));
2366 showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, GlobalData.openingPackageList.getOpeningPackageById(id));
2367 this.currentOpeningPackageIndex = GlobalData.openingPackageList.findIndexOfListById(id);
2368 }
2369
2370 /**
2371 Open Package
2372
2373 @param path input file path
2374
2375 **/
2376 private void openPlatform(String path) {
2377 PlatformIdentification id = GlobalData.openingPlatformList.getIdByPath(path);
2378 if (id == null) {
2379 //
2380 // The platform is not in current workspace
2381 //
2382 Log.wrn("Open Platform", "The platform has not been installed in the current workspace!");
2383 return;
2384 }
2385
2386 //
2387 // Make the node selected
2388 //
2389 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
2390 IDefaultMutableTreeNode.PLATFORM)));
2391 //
2392 // Update opening package list information
2393 //
2394 if (!GlobalData.openingPlatformList.getPlatformOpen(id)) {
2395 //
2396 // Insert sub node of module
2397 //
2398 insertPlatformTreeNode(id);
2399 iTree.getSelectNode().setOpening(true);
2400
2401 //
2402 // Update opening module list
2403 //
2404 GlobalData.openingPlatformList.setPlatformOpen(id, true);
2405 Set<TreePath> temp = GlobalData.openingPlatformList.getTreePathById(id);
2406 temp.add(iTree.getSelectionPath());
2407 GlobalData.openingPlatformList.setTreePathById(id, temp);
2408 }
2409 //
2410 // Show fpd header in editor panel
2411 //
2412 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
2413 IDefaultMutableTreeNode.FPD_PLATFORMHEADER)));
2414 showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER,
2415 GlobalData.openingPlatformList.getOpeningPlatformById(id));
2416 this.currentOpeningPlatformIndex = GlobalData.openingPlatformList.findIndexOfListById(id);
2417 }
2418
2419 /**
2420 Save module
2421
2422 **/
2423 private void saveModule(int index) {
2424 OpeningModuleType omt = GlobalData.openingModuleList.getOpeningModuleByIndex(index);
2425 if (omt.isNew()) {
2426 if (getNewFilePath(DataType.MODULE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
2427 return;
2428 }
2429 }
2430 try {
2431 SaveFile.saveMsaFile(omt.getId().getPath(), omt.getXmlMsa());
2432 GlobalData.openingModuleList.setNew(omt.getId(), false);
2433 GlobalData.openingModuleList.setModuleSaved(omt.getId(), true);
2434 } catch (Exception e) {
2435 Log.wrn("Save Module", e.getMessage());
2436 Log.err("Save Module", e.getMessage());
2437 }
2438 }
2439
2440 /**
2441 Save package
2442
2443 **/
2444 private void savePackage(int index) {
2445 OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);
2446 if (opt.isNew()) {
2447 if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
2448 return;
2449 }
2450 }
2451 try {
2452 SaveFile.saveSpdFile(opt.getId().getPath(), opt.getXmlSpd());
2453 GlobalData.openingPackageList.setNew(opt.getId(), false);
2454 GlobalData.openingPackageList.setPackageSaved(opt.getId(), true);
2455 } catch (Exception e) {
2456 Log.wrn("Save Package", e.getMessage());
2457 Log.err("Save Package", e.getMessage());
2458 }
2459 }
2460
2461 /**
2462 Save platform
2463
2464 **/
2465 private void savePlatform(int index) {
2466 OpeningPlatformType opt = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index);
2467 if (opt.isNew()) {
2468 if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
2469 return;
2470 }
2471 }
2472 try {
2473 SaveFile.saveFpdFile(opt.getId().getPath(), opt.getXmlFpd());
2474 GlobalData.openingPlatformList.setNew(opt.getId(), false);
2475 GlobalData.openingPlatformList.setPlatformSaved(opt.getId(), true);
2476 } catch (Exception e) {
2477 Log.wrn("Save Package", e.getMessage());
2478 Log.err("Save Package", e.getMessage());
2479 }
2480 }
2481
2482 public void componentResized(ComponentEvent arg0) {
2483 if (this.jSplitPane != null) {
2484 this.jSplitPane.setSize(this.getWidth() - DataType.MAIN_FRAME_WIDTH_SPACING,
2485 this.getHeight() - DataType.MAIN_FRAME_HEIGHT_SPACING);
2486 this.jSplitPane.validate();
2487 resizeDesktopPanel();
2488 }
2489 }
2490
2491 /**
2492 Resize JDesktopPanel
2493
2494 */
2495 private void resizeDesktopPanel() {
2496 resizeDesktopPanel(this.jDesktopPaneModule);
2497 resizeDesktopPanel(this.jDesktopPanePackage);
2498 resizeDesktopPanel(this.jDesktopPanePlatform);
2499 }
2500
2501 /**
2502 Resize JDesktopPanel
2503
2504 */
2505 private void resizeDesktopPanel(JDesktopPane jdk) {
2506 JInternalFrame[] iif = jdk.getAllFrames();
2507 for (int index = 0; index < iif.length; index++) {
2508 iif[index].setSize(jdk.getWidth(), jdk.getHeight());
2509 }
2510 }
2511
2512 private void insertModuleTreeNode(Identification id, IDefaultMutableTreeNode belongNode) {
2513 iTree.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode.MSA_HEADER, true, id,
2514 belongNode));
2515 iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id,
2516 belongNode));
2517 iTree.addNode(new IDefaultMutableTreeNode("Library Class Definitions",
2518 IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS, true, id,
2519 belongNode));
2520 iTree
2521 .addNode(new IDefaultMutableTreeNode("Package Dependencies",
2522 IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES, true, id, belongNode));
2523 iTree.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode.MSA_PROTOCOLS, true, id,
2524 belongNode));
2525 iTree.addNode(new IDefaultMutableTreeNode("Events", IDefaultMutableTreeNode.MSA_EVENTS, true, id, belongNode));
2526 iTree.addNode(new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode.MSA_HOBS, true, id, belongNode));
2527 iTree.addNode(new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode.MSA_PPIS, true, id, belongNode));
2528 iTree.addNode(new IDefaultMutableTreeNode("Variables", IDefaultMutableTreeNode.MSA_VARIABLES, true, id,
2529 belongNode));
2530 iTree.addNode(new IDefaultMutableTreeNode("Boot Modes", IDefaultMutableTreeNode.MSA_BOOTMODES, true, id,
2531 belongNode));
2532 iTree.addNode(new IDefaultMutableTreeNode("System Tables", IDefaultMutableTreeNode.MSA_SYSTEMTABLES, true, id,
2533 belongNode));
2534 iTree.addNode(new IDefaultMutableTreeNode("Data Hubs", IDefaultMutableTreeNode.MSA_DATAHUBS, true, id,
2535 belongNode));
2536 iTree.addNode(new IDefaultMutableTreeNode("Hii Packages", IDefaultMutableTreeNode.MSA_HIIPACKAGES, true, id,
2537 belongNode));
2538 iTree.addNode(new IDefaultMutableTreeNode("Guids", IDefaultMutableTreeNode.MSA_GUIDS, true, id, belongNode));
2539 iTree.addNode(new IDefaultMutableTreeNode("External Defintions", IDefaultMutableTreeNode.MSA_EXTERNS, true, id,
2540 belongNode));
2541 iTree.addNode(new IDefaultMutableTreeNode("Pcd Coded", IDefaultMutableTreeNode.MSA_PCDS, true, id, belongNode));
2542 }
2543
2544 private void insertPackageTreeNode(Identification id) {
2545 IDefaultMutableTreeNode idmtTemp = this.dmtnPackageDescription;
2546 iTree.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode.SPD_HEADER, true, id,
2547 idmtTemp));
2548 iTree.addNode(new IDefaultMutableTreeNode("Library Class Declarations",
2549 IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS, true, id,
2550 idmtTemp));
2551 iTree.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode.SPD_MSAFILES, false, id,
2552 idmtTemp));
2553 iTree.addNode(new IDefaultMutableTreeNode("Package Includes", IDefaultMutableTreeNode.SPD_PACKAGEHEADERS, true,
2554 id, idmtTemp));
2555 iTree.addNode(new IDefaultMutableTreeNode("Guid Declarations", IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS,
2556 true, id, idmtTemp));
2557 iTree
2558 .addNode(new IDefaultMutableTreeNode("Protocol Declarations",
2559 IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS, true, id, idmtTemp));
2560 iTree.addNode(new IDefaultMutableTreeNode("Ppi Declarations", IDefaultMutableTreeNode.SPD_PPIDECLARATIONS,
2561 true, id, idmtTemp));
2562 iTree.addNode(new IDefaultMutableTreeNode("Pcd Declarations", IDefaultMutableTreeNode.SPD_PCDDECLARATIONS,
2563 true, id, idmtTemp));
2564 //
2565 // Add modules in this package
2566 //
2567 IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
2568 IDefaultMutableTreeNode dmtnModulePackageModule = null;
2569
2570 dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
2571 IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
2572 id, idmtTemp);
2573 dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
2574 false, id, idmtTemp);
2575
2576 Vector<ModuleIdentification> vModule = wt.getAllModules(new PackageIdentification(id));
2577 for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
2578 if (vModule.get(indexJ).isLibrary()) {
2579 dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
2580 IDefaultMutableTreeNode.MODULE, false,
2581 vModule.get(indexJ), idmtTemp));
2582 } else {
2583 dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
2584 IDefaultMutableTreeNode.MODULE, false,
2585 vModule.get(indexJ), idmtTemp));
2586 }
2587 }
2588 if (dmtnModulePackageModule.getChildCount() > 0) {
2589 iTree.addNode(dmtnModulePackageModule);
2590 }
2591 if (dmtnModulePackageLibrary.getChildCount() > 0) {
2592 iTree.addNode(dmtnModulePackageLibrary);
2593 }
2594 }
2595
2596 private void insertPlatformTreeNode(Identification id) {
2597 IDefaultMutableTreeNode idmtTemp = this.dmtnPlatformDescription;
2598 iTree.addNode(new IDefaultMutableTreeNode("Platform Header", IDefaultMutableTreeNode.FPD_PLATFORMHEADER, true,
2599 id, idmtTemp));
2600 iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions",
2601 IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id, idmtTemp));
2602 iTree.addNode(new IDefaultMutableTreeNode("Flash Information", IDefaultMutableTreeNode.FPD_FLASH, true, id,
2603 idmtTemp));
2604 iTree.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES,
2605 true, id, idmtTemp));
2606 iTree.addNode(new IDefaultMutableTreeNode("Dynamic PCD Build Declarations",
2607 IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS, true, id,
2608 idmtTemp));
2609 iTree.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode.FPD_BUILDOPTIONS, true, id,
2610 idmtTemp));
2611
2612 //
2613 // Add modules in this platform
2614 //
2615 IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
2616 IDefaultMutableTreeNode dmtnModulePackageModule = null;
2617
2618 dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
2619 IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
2620 id, idmtTemp);
2621 dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
2622 false, id, idmtTemp);
2623
2624 Vector<ModuleIdentification> vModule = wt.getAllModules(new PlatformIdentification(id));
2625 for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
2626 if (vModule.get(indexJ).isLibrary()) {
2627 dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
2628 IDefaultMutableTreeNode.MODULE, false,
2629 vModule.get(indexJ), idmtTemp));
2630 } else {
2631 dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
2632 IDefaultMutableTreeNode.MODULE, false,
2633 vModule.get(indexJ), idmtTemp));
2634 }
2635 }
2636 if (dmtnModulePackageModule.getChildCount() > 0) {
2637 iTree.addNode(dmtnModulePackageModule);
2638 }
2639 if (dmtnModulePackageLibrary.getChildCount() > 0) {
2640 iTree.addNode(dmtnModulePackageLibrary);
2641 }
2642 }
2643
2644 /**
2645 Operate when double click a tree node
2646
2647 **/
2648 private void doubleClickModuleTreeNode() {
2649 Identification id = null;
2650 int intCategory = -1;
2651 String path = null;
2652 IDefaultMutableTreeNode belongNode = null;
2653
2654 try {
2655 //
2656 // Get selected tree node
2657 //
2658 if (iTree.getSelectNode() != null) {
2659 id = iTree.getSelectNode().getId();
2660 }
2661
2662 //
2663 // If id is null, return directly
2664 //
2665 if (id == null) {
2666 return;
2667 }
2668
2669 intCategory = iTree.getSelectCategory();
2670 belongNode = iTree.getSelectNode().getBelongNode();
2671
2672 //
2673 // If the node is not opened yet
2674 // Insert top level elements first
2675 //
2676 if (intCategory == IDefaultMutableTreeNode.MODULE) {
2677 path = iTree.getSelectNode().getId().getPath();
2678 openModule(path, belongNode);
2679 return;
2680 }
2681 if (intCategory == IDefaultMutableTreeNode.PACKAGE) {
2682 path = iTree.getSelectNode().getId().getPath();
2683 openPackage(path);
2684 return;
2685 }
2686 if (intCategory == IDefaultMutableTreeNode.PLATFORM) {
2687 path = iTree.getSelectNode().getId().getPath();
2688 openPlatform(path);
2689 return;
2690 }
2691
2692 //
2693 // Show editor panel
2694 //
2695 if (intCategory >= IDefaultMutableTreeNode.MSA_HEADER && intCategory < IDefaultMutableTreeNode.SPD_HEADER) {
2696 showModuleElement(intCategory,
2697 GlobalData.openingModuleList.getOpeningModuleById(new ModuleIdentification(id)));
2698 this.currentOpeningModuleIndex = GlobalData.openingModuleList
2699 .findIndexOfListById(new ModuleIdentification(
2700 id));
2701 }
2702 if (intCategory >= IDefaultMutableTreeNode.SPD_HEADER
2703 && intCategory < IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
2704 showPackageElement(intCategory,
2705 GlobalData.openingPackageList.getOpeningPackageById(new PackageIdentification(id)));
2706 this.currentOpeningPackageIndex = GlobalData.openingPackageList
2707 .findIndexOfListById(new PackageIdentification(
2708 id));
2709 }
2710 if (intCategory >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
2711 showPlatformElement(
2712 intCategory,
2713 GlobalData.openingPlatformList
2714 .getOpeningPlatformById(new PlatformIdentification(id)));
2715 this.currentOpeningPlatformIndex = GlobalData.openingPlatformList
2716 .findIndexOfListById(new PlatformIdentification(
2717 id));
2718 }
2719 } catch (Exception e) {
2720 Log.err("double click category: " + intCategory);
2721 Log.err("double click belong node: " + belongNode.toString());
2722 Log.err("double click id path: " + id);
2723 Log.err("double click exception: " + e.getMessage());
2724 }
2725 }
2726
2727 /**
2728 Show content of editor panel via selected element
2729
2730 @param elementType
2731 @param fpd
2732
2733 **/
2734 private void showPlatformElement(int elementType, OpeningPlatformType fpd) {
2735 this.cleanDesktopPanePlatform();
2736
2737 switch (elementType) {
2738 case IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS:
2739 FpdPlatformDefs frmFpdPlatformDefs = new FpdPlatformDefs(fpd);
2740 getJDesktopPanePlatform().add(frmFpdPlatformDefs, 1);
2741 break;
2742 case IDefaultMutableTreeNode.FPD_PLATFORMHEADER:
2743 FpdHeader frmFpdHeader = new FpdHeader(fpd);
2744 getJDesktopPanePlatform().add(frmFpdHeader, 1);
2745 break;
2746 case IDefaultMutableTreeNode.FPD_FLASH:
2747 FpdFlash frmFpdFlash = new FpdFlash(fpd);
2748 getJDesktopPanePlatform().add(frmFpdFlash, 1);
2749 break;
2750 case IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES:
2751 FpdFrameworkModules frmFpdFrameworkModules = new FpdFrameworkModules(fpd);
2752 getJDesktopPanePlatform().add(frmFpdFrameworkModules, 1);
2753 break;
2754 case IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS:
2755 FpdDynamicPcdBuildDefinitions frmFpdDynamicPcdBuildDefinitions = new FpdDynamicPcdBuildDefinitions(fpd);
2756 getJDesktopPanePlatform().add(frmFpdDynamicPcdBuildDefinitions, 1);
2757 break;
2758 case IDefaultMutableTreeNode.FPD_BUILDOPTIONS:
2759 FpdBuildOptions frmFpdBuildOptions = new FpdBuildOptions(fpd);
2760 getJDesktopPanePlatform().add(frmFpdBuildOptions, 1);
2761 break;
2762 }
2763 this.jTabbedPaneEditor.setSelectedIndex(2);
2764 resizeDesktopPanel();
2765 }
2766
2767 /**
2768 Show content of editor panel via selected element
2769
2770 @param elementType
2771 @param spd
2772
2773 */
2774 private void showPackageElement(int elementType, OpeningPackageType spd) {
2775 this.cleanDesktopPanePackage();
2776 Tools.dirForNewSpd = spd.getId().getPath();
2777 switch (elementType) {
2778 case IDefaultMutableTreeNode.SPD_HEADER:
2779 SpdHeader frmSpdHeader = new SpdHeader(spd);
2780 getJDesktopPanePackage().add(frmSpdHeader, 1);
2781 break;
2782 case IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS:
2783 SpdLibClassDecls frmSlcd = new SpdLibClassDecls(spd);
2784 getJDesktopPanePackage().add(frmSlcd, 1);
2785 break;
2786 case IDefaultMutableTreeNode.SPD_MSAFILES:
2787 SpdMsaFiles frmSmf = new SpdMsaFiles(spd);
2788 getJDesktopPanePackage().add(frmSmf, 1);
2789 break;
2790 case IDefaultMutableTreeNode.SPD_PACKAGEHEADERS:
2791 SpdPackageHeaders frmSph = new SpdPackageHeaders(spd);
2792 getJDesktopPanePackage().add(frmSph, 1);
2793 break;
2794 case IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS:
2795 SpdGuidDecls frmSgd = new SpdGuidDecls(spd);
2796 getJDesktopPanePackage().add(frmSgd, 1);
2797 break;
2798 case IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS:
2799 SpdProtocolDecls frmSprod = new SpdProtocolDecls(spd);
2800 getJDesktopPanePackage().add(frmSprod, 1);
2801 break;
2802 case IDefaultMutableTreeNode.SPD_PPIDECLARATIONS:
2803 SpdPpiDecls frmSppid = new SpdPpiDecls(spd);
2804 getJDesktopPanePackage().add(frmSppid, 1);
2805 break;
2806 case IDefaultMutableTreeNode.SPD_PCDDECLARATIONS:
2807 SpdPcdDefs frmSpcdd = new SpdPcdDefs(spd);
2808 getJDesktopPanePackage().add(frmSpcdd, 1);
2809 break;
2810 }
2811 this.jTabbedPaneEditor.setSelectedIndex(1);
2812 resizeDesktopPanel();
2813 }
2814
2815 /**
2816 Show content of editor panel via selected element
2817
2818 @param elementType
2819 @param msa
2820
2821 */
2822 private void showModuleElement(int elementType, OpeningModuleType msa) {
2823 this.cleanDesktopPaneModule();
2824 switch (elementType) {
2825 case IDefaultMutableTreeNode.MSA_HEADER:
2826 MsaHeader frmMsaHeader = new MsaHeader(msa);
2827 getJDesktopPaneModule().add(frmMsaHeader, 1);
2828 break;
2829 case IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS:
2830 ModuleLibraryClassDefinitions frmMlcd = new ModuleLibraryClassDefinitions(msa);
2831 getJDesktopPaneModule().add(frmMlcd, 1);
2832 break;
2833 case IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES:
2834 ModulePackageDependencies frmMpd = new ModulePackageDependencies(msa);
2835 getJDesktopPaneModule().add(frmMpd, 1);
2836 break;
2837 case IDefaultMutableTreeNode.MSA_SOURCEFILES:
2838 ModuleSourceFiles frmMsf = new ModuleSourceFiles(msa);
2839 getJDesktopPaneModule().add(frmMsf, 1);
2840 break;
2841 case IDefaultMutableTreeNode.MSA_PROTOCOLS:
2842 ModuleProtocols frmMp = new ModuleProtocols(msa);
2843 getJDesktopPaneModule().add(frmMp, 1);
2844 break;
2845 case IDefaultMutableTreeNode.MSA_EVENTS:
2846 ModuleEvents frmMe = new ModuleEvents(msa);
2847 getJDesktopPaneModule().add(frmMe, 1);
2848 break;
2849 case IDefaultMutableTreeNode.MSA_HOBS:
2850 ModuleHobs frmMh = new ModuleHobs(msa);
2851 getJDesktopPaneModule().add(frmMh, 1);
2852 break;
2853 case IDefaultMutableTreeNode.MSA_PPIS:
2854 ModulePpis frmMpp = new ModulePpis(msa);
2855 getJDesktopPaneModule().add(frmMpp, 1);
2856 break;
2857 case IDefaultMutableTreeNode.MSA_VARIABLES:
2858 ModuleVariables frmMv = new ModuleVariables(msa);
2859 getJDesktopPaneModule().add(frmMv, 1);
2860 break;
2861 case IDefaultMutableTreeNode.MSA_BOOTMODES:
2862 ModuleBootModes frmMbm = new ModuleBootModes(msa);
2863 getJDesktopPaneModule().add(frmMbm, 1);
2864 break;
2865 case IDefaultMutableTreeNode.MSA_SYSTEMTABLES:
2866 ModuleSystemTables frmMst = new ModuleSystemTables(msa);
2867 getJDesktopPaneModule().add(frmMst, 1);
2868 break;
2869 case IDefaultMutableTreeNode.MSA_DATAHUBS:
2870 ModuleDataHubs frmMdh = new ModuleDataHubs(msa);
2871 getJDesktopPaneModule().add(frmMdh, 1);
2872 break;
2873 case IDefaultMutableTreeNode.MSA_HIIPACKAGES:
2874 ModuleHiiPackages frmMf = new ModuleHiiPackages(msa);
2875 getJDesktopPaneModule().add(frmMf, 1);
2876 break;
2877 case IDefaultMutableTreeNode.MSA_GUIDS:
2878 ModuleGuids frmGuid = new ModuleGuids(msa);
2879 getJDesktopPaneModule().add(frmGuid, 1);
2880 break;
2881 case IDefaultMutableTreeNode.MSA_EXTERNS:
2882 ModuleExterns frmMex = new ModuleExterns(msa);
2883 getJDesktopPaneModule().add(frmMex, 1);
2884 break;
2885 case IDefaultMutableTreeNode.MSA_PCDS:
2886 ModulePCDs frmPcd = new ModulePCDs(msa);
2887 getJDesktopPaneModule().add(frmPcd, 1);
2888 break;
2889 }
2890 this.jTabbedPaneEditor.setSelectedIndex(0);
2891 resizeDesktopPanel();
2892 }
2893
2894 //
2895 // Define operations of menu
2896 //
2897 /**
2898 New a file
2899
2900 **/
2901 private void fileNew() {
2902 int result = -1;
2903 //
2904 // Selece new file type
2905 //
2906 NewFileChooser nfc = new NewFileChooser(this, true);
2907 result = nfc.showDialog();
2908
2909 if (result == DataType.RETURN_TYPE_CANCEL) {
2910 nfc.dispose();
2911 return;
2912 } else if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
2913 //
2914 // To new a module
2915 //
2916 SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
2917 result = smb.showDialog();
2918
2919 if (result == DataType.RETURN_TYPE_CANCEL) {
2920 nfc.dispose();
2921 smb.dispose();
2922 return;
2923 } else if (result == DataType.RETURN_TYPE_OK) {
2924 ModuleIdentification mid = smb.getMid();
2925 if (mid != null) {
2926 //
2927 // Update package of workspace first
2928 //
2929 PackageSurfaceAreaDocument.PackageSurfaceArea psa = null;
2930 if (GlobalData.openingPackageList.existsPackage(mid.getPackageId())) {
2931 psa = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId());
2932 }
2933 try {
2934 wt.addModuleToPackage(mid, psa);
2935 } catch (IOException e) {
2936 Log.wrn("Update MsaFiles in Package", e.getMessage());
2937 Log.err("Update MsaFiles in Package", e.getMessage());
2938 return;
2939 } catch (XmlException e) {
2940 Log.wrn("Update MsaFiles in Package", e.getMessage());
2941 Log.err("Update MsaFiles in Package", e.getMessage());
2942 return;
2943 } catch (Exception e) {
2944 Log.wrn("Update MsaFiles in Package", e.getMessage());
2945 Log.err("Update MsaFiles in Package", e.getMessage());
2946 return;
2947 }
2948
2949 //
2950 // Update Global Data
2951 //
2952 GlobalData.openingModuleList.insertToOpeningModuleList(mid, smb.getMsa());
2953 GlobalData.vModuleList.addElement(mid);
2954
2955 //
2956 // Create new node on the tree
2957 //
2958 addModuleToTree(mid);
2959
2960 //
2961 // Open the node
2962 //
2963 this.openModule(mid.getPath(), this.dmtnModuleDescription);
2964 }
2965 }
2966 } else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
2967 //
2968 // To new a package
2969 //
2970 SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
2971 result = smb.showDialog();
2972
2973 if (result == DataType.RETURN_TYPE_CANCEL) {
2974 nfc.dispose();
2975 smb.dispose();
2976 return;
2977 } else if (result == DataType.RETURN_TYPE_OK) {