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