3 The main GUI for module editor.
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
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.
16 package org
.tianocore
.frameworkwizard
;
18 import java
.awt
.event
.ActionEvent
;
19 import java
.awt
.event
.ComponentEvent
;
20 import java
.awt
.event
.KeyEvent
;
21 import java
.awt
.event
.KeyListener
;
22 import java
.awt
.event
.MouseEvent
;
23 import java
.awt
.event
.MouseListener
;
24 import java
.awt
.event
.WindowEvent
;
25 import java
.io
.BufferedWriter
;
27 import java
.io
.FileWriter
;
28 import java
.io
.IOException
;
29 import java
.util
.Iterator
;
31 import java
.util
.Vector
;
33 import javax
.swing
.JButton
;
34 import javax
.swing
.JCheckBoxMenuItem
;
35 import javax
.swing
.JDesktopPane
;
36 import javax
.swing
.JFileChooser
;
37 import javax
.swing
.JFrame
;
38 import javax
.swing
.JInternalFrame
;
39 import javax
.swing
.JMenu
;
40 import javax
.swing
.JMenuBar
;
41 import javax
.swing
.JMenuItem
;
42 import javax
.swing
.JOptionPane
;
43 import javax
.swing
.JPanel
;
44 import javax
.swing
.JScrollPane
;
45 import javax
.swing
.JSplitPane
;
46 import javax
.swing
.JTabbedPane
;
47 import javax
.swing
.ToolTipManager
;
48 import javax
.swing
.event
.MenuEvent
;
49 import javax
.swing
.event
.MenuListener
;
50 import javax
.swing
.event
.TreeSelectionEvent
;
51 import javax
.swing
.event
.TreeSelectionListener
;
52 import javax
.swing
.tree
.TreePath
;
54 import org
.apache
.xmlbeans
.XmlException
;
55 import org
.tianocore
.PackageSurfaceAreaDocument
;
56 import org
.tianocore
.frameworkwizard
.common
.DataType
;
57 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
58 import org
.tianocore
.frameworkwizard
.common
.IFileFilter
;
59 import org
.tianocore
.frameworkwizard
.common
.Log
;
60 import org
.tianocore
.frameworkwizard
.common
.SaveFile
;
61 import org
.tianocore
.frameworkwizard
.common
.Tools
;
62 import org
.tianocore
.frameworkwizard
.common
.Identifications
.Identification
;
63 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningModuleType
;
64 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
65 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
66 import org
.tianocore
.frameworkwizard
.common
.find
.FindResult
;
67 import org
.tianocore
.frameworkwizard
.common
.ui
.IDefaultMutableTreeNode
;
68 import org
.tianocore
.frameworkwizard
.common
.ui
.IDesktopManager
;
69 import org
.tianocore
.frameworkwizard
.common
.ui
.IFrame
;
70 import org
.tianocore
.frameworkwizard
.common
.ui
.ITree
;
71 import org
.tianocore
.frameworkwizard
.far
.createui
.CreateStepOne
;
72 import org
.tianocore
.frameworkwizard
.far
.deleteui
.DeleteStepOne
;
73 import org
.tianocore
.frameworkwizard
.far
.installui
.InstallStepOne
;
74 import org
.tianocore
.frameworkwizard
.far
.updateui
.UpdateStepOne
;
75 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
76 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleBootModes
;
77 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleBuildOptions
;
78 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleDataHubs
;
79 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleEvents
;
80 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleExterns
;
81 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleGuids
;
82 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleHiiPackages
;
83 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleHobs
;
84 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleLibraryClassDefinitions
;
85 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePCDs
;
86 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePackageDependencies
;
87 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePpis
;
88 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleProtocols
;
89 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleSourceFiles
;
90 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleSystemTables
;
91 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleVariables
;
92 import org
.tianocore
.frameworkwizard
.module
.ui
.MsaHeader
;
93 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
94 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdGuidDecls
;
95 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdHeader
;
96 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdLibClassDecls
;
97 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdMsaFiles
;
98 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPackageHeaders
;
99 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPcdDefs
;
100 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPpiDecls
;
101 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdProtocolDecls
;
102 import org
.tianocore
.frameworkwizard
.platform
.PlatformIdentification
;
103 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdBuildOptions
;
104 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdDynamicPcdBuildDefinitions
;
105 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdFlash
;
106 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdFrameworkModules
;
107 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdHeader
;
108 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdPlatformDefs
;
109 import org
.tianocore
.frameworkwizard
.workspace
.Workspace
;
110 import org
.tianocore
.frameworkwizard
.workspace
.WorkspaceTools
;
111 import org
.tianocore
.frameworkwizard
.workspace
.ui
.SwitchWorkspace
;
112 import org
.tianocore
.frameworkwizard
.toolchain
.Preferences
;
115 The class is used to show main GUI of FrameworkWizard
116 It extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener and MenuListener
119 public class FrameworkWizardUI
extends IFrame
implements KeyListener
, MouseListener
, TreeSelectionListener
,
122 /// Define class Serial Version UID
124 private static final long serialVersionUID
= -7103240960573031772L;
127 // Set ToolTipText Show Time
129 static { ToolTipManager
.sharedInstance().setDismissDelay(18000); }
132 /// Used to record current operation target
134 private int currentOpeningModuleIndex
= -1;
136 private int currentOpeningPackageIndex
= -1;
138 private int currentOpeningPlatformIndex
= -1;
141 /// Used to generate tree structure
143 private IDefaultMutableTreeNode dmtnRoot
= null;
145 private IDefaultMutableTreeNode dmtnModuleDescription
= null;
147 private IDefaultMutableTreeNode dmtnPackageDescription
= null;
149 private IDefaultMutableTreeNode dmtnPlatformDescription
= null;
154 private JPanel jContentPane
= null;
156 private JMenuBar jMenuBar
= null;
158 private JMenu jMenuFile
= null;
160 private JMenuItem jMenuItemFileNew
= null;
162 private JMenuItem jMenuItemFileRefresh
= null;
164 private JMenuItem jMenuItemFileSaveAs
= null;
166 private JMenuItem jMenuItemFileExit
= null;
168 private JMenu jMenuEdit
= null;
170 private JDesktopPane jDesktopPaneModule
= null;
172 private JDesktopPane jDesktopPanePackage
= null;
174 private JDesktopPane jDesktopPanePlatform
= null;
176 private JTabbedPane jTabbedPaneTree
= null;
178 private JTabbedPane jTabbedPaneEditor
= null;
180 private IDesktopManager iDesktopManager
= new IDesktopManager();
182 private JScrollPane jScrollPaneTree
= null;
184 private ITree iTree
= null;
186 private JMenu jMenuHelp
= null;
188 private JMenuItem jMenuItemHelpAbout
= null;
190 private JMenuItem jMenuItemEditDelete
= null;
192 private WorkspaceTools wt
= new WorkspaceTools();
194 private JMenuItem jMenuItemFileSave
= null;
196 private JMenuItem jMenuItemFileClose
= null;
198 private JMenu jMenuTools
= null;
200 private JMenu jMenuWindow
= null;
202 private JPanel jPanelOperation
= null;
204 private JButton jButtonOk
= null;
206 private JButton jButtonCancel
= null;
208 private JMenuItem jMenuItemFileOpen
= null;
210 private JMenuItem jMenuItemFileCloseAll
= null;
212 private JMenuItem jMenuItemFileSaveAll
= null;
214 private JMenuItem jMenuItemFilePageSetup
= null;
216 private JMenuItem jMenuItemFilePrint
= null;
218 private JMenuItem jMenuItemFileImport
= null;
220 private JMenuItem jMenuItemFileProperties
= null;
222 private JMenu jMenuFileRecentFiles
= null;
224 private JSplitPane jSplitPane
= null;
226 private JMenuItem jMenuItemEditUndo
= null;
228 private JMenuItem jMenuItemEditRedo
= null;
230 private JMenuItem jMenuItemEditCut
= null;
232 private JMenuItem jMenuItemEditCopy
= null;
234 private JMenuItem jMenuItemEditPaste
= null;
236 private JMenuItem jMenuItemEditSelectAll
= null;
238 private JMenuItem jMenuItemEditFindNext
= null;
240 private JMenu jMenuView
= null;
242 private JMenu jMenuViewToolbars
= null;
244 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsFile
= null;
246 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsEdit
= null;
248 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsWindow
= null;
250 private JMenuItem jMenuItemViewStandard
= null;
252 private JMenuItem jMenuItemViewAdvanced
= null;
254 private JMenu jMenuProject
= null;
256 private JMenuItem jMenuItemProjectAdmin
= null;
258 private JMenuItem jMenuItemProjectChangeWorkspace
= null;
260 private JMenuItem jMenuItemToolsBuildPreferences
= null;
262 // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null;
264 // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null;
266 private JMenuItem jMenuItemToolsToolChainConfiguration
= null;
268 private JMenuItem jMenuItemToolsClone
= null;
270 private JMenuItem jMenuItemToolsCodeScan
= null;
272 private JMenuItem jMenuItemWindowDisplaySide
= null;
274 private JMenuItem jMenuItemWindowDisplayTopBottom
= null;
276 private JMenuItem jMenuItemViewXML
= null;
278 private JMenuItem jMenuItemWindowTabView
= null;
280 private JMenuItem jMenuItemWindowSource
= null;
282 private JMenuItem jMenuItemWindowXML
= null;
284 private JMenuItem jMenuItemWindowPreferences
= null;
286 private JMenuItem jMenuItemHelpContents
= null;
288 private JMenuItem jMenuItemHelpIndex
= null;
290 private JMenuItem jMenuItemHelpSearch
= null;
292 private JMenuItem jMenuItemProjectInstallFar
= null;
294 private JMenuItem jMenuItemProjectUpdateFar
= null;
296 private JMenuItem jMenuItemProjectRemoveFar
= null;
298 private JMenuItem jMenuItemProjectCreateFar
= null;
300 private JMenu jMenuEditFind
= null;
302 private JMenuItem jMenuItemEditFindPcd
= null;
304 private JMenuItem jMenuItemEditFindLibraryClass
= null;
306 private JMenuItem jMenuItemEditFindPpi
= null;
308 private JMenuItem jMenuItemEditFindProtocol
= null;
310 private JMenuItem jMenuItemEditFindGuid
= null;
312 private JMenuItem jMenuItemEditFindLibraryInstance
= null;
315 /// A static definition for this class itself
317 private static FrameworkWizardUI fwui
= null;
319 private JMenuItem jMenuItemToolsGenerateGuidsXref
= null;
322 If the class hasn't an instnace, new one.
324 @return FrameworkWizardUI The instance of this class
327 public static FrameworkWizardUI
getInstance() {
329 fwui
= new FrameworkWizardUI();
335 This method initializes jMenuBar
337 @return javax.swing.JMenuBar Main menu bar for the entire GUI
340 private JMenuBar
getjJMenuBar() {
341 if (jMenuBar
== null) {
342 jMenuBar
= new JMenuBar();
343 jMenuBar
.setPreferredSize(new java
.awt
.Dimension(0, 18));
344 jMenuBar
.add(getJMenuFile());
345 jMenuBar
.add(getJMenuEdit());
346 jMenuBar
.add(getJMenuView());
347 jMenuBar
.add(getJMenuProject());
348 jMenuBar
.add(getJMenuTools());
349 jMenuBar
.add(getJMenuWindow());
350 jMenuBar
.add(getJMenuHelp());
356 This method initializes jSplitPane
358 @return javax.swing.JSplitPane
361 private JSplitPane
getJSplitPane() {
362 if (jSplitPane
== null) {
363 jSplitPane
= new JSplitPane(JSplitPane
.HORIZONTAL_SPLIT
, getJTabbedPaneTree(), getJTabbedPaneEditor());
364 jSplitPane
.setBounds(new java
.awt
.Rectangle(0, 1, DataType
.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH
,
365 DataType
.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT
));
366 jSplitPane
.addComponentListener(this);
372 This method initializes jTabbedPaneEditor
374 @return javax.swing.JTabbedPane
377 private JTabbedPane
getJTabbedPaneEditor() {
378 if (jTabbedPaneEditor
== null) {
379 jTabbedPaneEditor
= new JTabbedPane();
380 jTabbedPaneEditor
.setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
381 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
382 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
383 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
385 .setMinimumSize(new java
.awt
.Dimension(
386 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
387 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
388 jTabbedPaneEditor
.addTab("Module", null, getJDesktopPaneModule(), null);
389 jTabbedPaneEditor
.addTab("Package", null, getJDesktopPanePackage(), null);
390 jTabbedPaneEditor
.addTab("Platform", null, getJDesktopPanePlatform(), null);
392 return jTabbedPaneEditor
;
396 This method initializes jTabbedPaneTree
398 @return javax.swing.JTabbedPane
401 private JTabbedPane
getJTabbedPaneTree() {
402 if (jTabbedPaneTree
== null) {
403 jTabbedPaneTree
= new JTabbedPane();
405 .setPreferredSize(new java
.awt
.Dimension(
406 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
407 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
409 .setMinimumSize(new java
.awt
.Dimension(DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
410 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
411 jTabbedPaneTree
.addTab("Workspace Explorer", null, getJScrollPaneTree(), null);
413 return jTabbedPaneTree
;
417 This method initializes jMenuFile
419 @return javax.swing.JMenu jMenuModule
422 private JMenu
getJMenuFile() {
423 if (jMenuFile
== null) {
425 // Set jMenuFile's attributes
427 jMenuFile
= new JMenu();
428 jMenuFile
.setText("File");
429 jMenuFile
.setMnemonic('F');
430 jMenuFile
.addMenuListener(this);
433 // Add sub menu items
435 jMenuFile
.add(getJMenuItemFileNew());
436 jMenuFile
.add(getJMenuItemFileOpen());
437 jMenuFile
.add(getJMenuItemFileClose());
438 jMenuFile
.add(getJMenuItemFileCloseAll());
439 jMenuFile
.addSeparator();
441 jMenuFile
.add(getJMenuFileRecentFiles());
442 jMenuFile
.add(getJMenuItemFileSave());
443 jMenuFile
.add(getJMenuItemFileSaveAs());
444 jMenuFile
.add(getJMenuItemFileSaveAll());
445 jMenuFile
.addSeparator();
447 jMenuFile
.add(getJMenuItemFileRefresh());
448 jMenuFile
.addSeparator();
450 jMenuFile
.add(getJMenuItemFilePageSetup());
451 jMenuFile
.add(getJMenuItemFilePrint());
452 jMenuFile
.add(getJMenuItemFileImport());
453 jMenuFile
.add(getJMenuItemFileProperties());
455 jMenuFile
.add(getJMenuItemFileExit());
461 This method initializes jMenuItemFileSaveAs
463 @return javax.swing.JMenuItem jMenuItemFileSaveAs
466 private JMenuItem
getJMenuItemFileSaveAs() {
467 if (jMenuItemFileSaveAs
== null) {
468 jMenuItemFileSaveAs
= new JMenuItem();
469 jMenuItemFileSaveAs
.setText("Save As...");
470 jMenuItemFileSaveAs
.setMnemonic('a');
471 jMenuItemFileSaveAs
.addActionListener(this);
472 jMenuItemFileSaveAs
.setEnabled(false);
473 jMenuItemFileSaveAs
.setVisible(false);
475 return jMenuItemFileSaveAs
;
479 This method initializes jMenuItemFileRefresh
481 @return javax.swing.JMenuItem jMenuItemFileRefresh
484 private JMenuItem
getJMenuItemFileRefresh() {
485 if (jMenuItemFileRefresh
== null) {
486 jMenuItemFileRefresh
= new JMenuItem();
487 jMenuItemFileRefresh
.setText("Refresh");
488 jMenuItemFileRefresh
.setMnemonic('R');
489 jMenuItemFileRefresh
.addActionListener(this);
490 jMenuItemFileRefresh
.setVisible(true);
492 return jMenuItemFileRefresh
;
496 This method initializes jMenuItemModuleExit
498 @return javax.swing.JMenuItem jMenuItemModuleExit
501 private JMenuItem
getJMenuItemFileExit() {
502 if (jMenuItemFileExit
== null) {
503 jMenuItemFileExit
= new JMenuItem();
504 jMenuItemFileExit
.setText("Exit");
505 jMenuItemFileExit
.setMnemonic('x');
506 jMenuItemFileExit
.addActionListener(this);
508 return jMenuItemFileExit
;
512 This method initializes jMenuEdit
514 @return javax.swing.JMenu jMenuEdit
517 private JMenu
getJMenuEdit() {
518 if (jMenuEdit
== null) {
520 // Set jMenuEdit's attributes
522 jMenuEdit
= new JMenu();
523 jMenuEdit
.setText("Edit");
524 jMenuEdit
.setMnemonic('E');
525 jMenuEdit
.setVisible(true);
528 // Add sub menu items
530 jMenuEdit
.add(getJMenuItemEditUndo());
531 jMenuEdit
.add(getJMenuItemEditRedo());
532 //jMenuEdit.addSeparator();
534 jMenuEdit
.add(getJMenuItemEditCut());
535 jMenuEdit
.add(getJMenuItemEditCopy());
536 jMenuEdit
.add(getJMenuItemEditPaste());
537 jMenuEdit
.add(getJMenuItemEditDelete());
538 //jMenuEdit.addSeparator();
540 jMenuEdit
.add(getJMenuItemEditSelectAll());
541 jMenuEdit
.add(getJMenuEditFind());
542 jMenuEdit
.add(getJMenuItemEditFindNext());
543 //jMenuEdit.addSeparator();
549 This method initializes jDesktopPane
551 @return javax.swing.JDesktopPane jDesktopPane
554 private JDesktopPane
getJDesktopPaneModule() {
555 if (jDesktopPaneModule
== null) {
556 jDesktopPaneModule
= new JDesktopPane();
558 .setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
559 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
560 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
561 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
563 .setMinimumSize(new java
.awt
.Dimension(
564 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
565 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
566 jDesktopPaneModule
.setDesktopManager(iDesktopManager
);
567 jDesktopPaneModule
.addComponentListener(this);
569 return jDesktopPaneModule
;
573 This method initializes jDesktopPane
575 @return javax.swing.JDesktopPane jDesktopPane
578 private JDesktopPane
getJDesktopPanePackage() {
579 if (jDesktopPanePackage
== null) {
580 jDesktopPanePackage
= new JDesktopPane();
582 .setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
583 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
584 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
585 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
587 .setMinimumSize(new java
.awt
.Dimension(
588 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
589 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
590 jDesktopPanePackage
.setDesktopManager(iDesktopManager
);
591 jDesktopPanePackage
.addComponentListener(this);
593 return jDesktopPanePackage
;
597 This method initializes jDesktopPane
599 @return javax.swing.JDesktopPane jDesktopPane
602 private JDesktopPane
getJDesktopPanePlatform() {
603 if (jDesktopPanePlatform
== null) {
604 jDesktopPanePlatform
= new JDesktopPane();
606 .setBounds(new java
.awt
.Rectangle(
607 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
608 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
609 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
610 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
612 .setMinimumSize(new java
.awt
.Dimension(
613 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
614 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
615 jDesktopPanePlatform
.setDesktopManager(iDesktopManager
);
616 jDesktopPanePlatform
.addComponentListener(this);
618 return jDesktopPanePlatform
;
622 This method initializes jScrollPaneTree
624 @return javax.swing.JScrollPane jScrollPaneTree
627 private JScrollPane
getJScrollPaneTree() {
628 if (jScrollPaneTree
== null) {
629 jScrollPaneTree
= new JScrollPane();
631 .setPreferredSize(new java
.awt
.Dimension(
632 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
633 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
635 .setMinimumSize(new java
.awt
.Dimension(
636 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
/ 2,
637 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
638 jScrollPaneTree
.setViewportView(getITree());
640 return jScrollPaneTree
;
644 This method initializes iTree
646 @return org.tianocore.packaging.common.ui.ITree iTree
649 private ITree
getITree() {
651 //Before open a real module, use an empty root node for the tree
658 This method initializes jMenuHelp
660 @return javax.swing.JMenu jMenuHelp
663 private JMenu
getJMenuHelp() {
664 if (jMenuHelp
== null) {
666 // Set jMenuHelp's attributes
668 jMenuHelp
= new JMenu();
669 jMenuHelp
.setText("Help");
670 jMenuHelp
.setMnemonic('H');
673 // Add sub menu items
675 jMenuHelp
.add(getJMenuItemHelpContents());
676 jMenuHelp
.add(getJMenuItemHelpIndex());
677 jMenuHelp
.add(getJMenuItemHelpSearch());
679 jMenuHelp
.add(getJMenuItemHelpAbout());
685 This method initializes jMenuItemHelpAbout
687 @return javax.swing.JMenuItem jMenuItemHelpAbout
690 private JMenuItem
getJMenuItemHelpAbout() {
691 if (jMenuItemHelpAbout
== null) {
692 jMenuItemHelpAbout
= new JMenuItem();
693 jMenuItemHelpAbout
.setText("About");
694 jMenuItemHelpAbout
.setMnemonic('A');
695 jMenuItemHelpAbout
.addActionListener(this);
697 return jMenuItemHelpAbout
;
701 This method initializes jMenuItemEditDelete
703 @return javax.swing.JMenuItem jMenuItemEditDelete
706 private JMenuItem
getJMenuItemEditDelete() {
707 if (jMenuItemEditDelete
== null) {
708 jMenuItemEditDelete
= new JMenuItem();
709 jMenuItemEditDelete
.setText("Delete");
710 jMenuItemEditDelete
.setMnemonic('D');
711 jMenuItemEditDelete
.setVisible(false);
712 jMenuItemEditDelete
.setEnabled(false);
713 jMenuItemEditDelete
.addActionListener(this);
715 //Disabled first when no module is open
717 jMenuItemEditDelete
.setEnabled(false);
719 return jMenuItemEditDelete
;
723 This method initializes jMenuFileNew
725 @return javax.swing.JMenuItem jMenuFileNew
728 private JMenuItem
getJMenuItemFileNew() {
729 if (jMenuItemFileNew
== null) {
730 jMenuItemFileNew
= new JMenuItem();
731 jMenuItemFileNew
.setText("New...");
732 jMenuItemFileNew
.setMnemonic('N');
733 jMenuItemFileNew
.addActionListener(this);
735 return jMenuItemFileNew
;
739 This method initializes jMenuItemFileSave
741 @return javax.swing.JMenuItem jMenuItemModuleSave
744 private JMenuItem
getJMenuItemFileSave() {
745 if (jMenuItemFileSave
== null) {
746 jMenuItemFileSave
= new JMenuItem();
747 jMenuItemFileSave
.setText("Save");
748 jMenuItemFileSave
.setMnemonic('S');
749 jMenuItemFileSave
.addActionListener(this);
750 jMenuItemFileSave
.setEnabled(true);
752 return jMenuItemFileSave
;
756 This method initializes jMenuItemModuleClose
758 @return javax.swing.JMenuItem jMenuItemModuleClose
761 private JMenuItem
getJMenuItemFileClose() {
762 if (jMenuItemFileClose
== null) {
763 jMenuItemFileClose
= new JMenuItem();
764 jMenuItemFileClose
.setText("Close");
765 jMenuItemFileClose
.setMnemonic('C');
766 jMenuItemFileClose
.setEnabled(true);
767 jMenuItemFileClose
.addActionListener(this);
769 return jMenuItemFileClose
;
773 This method initializes jMenuTools
776 @return javax.swing.JMenu jMenuTools
779 private JMenu
getJMenuTools() {
780 if (jMenuTools
== null) {
782 // Set jMenuTools's attributes
784 jMenuTools
= new JMenu();
785 jMenuTools
.setText("Tools");
786 jMenuTools
.setMnemonic('T');
787 jMenuTools
.addMenuListener(this);
790 // Add sub menu items
793 jMenuTools
.add(getJMenuItemToolsClone());
794 jMenuTools
.add(getJMenuItemToolsCodeScan());
795 jMenuTools
.addSeparator();
797 jMenuTools
.add(getJMenuItemToolsToolChainConfiguration());
798 jMenuTools
.add(getJMenuItemToolsBuildPreferences());
799 jMenuTools
.addSeparator();
801 jMenuTools
.add(getJMenuItemToolsGenerateGuidsXref());
807 This method initializes jMenuWindow
810 @return javax.swing.JMenu jMenuWindow
813 private JMenu
getJMenuWindow() {
814 if (jMenuWindow
== null) {
816 // Set jMenuWindow's attribute
818 jMenuWindow
= new JMenu();
819 jMenuWindow
.setText("Window");
820 jMenuWindow
.setMnemonic('W');
821 jMenuWindow
.setVisible(false);
824 // Add sub menu items
826 jMenuWindow
.add(getJMenuItemWindowDisplaySide());
827 jMenuWindow
.add(getJMenuItemWindowDisplayTopBottom());
828 jMenuWindow
.addSeparator();
830 jMenuWindow
.add(getJMenuItemWindowTabView());
831 jMenuWindow
.addSeparator();
833 jMenuWindow
.add(getJMenuItemWindowSource());
834 jMenuWindow
.add(getJMenuItemWindowXML());
835 jMenuWindow
.addSeparator();
837 jMenuWindow
.add(getJMenuItemWindowPreferences());
843 This method initializes jPanelOperation
846 @return javax.swing.JPanel jPanelOperation
849 private JPanel
getJPanelOperation() {
850 if (jPanelOperation
== null) {
851 jPanelOperation
= new JPanel();
852 jPanelOperation
.setLayout(null);
853 jPanelOperation
.setBounds(new java
.awt
.Rectangle(295, 520, 500, 25));
854 jPanelOperation
.add(getJButtonOk(), null);
855 jPanelOperation
.add(getJButtonCancel(), null);
856 jPanelOperation
.setVisible(false);
858 return jPanelOperation
;
862 This method initializes jButtonOk
865 @return javax.swing.JButton jButtonOk
868 private JButton
getJButtonOk() {
869 if (jButtonOk
== null) {
870 jButtonOk
= new JButton();
871 jButtonOk
.setBounds(new java
.awt
.Rectangle(395, 2, 90, 20));
872 jButtonOk
.setText("Ok");
873 jButtonOk
.setEnabled(false);
874 jButtonOk
.addActionListener(this);
880 This method initializes jButtonCancel
883 @return javax.swing.JButton jButtonCancel
886 private JButton
getJButtonCancel() {
887 if (jButtonCancel
== null) {
888 jButtonCancel
= new JButton();
889 jButtonCancel
.setBounds(new java
.awt
.Rectangle(395, 2, 90, 20));
890 jButtonCancel
.setText("Cancel");
891 jButtonCancel
.setEnabled(false);
892 jButtonCancel
.addActionListener(this);
893 jButtonCancel
.setVisible(false);
895 return jButtonCancel
;
899 This method initializes jMenuItemFileOpen
901 @return javax.swing.JMenuItem jMenuItemFileOpen
904 private JMenuItem
getJMenuItemFileOpen() {
905 if (jMenuItemFileOpen
== null) {
906 jMenuItemFileOpen
= new JMenuItem();
907 jMenuItemFileOpen
.setText("Open...");
908 jMenuItemFileOpen
.setMnemonic('O');
909 jMenuItemFileOpen
.addActionListener(this);
911 return jMenuItemFileOpen
;
915 This method initializes jMenuItemFileCloseAll
917 @return javax.swing.JMenuItem jMenuItemFileOpen
920 private JMenuItem
getJMenuItemFileCloseAll() {
921 if (jMenuItemFileCloseAll
== null) {
922 jMenuItemFileCloseAll
= new JMenuItem();
923 jMenuItemFileCloseAll
.setText("Close All");
924 jMenuItemFileCloseAll
.setMnemonic('A');
925 jMenuItemFileCloseAll
.setEnabled(true);
926 jMenuItemFileCloseAll
.addActionListener(this);
928 return jMenuItemFileCloseAll
;
932 This method initializes jMenuItemFileSaveAll
934 @return javax.swing.JMenuItem jMenuItemFileSaveAll
937 private JMenuItem
getJMenuItemFileSaveAll() {
938 if (jMenuItemFileSaveAll
== null) {
939 jMenuItemFileSaveAll
= new JMenuItem();
940 jMenuItemFileSaveAll
.setText("Save All");
941 jMenuItemFileSaveAll
.setMnemonic('v');
942 jMenuItemFileSaveAll
.setEnabled(true);
943 jMenuItemFileSaveAll
.addActionListener(this);
945 return jMenuItemFileSaveAll
;
949 This method initializes jMenuItemFilePageSetup
951 @return javax.swing.JMenuItem
954 private JMenuItem
getJMenuItemFilePageSetup() {
955 if (jMenuItemFilePageSetup
== null) {
956 jMenuItemFilePageSetup
= new JMenuItem();
957 jMenuItemFilePageSetup
.setText("Page Setup");
958 jMenuItemFilePageSetup
.setMnemonic('u');
959 jMenuItemFilePageSetup
.setEnabled(false);
960 jMenuItemFilePageSetup
.addActionListener(this);
961 jMenuItemFilePageSetup
.setVisible(false);
963 return jMenuItemFilePageSetup
;
967 This method initializes jMenuItemFilePrint
969 @return javax.swing.JMenuItem
972 private JMenuItem
getJMenuItemFilePrint() {
973 if (jMenuItemFilePrint
== null) {
974 jMenuItemFilePrint
= new JMenuItem();
975 jMenuItemFilePrint
.setText("Print");
976 jMenuItemFilePrint
.setMnemonic('P');
977 jMenuItemFilePrint
.setEnabled(false);
978 jMenuItemFilePrint
.addActionListener(this);
979 jMenuItemFilePrint
.setVisible(false);
981 return jMenuItemFilePrint
;
985 This method initializes jMenuItemFileImport
987 @return javax.swing.JMenuItem
990 private JMenuItem
getJMenuItemFileImport() {
991 if (jMenuItemFileImport
== null) {
992 jMenuItemFileImport
= new JMenuItem();
993 jMenuItemFileImport
.setText("Import");
994 jMenuItemFileImport
.setMnemonic('I');
995 jMenuItemFileImport
.setEnabled(false);
996 jMenuItemFileImport
.addActionListener(this);
997 jMenuItemFileImport
.setVisible(false);
999 return jMenuItemFileImport
;
1003 This method initializes jMenuItemFileProperties
1005 @return javax.swing.JMenuItem
1008 private JMenuItem
getJMenuItemFileProperties() {
1009 if (jMenuItemFileProperties
== null) {
1010 jMenuItemFileProperties
= new JMenuItem();
1011 jMenuItemFileProperties
.setText("Properties");
1012 jMenuItemFileProperties
.setMnemonic('t');
1013 jMenuItemFileProperties
.setEnabled(false);
1014 jMenuItemFileProperties
.addActionListener(this);
1015 jMenuItemFileProperties
.setVisible(false);
1017 return jMenuItemFileProperties
;
1021 This method initializes jMenuFileRecentFiles
1023 @return javax.swing.JMenu
1026 private JMenu
getJMenuFileRecentFiles() {
1027 if (jMenuFileRecentFiles
== null) {
1028 jMenuFileRecentFiles
= new JMenu();
1029 jMenuFileRecentFiles
.setText("Recent Files");
1030 jMenuFileRecentFiles
.setMnemonic('F');
1031 jMenuFileRecentFiles
.setEnabled(false);
1032 jMenuFileRecentFiles
.addActionListener(this);
1033 jMenuFileRecentFiles
.setVisible(false);
1035 return jMenuFileRecentFiles
;
1039 This method initializes jMenuItemEditUndo
1041 @return javax.swing.JMenuItem
1044 private JMenuItem
getJMenuItemEditUndo() {
1045 if (jMenuItemEditUndo
== null) {
1046 jMenuItemEditUndo
= new JMenuItem();
1047 jMenuItemEditUndo
.setText("Undo");
1048 jMenuItemEditUndo
.setMnemonic('U');
1049 jMenuItemEditUndo
.setEnabled(false);
1050 jMenuItemEditUndo
.setVisible(false);
1051 jMenuItemEditUndo
.addActionListener(this);
1053 return jMenuItemEditUndo
;
1057 This method initializes jMenuItemEditRedo
1059 @return javax.swing.JMenuItem
1062 private JMenuItem
getJMenuItemEditRedo() {
1063 if (jMenuItemEditRedo
== null) {
1064 jMenuItemEditRedo
= new JMenuItem();
1065 jMenuItemEditRedo
.setText("Redo");
1066 jMenuItemEditRedo
.setMnemonic('R');
1067 jMenuItemEditRedo
.setEnabled(false);
1068 jMenuItemEditRedo
.setVisible(false);
1069 jMenuItemEditRedo
.addActionListener(this);
1071 return jMenuItemEditRedo
;
1075 This method initializes jMenuItemEditCut
1077 @return javax.swing.JMenuItem
1080 private JMenuItem
getJMenuItemEditCut() {
1081 if (jMenuItemEditCut
== null) {
1082 jMenuItemEditCut
= new JMenuItem();
1083 jMenuItemEditCut
.setText("Cut");
1084 jMenuItemEditCut
.setMnemonic('t');
1085 jMenuItemEditCut
.setEnabled(false);
1086 jMenuItemEditCut
.setVisible(false);
1087 jMenuItemEditCut
.addActionListener(this);
1089 return jMenuItemEditCut
;
1093 This method initializes jMenuItemEditCopy
1095 @return javax.swing.JMenuItem
1098 private JMenuItem
getJMenuItemEditCopy() {
1099 if (jMenuItemEditCopy
== null) {
1100 jMenuItemEditCopy
= new JMenuItem();
1101 jMenuItemEditCopy
.setText("Copy");
1102 jMenuItemEditCopy
.setMnemonic('C');
1103 jMenuItemEditCopy
.setEnabled(false);
1104 jMenuItemEditCopy
.setVisible(false);
1105 jMenuItemEditCopy
.addActionListener(this);
1107 return jMenuItemEditCopy
;
1111 This method initializes jMenuItemEditPaste
1113 return javax.swing.JMenuItem
1116 private JMenuItem
getJMenuItemEditPaste() {
1117 if (jMenuItemEditPaste
== null) {
1118 jMenuItemEditPaste
= new JMenuItem();
1119 jMenuItemEditPaste
.setText("Paste");
1120 jMenuItemEditPaste
.setMnemonic('P');
1121 jMenuItemEditPaste
.setEnabled(false);
1122 jMenuItemEditPaste
.setVisible(false);
1123 jMenuItemEditPaste
.addActionListener(this);
1125 return jMenuItemEditPaste
;
1129 This method initializes jMenuItem
1131 @return javax.swing.JMenuItem
1134 private JMenuItem
getJMenuItemEditSelectAll() {
1135 if (jMenuItemEditSelectAll
== null) {
1136 jMenuItemEditSelectAll
= new JMenuItem();
1137 jMenuItemEditSelectAll
.setText("Select All");
1138 jMenuItemEditSelectAll
.setMnemonic('A');
1139 jMenuItemEditSelectAll
.setEnabled(false);
1140 jMenuItemEditSelectAll
.setVisible(false);
1141 jMenuItemEditSelectAll
.addActionListener(this);
1143 return jMenuItemEditSelectAll
;
1147 This method initializes jMenuItemEditFindNext
1149 @return javax.swing.JMenuItem
1152 private JMenuItem
getJMenuItemEditFindNext() {
1153 if (jMenuItemEditFindNext
== null) {
1154 jMenuItemEditFindNext
= new JMenuItem();
1155 jMenuItemEditFindNext
.setText("Find Next");
1156 jMenuItemEditFindNext
.setMnemonic('n');
1157 jMenuItemEditFindNext
.setEnabled(false);
1158 jMenuItemEditFindNext
.setVisible(false);
1159 jMenuItemEditFindNext
.addActionListener(this);
1161 return jMenuItemEditFindNext
;
1165 This method initializes jMenuView
1167 @return javax.swing.JMenu
1170 private JMenu
getJMenuView() {
1171 if (jMenuView
== null) {
1173 // Set jMenuView's attributes
1175 jMenuView
= new JMenu();
1176 jMenuView
.setText("View");
1177 jMenuView
.setMnemonic('V');
1178 jMenuView
.setVisible(false);
1181 // Add sub menu items
1183 jMenuView
.add(getJMenuViewToolbars());
1184 jMenuView
.add(getJMenuItemViewAdvanced());
1185 jMenuView
.add(getJMenuItemViewStandard());
1186 jMenuView
.add(getJMenuItemViewXML());
1192 This method initializes jMenuViewToolbars
1194 @return javax.swing.JMenu
1197 private JMenu
getJMenuViewToolbars() {
1198 if (jMenuViewToolbars
== null) {
1199 jMenuViewToolbars
= new JMenu();
1200 jMenuViewToolbars
.setText("Toolbars");
1201 jMenuViewToolbars
.setMnemonic('T');
1203 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsFile());
1204 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsEdit());
1205 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsWindow());
1207 return jMenuViewToolbars
;
1211 This method initializes jCheckBoxMenuItemViewToolbarsFile
1213 @return javax.swing.JCheckBoxMenuItem
1216 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsFile() {
1217 if (jCheckBoxMenuItemViewToolbarsFile
== null) {
1218 jCheckBoxMenuItemViewToolbarsFile
= new JCheckBoxMenuItem();
1219 jCheckBoxMenuItemViewToolbarsFile
.setText("File");
1220 jCheckBoxMenuItemViewToolbarsFile
.setEnabled(false);
1221 jCheckBoxMenuItemViewToolbarsFile
.addActionListener(this);
1223 return jCheckBoxMenuItemViewToolbarsFile
;
1227 This method initializes jCheckBoxMenuItemViewToolbarsEdit
1229 @return javax.swing.JCheckBoxMenuItem
1232 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsEdit() {
1233 if (jCheckBoxMenuItemViewToolbarsEdit
== null) {
1234 jCheckBoxMenuItemViewToolbarsEdit
= new JCheckBoxMenuItem();
1235 jCheckBoxMenuItemViewToolbarsEdit
.setText("Edit");
1236 jCheckBoxMenuItemViewToolbarsEdit
.setEnabled(false);
1237 jCheckBoxMenuItemViewToolbarsEdit
.addActionListener(this);
1239 return jCheckBoxMenuItemViewToolbarsEdit
;
1243 This method initializes jCheckBoxMenuItemViewToolbarsWindow
1245 @return javax.swing.JCheckBoxMenuItem
1248 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsWindow() {
1249 if (jCheckBoxMenuItemViewToolbarsWindow
== null) {
1250 jCheckBoxMenuItemViewToolbarsWindow
= new JCheckBoxMenuItem();
1251 jCheckBoxMenuItemViewToolbarsWindow
.setText("Window");
1252 jCheckBoxMenuItemViewToolbarsWindow
.setEnabled(false);
1253 jCheckBoxMenuItemViewToolbarsWindow
.addActionListener(this);
1255 return jCheckBoxMenuItemViewToolbarsWindow
;
1259 This method initializes jMenuItemStandard
1261 @return javax.swing.JMenuItem
1264 private JMenuItem
getJMenuItemViewStandard() {
1265 if (jMenuItemViewStandard
== null) {
1266 jMenuItemViewStandard
= new JMenuItem();
1267 jMenuItemViewStandard
.setText("Standard");
1268 jMenuItemViewStandard
.setMnemonic('S');
1269 jMenuItemViewStandard
.setEnabled(false);
1270 jMenuItemViewStandard
.addActionListener(this);
1272 return jMenuItemViewStandard
;
1276 This method initializes jMenuItemAdvanced
1278 @return javax.swing.JMenuItem
1281 private JMenuItem
getJMenuItemViewAdvanced() {
1282 if (jMenuItemViewAdvanced
== null) {
1283 jMenuItemViewAdvanced
= new JMenuItem();
1284 jMenuItemViewAdvanced
.setText("Advanced");
1285 jMenuItemViewAdvanced
.setMnemonic('A');
1286 jMenuItemViewAdvanced
.setEnabled(false);
1287 jMenuItemViewAdvanced
.addActionListener(this);
1289 return jMenuItemViewAdvanced
;
1293 This method initializes jMenuProject
1295 @return javax.swing.JMenu
1298 private JMenu
getJMenuProject() {
1299 if (jMenuProject
== null) {
1301 // Set jMenuProject's attributes
1303 jMenuProject
= new JMenu();
1304 jMenuProject
.setText("Project");
1305 jMenuProject
.setMnemonic('P');
1308 // Add sub menu items
1310 jMenuProject
.add(getJMenuItemProjectAdmin());
1312 jMenuProject
.add(getJMenuItemProjectChangeWorkspace());
1313 jMenuProject
.addSeparator();
1315 jMenuProject
.add(getJMenuItemProjectCreateFar());
1316 jMenuProject
.add(getJMenuItemProjectInstallFar());
1317 jMenuProject
.add(getJMenuItemProjectUpdateFar());
1318 jMenuProject
.add(getJMenuItemProjectRemoveFar());
1321 return jMenuProject
;
1325 This method initializes jMenuItemProjectAdmin
1327 @return javax.swing.JMenuItem
1330 private JMenuItem
getJMenuItemProjectAdmin() {
1331 if (jMenuItemProjectAdmin
== null) {
1332 jMenuItemProjectAdmin
= new JMenuItem();
1333 jMenuItemProjectAdmin
.setText("Admin...");
1334 jMenuItemProjectAdmin
.setMnemonic('A');
1335 jMenuItemProjectAdmin
.setEnabled(false);
1336 jMenuItemProjectAdmin
.addActionListener(this);
1337 jMenuItemProjectAdmin
.setVisible(false);
1339 return jMenuItemProjectAdmin
;
1343 This method initializes jMenuItemProjectChangeWorkspace
1345 @return javax.swing.JMenuItem
1348 private JMenuItem
getJMenuItemProjectChangeWorkspace() {
1349 if (jMenuItemProjectChangeWorkspace
== null) {
1350 jMenuItemProjectChangeWorkspace
= new JMenuItem();
1351 jMenuItemProjectChangeWorkspace
.setText("Change WORKSPACE...");
1352 jMenuItemProjectChangeWorkspace
.setMnemonic('W');
1353 jMenuItemProjectChangeWorkspace
.setEnabled(true);
1354 jMenuItemProjectChangeWorkspace
.addActionListener(this);
1356 return jMenuItemProjectChangeWorkspace
;
1360 This method initializes jMenuProjectBuildPreferences
1362 @return javax.swing.JMenu
1365 private JMenuItem
getJMenuItemToolsBuildPreferences() {
1366 if (jMenuItemToolsBuildPreferences
== null) {
1367 jMenuItemToolsBuildPreferences
= new JMenuItem();
1368 jMenuItemToolsBuildPreferences
.setText("Build Preferences...");
1369 jMenuItemToolsBuildPreferences
.setMnemonic('P');
1370 jMenuItemToolsBuildPreferences
.setEnabled(true);
1371 jMenuItemToolsBuildPreferences
.addActionListener(this);
1373 return jMenuItemToolsBuildPreferences
;
1377 This method initializes jMenuItemToolsToolChainConfiguration
1379 @return javax.swing.JMenuItem
1382 private JMenuItem
getJMenuItemToolsToolChainConfiguration() {
1383 if (jMenuItemToolsToolChainConfiguration
== null) {
1384 jMenuItemToolsToolChainConfiguration
= new JMenuItem();
1385 jMenuItemToolsToolChainConfiguration
.setText("Tool Chain Configuration...");
1386 jMenuItemToolsToolChainConfiguration
.setMnemonic('C');
1387 jMenuItemToolsToolChainConfiguration
.addActionListener(this);
1389 return jMenuItemToolsToolChainConfiguration
;
1393 This method initializes jMenuItemToolsClone
1395 @return javax.swing.JMenuItem
1398 private JMenuItem
getJMenuItemToolsClone() {
1399 if (jMenuItemToolsClone
== null) {
1400 jMenuItemToolsClone
= new JMenuItem();
1401 jMenuItemToolsClone
.setText("Clone...");
1402 jMenuItemToolsClone
.setMnemonic('l');
1403 jMenuItemToolsClone
.setEnabled(true);
1404 jMenuItemToolsClone
.addActionListener(this);
1406 return jMenuItemToolsClone
;
1410 This method initializes jMenuItemToolsCodeScan
1412 @return javax.swing.JMenuItem
1415 private JMenuItem
getJMenuItemToolsCodeScan() {
1416 if (jMenuItemToolsCodeScan
== null) {
1417 jMenuItemToolsCodeScan
= new JMenuItem();
1418 jMenuItemToolsCodeScan
.setText("Code Scan...");
1419 jMenuItemToolsCodeScan
.setMnemonic('S');
1420 jMenuItemToolsCodeScan
.setEnabled(false);
1421 jMenuItemToolsCodeScan
.addActionListener(this);
1422 jMenuItemToolsCodeScan
.setVisible(false);
1424 return jMenuItemToolsCodeScan
;
1428 This method initializes jMenuItemWindowSplitVertical
1430 @return javax.swing.JMenuItem
1433 private JMenuItem
getJMenuItemWindowDisplaySide() {
1434 if (jMenuItemWindowDisplaySide
== null) {
1435 jMenuItemWindowDisplaySide
= new JMenuItem();
1436 jMenuItemWindowDisplaySide
.setText("Display Side by Side");
1437 jMenuItemWindowDisplaySide
.setMnemonic('S');
1438 jMenuItemWindowDisplaySide
.setEnabled(false);
1439 jMenuItemWindowDisplaySide
.addActionListener(this);
1441 return jMenuItemWindowDisplaySide
;
1445 This method initializes jMenuItemWindowSplitHorizontal
1447 @return javax.swing.JMenuItem
1450 private JMenuItem
getJMenuItemWindowDisplayTopBottom() {
1451 if (jMenuItemWindowDisplayTopBottom
== null) {
1452 jMenuItemWindowDisplayTopBottom
= new JMenuItem();
1453 jMenuItemWindowDisplayTopBottom
.setText("Display Top and Bottom");
1454 jMenuItemWindowDisplayTopBottom
.setMnemonic('B');
1455 jMenuItemWindowDisplayTopBottom
.setEnabled(false);
1456 jMenuItemWindowDisplayTopBottom
.addActionListener(this);
1458 return jMenuItemWindowDisplayTopBottom
;
1462 This method initializes jMenuItemViewXML
1464 @return javax.swing.JMenuItem
1467 private JMenuItem
getJMenuItemViewXML() {
1468 if (jMenuItemViewXML
== null) {
1469 jMenuItemViewXML
= new JMenuItem();
1470 jMenuItemViewXML
.setText("XML");
1471 jMenuItemViewXML
.setMnemonic('X');
1472 jMenuItemViewXML
.setEnabled(false);
1473 jMenuItemViewXML
.addActionListener(this);
1475 return jMenuItemViewXML
;
1479 This method initializes jMenuItemWindowTabView
1481 @return javax.swing.JMenuItem
1484 private JMenuItem
getJMenuItemWindowTabView() {
1485 if (jMenuItemWindowTabView
== null) {
1486 jMenuItemWindowTabView
= new JMenuItem();
1487 jMenuItemWindowTabView
.setText("Tab View");
1488 jMenuItemWindowTabView
.setMnemonic('T');
1489 jMenuItemWindowTabView
.setEnabled(false);
1490 jMenuItemWindowTabView
.addActionListener(this);
1492 return jMenuItemWindowTabView
;
1496 This method initializes jMenuItemWindowSource
1498 @return javax.swing.JMenuItem
1501 private JMenuItem
getJMenuItemWindowSource() {
1502 if (jMenuItemWindowSource
== null) {
1503 jMenuItemWindowSource
= new JMenuItem();
1504 jMenuItemWindowSource
.setText("Source");
1505 jMenuItemWindowSource
.setMnemonic('S');
1506 jMenuItemWindowSource
.setEnabled(false);
1507 jMenuItemWindowSource
.addActionListener(this);
1509 return jMenuItemWindowSource
;
1513 This method initializes jMenuItemWindowXML
1515 @return javax.swing.JMenuItem
1518 private JMenuItem
getJMenuItemWindowXML() {
1519 if (jMenuItemWindowXML
== null) {
1520 jMenuItemWindowXML
= new JMenuItem();
1521 jMenuItemWindowXML
.setText("XML");
1522 jMenuItemWindowXML
.setMnemonic('X');
1523 jMenuItemWindowXML
.setEnabled(false);
1524 jMenuItemWindowXML
.addActionListener(this);
1526 return jMenuItemWindowXML
;
1530 This method initializes jMenuItemWindowPreferences
1532 @return javax.swing.JMenuItem
1535 private JMenuItem
getJMenuItemWindowPreferences() {
1536 if (jMenuItemWindowPreferences
== null) {
1537 jMenuItemWindowPreferences
= new JMenuItem();
1538 jMenuItemWindowPreferences
.setText("Preferences");
1539 jMenuItemWindowPreferences
.setMnemonic('P');
1540 jMenuItemWindowPreferences
.setEnabled(false);
1541 jMenuItemWindowPreferences
.addActionListener(this);
1543 return jMenuItemWindowPreferences
;
1547 This method initializes jMenuItemHelpContents
1549 @return javax.swing.JMenuItem
1552 private JMenuItem
getJMenuItemHelpContents() {
1553 if (jMenuItemHelpContents
== null) {
1554 jMenuItemHelpContents
= new JMenuItem();
1555 jMenuItemHelpContents
.setText("Contents");
1556 jMenuItemHelpContents
.setMnemonic('C');
1557 jMenuItemHelpContents
.setEnabled(false);
1558 jMenuItemHelpContents
.addActionListener(this);
1559 jMenuItemHelpContents
.setVisible(false);
1561 return jMenuItemHelpContents
;
1565 This method initializes jMenuItemHelpIndex
1567 @return javax.swing.JMenuItem
1570 private JMenuItem
getJMenuItemHelpIndex() {
1571 if (jMenuItemHelpIndex
== null) {
1572 jMenuItemHelpIndex
= new JMenuItem();
1573 jMenuItemHelpIndex
.setText("Index");
1574 jMenuItemHelpIndex
.setMnemonic('I');
1575 jMenuItemHelpIndex
.setEnabled(false);
1576 jMenuItemHelpIndex
.addActionListener(this);
1577 jMenuItemHelpIndex
.setVisible(false);
1579 return jMenuItemHelpIndex
;
1583 This method initializes jMenuItemHelpSearch
1585 @return javax.swing.JMenuItem
1588 private JMenuItem
getJMenuItemHelpSearch() {
1589 if (jMenuItemHelpSearch
== null) {
1590 jMenuItemHelpSearch
= new JMenuItem();
1591 jMenuItemHelpSearch
.setText("Search");
1592 jMenuItemHelpSearch
.setMnemonic('S');
1593 jMenuItemHelpSearch
.setEnabled(false);
1594 jMenuItemHelpSearch
.addActionListener(this);
1595 jMenuItemHelpSearch
.setVisible(false);
1597 return jMenuItemHelpSearch
;
1601 * This method initializes jMenuItemToolsInstallPackage
1603 * @return javax.swing.JMenuItem
1605 private JMenuItem
getJMenuItemProjectInstallFar() {
1606 if (jMenuItemProjectInstallFar
== null) {
1607 jMenuItemProjectInstallFar
= new JMenuItem();
1608 jMenuItemProjectInstallFar
.setText("Install FAR...");
1609 jMenuItemProjectInstallFar
.setMnemonic('I');
1610 jMenuItemProjectInstallFar
.setEnabled(true);
1611 jMenuItemProjectInstallFar
.addActionListener(this);
1613 return jMenuItemProjectInstallFar
;
1617 * This method initializes jMenuItemToolsUpdatePackage
1619 * @return javax.swing.JMenuItem
1621 private JMenuItem
getJMenuItemProjectUpdateFar() {
1622 if (jMenuItemProjectUpdateFar
== null) {
1623 jMenuItemProjectUpdateFar
= new JMenuItem();
1624 jMenuItemProjectUpdateFar
.setText("Update FAR...");
1625 jMenuItemProjectUpdateFar
.setMnemonic('U');
1626 jMenuItemProjectUpdateFar
.setEnabled(true);
1627 jMenuItemProjectUpdateFar
.addActionListener(this);
1628 jMenuItemProjectUpdateFar
.setVisible(true);
1630 return jMenuItemProjectUpdateFar
;
1634 * This method initializes jMenuItemRemovePackage
1636 * @return javax.swing.JMenuItem
1638 private JMenuItem
getJMenuItemProjectRemoveFar() {
1639 if (jMenuItemProjectRemoveFar
== null) {
1640 jMenuItemProjectRemoveFar
= new JMenuItem();
1641 jMenuItemProjectRemoveFar
.setText("Remove FAR...");
1642 jMenuItemProjectRemoveFar
.setMnemonic('R');
1643 jMenuItemProjectRemoveFar
.setEnabled(true);
1644 jMenuItemProjectRemoveFar
.addActionListener(this);
1646 return jMenuItemProjectRemoveFar
;
1650 * This method initializes jMenuItemProjectCreateFar
1652 * @return javax.swing.JMenuItem
1654 private JMenuItem
getJMenuItemProjectCreateFar() {
1655 if (jMenuItemProjectCreateFar
== null) {
1656 jMenuItemProjectCreateFar
= new JMenuItem();
1657 jMenuItemProjectCreateFar
.setText("Create FAR...");
1658 jMenuItemProjectCreateFar
.setMnemonic('C');
1659 jMenuItemProjectCreateFar
.addActionListener(this);
1661 return jMenuItemProjectCreateFar
;
1665 * This method initializes jMenuEditFind
1667 * @return javax.swing.JMenu
1669 private JMenu
getJMenuEditFind() {
1670 if (jMenuEditFind
== null) {
1671 jMenuEditFind
= new JMenu();
1672 jMenuEditFind
.setText("Find");
1673 jMenuEditFind
.setMnemonic('F');
1675 jMenuEditFind
.add(getJMenuItemEditFindPpi());
1676 jMenuEditFind
.add(getJMenuItemEditFindProtocol());
1677 jMenuEditFind
.add(getJMenuItemEditFindGuid());
1678 jMenuEditFind
.add(getJMenuItemEditFindPcd());
1679 jMenuEditFind
.add(getJMenuItemEditFindLibraryClass());
1680 jMenuEditFind
.add(getJMenuItemEditFindLibraryInstance());
1682 return jMenuEditFind
;
1686 * This method initializes jMenuItemEditFindPcd
1688 * @return javax.swing.JMenuItem
1690 private JMenuItem
getJMenuItemEditFindPcd() {
1691 if (jMenuItemEditFindPcd
== null) {
1692 jMenuItemEditFindPcd
= new JMenuItem();
1693 jMenuItemEditFindPcd
.setText("All PCD entries");
1694 jMenuItemEditFindPcd
.setMnemonic('P');
1695 jMenuItemEditFindPcd
.addActionListener(this);
1697 return jMenuItemEditFindPcd
;
1701 * This method initializes jMenuItemEditFindLibraryClass
1703 * @return javax.swing.JMenuItem
1705 private JMenuItem
getJMenuItemEditFindLibraryClass() {
1706 if (jMenuItemEditFindLibraryClass
== null) {
1707 jMenuItemEditFindLibraryClass
= new JMenuItem();
1708 jMenuItemEditFindLibraryClass
.setText("All Library Classes");
1709 jMenuItemEditFindLibraryClass
.setMnemonic('C');
1710 jMenuItemEditFindLibraryClass
.addActionListener(this);
1712 return jMenuItemEditFindLibraryClass
;
1716 * This method initializes jMenuItemEditFindPpi
1718 * @return javax.swing.JMenuItem
1720 private JMenuItem
getJMenuItemEditFindPpi() {
1721 if (jMenuItemEditFindPpi
== null) {
1722 jMenuItemEditFindPpi
= new JMenuItem();
1723 jMenuItemEditFindPpi
.setText("All PPIs");
1724 jMenuItemEditFindPpi
.setMnemonic('I');
1725 jMenuItemEditFindPpi
.addActionListener(this);
1727 return jMenuItemEditFindPpi
;
1731 * This method initializes jMenuItemEditFindProtocol
1733 * @return javax.swing.JMenuItem
1735 private JMenuItem
getJMenuItemEditFindProtocol() {
1736 if (jMenuItemEditFindProtocol
== null) {
1737 jMenuItemEditFindProtocol
= new JMenuItem();
1738 jMenuItemEditFindProtocol
.setText("All Protocols");
1739 jMenuItemEditFindProtocol
.setMnemonic('r');
1740 jMenuItemEditFindProtocol
.addActionListener(this);
1742 return jMenuItemEditFindProtocol
;
1746 * This method initializes jMenuItemEditFindGuid
1748 * @return javax.swing.JMenuItem
1750 private JMenuItem
getJMenuItemEditFindGuid() {
1751 if (jMenuItemEditFindGuid
== null) {
1752 jMenuItemEditFindGuid
= new JMenuItem();
1753 jMenuItemEditFindGuid
.setText("All GUIDs");
1754 jMenuItemEditFindGuid
.setMnemonic('G');
1755 jMenuItemEditFindGuid
.addActionListener(this);
1757 return jMenuItemEditFindGuid
;
1761 * This method initializes jMenuItemEditFindLibraryInstance
1763 * @return javax.swing.JMenuItem
1765 private JMenuItem
getJMenuItemEditFindLibraryInstance() {
1766 if (jMenuItemEditFindLibraryInstance
== null) {
1767 jMenuItemEditFindLibraryInstance
= new JMenuItem();
1768 jMenuItemEditFindLibraryInstance
.setText("All Library Instances");
1769 jMenuItemEditFindLibraryInstance
.setMnemonic('n');
1770 jMenuItemEditFindLibraryInstance
.addActionListener(this);
1771 jMenuItemEditFindLibraryInstance
.setVisible(false);
1773 return jMenuItemEditFindLibraryInstance
;
1777 * This method initializes jMenuItemProjectGenerateGuidsXref
1779 * @return javax.swing.JMenuItem
1781 private JMenuItem
getJMenuItemToolsGenerateGuidsXref() {
1782 if (jMenuItemToolsGenerateGuidsXref
== null) {
1783 jMenuItemToolsGenerateGuidsXref
= new JMenuItem();
1784 jMenuItemToolsGenerateGuidsXref
.setText("Generate guids.xref...");
1785 jMenuItemToolsGenerateGuidsXref
.setMnemonic('G');
1786 jMenuItemToolsGenerateGuidsXref
.addActionListener(this);
1788 return jMenuItemToolsGenerateGuidsXref
;
1792 * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
1794 * Main class, start the GUI
1797 public static void main(String
[] args
) {
1798 FrameworkWizardUI module
= FrameworkWizardUI
.getInstance();
1799 module
.setVisible(true);
1803 This is the default constructor
1806 public FrameworkWizardUI() {
1812 This method initializes this
1816 private void init() {
1818 // Set current workspace and check
1819 // Check if exists WORKSPACE
1821 Workspace
.setCurrentWorkspace(System
.getenv("WORKSPACE"));
1822 this.checkWorkspace();
1825 // Show splash screen
1827 SplashScreen ss
= new SplashScreen();
1828 ss
.setVisible(true);
1836 // Close splash screen
1843 this.setSize(DataType
.MAIN_FRAME_PREFERRED_SIZE_WIDTH
, DataType
.MAIN_FRAME_PREFERRED_SIZE_HEIGHT
);
1844 this.setResizable(true);
1845 this.setJMenuBar(getjJMenuBar());
1846 this.setContentPane(getJContentPane());
1847 this.setTitle(DataType
.PROJECT_NAME
+ " " + DataType
.PROJECT_VERSION
+ " " + "- ["
1848 + Workspace
.getCurrentWorkspace() + "]");
1849 this.setExitType(1);
1854 this.setExtendedState(JFrame
.MAXIMIZED_BOTH
);
1858 This method initializes jContentPane
1860 @return javax.swing.JPanel jContentPane
1863 private JPanel
getJContentPane() {
1864 if (jContentPane
== null) {
1865 jContentPane
= new JPanel();
1866 jContentPane
.setLayout(null);
1867 jContentPane
.add(getJPanelOperation(), null);
1868 jContentPane
.add(getJSplitPane(), null);
1870 return jContentPane
;
1874 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1876 * Override actionPerformed to listen all actions
1879 public void actionPerformed(ActionEvent arg0
) {
1881 // Operations of Menu
1883 if (arg0
.getSource() == this.jMenuItemFileNew
) {
1887 if (arg0
.getSource() == this.jMenuItemFileOpen
) {
1891 if (arg0
.getSource() == this.jMenuItemFileClose
) {
1895 if (arg0
.getSource() == this.jMenuItemFileCloseAll
) {
1898 this.makeEmptyTree();
1901 if (arg0
.getSource() == this.jMenuItemFileSave
) {
1905 if (arg0
.getSource() == this.jMenuItemFileSaveAs
) {
1909 if (arg0
.getSource() == this.jMenuItemFileSaveAll
) {
1913 if (arg0
.getSource() == this.jMenuItemFileRefresh
) {
1914 if (this.closeAll() == 0) {
1916 this.makeEmptyTree();
1920 if (arg0
.getSource() == this.jMenuItemFileExit
) {
1924 if (arg0
.getSource() == this.jMenuItemEditFindPpi
) {
1928 if (arg0
.getSource() == this.jMenuItemEditFindProtocol
) {
1929 this.findProtocol();
1932 if (arg0
.getSource() == this.jMenuItemEditFindGuid
) {
1936 if (arg0
.getSource() == this.jMenuItemEditFindPcd
) {
1940 if (arg0
.getSource() == this.jMenuItemEditFindLibraryClass
) {
1941 this.findLibraryClass();
1944 if (arg0
.getSource() == this.jMenuItemEditFindLibraryInstance
) {
1945 this.findLibraryInstance();
1948 if (arg0
.getSource() == jMenuItemToolsBuildPreferences
) {
1949 configBuildPreferences();
1952 if (arg0
.getSource() == this.jMenuItemProjectChangeWorkspace
) {
1953 this.changeWorkspace();
1956 if (arg0
.getSource() == this.jMenuItemProjectCreateFar
) {
1960 if (arg0
.getSource() == this.jMenuItemProjectInstallFar
) {
1964 if (arg0
.getSource() == this.jMenuItemProjectRemoveFar
) {
1968 if (arg0
.getSource() == this.jMenuItemProjectUpdateFar
) {
1972 if (arg0
.getSource() == this.jMenuItemToolsClone
) {
1976 if (arg0
.getSource() == this.jMenuItemToolsToolChainConfiguration
) {
1977 this.setupToolChainConfiguration();
1980 if (arg0
.getSource() == this.jMenuItemToolsGenerateGuidsXref
) {
1981 this.generateGuidsXref();
1984 if (arg0
.getSource() == this.jMenuItemHelpAbout
) {
1985 About a
= new About(this, true);
1986 int result
= a
.showDialog();
1987 if (result
== DataType
.RETURN_TYPE_OK
) {
1994 Create an empty tree if no file is open
1997 private void makeEmptyTree() {
2001 dmtnRoot
= new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode
.WORKSPACE
, false, null, null);
2004 // Make Module Description
2006 dmtnModuleDescription
= new IDefaultMutableTreeNode("Modules", IDefaultMutableTreeNode
.MODULE_DESCRIPTION
,
2007 false, null, dmtnRoot
);
2010 // First add package
2012 if (GlobalData
.vPackageList
.size() > 0) {
2013 for (int index
= 0; index
< GlobalData
.vPackageList
.size(); index
++) {
2014 IDefaultMutableTreeNode dmtnModulePackage
= null;
2015 IDefaultMutableTreeNode dmtnModulePackageLibrary
= null;
2016 IDefaultMutableTreeNode dmtnModulePackageModule
= null;
2018 dmtnModulePackage
= new IDefaultMutableTreeNode(GlobalData
.vPackageList
.elementAt(index
).getName(),
2019 IDefaultMutableTreeNode
.MODULE_PACKAGE
, false,
2020 GlobalData
.vPackageList
.elementAt(index
),
2021 this.dmtnModuleDescription
);
2022 dmtnModulePackageLibrary
= new IDefaultMutableTreeNode("Library",
2023 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
,
2024 false, GlobalData
.vPackageList
.elementAt(index
),
2025 this.dmtnModuleDescription
);
2026 dmtnModulePackageModule
= new IDefaultMutableTreeNode("Module",
2027 IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2028 false, GlobalData
.vPackageList
.elementAt(index
),
2029 this.dmtnModuleDescription
);
2031 // And then add each module in its package
2033 Vector
<ModuleIdentification
> vModule
= wt
.getAllModules(GlobalData
.vPackageList
.elementAt(index
));
2034 for (int indexJ
= 0; indexJ
< vModule
.size(); indexJ
++) {
2035 if (vModule
.get(indexJ
).isLibrary()) {
2036 dmtnModulePackageLibrary
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2037 IDefaultMutableTreeNode
.MODULE
, false,
2038 vModule
.get(indexJ
),
2039 this.dmtnModuleDescription
));
2041 dmtnModulePackageModule
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2042 IDefaultMutableTreeNode
.MODULE
, false,
2043 vModule
.get(indexJ
),
2044 this.dmtnModuleDescription
));
2047 if (dmtnModulePackageModule
.getChildCount() > 0) {
2048 dmtnModulePackage
.add(dmtnModulePackageModule
);
2050 if (dmtnModulePackageLibrary
.getChildCount() > 0) {
2051 dmtnModulePackage
.add(dmtnModulePackageLibrary
);
2054 dmtnModuleDescription
.add(dmtnModulePackage
);
2059 // Make Package Description
2061 dmtnPackageDescription
= new IDefaultMutableTreeNode("Packages", IDefaultMutableTreeNode
.PACKAGE_DESCRIPTION
,
2062 false, null, this.dmtnRoot
);
2063 if (GlobalData
.vPackageList
.size() > 0) {
2064 for (int index
= 0; index
< GlobalData
.vPackageList
.size(); index
++) {
2065 dmtnPackageDescription
.add(new IDefaultMutableTreeNode(GlobalData
.vPackageList
.elementAt(index
)
2067 IDefaultMutableTreeNode
.PACKAGE
, false,
2068 GlobalData
.vPackageList
.elementAt(index
),
2069 this.dmtnPackageDescription
));
2074 // Make Platform Description
2076 dmtnPlatformDescription
= new IDefaultMutableTreeNode("Platforms",
2077 IDefaultMutableTreeNode
.PLATFORM_DESCRIPTION
, false,
2078 null, this.dmtnRoot
);
2079 if (GlobalData
.vPlatformList
.size() > 0) {
2080 for (int index
= 0; index
< GlobalData
.vPlatformList
.size(); index
++) {
2081 dmtnPlatformDescription
.add(new IDefaultMutableTreeNode(GlobalData
.vPlatformList
.elementAt(index
)
2083 IDefaultMutableTreeNode
.PLATFORM
, false,
2084 GlobalData
.vPlatformList
.elementAt(index
),
2085 this.dmtnPlatformDescription
));
2090 // Add sub nodes to root node
2092 dmtnRoot
.add(dmtnModuleDescription
);
2093 dmtnRoot
.add(dmtnPackageDescription
);
2094 dmtnRoot
.add(dmtnPlatformDescription
);
2095 iTree
= new ITree(dmtnRoot
);
2096 iTree
.addMouseListener(this);
2097 iTree
.addKeyListener(this);
2098 jScrollPaneTree
.setViewportView(iTree
);
2102 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
2104 * Override windowClosing to popup warning message to confirm quit
2107 public void windowClosing(WindowEvent arg0
) {
2112 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
2114 * Override mouseClicked to check if need display popup menu
2117 public void mouseClicked(MouseEvent arg0
) {
2119 // When double click
2121 if (arg0
.getClickCount() == 2) {
2122 doubleClickModuleTreeNode();
2126 public void mouseEntered(MouseEvent arg0
) {
2127 // TODO Auto-generated method stub
2130 public void mouseExited(MouseEvent arg0
) {
2131 // TODO Auto-generated method stub
2134 public void mousePressed(MouseEvent arg0
) {
2135 // TODO Auto-generated method stub
2138 public void mouseReleased(MouseEvent arg0
) {
2139 // TODO Auto-generated method stub
2143 Remove all Internal Frame of Module Desktop Pane
2146 private void cleanDesktopPaneModule() {
2147 if (jDesktopPaneModule
!= null) {
2148 JInternalFrame
[] iif
= this.jDesktopPaneModule
.getAllFrames();
2149 for (int index
= 0; index
< iif
.length
; index
++) {
2150 iif
[index
].dispose();
2156 Remove all Internal Frame of package Desktop Pane
2159 private void cleanDesktopPanePackage() {
2160 if (jDesktopPanePlatform
!= null) {
2161 JInternalFrame
[] iif
= this.jDesktopPanePackage
.getAllFrames();
2162 for (int index
= 0; index
< iif
.length
; index
++) {
2163 iif
[index
].dispose();
2169 Remove all Internal Frame of platform Desktop Pane
2172 private void cleanDesktopPanePlatform() {
2173 if (jDesktopPanePlatform
!= null) {
2174 JInternalFrame
[] iif
= this.jDesktopPanePlatform
.getAllFrames();
2175 for (int index
= 0; index
< iif
.length
; index
++) {
2176 iif
[index
].dispose();
2182 Remove all Internal Frame of all Desktop Panes
2185 private void cleanDesktopPane() {
2186 cleanDesktopPaneModule();
2187 cleanDesktopPanePackage();
2188 cleanDesktopPanePlatform();
2192 Set file filter as input ext
2198 private int getNewFilePath(String ext
) {
2199 JFileChooser fc
= new JFileChooser(Workspace
.getCurrentWorkspace());
2200 fc
.setAcceptAllFileFilterUsed(false);
2201 fc
.addChoosableFileFilter(new IFileFilter(ext
));
2202 return fc
.showSaveDialog(new JPanel());
2206 Add a module to tree
2208 @param mid The module node to be added
2211 private void addModuleToTree(ModuleIdentification mid
) {
2213 // Add new MsaHeader node to the tree
2215 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(mid
.getName(), IDefaultMutableTreeNode
.MODULE
,
2216 false, mid
, this.dmtnModuleDescription
);
2218 // First find the module belongs to which package
2220 IDefaultMutableTreeNode packageNode
= iTree
.getNodeById(dmtnModuleDescription
, mid
.getPackageId(),
2221 IDefaultMutableTreeNode
.MODULE_PACKAGE
);
2223 // To check if has module node or library node
2225 IDefaultMutableTreeNode parentModuleNode
= null;
2226 IDefaultMutableTreeNode parentLibraryNode
= null;
2227 boolean hasModule
= false;
2228 boolean hasLibrary
= false;
2229 for (int index
= 0; index
< packageNode
.getChildCount(); index
++) {
2230 IDefaultMutableTreeNode iNode
= (IDefaultMutableTreeNode
) packageNode
.getChildAt(index
);
2231 if (iNode
.getCategory() == IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
) {
2233 parentLibraryNode
= iNode
;
2235 if (iNode
.getCategory() == IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
) {
2237 parentModuleNode
= iNode
;
2244 if (!mid
.isLibrary()) {
2246 // Create parent node first if has no parent node
2249 parentModuleNode
= new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2250 false, mid
.getPackageId(), this.dmtnModuleDescription
);
2251 iTree
.addNode(packageNode
, parentModuleNode
);
2254 iTree
.addNode(parentModuleNode
, node
);
2260 if (mid
.isLibrary()) {
2262 // Create parent node first if has no parent node
2265 parentLibraryNode
= new IDefaultMutableTreeNode("Library",
2266 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
, false,
2267 mid
.getPackageId(), this.dmtnModuleDescription
);
2268 iTree
.addNode(packageNode
, parentLibraryNode
);
2271 iTree
.addNode(parentLibraryNode
, node
);
2278 @param path input file path
2281 private void openModule(String path
, IDefaultMutableTreeNode belongNode
) {
2282 ModuleIdentification id
= GlobalData
.openingModuleList
.getIdByPath(path
);
2285 // The module is not in existing packages
2287 Log
.wrn("Open Module", "The module does not belong to any package in the current workspace!");
2292 // Make the node selected
2294 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(belongNode
, id
, IDefaultMutableTreeNode
.MODULE
)));
2297 // Update opening Module list information
2299 if (!iTree
.getSelectNode().isOpening()) {
2301 // Insert sub node of module
2303 insertModuleTreeNode(id
, belongNode
);
2304 iTree
.getSelectNode().setOpening(true);
2307 // Update opening module list
2309 GlobalData
.openingModuleList
.setModuleOpen(id
, true);
2310 Set
<TreePath
> temp
= GlobalData
.openingModuleList
.getTreePathById(id
);
2311 temp
.add(iTree
.getSelectionPath());
2312 GlobalData
.openingModuleList
.setTreePathById(id
, temp
);
2315 // Select msa header node and show it in editor panel
2318 .setSelectionPath(iTree
2319 .getPathOfNode(iTree
2320 .getNodeById(belongNode
, id
, IDefaultMutableTreeNode
.MSA_HEADER
)));
2321 showModuleElement(IDefaultMutableTreeNode
.MSA_HEADER
, GlobalData
.openingModuleList
.getOpeningModuleById(id
));
2322 this.currentOpeningModuleIndex
= GlobalData
.openingModuleList
.findIndexOfListById(id
);
2328 @param path input file path
2331 private void openPackage(String path
) {
2332 PackageIdentification id
= GlobalData
.openingPackageList
.getIdByPath(path
);
2335 // The package is not in current workspace
2337 Log
.wrn("Open Package", "The package has not been installed in the current workspace!");
2342 // Make the node selected
2344 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPackageDescription
, id
,
2345 IDefaultMutableTreeNode
.PACKAGE
)));
2347 // Update opening package list information
2349 if (!GlobalData
.openingPackageList
.getPackageOpen(id
)) {
2351 // Insert sub node of module
2353 insertPackageTreeNode(id
);
2354 iTree
.getSelectNode().setOpening(true);
2357 // Update opening module list
2359 GlobalData
.openingPackageList
.setPackageOpen(id
, true);
2360 Set
<TreePath
> temp
= GlobalData
.openingPackageList
.getTreePathById(id
);
2361 temp
.add(iTree
.getSelectionPath());
2362 GlobalData
.openingPackageList
.setTreePathById(id
, temp
);
2365 // Show spd header in editor panel
2367 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPackageDescription
, id
,
2368 IDefaultMutableTreeNode
.SPD_HEADER
)));
2369 showPackageElement(IDefaultMutableTreeNode
.SPD_HEADER
, GlobalData
.openingPackageList
.getOpeningPackageById(id
));
2370 this.currentOpeningPackageIndex
= GlobalData
.openingPackageList
.findIndexOfListById(id
);
2376 @param path input file path
2379 private void openPlatform(String path
) {
2380 PlatformIdentification id
= GlobalData
.openingPlatformList
.getIdByPath(path
);
2383 // The platform is not in current workspace
2385 Log
.wrn("Open Platform", "The platform has not been installed in the current workspace!");
2390 // Make the node selected
2392 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPlatformDescription
, id
,
2393 IDefaultMutableTreeNode
.PLATFORM
)));
2395 // Update opening package list information
2397 if (!GlobalData
.openingPlatformList
.getPlatformOpen(id
)) {
2399 // Insert sub node of module
2401 insertPlatformTreeNode(id
);
2402 iTree
.getSelectNode().setOpening(true);
2405 // Update opening module list
2407 GlobalData
.openingPlatformList
.setPlatformOpen(id
, true);
2408 Set
<TreePath
> temp
= GlobalData
.openingPlatformList
.getTreePathById(id
);
2409 temp
.add(iTree
.getSelectionPath());
2410 GlobalData
.openingPlatformList
.setTreePathById(id
, temp
);
2413 // Show fpd header in editor panel
2415 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPlatformDescription
, id
,
2416 IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
)));
2417 showPlatformElement(IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
,
2418 GlobalData
.openingPlatformList
.getOpeningPlatformById(id
));
2419 this.currentOpeningPlatformIndex
= GlobalData
.openingPlatformList
.findIndexOfListById(id
);
2426 private void saveModule(int index
) {
2427 OpeningModuleType omt
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(index
);
2429 if (getNewFilePath(DataType
.MODULE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2434 SaveFile
.saveMsaFile(omt
.getId().getPath(), omt
.getXmlMsa());
2435 GlobalData
.openingModuleList
.setNew(omt
.getId(), false);
2436 GlobalData
.openingModuleList
.setModuleSaved(omt
.getId(), true);
2437 } catch (Exception e
) {
2438 Log
.wrn("Save Module", e
.getMessage());
2439 Log
.err("Save Module", e
.getMessage());
2447 private void savePackage(int index
) {
2448 OpeningPackageType opt
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(index
);
2450 if (getNewFilePath(DataType
.PACKAGE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2455 SaveFile
.saveSpdFile(opt
.getId().getPath(), opt
.getXmlSpd());
2456 GlobalData
.openingPackageList
.setNew(opt
.getId(), false);
2457 GlobalData
.openingPackageList
.setPackageSaved(opt
.getId(), true);
2458 } catch (Exception e
) {
2459 Log
.wrn("Save Package", e
.getMessage());
2460 Log
.err("Save Package", e
.getMessage());
2468 private void savePlatform(int index
) {
2469 OpeningPlatformType opt
= GlobalData
.openingPlatformList
.getOpeningPlatformByIndex(index
);
2471 if (getNewFilePath(DataType
.PACKAGE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2476 SaveFile
.saveFpdFile(opt
.getId().getPath(), opt
.getXmlFpd());
2477 GlobalData
.openingPlatformList
.setNew(opt
.getId(), false);
2478 GlobalData
.openingPlatformList
.setPlatformSaved(opt
.getId(), true);
2479 } catch (Exception e
) {
2480 Log
.wrn("Save Package", e
.getMessage());
2481 Log
.err("Save Package", e
.getMessage());
2485 public void componentResized(ComponentEvent arg0
) {
2486 if (this.jSplitPane
!= null) {
2487 this.jSplitPane
.setSize(this.getWidth() - DataType
.MAIN_FRAME_WIDTH_SPACING
,
2488 this.getHeight() - DataType
.MAIN_FRAME_HEIGHT_SPACING
);
2489 this.jSplitPane
.validate();
2490 resizeDesktopPanel();
2495 Resize JDesktopPanel
2498 private void resizeDesktopPanel() {
2499 resizeDesktopPanel(this.jDesktopPaneModule
);
2500 resizeDesktopPanel(this.jDesktopPanePackage
);
2501 resizeDesktopPanel(this.jDesktopPanePlatform
);
2505 Resize JDesktopPanel
2508 private void resizeDesktopPanel(JDesktopPane jdk
) {
2509 JInternalFrame
[] iif
= jdk
.getAllFrames();
2510 for (int index
= 0; index
< iif
.length
; index
++) {
2511 iif
[index
].setSize(jdk
.getWidth(), jdk
.getHeight());
2515 private void insertModuleTreeNode(Identification id
, IDefaultMutableTreeNode belongNode
) {
2516 iTree
.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode
.MSA_HEADER
, true, id
,
2518 iTree
.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode
.MSA_SOURCEFILES
, true, id
,
2520 iTree
.addNode(new IDefaultMutableTreeNode("Library Class Definitions",
2521 IDefaultMutableTreeNode
.MSA_LIBRARYCLASSDEFINITIONS
, true, id
,
2524 .addNode(new IDefaultMutableTreeNode("Package Dependencies",
2525 IDefaultMutableTreeNode
.MSA_PACKAGEDEPENDENCIES
, true, id
, belongNode
));
2526 iTree
.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode
.MSA_PROTOCOLS
, true, id
,
2528 iTree
.addNode(new IDefaultMutableTreeNode("Events", IDefaultMutableTreeNode
.MSA_EVENTS
, true, id
, belongNode
));
2529 iTree
.addNode(new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode
.MSA_HOBS
, true, id
, belongNode
));
2530 iTree
.addNode(new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode
.MSA_PPIS
, true, id
, belongNode
));
2531 iTree
.addNode(new IDefaultMutableTreeNode("Variables", IDefaultMutableTreeNode
.MSA_VARIABLES
, true, id
,
2533 iTree
.addNode(new IDefaultMutableTreeNode("Boot Modes", IDefaultMutableTreeNode
.MSA_BOOTMODES
, true, id
,
2535 iTree
.addNode(new IDefaultMutableTreeNode("System Tables", IDefaultMutableTreeNode
.MSA_SYSTEMTABLES
, true, id
,
2537 iTree
.addNode(new IDefaultMutableTreeNode("Data Hubs", IDefaultMutableTreeNode
.MSA_DATAHUBS
, true, id
,
2539 iTree
.addNode(new IDefaultMutableTreeNode("Hii Packages", IDefaultMutableTreeNode
.MSA_HIIPACKAGES
, true, id
,
2541 iTree
.addNode(new IDefaultMutableTreeNode("Guids", IDefaultMutableTreeNode
.MSA_GUIDS
, true, id
, belongNode
));
2542 iTree
.addNode(new IDefaultMutableTreeNode("External Defintions", IDefaultMutableTreeNode
.MSA_EXTERNS
, true, id
,
2544 iTree
.addNode(new IDefaultMutableTreeNode("Pcd Coded", IDefaultMutableTreeNode
.MSA_PCDS
, true, id
, belongNode
));
2545 iTree
.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode
.MSA_BUILDOPTIONS
, true, id
, belongNode
));
2548 private void insertPackageTreeNode(Identification id
) {
2549 IDefaultMutableTreeNode idmtTemp
= this.dmtnPackageDescription
;
2550 iTree
.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode
.SPD_HEADER
, true, id
,
2552 iTree
.addNode(new IDefaultMutableTreeNode("Library Class Declarations",
2553 IDefaultMutableTreeNode
.SPD_LIBRARYCLASSDECLARATIONS
, true, id
,
2555 iTree
.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode
.SPD_MSAFILES
, false, id
,
2557 iTree
.addNode(new IDefaultMutableTreeNode("Package Includes", IDefaultMutableTreeNode
.SPD_PACKAGEHEADERS
, true,
2559 iTree
.addNode(new IDefaultMutableTreeNode("Guid Declarations", IDefaultMutableTreeNode
.SPD_GUIDDECLARATIONS
,
2560 true, id
, idmtTemp
));
2562 .addNode(new IDefaultMutableTreeNode("Protocol Declarations",
2563 IDefaultMutableTreeNode
.SPD_PROTOCOLDECLARATIONS
, true, id
, idmtTemp
));
2564 iTree
.addNode(new IDefaultMutableTreeNode("Ppi Declarations", IDefaultMutableTreeNode
.SPD_PPIDECLARATIONS
,
2565 true, id
, idmtTemp
));
2566 iTree
.addNode(new IDefaultMutableTreeNode("Pcd Declarations", IDefaultMutableTreeNode
.SPD_PCDDECLARATIONS
,
2567 true, id
, idmtTemp
));
2569 // Add modules in this package
2571 IDefaultMutableTreeNode dmtnModulePackageLibrary
= null;
2572 IDefaultMutableTreeNode dmtnModulePackageModule
= null;
2574 dmtnModulePackageLibrary
= new IDefaultMutableTreeNode("Library",
2575 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
, false,
2577 dmtnModulePackageModule
= new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2578 false, id
, idmtTemp
);
2580 Vector
<ModuleIdentification
> vModule
= wt
.getAllModules(new PackageIdentification(id
));
2581 for (int indexJ
= 0; indexJ
< vModule
.size(); indexJ
++) {
2582 if (vModule
.get(indexJ
).isLibrary()) {
2583 dmtnModulePackageLibrary
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2584 IDefaultMutableTreeNode
.MODULE
, false,
2585 vModule
.get(indexJ
), idmtTemp
));
2587 dmtnModulePackageModule
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2588 IDefaultMutableTreeNode
.MODULE
, false,
2589 vModule
.get(indexJ
), idmtTemp
));
2592 if (dmtnModulePackageModule
.getChildCount() > 0) {
2593 iTree
.addNode(dmtnModulePackageModule
);
2595 if (dmtnModulePackageLibrary
.getChildCount() > 0) {
2596 iTree
.addNode(dmtnModulePackageLibrary
);
2600 private void insertPlatformTreeNode(Identification id
) {
2601 IDefaultMutableTreeNode idmtTemp
= this.dmtnPlatformDescription
;
2602 iTree
.addNode(new IDefaultMutableTreeNode("Platform Header", IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
, true,
2604 iTree
.addNode(new IDefaultMutableTreeNode("Platform Definitions",
2605 IDefaultMutableTreeNode
.FPD_PLATFORMDEFINITIONS
, true, id
, idmtTemp
));
2606 iTree
.addNode(new IDefaultMutableTreeNode("Flash Information", IDefaultMutableTreeNode
.FPD_FLASH
, true, id
,
2608 iTree
.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode
.FPD_FRAMEWORKMODULES
,
2609 true, id
, idmtTemp
));
2610 iTree
.addNode(new IDefaultMutableTreeNode("Dynamic PCD Build Declarations",
2611 IDefaultMutableTreeNode
.FPD_PCDDYNAMICBUILDDECLARATIONS
, true, id
,
2613 iTree
.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode
.FPD_BUILDOPTIONS
, true, id
,
2617 // Add modules in this platform
2619 IDefaultMutableTreeNode dmtnModulePackageLibrary
= null;
2620 IDefaultMutableTreeNode dmtnModulePackageModule
= null;
2622 dmtnModulePackageLibrary
= new IDefaultMutableTreeNode("Library",
2623 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
, false,
2625 dmtnModulePackageModule
= new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2626 false, id
, idmtTemp
);
2628 Vector
<ModuleIdentification
> vModule
= wt
.getAllModules(new PlatformIdentification(id
));
2629 for (int indexJ
= 0; indexJ
< vModule
.size(); indexJ
++) {
2630 if (vModule
.get(indexJ
).isLibrary()) {
2631 dmtnModulePackageLibrary
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2632 IDefaultMutableTreeNode
.MODULE
, false,
2633 vModule
.get(indexJ
), idmtTemp
));
2635 dmtnModulePackageModule
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2636 IDefaultMutableTreeNode
.MODULE
, false,
2637 vModule
.get(indexJ
), idmtTemp
));
2640 if (dmtnModulePackageModule
.getChildCount() > 0) {
2641 iTree
.addNode(dmtnModulePackageModule
);
2643 if (dmtnModulePackageLibrary
.getChildCount() > 0) {
2644 iTree
.addNode(dmtnModulePackageLibrary
);
2649 Operate when double click a tree node
2652 private void doubleClickModuleTreeNode() {
2653 Identification id
= null;
2654 int intCategory
= -1;
2656 IDefaultMutableTreeNode belongNode
= null;
2660 // Get selected tree node
2662 if (iTree
.getSelectNode() != null) {
2663 id
= iTree
.getSelectNode().getId();
2667 // If id is null, return directly
2673 intCategory
= iTree
.getSelectCategory();
2674 belongNode
= iTree
.getSelectNode().getBelongNode();
2677 // If the node is not opened yet
2678 // Insert top level elements first
2680 if (intCategory
== IDefaultMutableTreeNode
.MODULE
) {
2681 path
= iTree
.getSelectNode().getId().getPath();
2682 openModule(path
, belongNode
);
2685 if (intCategory
== IDefaultMutableTreeNode
.PACKAGE
) {
2686 path
= iTree
.getSelectNode().getId().getPath();
2690 if (intCategory
== IDefaultMutableTreeNode
.PLATFORM
) {
2691 path
= iTree
.getSelectNode().getId().getPath();
2697 // Show editor panel
2699 if (intCategory
>= IDefaultMutableTreeNode
.MSA_HEADER
&& intCategory
< IDefaultMutableTreeNode
.SPD_HEADER
) {
2700 showModuleElement(intCategory
,
2701 GlobalData
.openingModuleList
.getOpeningModuleById(new ModuleIdentification(id
)));
2702 this.currentOpeningModuleIndex
= GlobalData
.openingModuleList
2703 .findIndexOfListById(new ModuleIdentification(
2706 if (intCategory
>= IDefaultMutableTreeNode
.SPD_HEADER
2707 && intCategory
< IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
2708 showPackageElement(intCategory
,
2709 GlobalData
.openingPackageList
.getOpeningPackageById(new PackageIdentification(id
)));
2710 this.currentOpeningPackageIndex
= GlobalData
.openingPackageList
2711 .findIndexOfListById(new PackageIdentification(
2714 if (intCategory
>= IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
2715 showPlatformElement(
2717 GlobalData
.openingPlatformList
2718 .getOpeningPlatformById(new PlatformIdentification(id
)));
2719 this.currentOpeningPlatformIndex
= GlobalData
.openingPlatformList
2720 .findIndexOfListById(new PlatformIdentification(
2723 } catch (Exception e
) {
2724 Log
.err("double click category: " + intCategory
);
2725 Log
.err("double click belong node: " + belongNode
.toString());
2726 Log
.err("double click id path: " + id
);
2727 Log
.err("double click exception: " + e
.getMessage());
2732 Show content of editor panel via selected element
2738 private void showPlatformElement(int elementType
, OpeningPlatformType fpd
) {
2739 this.cleanDesktopPanePlatform();
2741 switch (elementType
) {
2742 case IDefaultMutableTreeNode
.FPD_PLATFORMDEFINITIONS
:
2743 FpdPlatformDefs frmFpdPlatformDefs
= new FpdPlatformDefs(fpd
);
2744 getJDesktopPanePlatform().add(frmFpdPlatformDefs
, 1);
2746 case IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
:
2747 FpdHeader frmFpdHeader
= new FpdHeader(fpd
);
2748 getJDesktopPanePlatform().add(frmFpdHeader
, 1);
2750 case IDefaultMutableTreeNode
.FPD_FLASH
:
2751 FpdFlash frmFpdFlash
= new FpdFlash(fpd
);
2752 getJDesktopPanePlatform().add(frmFpdFlash
, 1);
2754 case IDefaultMutableTreeNode
.FPD_FRAMEWORKMODULES
:
2755 FpdFrameworkModules frmFpdFrameworkModules
= new FpdFrameworkModules(fpd
);
2756 getJDesktopPanePlatform().add(frmFpdFrameworkModules
, 1);
2758 case IDefaultMutableTreeNode
.FPD_PCDDYNAMICBUILDDECLARATIONS
:
2759 FpdDynamicPcdBuildDefinitions frmFpdDynamicPcdBuildDefinitions
= new FpdDynamicPcdBuildDefinitions(fpd
);
2760 getJDesktopPanePlatform().add(frmFpdDynamicPcdBuildDefinitions
, 1);
2762 case IDefaultMutableTreeNode
.FPD_BUILDOPTIONS
:
2763 FpdBuildOptions frmFpdBuildOptions
= new FpdBuildOptions(fpd
);
2764 getJDesktopPanePlatform().add(frmFpdBuildOptions
, 1);
2767 this.jTabbedPaneEditor
.setSelectedIndex(2);
2768 resizeDesktopPanel();
2772 Show content of editor panel via selected element
2778 private void showPackageElement(int elementType
, OpeningPackageType spd
) {
2779 this.cleanDesktopPanePackage();
2780 Tools
.dirForNewSpd
= spd
.getId().getPath();
2781 switch (elementType
) {
2782 case IDefaultMutableTreeNode
.SPD_HEADER
:
2783 SpdHeader frmSpdHeader
= new SpdHeader(spd
);
2784 getJDesktopPanePackage().add(frmSpdHeader
, 1);
2786 case IDefaultMutableTreeNode
.SPD_LIBRARYCLASSDECLARATIONS
:
2787 SpdLibClassDecls frmSlcd
= new SpdLibClassDecls(spd
, this);
2788 getJDesktopPanePackage().add(frmSlcd
, 1);
2790 case IDefaultMutableTreeNode
.SPD_MSAFILES
:
2791 SpdMsaFiles frmSmf
= new SpdMsaFiles(spd
, this);
2792 getJDesktopPanePackage().add(frmSmf
, 1);
2794 case IDefaultMutableTreeNode
.SPD_PACKAGEHEADERS
:
2795 SpdPackageHeaders frmSph
= new SpdPackageHeaders(spd
, this);
2796 getJDesktopPanePackage().add(frmSph
, 1);
2798 case IDefaultMutableTreeNode
.SPD_GUIDDECLARATIONS
:
2799 SpdGuidDecls frmSgd
= new SpdGuidDecls(spd
, this);
2800 getJDesktopPanePackage().add(frmSgd
, 1);
2802 case IDefaultMutableTreeNode
.SPD_PROTOCOLDECLARATIONS
:
2803 SpdProtocolDecls frmSprod
= new SpdProtocolDecls(spd
, this);
2804 getJDesktopPanePackage().add(frmSprod
, 1);
2806 case IDefaultMutableTreeNode
.SPD_PPIDECLARATIONS
:
2807 SpdPpiDecls frmSppid
= new SpdPpiDecls(spd
, this);
2808 getJDesktopPanePackage().add(frmSppid
, 1);
2810 case IDefaultMutableTreeNode
.SPD_PCDDECLARATIONS
:
2811 SpdPcdDefs frmSpcdd
= new SpdPcdDefs(spd
, this);
2812 getJDesktopPanePackage().add(frmSpcdd
, 1);
2815 this.jTabbedPaneEditor
.setSelectedIndex(1);
2816 resizeDesktopPanel();
2820 Show content of editor panel via selected element
2826 private void showModuleElement(int elementType
, OpeningModuleType msa
) {
2827 this.cleanDesktopPaneModule();
2828 switch (elementType
) {
2829 case IDefaultMutableTreeNode
.MSA_HEADER
:
2830 MsaHeader frmMsaHeader
= new MsaHeader(msa
);
2831 getJDesktopPaneModule().add(frmMsaHeader
, 1);
2833 case IDefaultMutableTreeNode
.MSA_LIBRARYCLASSDEFINITIONS
:
2834 ModuleLibraryClassDefinitions frmMlcd
= new ModuleLibraryClassDefinitions(msa
, this);
2835 getJDesktopPaneModule().add(frmMlcd
, 1);
2837 case IDefaultMutableTreeNode
.MSA_PACKAGEDEPENDENCIES
:
2838 ModulePackageDependencies frmMpd
= new ModulePackageDependencies(msa
, this);
2839 getJDesktopPaneModule().add(frmMpd
, 1);
2841 case IDefaultMutableTreeNode
.MSA_SOURCEFILES
:
2842 ModuleSourceFiles frmMsf
= new ModuleSourceFiles(msa
, this);
2843 getJDesktopPaneModule().add(frmMsf
, 1);
2845 case IDefaultMutableTreeNode
.MSA_PROTOCOLS
:
2846 ModuleProtocols frmMp
= new ModuleProtocols(msa
, this);
2847 getJDesktopPaneModule().add(frmMp
, 1);
2849 case IDefaultMutableTreeNode
.MSA_EVENTS
:
2850 ModuleEvents frmMe
= new ModuleEvents(msa
, this);
2851 getJDesktopPaneModule().add(frmMe
, 1);
2853 case IDefaultMutableTreeNode
.MSA_HOBS
:
2854 ModuleHobs frmMh
= new ModuleHobs(msa
, this);
2855 getJDesktopPaneModule().add(frmMh
, 1);
2857 case IDefaultMutableTreeNode
.MSA_PPIS
:
2858 ModulePpis frmMpp
= new ModulePpis(msa
, this);
2859 getJDesktopPaneModule().add(frmMpp
, 1);
2861 case IDefaultMutableTreeNode
.MSA_VARIABLES
:
2862 ModuleVariables frmMv
= new ModuleVariables(msa
, this);
2863 getJDesktopPaneModule().add(frmMv
, 1);
2865 case IDefaultMutableTreeNode
.MSA_BOOTMODES
:
2866 ModuleBootModes frmMbm
= new ModuleBootModes(msa
, this);
2867 getJDesktopPaneModule().add(frmMbm
, 1);
2869 case IDefaultMutableTreeNode
.MSA_SYSTEMTABLES
:
2870 ModuleSystemTables frmMst
= new ModuleSystemTables(msa
, this);
2871 getJDesktopPaneModule().add(frmMst
, 1);
2873 case IDefaultMutableTreeNode
.MSA_DATAHUBS
:
2874 ModuleDataHubs frmMdh
= new ModuleDataHubs(msa
, this);
2875 getJDesktopPaneModule().add(frmMdh
, 1);
2877 case IDefaultMutableTreeNode
.MSA_HIIPACKAGES
:
2878 ModuleHiiPackages frmMf
= new ModuleHiiPackages(msa
, this);
2879 getJDesktopPaneModule().add(frmMf
, 1);
2881 case IDefaultMutableTreeNode
.MSA_GUIDS
:
2882 ModuleGuids frmGuid
= new ModuleGuids(msa
, this);
2883 getJDesktopPaneModule().add(frmGuid
, 1);
2885 case IDefaultMutableTreeNode
.MSA_EXTERNS
:
2886 ModuleExterns frmMex
= new ModuleExterns(msa
, this);
2887 getJDesktopPaneModule().add(frmMex
, 1);
2889 case IDefaultMutableTreeNode
.MSA_PCDS
:
2890 ModulePCDs frmPcd
= new ModulePCDs(msa
, this);
2891 getJDesktopPaneModule().add(frmPcd
, 1);
2893 case IDefaultMutableTreeNode
.MSA_BUILDOPTIONS
:
2894 ModuleBuildOptions frmMbo
= new ModuleBuildOptions(msa
, this);
2895 getJDesktopPaneModule().add(frmMbo
, 1);
2898 this.jTabbedPaneEditor
.setSelectedIndex(0);
2899 resizeDesktopPanel();
2903 // Define operations of menu
2909 private void fileNew() {
2912 // Selece new file type
2914 NewFileChooser nfc
= new NewFileChooser(this, true);
2915 result
= nfc
.showDialog();
2917 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2920 } else if (result
== DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
) {
2924 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2925 result
= smb
.showDialog();
2927 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2931 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2932 ModuleIdentification mid
= smb
.getMid();
2935 // Update package of workspace first
2937 PackageSurfaceAreaDocument
.PackageSurfaceArea psa
= null;
2938 if (GlobalData
.openingPackageList
.existsPackage(mid
.getPackageId())) {
2939 psa
= GlobalData
.openingPackageList
.getPackageSurfaceAreaFromId(mid
.getPackageId());
2942 wt
.addModuleToPackage(mid
, psa
);
2943 } catch (IOException e
) {
2944 Log
.wrn("Update MsaFiles in Package", e
.getMessage());
2945 Log
.err("Update MsaFiles in Package", e
.getMessage());
2947 } catch (XmlException e
) {
2948 Log
.wrn("Update MsaFiles in Package", e
.getMessage());
2949 Log
.err("Update MsaFiles in Package", e
.getMessage());
2951 } catch (Exception e
) {
2952 Log
.wrn("Update MsaFiles in Package", e
.getMessage());
2953 Log
.err("Update MsaFiles in Package", e
.getMessage());
2958 // Update Global Data
2960 GlobalData
.openingModuleList
.insertToOpeningModuleList(mid
, smb
.getMsa());
2961 GlobalData
.vModuleList
.addElement(mid
);
2964 // Create new node on the tree
2966 addModuleToTree(mid
);
2971 this.openModule(mid
.getPath(), this.dmtnModuleDescription
);
2974 } else if (result
== DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
) {
2978 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2979 result
= smb
.showDialog();
2981 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2985 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2986 PackageIdentification pid
= smb
.getPid();
2989 wt
.addPackageToDatabase(smb
.getPid());
2990 } catch (Exception e
) {
2991 Log
.err("addPackageToDatabase", e
.getMessage());
2995 // Update Global Data
2997 GlobalData
.openingPackageList
.insertToOpeningPackageList(pid
, smb
.getSpd());
2998 GlobalData
.vPackageList
.addElement(pid
);
3001 // Add to Module Description node
3003 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(pid
.getName(),
3004 IDefaultMutableTreeNode
.MODULE_PACKAGE
,
3005 false, pid
, this.dmtnModuleDescription
);
3007 iTree
.addNode(dmtnModuleDescription
, node
);
3010 // Add new SpdHeader node to the tree
3012 node
= new IDefaultMutableTreeNode(pid
.getName(), IDefaultMutableTreeNode
.PACKAGE
, true, pid
,
3013 this.dmtnPackageDescription
);
3014 iTree
.addNode(dmtnPackageDescription
, node
);
3016 this.openPackage(pid
.getPath());
3019 } else if (result
== DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
) {
3021 // To new a platform
3023 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
3024 result
= smb
.showDialog();
3026 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3030 } else if (result
== DataType
.RETURN_TYPE_OK
) {
3031 PlatformIdentification fid
= smb
.getFid();
3034 wt
.addPlatformToDatabase(fid
);
3035 } catch (Exception e
) {
3036 Log
.err("addPlatformToDatabase", e
.getMessage());
3040 // Update global data
3042 GlobalData
.openingPlatformList
.insertToOpeningPlatformList(fid
, smb
.getFpd());
3043 GlobalData
.vPlatformList
.addElement(fid
);
3045 // Add new SpdHeader node to the tree
3047 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(fid
.getName(),
3048 IDefaultMutableTreeNode
.PLATFORM
, true,
3049 fid
, this.dmtnPlatformDescription
);
3050 iTree
.addNode(dmtnPlatformDescription
, node
);
3051 this.openPlatform(fid
.getPath());
3061 private void open() {
3062 JFileChooser fc
= new JFileChooser(Workspace
.getCurrentWorkspace());
3063 fc
.setAcceptAllFileFilterUsed(false);
3064 IFileFilter iffM
= new IFileFilter(DataType
.MODULE_SURFACE_AREA_EXT
);
3065 IFileFilter iffP
= new IFileFilter(DataType
.PACKAGE_SURFACE_AREA_EXT
);
3066 IFileFilter iffF
= new IFileFilter(DataType
.PLATFORM_SURFACE_AREA_EXT
);
3067 fc
.addChoosableFileFilter(iffM
);
3068 fc
.addChoosableFileFilter(iffP
);
3069 fc
.addChoosableFileFilter(iffF
);
3070 fc
.setFileFilter(iffM
);
3072 int result
= fc
.showOpenDialog(new JPanel());
3074 if (result
== JFileChooser
.APPROVE_OPTION
) {
3075 String path
= fc
.getSelectedFile().getPath();
3076 String match
= path
.substring(path
.length() - 4);
3077 if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.MODULE_SURFACE_AREA_EXT
)) {
3078 openModule(path
, this.dmtnModuleDescription
);
3079 } else if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.PACKAGE_SURFACE_AREA_EXT
)) {
3081 } else if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.PLATFORM_SURFACE_AREA_EXT
)) {
3091 private void close() {
3092 TreePath item
= null;
3093 switch (this.jTabbedPaneEditor
.getSelectedIndex()) {
3095 // Current is module
3098 if (this.currentOpeningModuleIndex
> -1) {
3099 if (!GlobalData
.openingModuleList
.getModuleSaved(currentOpeningModuleIndex
)) {
3100 int result
= showSaveDialog();
3101 if (result
== JOptionPane
.YES_OPTION
) {
3104 if (result
== JOptionPane
.NO_OPTION
) {
3107 if (result
== JOptionPane
.CANCEL_OPTION
) {
3113 // Remove all tree paths for the module
3115 Set
<TreePath
> openingTreePaths
= GlobalData
.openingModuleList
3116 .getTreePathByIndex(currentOpeningModuleIndex
);
3117 Iterator
<TreePath
> openingTreePathsIter
= openingTreePaths
.iterator();
3118 while (openingTreePathsIter
.hasNext()) {
3119 item
= openingTreePathsIter
.next();
3120 iTree
.getNodeByPath(item
).setOpening(false);
3121 iTree
.removeNodeChildrenByPath(item
);
3124 GlobalData
.openingModuleList
.reload(this.currentOpeningModuleIndex
);
3125 GlobalData
.openingModuleList
.setModuleOpen(this.currentOpeningModuleIndex
, false);
3126 GlobalData
.openingModuleList
.setModuleSaved(this.currentOpeningModuleIndex
, true);
3128 this.cleanDesktopPaneModule();
3129 this.currentOpeningModuleIndex
= -1;
3133 // Current is package
3136 if (this.currentOpeningPackageIndex
> -1) {
3137 if (!GlobalData
.openingPackageList
.getPackageSaved(currentOpeningPackageIndex
)) {
3138 int result
= showSaveDialog();
3139 if (result
== JOptionPane
.YES_OPTION
) {
3142 if (result
== JOptionPane
.NO_OPTION
) {
3145 if (result
== JOptionPane
.CANCEL_OPTION
) {
3151 // Remove all tree paths for the module
3153 Set
<TreePath
> openingTreePaths
= GlobalData
.openingPackageList
3154 .getTreePathByIndex(currentOpeningPackageIndex
);
3155 Iterator
<TreePath
> openingTreePathsIter
= openingTreePaths
.iterator();
3156 while (openingTreePathsIter
.hasNext()) {
3157 item
= openingTreePathsIter
.next();
3158 iTree
.getNodeByPath(item
).setOpening(false);
3159 iTree
.removeNodeChildrenByPath(item
);
3162 GlobalData
.openingPackageList
.reload(this.currentOpeningPackageIndex
);
3163 GlobalData
.openingPackageList
.setPackageOpen(this.currentOpeningPackageIndex
, false);
3164 GlobalData
.openingPackageList
.setPackageSaved(this.currentOpeningPackageIndex
, true);
3165 this.cleanDesktopPanePackage();
3166 this.currentOpeningPackageIndex
= -1;
3170 // Current is platform
3173 if (this.currentOpeningPlatformIndex
> -1) {
3174 if (!GlobalData
.openingPlatformList
.getPlatformSaved(currentOpeningPlatformIndex
)) {
3175 int result
= showSaveDialog();
3176 if (result
== JOptionPane
.YES_OPTION
) {
3179 if (result
== JOptionPane
.NO_OPTION
) {
3182 if (result
== JOptionPane
.CANCEL_OPTION
) {
3188 // Remove all tree paths for the module
3190 Set
<TreePath
> openingTreePaths
= GlobalData
.openingPlatformList
3191 .getTreePathByIndex(currentOpeningPlatformIndex
);
3192 Iterator
<TreePath
> openingTreePathsIter
= openingTreePaths
.iterator();
3193 while (openingTreePathsIter
.hasNext()) {
3194 item
= openingTreePathsIter
.next();
3195 iTree
.getNodeByPath(item
).setOpening(false);
3196 iTree
.removeNodeChildrenByPath(item
);
3199 GlobalData
.openingPlatformList
.reload(this.currentOpeningPlatformIndex
);
3200 GlobalData
.openingPlatformList
.setPlatformOpen(this.currentOpeningPlatformIndex
, false);
3201 GlobalData
.openingPlatformList
.setPlatformSaved(this.currentOpeningPlatformIndex
, true);
3202 this.cleanDesktopPanePlatform();
3203 this.currentOpeningPlatformIndex
= -1;
3210 Close all opening files and clean all showing internal frame
3213 private int closeAll() {
3214 int result
= JOptionPane
.NO_OPTION
;
3215 if (!GlobalData
.openingModuleList
.isSaved() || !GlobalData
.openingPackageList
.isSaved()
3216 || !GlobalData
.openingPlatformList
.isSaved()) {
3217 result
= showSaveDialog();
3219 if (result
== JOptionPane
.YES_OPTION
) {
3222 if (result
== JOptionPane
.NO_OPTION
) {
3227 if (result
== JOptionPane
.CANCEL_OPTION
|| result
== JOptionPane
.CLOSED_OPTION
) {
3230 this.cleanDesktopPane();
3231 GlobalData
.openingModuleList
.closeAll();
3232 GlobalData
.openingPackageList
.closeAll();
3233 GlobalData
.openingPlatformList
.closeAll();
3239 Refresh all global data from disk to memory
3242 private void refresh() {
3247 Save currentModule when press button OK
3250 private void save() {
3251 switch (this.jTabbedPaneEditor
.getSelectedIndex()) {
3253 if (this.currentOpeningModuleIndex
> -1) {
3254 saveModule(this.currentOpeningModuleIndex
);
3258 if (this.currentOpeningPackageIndex
> -1) {
3259 savePackage(this.currentOpeningPackageIndex
);
3263 if (this.currentOpeningPlatformIndex
> -1) {
3264 savePlatform(this.currentOpeningPlatformIndex
);
3270 private void saveAs() {
3274 private void saveAll() {
3278 for (int index
= 0; index
< GlobalData
.openingModuleList
.size(); index
++) {
3279 if (!GlobalData
.openingModuleList
.getModuleSaved(index
)) {
3285 // Save all packages
3287 for (int index
= 0; index
< GlobalData
.openingPackageList
.size(); index
++) {
3288 if (!GlobalData
.openingPackageList
.getPackageSaved(index
)) {
3294 // Save all platforms
3296 for (int index
= 0; index
< GlobalData
.openingPlatformList
.size(); index
++) {
3297 if (!GlobalData
.openingPlatformList
.getPlatformSaved(index
)) {
3298 savePlatform(index
);
3304 To save changed items before exit.
3307 private void exit() {
3308 int result
= JOptionPane
.NO_OPTION
;
3309 if (!GlobalData
.openingModuleList
.isSaved() || !GlobalData
.openingPackageList
.isSaved()
3310 || !GlobalData
.openingPlatformList
.isSaved()) {
3311 result
= showSaveDialog();
3313 if (result
== JOptionPane
.YES_OPTION
) {
3315 } else if (result
== JOptionPane
.NO_OPTION
) {
3317 } else if (result
== JOptionPane
.CANCEL_OPTION
|| result
== JOptionPane
.CLOSED_OPTION
) {
3325 To find all defined PPIs in workspace
3328 private void findPpi() {
3329 FindResult fr
= FindResult
.getInstance("PPI");
3330 fr
.setVisible(true);
3334 To find all defined PROTOCOLs in workspace
3337 private void findProtocol() {
3338 FindResult fr
= FindResult
.getInstance("PROTOCOL");
3339 fr
.setVisible(true);
3343 To find all defined PROTOCOLs in workspace
3346 private void findGuid() {
3347 FindResult fr
= FindResult
.getInstance("GUID");
3348 fr
.setVisible(true);
3352 To find all defined PROTOCOLs in workspace
3355 private void findPcd() {
3356 FindResult fr
= FindResult
.getInstance("PCD");
3357 fr
.setVisible(true);
3361 To find all defined Library Classes in workspace
3364 private void findLibraryClass() {
3365 FindResult fr
= FindResult
.getInstance("LIBRARY_CLASS");
3366 fr
.setVisible(true);
3370 To find all defined Library Instances in workspace
3373 private void findLibraryInstance() {
3374 FindResult fr
= FindResult
.getInstance("LIBRARY_INSTANCE");
3375 fr
.setVisible(true);
3379 Switch current workspace to others
3382 private void changeWorkspace() {
3383 SwitchWorkspace sw
= new SwitchWorkspace(this, true);
3384 int result
= sw
.showDialog();
3385 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3387 } else if (result
== DataType
.RETURN_TYPE_OK
) {
3389 // Reinit whole window
3392 this.setTitle(DataType
.PROJECT_NAME
+ " " + DataType
.PROJECT_VERSION
+ " " + "- ["
3393 + Workspace
.getCurrentWorkspace() + "]");
3398 this.makeEmptyTree();
3404 To create a Far file from current workspace
3407 private void createFar() {
3408 CreateStepOne cso
= new CreateStepOne(this, true);
3409 int result
= cso
.showDialog();
3410 if (result
== DataType
.RETURN_TYPE_OK
) {
3411 String strReturn
= "Far Creation Completed!";
3412 JOptionPane
.showConfirmDialog(this, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3413 JOptionPane
.INFORMATION_MESSAGE
);
3419 To install a Far file to current workspace
3422 private void installFar() {
3423 InstallStepOne iso
= new InstallStepOne(this, true);
3424 int result
= iso
.showDialog();
3425 if (result
== DataType
.RETURN_TYPE_OK
) {
3426 String strReturn
= "<html>Far Installalation completed!<br>Refreshing the WORKSPACE!</html>";
3427 JOptionPane
.showConfirmDialog(this, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3428 JOptionPane
.INFORMATION_MESSAGE
);
3431 this.makeEmptyTree();
3437 To remove a Far's items from current workspace
3440 private void removeFar() {
3441 DeleteStepOne dso
= new DeleteStepOne(this, true);
3442 int result
= dso
.showDialog();
3443 if (result
== DataType
.RETURN_TYPE_OK
) {
3444 String strReturn
= "<html>Far Deletion completed!<br>Refreshing the WORKSPACE!</html>";
3445 JOptionPane
.showConfirmDialog(this, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3446 JOptionPane
.INFORMATION_MESSAGE
);
3449 this.makeEmptyTree();
3455 To update an existing Far file
3458 private void updateFar() {
3459 UpdateStepOne uso
= new UpdateStepOne(this, true);
3460 int result
= uso
.showDialog();
3461 if (result
== DataType
.RETURN_TYPE_OK
) {
3462 String strReturn
= "<html>Far Update completed!<br>Refreshing the WORKSPACE!</html>";
3463 JOptionPane
.showConfirmDialog(this, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3464 JOptionPane
.INFORMATION_MESSAGE
);
3467 this.makeEmptyTree();
3473 Show Tool Chain Configuration Dialog to setup Tool Chain
3476 private void setupToolChainConfiguration() {
3477 ToolChainConfig tcc
= ToolChainConfig
.getInstance();
3481 private void configBuildPreferences() {
3482 Preferences bt
= Preferences
.getInstance();
3490 private void cloneItem() {
3494 // Check if there is any item can be cloned
3496 if (iTree
.getSelectionPath() == null) {
3497 Log
.wrn("Clone", "Please select a target to clone!");
3500 int category
= iTree
.getSelectCategory();
3501 Identification id
= iTree
.getSelectNode().getId();
3503 if (category
== IDefaultMutableTreeNode
.WORKSPACE
) {
3504 mode
= DataType
.RETURN_TYPE_WORKSPACE
;
3507 if ((category
== IDefaultMutableTreeNode
.MODULE
)
3508 || (category
>= IDefaultMutableTreeNode
.MSA_HEADER
&& category
< IDefaultMutableTreeNode
.SPD_HEADER
)) {
3509 mode
= DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
;
3511 if ((category
== IDefaultMutableTreeNode
.PACKAGE
)
3512 || (category
>= IDefaultMutableTreeNode
.SPD_HEADER
&& category
< IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
)) {
3513 mode
= DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
;
3515 if ((category
== IDefaultMutableTreeNode
.PLATFORM
) || (category
>= IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
)) {
3516 mode
= DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
;
3519 Clone c
= new Clone(this, true, mode
, id
);
3520 int result
= c
.showDialog();
3522 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3525 if (result
== DataType
.RETURN_TYPE_WORKSPACE
) {
3526 Tools
.showInformationMessage("Workspace Clone Completed!");
3528 if (result
== DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
) {
3529 Tools
.showInformationMessage("Module Clone Completed!");
3530 addModuleToTree(c
.getMid());
3532 if (result
== DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
) {
3533 Tools
.showInformationMessage("Package Clone Completed!");
3535 // Add new SpdHeader node to the tree
3537 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(GlobalData
.vPackageList
.lastElement().getName(),
3538 IDefaultMutableTreeNode
.PACKAGE
, false,
3539 GlobalData
.vPackageList
.lastElement(),
3540 this.dmtnPackageDescription
);
3541 iTree
.addNode(this.dmtnPackageDescription
, node
);
3543 if (result
== DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
) {
3544 Tools
.showInformationMessage("Platform Surface Area Clone Finished");
3546 // Add new SpdHeader node to the tree
3548 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(
3549 GlobalData
.vPlatformList
.lastElement().getName(),
3550 IDefaultMutableTreeNode
.PLATFORM
, false,
3551 GlobalData
.vPlatformList
.lastElement(),
3552 this.dmtnPlatformDescription
);
3553 iTree
.addNode(this.dmtnPlatformDescription
, node
);
3555 if (result
== DataType
.RETURN_TYPE_OK
) {
3560 public void valueChanged(TreeSelectionEvent arg0
) {
3561 // TODO Auto-generated method stub
3565 public void menuCanceled(MenuEvent arg0
) {
3566 // TODO Auto-generated method stub
3570 public void menuDeselected(MenuEvent arg0
) {
3571 // TODO Auto-generated method stub
3575 public void menuSelected(MenuEvent arg0
) {
3576 if (arg0
.getSource() == jMenuFile
) {
3578 // Enable close/close all if some files are opened
3580 switch (this.jTabbedPaneEditor
.getSelectedIndex()) {
3583 .setEnabled(GlobalData
.openingModuleList
3584 .getModuleOpen(this.currentOpeningModuleIndex
));
3586 .setEnabled(!GlobalData
.openingModuleList
3587 .getModuleSaved(this.currentOpeningModuleIndex
));
3591 .setEnabled(GlobalData
.openingPackageList
3592 .getPackageOpen(this.currentOpeningPackageIndex
));
3594 .setEnabled(!GlobalData
.openingPackageList
3595 .getPackageSaved(this.currentOpeningPackageIndex
));
3599 .setEnabled(GlobalData
.openingPlatformList
3600 .getPlatformOpen(this.currentOpeningPlatformIndex
));
3602 .setEnabled(!GlobalData
.openingPlatformList
3603 .getPlatformSaved(this.currentOpeningPlatformIndex
));
3606 jMenuItemFileCloseAll
.setEnabled(GlobalData
.openingModuleList
.isOpen()
3607 || GlobalData
.openingPackageList
.isOpen()
3608 || GlobalData
.openingPlatformList
.isOpen());
3611 // Enable save/save all if some files are changed
3613 jMenuItemFileSaveAll
.setEnabled(!GlobalData
.openingModuleList
.isSaved()
3614 || !GlobalData
.openingPackageList
.isSaved()
3615 || !GlobalData
.openingPlatformList
.isSaved());
3618 if (arg0
.getSource() == jMenuTools
) {
3620 // Enable clone when select some items
3622 if (iTree
.getSelectionPath() == null) {
3623 jMenuItemToolsClone
.setEnabled(false);
3625 int category
= iTree
.getSelectCategory();
3626 if (category
== IDefaultMutableTreeNode
.MODULE_DESCRIPTION
3627 || category
== IDefaultMutableTreeNode
.PACKAGE_DESCRIPTION
3628 || category
== IDefaultMutableTreeNode
.PLATFORM_DESCRIPTION
3629 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE
3630 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
3631 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
) {
3632 jMenuItemToolsClone
.setEnabled(false);
3634 jMenuItemToolsClone
.setEnabled(true);
3640 public void keyTyped(KeyEvent arg0
) {
3641 // TODO Auto-generated method stub
3645 public void keyPressed(KeyEvent arg0
) {
3646 // TODO Auto-generated method stub
3650 public void keyReleased(KeyEvent arg0
) {
3651 if (arg0
.getSource() == this.iTree
) {
3652 if (arg0
.getKeyCode() == KeyEvent
.VK_ENTER
) {
3653 this.doubleClickModuleTreeNode();
3659 Search whole workspace and find all module's name and guid, and save them to a file
3662 private void generateGuidsXref() {
3664 // Init File Chooser
3666 JFileChooser fc
= new JFileChooser();
3667 fc
.setCurrentDirectory(new File(Workspace
.getCurrentWorkspace()));
3668 fc
.setSelectedFile(new File(Workspace
.getCurrentWorkspace() + DataType
.FILE_SEPARATOR
3669 + DataType
.GUIDS_XREF_FILE_NAME
));
3670 fc
.setMultiSelectionEnabled(false);
3673 // Get guids xref and save to file
3675 int result
= fc
.showSaveDialog(new JPanel());
3676 if (result
== JFileChooser
.APPROVE_OPTION
) {
3677 Vector
<String
> v
= wt
.getAllModuleGuidXref();
3679 Log
.wrn("No guids found!!!");
3682 File f
= fc
.getSelectedFile();
3686 } catch (IOException e
) {
3687 Log
.wrn("Fail to create file", e
.getMessage());
3688 Log
.err("Fail to create file when generating guids.xref", e
.getMessage());
3691 FileWriter fw
= null;
3692 BufferedWriter bw
= null;
3694 fw
= new FileWriter(f
);
3695 bw
= new BufferedWriter(fw
);
3696 for (int index
= 0; index
< v
.size(); index
++) {
3697 bw
.write(v
.get(index
));
3704 } catch (IOException e
) {
3705 Log
.wrn("Fail to write file", e
.getMessage());
3706 Log
.err("Fail to write file when generating guids.xref", e
.getMessage());
3710 JOptionPane
.showConfirmDialog(this, "File is created", "Generate guids.xref", JOptionPane
.DEFAULT_OPTION
,
3711 JOptionPane
.INFORMATION_MESSAGE
);
3716 Check if WORKSPACE Environment is valid
3719 private void checkWorkspace() {
3720 switch (Workspace
.checkCurrentWorkspace()) {
3721 case Workspace
.WORKSPACE_VALID
:
3723 case Workspace
.WORKSPACE_NOT_DEFINED
:
3727 "WORKSPACE Environment Variable Is Not Defined, Please select a valid WORKSPACE directory. "
3728 + DataType
.LINE_SEPARATOR
3729 + DataType
.LINE_SEPARATOR
3731 + DataType
.LINE_SEPARATOR
3732 + "This does not change the System Environment Variable."
3733 + DataType
.LINE_SEPARATOR
3734 + "It only applies to where the Wizard will manage modification and file creations.",
3735 "Error", JOptionPane
.DEFAULT_OPTION
, JOptionPane
.ERROR_MESSAGE
);
3736 SwitchWorkspace sw
= new SwitchWorkspace(this, true);
3737 int result
= sw
.showDialog();
3738 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3741 } else if (result
== DataType
.RETURN_TYPE_OK
) {
3745 case Workspace
.WORKSPACE_NOT_EXIST
:
3746 JOptionPane
.showConfirmDialog(this, "Defined WORKSPACE Is Not Existed", "Error",
3747 JOptionPane
.DEFAULT_OPTION
, JOptionPane
.ERROR_MESSAGE
);
3750 case Workspace
.WORKSPACE_NOT_DIRECTORY
:
3751 JOptionPane
.showConfirmDialog(this, "Defined WORKSPACE Is Not A Directory", "Error",
3752 JOptionPane
.DEFAULT_OPTION
, JOptionPane
.ERROR_MESSAGE
);
3755 case Workspace
.WORKSPACE_NOT_VALID
:
3756 JOptionPane
.showConfirmDialog(this, "WORKSPACE Environment Variable Is Not Valid", "Error",
3757 JOptionPane
.DEFAULT_OPTION
, JOptionPane
.ERROR_MESSAGE
);
3760 case Workspace
.WORKSPACE_NO_TARGET_FILE
:
3761 JOptionPane
.showConfirmDialog(this, "Target.txt File Is Not Existed", "Error", JOptionPane
.DEFAULT_OPTION
,
3762 JOptionPane
.ERROR_MESSAGE
);