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
.ComponentListener
;
21 import java
.awt
.event
.MouseEvent
;
22 import java
.awt
.event
.MouseListener
;
23 import java
.awt
.event
.WindowEvent
;
24 import java
.io
.IOException
;
25 import java
.util
.Vector
;
27 import javax
.swing
.JButton
;
28 import javax
.swing
.JCheckBoxMenuItem
;
29 import javax
.swing
.JDesktopPane
;
30 import javax
.swing
.JFileChooser
;
31 import javax
.swing
.JFrame
;
32 import javax
.swing
.JInternalFrame
;
33 import javax
.swing
.JMenu
;
34 import javax
.swing
.JMenuBar
;
35 import javax
.swing
.JMenuItem
;
36 import javax
.swing
.JOptionPane
;
37 import javax
.swing
.JPanel
;
38 import javax
.swing
.JScrollPane
;
39 import javax
.swing
.JSplitPane
;
40 import javax
.swing
.JTabbedPane
;
41 import javax
.swing
.event
.MenuEvent
;
42 import javax
.swing
.event
.MenuListener
;
43 import javax
.swing
.event
.TreeSelectionEvent
;
44 import javax
.swing
.event
.TreeSelectionListener
;
46 import org
.apache
.xmlbeans
.XmlException
;
47 import org
.tianocore
.ModuleSurfaceAreaDocument
;
48 import org
.tianocore
.PackageSurfaceAreaDocument
;
49 import org
.tianocore
.PlatformSurfaceAreaDocument
;
50 import org
.tianocore
.frameworkwizard
.common
.DataType
;
51 import org
.tianocore
.frameworkwizard
.common
.IFileFilter
;
52 import org
.tianocore
.frameworkwizard
.common
.Log
;
53 import org
.tianocore
.frameworkwizard
.common
.OpenFile
;
54 import org
.tianocore
.frameworkwizard
.common
.SaveFile
;
55 import org
.tianocore
.frameworkwizard
.common
.Tools
;
56 import org
.tianocore
.frameworkwizard
.common
.Identifications
.Identification
;
57 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningModuleList
;
58 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningModuleType
;
59 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageList
;
60 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
61 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformList
;
62 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
63 import org
.tianocore
.frameworkwizard
.common
.ui
.IDefaultMutableTreeNode
;
64 import org
.tianocore
.frameworkwizard
.common
.ui
.IDesktopManager
;
65 import org
.tianocore
.frameworkwizard
.common
.ui
.IFrame
;
66 import org
.tianocore
.frameworkwizard
.common
.ui
.ITree
;
67 import org
.tianocore
.frameworkwizard
.far
.createui
.CreateStepOne
;
68 import org
.tianocore
.frameworkwizard
.far
.deleteui
.DeleteStepOne
;
69 import org
.tianocore
.frameworkwizard
.far
.installui
.InstallStepOne
;
70 import org
.tianocore
.frameworkwizard
.far
.updateui
.UpdateStepOne
;
71 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
72 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleBootModes
;
73 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleDataHubs
;
74 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleDefinitions
;
75 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleEvents
;
76 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleExterns
;
77 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleGuids
;
78 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleHiiPackages
;
79 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleHobs
;
80 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleLibraryClassDefinitions
;
81 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePCDs
;
82 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePackageDependencies
;
83 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePpis
;
84 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleProtocols
;
85 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleSourceFiles
;
86 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleSystemTables
;
87 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleVariables
;
88 import org
.tianocore
.frameworkwizard
.module
.ui
.MsaHeader
;
89 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
90 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdGuidDecls
;
91 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdHeader
;
92 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdLibClassDecls
;
93 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdMsaFiles
;
94 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPackageDefinitions
;
95 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPackageHeaders
;
96 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPcdDefs
;
97 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPpiDecls
;
98 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdProtocolDecls
;
99 import org
.tianocore
.frameworkwizard
.platform
.PlatformIdentification
;
100 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdBuildOptions
;
101 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdDynamicPcdBuildDefinitions
;
102 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdFlash
;
103 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdFrameworkModules
;
104 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdHeader
;
105 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdPlatformDefs
;
106 import org
.tianocore
.frameworkwizard
.workspace
.Workspace
;
107 import org
.tianocore
.frameworkwizard
.workspace
.WorkspaceTools
;
108 import org
.tianocore
.frameworkwizard
.workspace
.ui
.SwitchWorkspace
;
111 The class is used to show main GUI of FrameworkWizard
112 It extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener and MenuListener
115 public class FrameworkWizardUI
extends IFrame
implements MouseListener
, TreeSelectionListener
, ComponentListener
,
118 /// Define class Serial Version UID
120 private static final long serialVersionUID
= -7103240960573031772L;
123 /// Used to save information of all files
125 private Vector
<ModuleIdentification
> vModuleList
= new Vector
<ModuleIdentification
>();
127 private Vector
<PackageIdentification
> vPackageList
= new Vector
<PackageIdentification
>();
129 private Vector
<PlatformIdentification
> vPlatformList
= new Vector
<PlatformIdentification
>();
131 private OpeningModuleList openingModuleList
= new OpeningModuleList();
133 private OpeningPackageList openingPackageList
= new OpeningPackageList();
135 private OpeningPlatformList openingPlatformList
= new OpeningPlatformList();
137 private int currentOpeningModuleIndex
= -1;
139 private int currentOpeningPackageIndex
= -1;
141 private int currentOpeningPlatformIndex
= -1;
144 /// Used to generate tree structure
146 private IDefaultMutableTreeNode dmtnRoot
= null;
148 private IDefaultMutableTreeNode dmtnModuleDescription
= null;
150 private IDefaultMutableTreeNode dmtnPackageDescription
= null;
152 private IDefaultMutableTreeNode dmtnPlatformDescription
= null;
157 private JPanel jContentPane
= null;
159 private JMenuBar jMenuBar
= null;
161 private JMenu jMenuFile
= null;
163 private JMenuItem jMenuItemFileNew
= null;
165 private JMenuItem jMenuItemFileSaveAs
= null;
167 private JMenuItem jMenuItemFileExit
= null;
169 private JMenu jMenuEdit
= null;
171 private JDesktopPane jDesktopPaneModule
= null;
173 private JDesktopPane jDesktopPanePackage
= null;
175 private JDesktopPane jDesktopPanePlatform
= null;
177 private JTabbedPane jTabbedPaneTree
= null;
179 private JTabbedPane jTabbedPaneEditor
= null;
181 private IDesktopManager iDesktopManager
= new IDesktopManager();
183 private JScrollPane jScrollPaneTree
= null;
185 private ITree iTree
= null;
187 private JMenu jMenuHelp
= null;
189 private JMenuItem jMenuItemHelpAbout
= null;
191 private JMenuItem jMenuItemEditDelete
= null;
193 private WorkspaceTools wt
= new WorkspaceTools();
195 private JMenuItem jMenuItemFileSave
= null;
197 private JMenuItem jMenuItemFileClose
= null;
199 private JMenu jMenuTools
= null;
201 private JMenu jMenuWindow
= null;
203 private JPanel jPanelOperation
= null;
205 private JButton jButtonOk
= null;
207 private JButton jButtonCancel
= null;
209 private JMenuItem jMenuItemFileOpen
= null;
211 private JMenuItem jMenuItemFileCloseAll
= null;
213 private JMenuItem jMenuItemFileSaveAll
= null;
215 private JMenuItem jMenuItemFilePageSetup
= null;
217 private JMenuItem jMenuItemFilePrint
= null;
219 private JMenuItem jMenuItemFileImport
= null;
221 private JMenuItem jMenuItemFileProperties
= null;
223 private JMenu jMenuFileRecentFiles
= null;
225 private JSplitPane jSplitPane
= null;
227 private JMenuItem jMenuItemEditUndo
= null;
229 private JMenuItem jMenuItemEditRedo
= null;
231 private JMenuItem jMenuItemEditCut
= null;
233 private JMenuItem jMenuItemEditCopy
= null;
235 private JMenuItem jMenuItemEditPaste
= null;
237 private JMenuItem jMenuItemEditSelectAll
= null;
239 private JMenuItem jMenuItemEditFind
= null;
241 private JMenuItem jMenuItemEditFindNext
= null;
243 private JMenu jMenuView
= null;
245 private JMenu jMenuViewToolbars
= null;
247 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsFile
= null;
249 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsEdit
= null;
251 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsWindow
= null;
253 private JMenuItem jMenuItemViewStandard
= null;
255 private JMenuItem jMenuItemViewAdvanced
= null;
257 private JMenu jMenuProject
= null;
259 private JMenuItem jMenuItemProjectAdmin
= null;
261 private JMenuItem jMenuItemProjectChangeWorkspace
= null;
263 private JMenu jMenuProjectBuildTargets
= null;
265 private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug
= null;
267 private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease
= null;
269 private JMenuItem jMenuItemToolsToolChainConfiguration
= null;
271 private JMenuItem jMenuItemToolsClone
= null;
273 private JMenuItem jMenuItemToolsCodeScan
= null;
275 private JMenuItem jMenuItemWindowDisplaySide
= null;
277 private JMenuItem jMenuItemWindowDisplayTopBottom
= null;
279 private JMenuItem jMenuItemViewXML
= null;
281 private JMenuItem jMenuItemWindowTabView
= null;
283 private JMenuItem jMenuItemWindowSource
= null;
285 private JMenuItem jMenuItemWindowXML
= null;
287 private JMenuItem jMenuItemWindowPreferences
= null;
289 private JMenuItem jMenuItemHelpContents
= null;
291 private JMenuItem jMenuItemHelpIndex
= null;
293 private JMenuItem jMenuItemHelpSearch
= null;
295 private JMenuItem jMenuItemProjectInstallFar
= null;
297 private JMenuItem jMenuItemProjectUpdateFar
= null;
299 private JMenuItem jMenuItemProjectRemoveFar
= null;
301 private JMenuItem jMenuItemProjectCreateFar
= null;
304 /// A static definition for this class itself
306 private static FrameworkWizardUI fwui
= null;
309 If the class hasn't an instnace, new one.
311 @return FrameworkWizardUI The instance of this class
314 public static FrameworkWizardUI
getInstance() {
316 fwui
= new FrameworkWizardUI();
322 This method initializes jMenuBar
324 @return javax.swing.JMenuBar Main menu bar for the entire GUI
327 private JMenuBar
getjJMenuBar() {
328 if (jMenuBar
== null) {
329 jMenuBar
= new JMenuBar();
330 jMenuBar
.setPreferredSize(new java
.awt
.Dimension(0, 18));
331 jMenuBar
.add(getJMenuFile());
332 jMenuBar
.add(getJMenuEdit());
333 jMenuBar
.add(getJMenuView());
334 jMenuBar
.add(getJMenuProject());
335 jMenuBar
.add(getJMenuTools());
336 jMenuBar
.add(getJMenuWindow());
337 jMenuBar
.add(getJMenuHelp());
343 This method initializes jSplitPane
345 @return javax.swing.JSplitPane
348 private JSplitPane
getJSplitPane() {
349 if (jSplitPane
== null) {
350 jSplitPane
= new JSplitPane(JSplitPane
.HORIZONTAL_SPLIT
, getJTabbedPaneTree(), getJTabbedPaneEditor());
351 jSplitPane
.setBounds(new java
.awt
.Rectangle(0, 1, DataType
.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH
,
352 DataType
.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT
));
353 jSplitPane
.addComponentListener(this);
359 This method initializes jTabbedPaneEditor
361 @return javax.swing.JTabbedPane
364 private JTabbedPane
getJTabbedPaneEditor() {
365 if (jTabbedPaneEditor
== null) {
366 jTabbedPaneEditor
= new JTabbedPane();
367 jTabbedPaneEditor
.setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
368 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
369 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
370 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
372 .setMinimumSize(new java
.awt
.Dimension(
373 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
374 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
375 jTabbedPaneEditor
.addTab("Module", null, getJDesktopPaneModule(), null);
376 jTabbedPaneEditor
.addTab("Package", null, getJDesktopPanePackage(), null);
377 jTabbedPaneEditor
.addTab("Platform", null, getJDesktopPanePlatform(), null);
379 return jTabbedPaneEditor
;
383 This method initializes jTabbedPaneTree
385 @return javax.swing.JTabbedPane
388 private JTabbedPane
getJTabbedPaneTree() {
389 if (jTabbedPaneTree
== null) {
390 jTabbedPaneTree
= new JTabbedPane();
392 .setPreferredSize(new java
.awt
.Dimension(
393 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
394 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
396 .setMinimumSize(new java
.awt
.Dimension(DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
397 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
398 jTabbedPaneTree
.addTab("Workspace Explorer", null, getJScrollPaneTree(), null);
400 return jTabbedPaneTree
;
404 This method initializes jMenuFile
406 @return javax.swing.JMenu jMenuModule
409 private JMenu
getJMenuFile() {
410 if (jMenuFile
== null) {
412 // Set jMenuFile's attributes
414 jMenuFile
= new JMenu();
415 jMenuFile
.setText("File");
416 jMenuFile
.setMnemonic('F');
417 jMenuFile
.addMenuListener(this);
420 // Add sub menu items
422 jMenuFile
.add(getJMenuItemFileNew());
423 jMenuFile
.add(getJMenuItemFileOpen());
424 jMenuFile
.add(getJMenuItemFileClose());
425 jMenuFile
.add(getJMenuItemFileCloseAll());
426 jMenuFile
.addSeparator();
428 jMenuFile
.add(getJMenuFileRecentFiles());
429 jMenuFile
.add(getJMenuItemFileSave());
430 jMenuFile
.add(getJMenuItemFileSaveAs());
431 jMenuFile
.add(getJMenuItemFileSaveAll());
432 jMenuFile
.addSeparator();
434 jMenuFile
.add(getJMenuItemFilePageSetup());
435 jMenuFile
.add(getJMenuItemFilePrint());
436 jMenuFile
.add(getJMenuItemFileImport());
437 jMenuFile
.add(getJMenuItemFileProperties());
439 jMenuFile
.add(getJMenuItemFileExit());
445 This method initializes jMenuItemFileSaveAs
447 @return javax.swing.JMenuItem jMenuItemFileSaveAs
450 private JMenuItem
getJMenuItemFileSaveAs() {
451 if (jMenuItemFileSaveAs
== null) {
452 jMenuItemFileSaveAs
= new JMenuItem();
453 jMenuItemFileSaveAs
.setText("Save As...");
454 jMenuItemFileSaveAs
.setMnemonic('a');
455 jMenuItemFileSaveAs
.addActionListener(this);
456 jMenuItemFileSaveAs
.setEnabled(false);
457 jMenuItemFileSaveAs
.setVisible(false);
459 return jMenuItemFileSaveAs
;
463 This method initializes jMenuItemModuleExit
465 @return javax.swing.JMenuItem jMenuItemModuleExit
468 private JMenuItem
getJMenuItemFileExit() {
469 if (jMenuItemFileExit
== null) {
470 jMenuItemFileExit
= new JMenuItem();
471 jMenuItemFileExit
.setText("Exit");
472 jMenuItemFileExit
.setMnemonic('x');
473 jMenuItemFileExit
.addActionListener(this);
475 return jMenuItemFileExit
;
479 This method initializes jMenuEdit
481 @return javax.swing.JMenu jMenuEdit
484 private JMenu
getJMenuEdit() {
485 if (jMenuEdit
== null) {
487 // Set jMenuEdit's attributes
489 jMenuEdit
= new JMenu();
490 jMenuEdit
.setText("Edit");
491 jMenuEdit
.setMnemonic('E');
492 jMenuEdit
.setVisible(false);
495 // Add sub menu items
497 jMenuEdit
.add(getJMenuItemEditUndo());
498 jMenuEdit
.add(getJMenuItemEditRedo());
499 jMenuEdit
.addSeparator();
501 jMenuEdit
.add(getJMenuItemEditCut());
502 jMenuEdit
.add(getJMenuItemEditCopy());
503 jMenuEdit
.add(getJMenuItemEditPaste());
504 jMenuEdit
.add(getJMenuItemEditDelete());
505 jMenuEdit
.addSeparator();
507 jMenuEdit
.add(getJMenuItemEditSelectAll());
508 jMenuEdit
.add(getJMenuItemEditFind());
509 jMenuEdit
.add(getJMenuItemEditFindNext());
510 jMenuEdit
.addSeparator();
516 This method initializes jDesktopPane
518 @return javax.swing.JDesktopPane jDesktopPane
521 private JDesktopPane
getJDesktopPaneModule() {
522 if (jDesktopPaneModule
== null) {
523 jDesktopPaneModule
= new JDesktopPane();
525 .setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
526 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
527 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
528 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
530 .setMinimumSize(new java
.awt
.Dimension(
531 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
532 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
533 jDesktopPaneModule
.setDesktopManager(iDesktopManager
);
534 jDesktopPaneModule
.addComponentListener(this);
536 return jDesktopPaneModule
;
540 This method initializes jDesktopPane
542 @return javax.swing.JDesktopPane jDesktopPane
545 private JDesktopPane
getJDesktopPanePackage() {
546 if (jDesktopPanePackage
== null) {
547 jDesktopPanePackage
= new JDesktopPane();
549 .setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
550 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
551 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
552 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
554 .setMinimumSize(new java
.awt
.Dimension(
555 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
556 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
557 jDesktopPanePackage
.setDesktopManager(iDesktopManager
);
558 jDesktopPanePackage
.addComponentListener(this);
560 return jDesktopPanePackage
;
564 This method initializes jDesktopPane
566 @return javax.swing.JDesktopPane jDesktopPane
569 private JDesktopPane
getJDesktopPanePlatform() {
570 if (jDesktopPanePlatform
== null) {
571 jDesktopPanePlatform
= new JDesktopPane();
573 .setBounds(new java
.awt
.Rectangle(
574 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
575 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
576 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
577 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
579 .setMinimumSize(new java
.awt
.Dimension(
580 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
581 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
582 jDesktopPanePlatform
.setDesktopManager(iDesktopManager
);
583 jDesktopPanePlatform
.addComponentListener(this);
585 return jDesktopPanePlatform
;
589 This method initializes jScrollPaneTree
591 @return javax.swing.JScrollPane jScrollPaneTree
594 private JScrollPane
getJScrollPaneTree() {
595 if (jScrollPaneTree
== null) {
596 jScrollPaneTree
= new JScrollPane();
598 .setPreferredSize(new java
.awt
.Dimension(
599 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
600 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
602 .setMinimumSize(new java
.awt
.Dimension(
603 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
/ 2,
604 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
605 jScrollPaneTree
.setViewportView(getITree());
607 return jScrollPaneTree
;
611 This method initializes iTree
613 @return org.tianocore.packaging.common.ui.ITree iTree
616 private ITree
getITree() {
618 //Before open a real module, use an empty root node for the tree
625 This method initializes jMenuHelp
627 @return javax.swing.JMenu jMenuHelp
630 private JMenu
getJMenuHelp() {
631 if (jMenuHelp
== null) {
633 // Set jMenuHelp's attributes
635 jMenuHelp
= new JMenu();
636 jMenuHelp
.setText("Help");
639 // Add sub menu items
641 jMenuHelp
.add(getJMenuItemHelpContents());
642 jMenuHelp
.add(getJMenuItemHelpIndex());
643 jMenuHelp
.add(getJMenuItemHelpSearch());
645 jMenuHelp
.add(getJMenuItemHelpAbout());
651 This method initializes jMenuItemHelpAbout
653 @return javax.swing.JMenuItem jMenuItemHelpAbout
656 private JMenuItem
getJMenuItemHelpAbout() {
657 if (jMenuItemHelpAbout
== null) {
658 jMenuItemHelpAbout
= new JMenuItem();
659 jMenuItemHelpAbout
.setText("About...");
660 jMenuItemHelpAbout
.addActionListener(this);
662 return jMenuItemHelpAbout
;
666 This method initializes jMenuItemEditDelete
668 @return javax.swing.JMenuItem jMenuItemEditDelete
671 private JMenuItem
getJMenuItemEditDelete() {
672 if (jMenuItemEditDelete
== null) {
673 jMenuItemEditDelete
= new JMenuItem();
674 jMenuItemEditDelete
.setText("Delete");
675 jMenuItemEditDelete
.setMnemonic('D');
676 jMenuItemEditDelete
.addActionListener(this);
678 //Disabled first when no module is open
680 jMenuItemEditDelete
.setEnabled(false);
682 return jMenuItemEditDelete
;
686 This method initializes jMenuFileNew
688 @return javax.swing.JMenuItem jMenuFileNew
691 private JMenuItem
getJMenuItemFileNew() {
692 if (jMenuItemFileNew
== null) {
693 jMenuItemFileNew
= new JMenuItem();
694 jMenuItemFileNew
.setText("New...");
695 jMenuItemFileNew
.setMnemonic('N');
696 jMenuItemFileNew
.addActionListener(this);
698 return jMenuItemFileNew
;
702 This method initializes jMenuItemFileSave
704 @return javax.swing.JMenuItem jMenuItemModuleSave
707 private JMenuItem
getJMenuItemFileSave() {
708 if (jMenuItemFileSave
== null) {
709 jMenuItemFileSave
= new JMenuItem();
710 jMenuItemFileSave
.setText("Save");
711 jMenuItemFileSave
.setMnemonic('S');
712 jMenuItemFileSave
.addActionListener(this);
713 jMenuItemFileSave
.setEnabled(true);
715 return jMenuItemFileSave
;
719 This method initializes jMenuItemModuleClose
721 @return javax.swing.JMenuItem jMenuItemModuleClose
724 private JMenuItem
getJMenuItemFileClose() {
725 if (jMenuItemFileClose
== null) {
726 jMenuItemFileClose
= new JMenuItem();
727 jMenuItemFileClose
.setText("Close");
728 jMenuItemFileClose
.setMnemonic('C');
729 jMenuItemFileClose
.setEnabled(true);
730 jMenuItemFileClose
.addActionListener(this);
732 return jMenuItemFileClose
;
736 This method initializes jMenuTools
739 @return javax.swing.JMenu jMenuTools
742 private JMenu
getJMenuTools() {
743 if (jMenuTools
== null) {
745 // Set jMenuTools's attributes
747 jMenuTools
= new JMenu();
748 jMenuTools
.setText("Tools");
749 jMenuTools
.setMnemonic('T');
750 jMenuTools
.addMenuListener(this);
753 // Add sub menu items
755 jMenuTools
.add(getJMenuItemToolsToolChainConfiguration());
756 jMenuTools
.addSeparator();
758 jMenuTools
.add(getJMenuItemToolsClone());
759 jMenuTools
.add(getJMenuItemToolsCodeScan());
765 This method initializes jMenuWindow
768 @return javax.swing.JMenu jMenuWindow
771 private JMenu
getJMenuWindow() {
772 if (jMenuWindow
== null) {
774 // Set jMenuWindow's attribute
776 jMenuWindow
= new JMenu();
777 jMenuWindow
.setText("Window");
778 jMenuWindow
.setMnemonic('W');
779 jMenuWindow
.setVisible(false);
782 // Add sub menu items
784 jMenuWindow
.add(getJMenuItemWindowDisplaySide());
785 jMenuWindow
.add(getJMenuItemWindowDisplayTopBottom());
786 jMenuWindow
.addSeparator();
788 jMenuWindow
.add(getJMenuItemWindowTabView());
789 jMenuWindow
.addSeparator();
791 jMenuWindow
.add(getJMenuItemWindowSource());
792 jMenuWindow
.add(getJMenuItemWindowXML());
793 jMenuWindow
.addSeparator();
795 jMenuWindow
.add(getJMenuItemWindowPreferences());
801 This method initializes jPanelOperation
804 @return javax.swing.JPanel jPanelOperation
807 private JPanel
getJPanelOperation() {
808 if (jPanelOperation
== null) {
809 jPanelOperation
= new JPanel();
810 jPanelOperation
.setLayout(null);
811 jPanelOperation
.setBounds(new java
.awt
.Rectangle(295, 520, 500, 25));
812 jPanelOperation
.add(getJButtonOk(), null);
813 jPanelOperation
.add(getJButtonCancel(), null);
814 jPanelOperation
.setVisible(false);
816 return jPanelOperation
;
820 This method initializes jButtonOk
823 @return javax.swing.JButton jButtonOk
826 private JButton
getJButtonOk() {
827 if (jButtonOk
== null) {
828 jButtonOk
= new JButton();
829 jButtonOk
.setBounds(new java
.awt
.Rectangle(395, 2, 90, 20));
830 jButtonOk
.setText("Ok");
831 jButtonOk
.setEnabled(false);
832 jButtonOk
.addActionListener(this);
838 This method initializes jButtonCancel
841 @return javax.swing.JButton jButtonCancel
844 private JButton
getJButtonCancel() {
845 if (jButtonCancel
== null) {
846 jButtonCancel
= new JButton();
847 jButtonCancel
.setBounds(new java
.awt
.Rectangle(395, 2, 90, 20));
848 jButtonCancel
.setText("Cancel");
849 jButtonCancel
.setEnabled(false);
850 jButtonCancel
.addActionListener(this);
851 jButtonCancel
.setVisible(false);
853 return jButtonCancel
;
857 This method initializes jMenuItemFileOpen
859 @return javax.swing.JMenuItem jMenuItemFileOpen
862 private JMenuItem
getJMenuItemFileOpen() {
863 if (jMenuItemFileOpen
== null) {
864 jMenuItemFileOpen
= new JMenuItem();
865 jMenuItemFileOpen
.setText("Open...");
866 jMenuItemFileOpen
.setMnemonic('O');
867 jMenuItemFileOpen
.addActionListener(this);
869 return jMenuItemFileOpen
;
873 This method initializes jMenuItemFileCloseAll
875 @return javax.swing.JMenuItem jMenuItemFileOpen
878 private JMenuItem
getJMenuItemFileCloseAll() {
879 if (jMenuItemFileCloseAll
== null) {
880 jMenuItemFileCloseAll
= new JMenuItem();
881 jMenuItemFileCloseAll
.setText("Close All");
882 jMenuItemFileCloseAll
.setEnabled(true);
883 jMenuItemFileCloseAll
.addActionListener(this);
885 return jMenuItemFileCloseAll
;
889 This method initializes jMenuItemFileSaveAll
891 @return javax.swing.JMenuItem jMenuItemFileSaveAll
894 private JMenuItem
getJMenuItemFileSaveAll() {
895 if (jMenuItemFileSaveAll
== null) {
896 jMenuItemFileSaveAll
= new JMenuItem();
897 jMenuItemFileSaveAll
.setText("Save All");
898 jMenuItemFileSaveAll
.setMnemonic('v');
899 jMenuItemFileSaveAll
.setEnabled(true);
900 jMenuItemFileSaveAll
.addActionListener(this);
902 return jMenuItemFileSaveAll
;
906 This method initializes jMenuItemFilePageSetup
908 @return javax.swing.JMenuItem
911 private JMenuItem
getJMenuItemFilePageSetup() {
912 if (jMenuItemFilePageSetup
== null) {
913 jMenuItemFilePageSetup
= new JMenuItem();
914 jMenuItemFilePageSetup
.setText("Page Setup");
915 jMenuItemFilePageSetup
.setMnemonic('u');
916 jMenuItemFilePageSetup
.setEnabled(false);
917 jMenuItemFilePageSetup
.addActionListener(this);
918 jMenuItemFilePageSetup
.setVisible(false);
920 return jMenuItemFilePageSetup
;
924 This method initializes jMenuItemFilePrint
926 @return javax.swing.JMenuItem
929 private JMenuItem
getJMenuItemFilePrint() {
930 if (jMenuItemFilePrint
== null) {
931 jMenuItemFilePrint
= new JMenuItem();
932 jMenuItemFilePrint
.setText("Print");
933 jMenuItemFilePrint
.setMnemonic('P');
934 jMenuItemFilePrint
.setEnabled(false);
935 jMenuItemFilePrint
.addActionListener(this);
936 jMenuItemFilePrint
.setVisible(false);
938 return jMenuItemFilePrint
;
942 This method initializes jMenuItemFileImport
944 @return javax.swing.JMenuItem
947 private JMenuItem
getJMenuItemFileImport() {
948 if (jMenuItemFileImport
== null) {
949 jMenuItemFileImport
= new JMenuItem();
950 jMenuItemFileImport
.setText("Import");
951 jMenuItemFileImport
.setMnemonic('I');
952 jMenuItemFileImport
.setEnabled(false);
953 jMenuItemFileImport
.addActionListener(this);
954 jMenuItemFileImport
.setVisible(false);
956 return jMenuItemFileImport
;
960 This method initializes jMenuItemFileProperties
962 @return javax.swing.JMenuItem
965 private JMenuItem
getJMenuItemFileProperties() {
966 if (jMenuItemFileProperties
== null) {
967 jMenuItemFileProperties
= new JMenuItem();
968 jMenuItemFileProperties
.setText("Properties");
969 jMenuItemFileProperties
.setMnemonic('t');
970 jMenuItemFileProperties
.setEnabled(false);
971 jMenuItemFileProperties
.addActionListener(this);
972 jMenuItemFileProperties
.setVisible(false);
974 return jMenuItemFileProperties
;
978 This method initializes jMenuFileRecentFiles
980 @return javax.swing.JMenu
983 private JMenu
getJMenuFileRecentFiles() {
984 if (jMenuFileRecentFiles
== null) {
985 jMenuFileRecentFiles
= new JMenu();
986 jMenuFileRecentFiles
.setText("Recent Files");
987 jMenuFileRecentFiles
.setMnemonic('F');
988 jMenuFileRecentFiles
.setEnabled(false);
989 jMenuFileRecentFiles
.addActionListener(this);
990 jMenuFileRecentFiles
.setVisible(false);
992 return jMenuFileRecentFiles
;
996 This method initializes jMenuItemEditUndo
998 @return javax.swing.JMenuItem
1001 private JMenuItem
getJMenuItemEditUndo() {
1002 if (jMenuItemEditUndo
== null) {
1003 jMenuItemEditUndo
= new JMenuItem();
1004 jMenuItemEditUndo
.setText("Undo");
1005 jMenuItemEditUndo
.setMnemonic('U');
1006 jMenuItemEditUndo
.setEnabled(false);
1007 jMenuItemEditUndo
.addActionListener(this);
1009 return jMenuItemEditUndo
;
1013 This method initializes jMenuItemEditRedo
1015 @return javax.swing.JMenuItem
1018 private JMenuItem
getJMenuItemEditRedo() {
1019 if (jMenuItemEditRedo
== null) {
1020 jMenuItemEditRedo
= new JMenuItem();
1021 jMenuItemEditRedo
.setText("Redo");
1022 jMenuItemEditRedo
.setMnemonic('R');
1023 jMenuItemEditRedo
.setEnabled(false);
1024 jMenuItemEditRedo
.addActionListener(this);
1026 return jMenuItemEditRedo
;
1030 This method initializes jMenuItemEditCut
1032 @return javax.swing.JMenuItem
1035 private JMenuItem
getJMenuItemEditCut() {
1036 if (jMenuItemEditCut
== null) {
1037 jMenuItemEditCut
= new JMenuItem();
1038 jMenuItemEditCut
.setText("Cut");
1039 jMenuItemEditCut
.setMnemonic('t');
1040 jMenuItemEditCut
.setEnabled(false);
1041 jMenuItemEditCut
.addActionListener(this);
1043 return jMenuItemEditCut
;
1047 This method initializes jMenuItemEditCopy
1049 @return javax.swing.JMenuItem
1052 private JMenuItem
getJMenuItemEditCopy() {
1053 if (jMenuItemEditCopy
== null) {
1054 jMenuItemEditCopy
= new JMenuItem();
1055 jMenuItemEditCopy
.setText("Copy");
1056 jMenuItemEditCopy
.setMnemonic('C');
1057 jMenuItemEditCopy
.setEnabled(false);
1058 jMenuItemEditCopy
.addActionListener(this);
1060 return jMenuItemEditCopy
;
1064 This method initializes jMenuItemEditPaste
1066 return javax.swing.JMenuItem
1069 private JMenuItem
getJMenuItemEditPaste() {
1070 if (jMenuItemEditPaste
== null) {
1071 jMenuItemEditPaste
= new JMenuItem();
1072 jMenuItemEditPaste
.setText("Paste");
1073 jMenuItemEditPaste
.setMnemonic('P');
1074 jMenuItemEditPaste
.setEnabled(false);
1075 jMenuItemEditPaste
.addActionListener(this);
1077 return jMenuItemEditPaste
;
1081 This method initializes jMenuItem
1083 @return javax.swing.JMenuItem
1086 private JMenuItem
getJMenuItemEditSelectAll() {
1087 if (jMenuItemEditSelectAll
== null) {
1088 jMenuItemEditSelectAll
= new JMenuItem();
1089 jMenuItemEditSelectAll
.setText("Select All");
1090 jMenuItemEditSelectAll
.setMnemonic('A');
1091 jMenuItemEditSelectAll
.setEnabled(false);
1092 jMenuItemEditSelectAll
.addActionListener(this);
1094 return jMenuItemEditSelectAll
;
1098 This method initializes jMenuItemEditFind
1100 @return javax.swing.JMenuItem
1103 private JMenuItem
getJMenuItemEditFind() {
1104 if (jMenuItemEditFind
== null) {
1105 jMenuItemEditFind
= new JMenuItem();
1106 jMenuItemEditFind
.setText("Find");
1107 jMenuItemEditFind
.setMnemonic('F');
1108 jMenuItemEditFind
.setEnabled(false);
1109 jMenuItemEditFind
.addActionListener(this);
1111 return jMenuItemEditFind
;
1115 This method initializes jMenuItemEditFindNext
1117 @return javax.swing.JMenuItem
1120 private JMenuItem
getJMenuItemEditFindNext() {
1121 if (jMenuItemEditFindNext
== null) {
1122 jMenuItemEditFindNext
= new JMenuItem();
1123 jMenuItemEditFindNext
.setText("Find Next");
1124 jMenuItemEditFindNext
.setMnemonic('n');
1125 jMenuItemEditFindNext
.setEnabled(false);
1126 jMenuItemEditFindNext
.addActionListener(this);
1128 return jMenuItemEditFindNext
;
1132 This method initializes jMenuView
1134 @return javax.swing.JMenu
1137 private JMenu
getJMenuView() {
1138 if (jMenuView
== null) {
1140 // Set jMenuView's attributes
1142 jMenuView
= new JMenu();
1143 jMenuView
.setText("View");
1144 jMenuView
.setMnemonic('V');
1145 jMenuView
.setVisible(false);
1148 // Add sub menu items
1150 jMenuView
.add(getJMenuViewToolbars());
1151 jMenuView
.add(getJMenuItemViewAdvanced());
1152 jMenuView
.add(getJMenuItemViewStandard());
1153 jMenuView
.add(getJMenuItemViewXML());
1159 This method initializes jMenuViewToolbars
1161 @return javax.swing.JMenu
1164 private JMenu
getJMenuViewToolbars() {
1165 if (jMenuViewToolbars
== null) {
1166 jMenuViewToolbars
= new JMenu();
1167 jMenuViewToolbars
.setText("Toolbars");
1168 jMenuViewToolbars
.setMnemonic('T');
1170 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsFile());
1171 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsEdit());
1172 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsWindow());
1174 return jMenuViewToolbars
;
1178 This method initializes jCheckBoxMenuItemViewToolbarsFile
1180 @return javax.swing.JCheckBoxMenuItem
1183 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsFile() {
1184 if (jCheckBoxMenuItemViewToolbarsFile
== null) {
1185 jCheckBoxMenuItemViewToolbarsFile
= new JCheckBoxMenuItem();
1186 jCheckBoxMenuItemViewToolbarsFile
.setText("File");
1187 jCheckBoxMenuItemViewToolbarsFile
.setEnabled(false);
1188 jCheckBoxMenuItemViewToolbarsFile
.addActionListener(this);
1190 return jCheckBoxMenuItemViewToolbarsFile
;
1194 This method initializes jCheckBoxMenuItemViewToolbarsEdit
1196 @return javax.swing.JCheckBoxMenuItem
1199 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsEdit() {
1200 if (jCheckBoxMenuItemViewToolbarsEdit
== null) {
1201 jCheckBoxMenuItemViewToolbarsEdit
= new JCheckBoxMenuItem();
1202 jCheckBoxMenuItemViewToolbarsEdit
.setText("Edit");
1203 jCheckBoxMenuItemViewToolbarsEdit
.setEnabled(false);
1204 jCheckBoxMenuItemViewToolbarsEdit
.addActionListener(this);
1206 return jCheckBoxMenuItemViewToolbarsEdit
;
1210 This method initializes jCheckBoxMenuItemViewToolbarsWindow
1212 @return javax.swing.JCheckBoxMenuItem
1215 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsWindow() {
1216 if (jCheckBoxMenuItemViewToolbarsWindow
== null) {
1217 jCheckBoxMenuItemViewToolbarsWindow
= new JCheckBoxMenuItem();
1218 jCheckBoxMenuItemViewToolbarsWindow
.setText("Window");
1219 jCheckBoxMenuItemViewToolbarsWindow
.setEnabled(false);
1220 jCheckBoxMenuItemViewToolbarsWindow
.addActionListener(this);
1222 return jCheckBoxMenuItemViewToolbarsWindow
;
1226 This method initializes jMenuItemStandard
1228 @return javax.swing.JMenuItem
1231 private JMenuItem
getJMenuItemViewStandard() {
1232 if (jMenuItemViewStandard
== null) {
1233 jMenuItemViewStandard
= new JMenuItem();
1234 jMenuItemViewStandard
.setText("Standard");
1235 jMenuItemViewStandard
.setMnemonic('S');
1236 jMenuItemViewStandard
.setEnabled(false);
1237 jMenuItemViewStandard
.addActionListener(this);
1239 return jMenuItemViewStandard
;
1243 This method initializes jMenuItemAdvanced
1245 @return javax.swing.JMenuItem
1248 private JMenuItem
getJMenuItemViewAdvanced() {
1249 if (jMenuItemViewAdvanced
== null) {
1250 jMenuItemViewAdvanced
= new JMenuItem();
1251 jMenuItemViewAdvanced
.setText("Advanced");
1252 jMenuItemViewAdvanced
.setMnemonic('A');
1253 jMenuItemViewAdvanced
.setEnabled(false);
1254 jMenuItemViewAdvanced
.addActionListener(this);
1256 return jMenuItemViewAdvanced
;
1260 This method initializes jMenuProject
1262 @return javax.swing.JMenu
1265 private JMenu
getJMenuProject() {
1266 if (jMenuProject
== null) {
1268 // Set jMenuProject's attributes
1270 jMenuProject
= new JMenu();
1271 jMenuProject
.setText("Project");
1272 jMenuProject
.setMnemonic('P');
1275 // Add sub menu items
1277 jMenuProject
.add(getJMenuItemProjectAdmin());
1279 jMenuProject
.add(getJMenuItemProjectChangeWorkspace());
1280 jMenuProject
.addSeparator();
1282 jMenuProject
.add(getJMenuItemProjectCreateFar());
1283 jMenuProject
.add(getJMenuItemProjectInstallFar());
1284 jMenuProject
.add(getJMenuItemProjectUpdateFar());
1285 jMenuProject
.add(getJMenuItemProjectRemoveFar());
1287 jMenuProject
.add(getJMenuProjectBuildTargets());
1289 return jMenuProject
;
1293 This method initializes jMenuItemProjectAdmin
1295 @return javax.swing.JMenuItem
1298 private JMenuItem
getJMenuItemProjectAdmin() {
1299 if (jMenuItemProjectAdmin
== null) {
1300 jMenuItemProjectAdmin
= new JMenuItem();
1301 jMenuItemProjectAdmin
.setText("Admin...");
1302 jMenuItemProjectAdmin
.setMnemonic('A');
1303 jMenuItemProjectAdmin
.setEnabled(false);
1304 jMenuItemProjectAdmin
.addActionListener(this);
1305 jMenuItemProjectAdmin
.setVisible(false);
1307 return jMenuItemProjectAdmin
;
1311 This method initializes jMenuItemProjectChangeWorkspace
1313 @return javax.swing.JMenuItem
1316 private JMenuItem
getJMenuItemProjectChangeWorkspace() {
1317 if (jMenuItemProjectChangeWorkspace
== null) {
1318 jMenuItemProjectChangeWorkspace
= new JMenuItem();
1319 jMenuItemProjectChangeWorkspace
.setText("Change WORKSPACE...");
1320 jMenuItemProjectChangeWorkspace
.setMnemonic('W');
1321 jMenuItemProjectChangeWorkspace
.setEnabled(true);
1322 jMenuItemProjectChangeWorkspace
.addActionListener(this);
1324 return jMenuItemProjectChangeWorkspace
;
1328 This method initializes jMenuProjectBuildTargets
1330 @return javax.swing.JMenu
1333 private JMenu
getJMenuProjectBuildTargets() {
1334 if (jMenuProjectBuildTargets
== null) {
1335 jMenuProjectBuildTargets
= new JMenu();
1336 jMenuProjectBuildTargets
.setText("Build Targets");
1337 jMenuProjectBuildTargets
.setMnemonic('T');
1338 jMenuProjectBuildTargets
.setVisible(false);
1340 jMenuProjectBuildTargets
.add(getJCheckBoxMenuItemProjectBuildTargetsDebug());
1341 jMenuProjectBuildTargets
.add(getJCheckBoxMenuItemProjectBuildTargetsRelease());
1343 return jMenuProjectBuildTargets
;
1347 This method initializes jCheckBoxMenuItemProjectBuildTargetsDebug
1349 @return javax.swing.JCheckBoxMenuItem
1352 private JCheckBoxMenuItem
getJCheckBoxMenuItemProjectBuildTargetsDebug() {
1353 if (jCheckBoxMenuItemProjectBuildTargetsDebug
== null) {
1354 jCheckBoxMenuItemProjectBuildTargetsDebug
= new JCheckBoxMenuItem();
1355 jCheckBoxMenuItemProjectBuildTargetsDebug
.setText("Debug");
1356 jCheckBoxMenuItemProjectBuildTargetsDebug
.setEnabled(false);
1358 return jCheckBoxMenuItemProjectBuildTargetsDebug
;
1362 This method initializes jCheckBoxMenuItemProjectBuildTargetsRelease
1364 @return javax.swing.JCheckBoxMenuItem
1367 private JCheckBoxMenuItem
getJCheckBoxMenuItemProjectBuildTargetsRelease() {
1368 if (jCheckBoxMenuItemProjectBuildTargetsRelease
== null) {
1369 jCheckBoxMenuItemProjectBuildTargetsRelease
= new JCheckBoxMenuItem();
1370 jCheckBoxMenuItemProjectBuildTargetsRelease
.setText("Release");
1371 jCheckBoxMenuItemProjectBuildTargetsRelease
.setEnabled(false);
1373 return jCheckBoxMenuItemProjectBuildTargetsRelease
;
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 * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
1667 * Main class, start the GUI
1670 public static void main(String
[] args
) {
1671 FrameworkWizardUI module
= FrameworkWizardUI
.getInstance();
1672 module
.setVisible(true);
1676 This is the default constructor
1679 public FrameworkWizardUI() {
1685 This method initializes this
1689 private void init() {
1691 // Set current workspace and check
1692 // Check if exists WORKSPACE
1695 Workspace
.setCurrentWorkspace(System
.getenv("WORKSPACE"));
1696 if (!Workspace
.checkCurrentWorkspace()) {
1697 JOptionPane
.showConfirmDialog(null, "Workspace is not setup correctly. Please setup first.", "Warning",
1698 JOptionPane
.DEFAULT_OPTION
, JOptionPane
.WARNING_MESSAGE
);
1703 this.setSize(DataType
.MAIN_FRAME_PREFERRED_SIZE_WIDTH
, DataType
.MAIN_FRAME_PREFERRED_SIZE_HEIGHT
);
1704 this.setResizable(true);
1705 this.setJMenuBar(getjJMenuBar());
1706 this.addComponentListener(this);
1707 this.getCompontentsFromFrameworkDatabase();
1708 this.setContentPane(getJContentPane());
1709 this.setTitle(DataType
.PROJECT_NAME
+ " " + DataType
.PROJECT_VERSION
+ " " + "- ["
1710 + Workspace
.getCurrentWorkspace() + "]");
1711 this.setExitType(1);
1716 this.setExtendedState(JFrame
.MAXIMIZED_BOTH
);
1720 This method initializes jContentPane
1722 @return javax.swing.JPanel jContentPane
1725 private JPanel
getJContentPane() {
1726 if (jContentPane
== null) {
1727 jContentPane
= new JPanel();
1728 jContentPane
.setLayout(null);
1729 jContentPane
.add(getJPanelOperation(), null);
1730 jContentPane
.add(getJSplitPane(), null);
1732 return jContentPane
;
1736 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1738 * Override actionPerformed to listen all actions
1741 public void actionPerformed(ActionEvent arg0
) {
1743 // Operations of Menu
1745 if (arg0
.getSource() == jMenuItemFileNew
) {
1749 if (arg0
.getSource() == jMenuItemFileOpen
) {
1753 if (arg0
.getSource() == jMenuItemFileClose
) {
1757 if (arg0
.getSource() == jMenuItemFileCloseAll
) {
1761 if (arg0
.getSource() == jMenuItemFileSave
) {
1765 if (arg0
.getSource() == jMenuItemFileSaveAs
) {
1769 if (arg0
.getSource() == jMenuItemFileSaveAll
) {
1773 if (arg0
.getSource() == jMenuItemFileExit
) {
1777 if (arg0
.getSource() == jMenuItemProjectChangeWorkspace
) {
1781 if (arg0
.getSource() == jMenuItemProjectCreateFar
) {
1785 if (arg0
.getSource() == jMenuItemProjectInstallFar
) {
1789 if (arg0
.getSource() == jMenuItemProjectRemoveFar
) {
1793 if (arg0
.getSource() == jMenuItemProjectUpdateFar
) {
1797 if (arg0
.getSource() == jMenuItemToolsClone
) {
1801 if (arg0
.getSource() == jMenuItemToolsToolChainConfiguration
) {
1802 setupToolChainConfiguration();
1805 if (arg0
.getSource() == jMenuItemHelpAbout
) {
1806 About a
= new About(this, true);
1807 int result
= a
.showDialog();
1808 if (result
== DataType
.RETURN_TYPE_OK
) {
1815 Create an empty tree if no file is open
1818 private void makeEmptyTree() {
1822 dmtnRoot
= new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode
.WORKSPACE
, -1);
1825 // Make Module Description
1827 dmtnModuleDescription
= new IDefaultMutableTreeNode("ModuleDescription", IDefaultMutableTreeNode
.MODULE
, -1);
1830 // First add package
1832 if (this.vPackageList
.size() > 0) {
1833 for (int index
= 0; index
< this.vPackageList
.size(); index
++) {
1834 IDefaultMutableTreeNode dmtnModulePackage
= null;
1835 IDefaultMutableTreeNode dmtnModulePackageLibrary
= null;
1836 IDefaultMutableTreeNode dmtnModulePackageModule
= null;
1838 dmtnModulePackage
= new IDefaultMutableTreeNode(this.vPackageList
.elementAt(index
).getName(),
1839 IDefaultMutableTreeNode
.MODULE_PACKAGE
, false,
1840 this.vPackageList
.elementAt(index
));
1841 dmtnModulePackageLibrary
= new IDefaultMutableTreeNode("Library",
1842 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
,
1843 false, this.vPackageList
.elementAt(index
));
1844 dmtnModulePackageModule
= new IDefaultMutableTreeNode("Module",
1845 IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
1846 false, this.vPackageList
.elementAt(index
));
1848 // And then add each module in its package
1850 Vector
<ModuleIdentification
> vModule
= wt
.getAllModules(this.vPackageList
.elementAt(index
));
1851 for (int indexJ
= 0; indexJ
< vModule
.size(); indexJ
++) {
1852 if (vModule
.get(indexJ
).isLibrary()) {
1853 dmtnModulePackageLibrary
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
1854 IDefaultMutableTreeNode
.MSA_HEADER
,
1855 false, vModule
.get(indexJ
)));
1857 dmtnModulePackageModule
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
1858 IDefaultMutableTreeNode
.MSA_HEADER
,
1859 false, vModule
.get(indexJ
)));
1862 if (dmtnModulePackageModule
.getChildCount() > 0) {
1863 dmtnModulePackage
.add(dmtnModulePackageModule
);
1865 if (dmtnModulePackageLibrary
.getChildCount() > 0) {
1866 dmtnModulePackage
.add(dmtnModulePackageLibrary
);
1869 dmtnModuleDescription
.add(dmtnModulePackage
);
1874 // Make Package Description
1876 dmtnPackageDescription
= new IDefaultMutableTreeNode("PackageDescription", IDefaultMutableTreeNode
.PACKAGE
, -1);
1877 if (this.vPackageList
.size() > 0) {
1878 for (int index
= 0; index
< this.vPackageList
.size(); index
++) {
1879 dmtnPackageDescription
.add(new IDefaultMutableTreeNode(this.vPackageList
.elementAt(index
).getName(),
1880 IDefaultMutableTreeNode
.SPD_HEADER
, false,
1881 this.vPackageList
.elementAt(index
)));
1886 // Make Platform Description
1888 dmtnPlatformDescription
= new IDefaultMutableTreeNode("PlatformDescription", IDefaultMutableTreeNode
.PLATFORM
,
1890 if (this.vPlatformList
.size() > 0) {
1891 for (int index
= 0; index
< this.vPlatformList
.size(); index
++) {
1892 dmtnPlatformDescription
.add(new IDefaultMutableTreeNode(this.vPlatformList
.elementAt(index
).getName(),
1893 IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
,
1894 false, this.vPlatformList
.elementAt(index
)));
1899 // Add sub nodes to root node
1901 dmtnRoot
.add(dmtnModuleDescription
);
1902 dmtnRoot
.add(dmtnPackageDescription
);
1903 dmtnRoot
.add(dmtnPlatformDescription
);
1904 iTree
= new ITree(dmtnRoot
);
1905 iTree
.addMouseListener(this);
1906 jScrollPaneTree
.setViewportView(iTree
);
1910 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
1912 * Override windowClosing to popup warning message to confirm quit
1915 public void windowClosing(WindowEvent arg0
) {
1920 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
1922 * Override mouseClicked to check if need display popup menu
1925 public void mouseClicked(MouseEvent arg0
) {
1926 if (arg0
.getButton() == MouseEvent
.BUTTON1
) {
1928 if (arg0
.getButton() == MouseEvent
.BUTTON3
) {
1931 // When double click
1933 if (arg0
.getClickCount() == 2) {
1934 doubleClickModuleTreeNode();
1938 public void mouseEntered(MouseEvent arg0
) {
1939 // TODO Auto-generated method stub
1942 public void mouseExited(MouseEvent arg0
) {
1943 // TODO Auto-generated method stub
1946 public void mousePressed(MouseEvent arg0
) {
1947 // TODO Auto-generated method stub
1950 public void mouseReleased(MouseEvent arg0
) {
1951 // TODO Auto-generated method stub
1955 Remove all Internal Frame of Module Desktop Pane
1958 private void cleanDesktopPaneModule() {
1959 if (jDesktopPaneModule
!= null) {
1960 JInternalFrame
[] iif
= this.jDesktopPaneModule
.getAllFrames();
1961 for (int index
= 0; index
< iif
.length
; index
++) {
1962 iif
[index
].dispose();
1968 Remove all Internal Frame of package Desktop Pane
1971 private void cleanDesktopPanePackage() {
1972 if (jDesktopPanePlatform
!= null) {
1973 JInternalFrame
[] iif
= this.jDesktopPanePackage
.getAllFrames();
1974 for (int index
= 0; index
< iif
.length
; index
++) {
1975 iif
[index
].dispose();
1981 Remove all Internal Frame of platform Desktop Pane
1984 private void cleanDesktopPanePlatform() {
1985 if (jDesktopPanePlatform
!= null) {
1986 JInternalFrame
[] iif
= this.jDesktopPanePlatform
.getAllFrames();
1987 for (int index
= 0; index
< iif
.length
; index
++) {
1988 iif
[index
].dispose();
1994 Remove all Internal Frame of all Desktop Panes
1997 private void cleanDesktopPane() {
1998 cleanDesktopPaneModule();
1999 cleanDesktopPanePackage();
2000 cleanDesktopPanePlatform();
2004 Set file filter as input ext
2010 private int getNewFilePath(String ext
) {
2011 JFileChooser fc
= new JFileChooser(Workspace
.getCurrentWorkspace());
2012 fc
.setAcceptAllFileFilterUsed(false);
2013 fc
.addChoosableFileFilter(new IFileFilter(ext
));
2014 return fc
.showSaveDialog(new JPanel());
2018 Add a module to tree
2020 @param mid The module node to be added
2023 private void addModuleToTree(ModuleIdentification mid
) {
2025 // Add new MsaHeader node to the tree
2027 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(mid
.getName(), IDefaultMutableTreeNode
.MSA_HEADER
,
2030 // First find the module belongs to which package
2032 IDefaultMutableTreeNode packageNode
= iTree
.getNodeById(dmtnModuleDescription
, mid
.getPackageId(),
2033 IDefaultMutableTreeNode
.MODULE_PACKAGE
);
2035 // To check if has module node or library node
2037 IDefaultMutableTreeNode parentModuleNode
= null;
2038 IDefaultMutableTreeNode parentLibraryNode
= null;
2039 boolean hasModule
= false;
2040 boolean hasLibrary
= false;
2041 for (int index
= 0; index
< packageNode
.getChildCount(); index
++) {
2042 IDefaultMutableTreeNode iNode
= (IDefaultMutableTreeNode
) packageNode
.getChildAt(index
);
2043 if (iNode
.getCategory() == IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
) {
2045 parentLibraryNode
= iNode
;
2047 if (iNode
.getCategory() == IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
) {
2049 parentModuleNode
= iNode
;
2056 if (!mid
.isLibrary()) {
2058 // Create parent node first if has no parent node
2061 parentModuleNode
= new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2062 false, mid
.getPackageId());
2063 iTree
.addNode(packageNode
, parentModuleNode
);
2066 iTree
.addNode(parentModuleNode
, node
);
2072 if (mid
.isLibrary()) {
2074 // Create parent node first if has no parent node
2077 parentLibraryNode
= new IDefaultMutableTreeNode("Library",
2078 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
, false,
2079 mid
.getPackageId());
2080 iTree
.addNode(packageNode
, parentLibraryNode
);
2083 iTree
.addNode(parentLibraryNode
, node
);
2090 @param path input file path
2093 private void openModule(String path
, ModuleIdentification moduleId
) {
2094 ModuleSurfaceAreaDocument
.ModuleSurfaceArea msa
= null;
2096 msa
= OpenFile
.openMsaFile(path
);
2097 } catch (IOException e
) {
2098 Log
.wrn("Open Module Surface Area " + path
, e
.getMessage());
2099 Log
.err("Open Module Surface Area " + path
, e
.getMessage());
2101 } catch (XmlException e
) {
2102 Log
.wrn("Open Module Surface Area " + path
, e
.getMessage());
2103 Log
.err("Open Module Surface Area " + path
, e
.getMessage());
2105 } catch (Exception e
) {
2106 Log
.wrn("Open Module Surface Area " + path
, "Invalid file type");
2107 Log
.err("Open Module Surface Area " + path
, "Invalid file type");
2110 Identification id
= new Identification(msa
.getMsaHeader().getModuleName(), msa
.getMsaHeader().getGuidValue(),
2111 msa
.getMsaHeader().getVersion(), path
);
2113 // Generate module id
2115 PackageIdentification pid
= wt
.getPackageIdByModuleId(id
);
2118 // To judge if the module existed in vModuleList
2119 // If not, add it to vModuleList
2121 boolean isFind
= false;
2122 for (int index
= 0; index
< vModuleList
.size(); index
++) {
2123 if (vModuleList
.elementAt(index
).equals(id
)) {
2129 ModuleIdentification mid
= new ModuleIdentification(id
, pid
, moduleId
.isLibrary());
2130 vModuleList
.addElement(mid
);
2131 addModuleToTree(mid
);
2135 // The module is not in existing packages
2137 Log
.err("The module hasn't been added to any package of current workspace!");
2142 // Make the node selected
2144 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnModuleDescription
, id
,
2145 IDefaultMutableTreeNode
.MSA_HEADER
)));
2147 // Update opening Module list information
2149 if (!openingModuleList
.existsModule(id
)) {
2151 // Insert sub node of module
2153 insertModuleTreeNode(id
);
2154 iTree
.getSelectNode().setOpening(true);
2157 // Update opening module list
2159 openingModuleList
.insertToOpeningModuleList(id
, msa
);
2160 openingModuleList
.setTreePathById(id
, iTree
.getSelectionPath());
2163 // Show msa header in editor panel
2165 showModuleElement(IDefaultMutableTreeNode
.MSA_HEADER
, openingModuleList
.getOpeningModuleById(id
));
2166 this.currentOpeningModuleIndex
= openingModuleList
.findIndexOfListById(id
);
2172 @param path input file path
2175 private void openModule(String path
) {
2176 ModuleSurfaceAreaDocument
.ModuleSurfaceArea msa
= null;
2178 msa
= OpenFile
.openMsaFile(path
);
2179 } catch (IOException e
) {
2180 Log
.wrn("Open Module Surface Area " + path
, e
.getMessage());
2181 Log
.err("Open Module Surface Area " + path
, e
.getMessage());
2183 } catch (XmlException e
) {
2184 Log
.wrn("Open Module Surface Area " + path
, e
.getMessage());
2185 Log
.err("Open Module Surface Area " + path
, e
.getMessage());
2187 } catch (Exception e
) {
2188 Log
.wrn("Open Module Surface Area " + path
, "Invalid file type");
2189 Log
.err("Open Module Surface Area " + path
, "Invalid file type");
2192 Identification id
= new Identification(msa
.getMsaHeader().getModuleName(), msa
.getMsaHeader().getGuidValue(),
2193 msa
.getMsaHeader().getVersion(), path
);
2195 // Generate module id
2197 PackageIdentification pid
= wt
.getPackageIdByModuleId(id
);
2200 // To judge if the module existed in vModuleList
2201 // If not, add it to vModuleList
2203 boolean isFind
= false;
2204 for (int index
= 0; index
< vModuleList
.size(); index
++) {
2205 if (vModuleList
.elementAt(index
).equals(id
)) {
2211 ModuleIdentification mid
= new ModuleIdentification(id
, pid
);
2212 vModuleList
.addElement(mid
);
2213 addModuleToTree(mid
);
2217 // The module is not in existing packages
2219 Log
.wrn("Open Module", "The module hasn't been added to any package of current workspace!");
2224 // Make the node selected
2226 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnModuleDescription
, id
,
2227 IDefaultMutableTreeNode
.MSA_HEADER
)));
2229 // Update opening Module list information
2231 if (!openingModuleList
.existsModule(id
)) {
2233 // Insert sub node of module
2235 insertModuleTreeNode(id
);
2236 iTree
.getSelectNode().setOpening(true);
2239 // Update opening module list
2241 openingModuleList
.insertToOpeningModuleList(id
, msa
);
2242 openingModuleList
.setTreePathById(id
, iTree
.getSelectionPath());
2245 // Show msa header in editor panel
2247 showModuleElement(IDefaultMutableTreeNode
.MSA_HEADER
, openingModuleList
.getOpeningModuleById(id
));
2248 this.currentOpeningModuleIndex
= openingModuleList
.findIndexOfListById(id
);
2254 @param path input file path
2257 private void openPackage(String path
) {
2258 PackageSurfaceAreaDocument
.PackageSurfaceArea spd
= null;
2260 spd
= OpenFile
.openSpdFile(path
);
2261 } catch (IOException e
) {
2262 Log
.wrn("Open Package Surface Area " + path
, e
.getMessage());
2263 Log
.err("Open Package Surface Area " + path
, e
.getMessage());
2265 } catch (XmlException e
) {
2266 Log
.wrn("Open Package Surface Area " + path
, e
.getMessage());
2267 Log
.err("Open Package Surface Area " + path
, e
.getMessage());
2269 } catch (Exception e
) {
2270 Log
.wrn("Open Package Surface Area " + path
, "Invalid file type");
2271 Log
.err("Open Package Surface Area " + path
, "Invalid file type");
2274 Identification id
= new Identification(spd
.getSpdHeader().getPackageName(), spd
.getSpdHeader().getGuidValue(),
2275 spd
.getSpdHeader().getVersion(), path
);
2277 // To judge if the package existed in vPackageList
2278 // If not, add it to vPackageList
2280 boolean isFind
= false;
2281 for (int index
= 0; index
< vPackageList
.size(); index
++) {
2282 if (vPackageList
.elementAt(index
).equals(id
)) {
2289 // The module is not in existing packages
2291 Log
.wrn("Open Package", "The package hasn't been added to current workspace!");
2296 // Make the node selected
2298 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPackageDescription
, id
,
2299 IDefaultMutableTreeNode
.SPD_HEADER
)));
2301 // Update opening package list information
2303 if (!openingPackageList
.existsPackage(id
)) {
2305 // Insert sub node of module
2307 insertPackageTreeNode(id
);
2308 iTree
.getSelectNode().setOpening(true);
2311 // Update opening module list
2313 openingPackageList
.insertToOpeningPackageList(id
, spd
);
2314 openingPackageList
.setTreePathById(id
, iTree
.getSelectionPath());
2317 // Show spd header in editor panel
2319 showPackageElement(IDefaultMutableTreeNode
.SPD_HEADER
, openingPackageList
.getOpeningPackageById(id
));
2320 this.currentOpeningPackageIndex
= openingPackageList
.findIndexOfListById(id
);
2326 @param path input file path
2329 private void openPlatform(String path
) {
2330 PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
= null;
2332 fpd
= OpenFile
.openFpdFile(path
);
2333 } catch (IOException e
) {
2334 Log
.wrn("Open Platform Surface Area " + path
, e
.getMessage());
2335 Log
.err("Open Platform Surface Area " + path
, e
.getMessage());
2337 } catch (XmlException e
) {
2338 Log
.wrn("Open Platform Surface Area " + path
, e
.getMessage());
2339 Log
.err("Open Platform Surface Area " + path
, e
.getMessage());
2341 } catch (Exception e
) {
2342 Log
.wrn("Open Platform Surface Area " + path
, "Invalid file type");
2343 Log
.err("Open Platform Surface Area " + path
, "Invalid file type");
2346 Identification id
= new Identification(fpd
.getPlatformHeader().getPlatformName(), fpd
.getPlatformHeader()
2348 fpd
.getPlatformHeader().getVersion(), path
);
2350 // To judge if the platform existed in vPlatformList
2351 // If not, add it to vPlatformList
2353 boolean isFind
= false;
2354 for (int index
= 0; index
< vPlatformList
.size(); index
++) {
2355 if (vPlatformList
.elementAt(index
).equals(id
)) {
2362 // The module is not in existing packages
2364 Log
.wrn("Open Platform", "The platform hasn't been added to current workspace!");
2369 // Make the node selected
2371 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPlatformDescription
, id
,
2372 IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
)));
2374 // Update opening package list information
2376 if (!openingPlatformList
.existsPlatform(id
)) {
2378 // Insert sub node of module
2380 insertPlatformTreeNode(id
);
2381 iTree
.getSelectNode().setOpening(true);
2384 // Update opening module list
2386 openingPlatformList
.insertToOpeningPlatformList(id
, fpd
);
2387 openingPlatformList
.setTreePathById(id
, iTree
.getSelectionPath());
2390 // Show fpd header in editor panel
2392 showPlatformElement(IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
, openingPlatformList
.getOpeningPlatformById(id
));
2393 this.currentOpeningPlatformIndex
= openingPlatformList
.findIndexOfListById(id
);
2400 private void saveModule(int index
) {
2401 OpeningModuleType omt
= openingModuleList
.getOpeningModuleByIndex(index
);
2403 if (getNewFilePath(DataType
.MODULE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2408 SaveFile
.saveMsaFile(omt
.getId().getPath(), omt
.getXmlMsa());
2409 openingModuleList
.setNew(omt
.getId(), false);
2410 openingModuleList
.setModuleSaved(omt
.getId(), true);
2411 } catch (Exception e
) {
2412 Log
.wrn("Save Module", e
.getMessage());
2413 Log
.err("Save Module", e
.getMessage());
2421 private void savePackage(int index
) {
2422 OpeningPackageType opt
= openingPackageList
.getOpeningPackageByIndex(index
);
2424 if (getNewFilePath(DataType
.PACKAGE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2429 SaveFile
.saveSpdFile(opt
.getId().getPath(), opt
.getXmlSpd());
2430 openingPackageList
.setNew(opt
.getId(), false);
2431 openingPackageList
.setPackageSaved(opt
.getId(), true);
2432 } catch (Exception e
) {
2433 Log
.wrn("Save Package", e
.getMessage());
2434 Log
.err("Save Package", e
.getMessage());
2442 private void savePlatform(int index
) {
2443 OpeningPlatformType opt
= openingPlatformList
.getOpeningPlatformByIndex(index
);
2445 if (getNewFilePath(DataType
.PACKAGE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2450 SaveFile
.saveFpdFile(opt
.getId().getPath(), opt
.getXmlFpd());
2451 openingPlatformList
.setNew(opt
.getId(), false);
2452 openingPlatformList
.setPlatformSaved(opt
.getId(), true);
2453 } catch (Exception e
) {
2454 Log
.wrn("Save Package", e
.getMessage());
2455 Log
.err("Save Package", e
.getMessage());
2459 public void componentHidden(ComponentEvent arg0
) {
2460 // TODO Auto-generated method stub
2464 public void componentMoved(ComponentEvent arg0
) {
2465 // TODO Auto-generated method stub
2469 public void componentResized(ComponentEvent arg0
) {
2470 this.jSplitPane
.setSize(this.getWidth() - DataType
.MAIN_FRAME_WIDTH_SPACING
,
2471 this.getHeight() - DataType
.MAIN_FRAME_HEIGHT_SPACING
);
2472 this.jSplitPane
.validate();
2473 resizeDesktopPanel();
2476 public void componentShown(ComponentEvent arg0
) {
2477 // TODO Auto-generated method stub
2482 Resize JDesktopPanel
2485 private void resizeDesktopPanel() {
2486 resizeDesktopPanel(this.jDesktopPaneModule
);
2487 resizeDesktopPanel(this.jDesktopPanePackage
);
2488 resizeDesktopPanel(this.jDesktopPanePlatform
);
2492 Resize JDesktopPanel
2495 private void resizeDesktopPanel(JDesktopPane jdk
) {
2496 JInternalFrame
[] iif
= jdk
.getAllFrames();
2497 for (int index
= 0; index
< iif
.length
; index
++) {
2498 iif
[index
].setSize(jdk
.getWidth(), jdk
.getHeight());
2502 private void getCompontentsFromFrameworkDatabase() {
2503 this.vModuleList
= wt
.getAllModules();
2504 this.vPackageList
= wt
.getAllPackages();
2505 this.vPlatformList
= wt
.getAllPlatforms();
2508 private void insertModuleTreeNode(Identification id
) {
2509 iTree
.addNode(new IDefaultMutableTreeNode("Module Definitions", IDefaultMutableTreeNode
.MSA_MODULEDEFINITIONS
,
2511 iTree
.addNode(new IDefaultMutableTreeNode("Library Class Definitions",
2512 IDefaultMutableTreeNode
.MSA_LIBRARYCLASSDEFINITIONS
, true, id
));
2513 iTree
.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode
.MSA_SOURCEFILES
, true, id
));
2514 iTree
.addNode(new IDefaultMutableTreeNode("Package Dependencies",
2515 IDefaultMutableTreeNode
.MSA_PACKAGEDEPENDENCIES
, true, id
));
2516 iTree
.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode
.MSA_PROTOCOLS
, true, id
));
2517 iTree
.addNode(new IDefaultMutableTreeNode("Events", IDefaultMutableTreeNode
.MSA_EVENTS
, true, id
));
2518 iTree
.addNode(new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode
.MSA_HOBS
, true, id
));
2519 iTree
.addNode(new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode
.MSA_PPIS
, true, id
));
2520 iTree
.addNode(new IDefaultMutableTreeNode("Variables", IDefaultMutableTreeNode
.MSA_VARIABLES
, true, id
));
2521 iTree
.addNode(new IDefaultMutableTreeNode("Boot Modes", IDefaultMutableTreeNode
.MSA_BOOTMODES
, true, id
));
2522 iTree
.addNode(new IDefaultMutableTreeNode("System Tables", IDefaultMutableTreeNode
.MSA_SYSTEMTABLES
, true, id
));
2523 iTree
.addNode(new IDefaultMutableTreeNode("Data Hubs", IDefaultMutableTreeNode
.MSA_DATAHUBS
, true, id
));
2524 iTree
.addNode(new IDefaultMutableTreeNode("Hii Packages", IDefaultMutableTreeNode
.MSA_HIIPACKAGES
, true, id
));
2525 iTree
.addNode(new IDefaultMutableTreeNode("Guids", IDefaultMutableTreeNode
.MSA_GUIDS
, true, id
));
2526 iTree
.addNode(new IDefaultMutableTreeNode("Externs", IDefaultMutableTreeNode
.MSA_EXTERNS
, true, id
));
2527 iTree
.addNode(new IDefaultMutableTreeNode("PcdCoded", IDefaultMutableTreeNode
.MSA_PCDS
, true, id
));
2530 private void insertPackageTreeNode(Identification id
) {
2531 iTree
.addNode(new IDefaultMutableTreeNode("Package Definitions",
2532 IDefaultMutableTreeNode
.SPD_PACKAGEDEFINITIONS
, true, id
));
2533 iTree
.addNode(new IDefaultMutableTreeNode("Library Class Declarations",
2534 IDefaultMutableTreeNode
.SPD_LIBRARYCLASSDECLARATIONS
, true, id
));
2535 iTree
.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode
.SPD_MSAFILES
, false, id
));
2536 iTree
.addNode(new IDefaultMutableTreeNode("Package Headers", IDefaultMutableTreeNode
.SPD_PACKAGEHEADERS
, true,
2538 iTree
.addNode(new IDefaultMutableTreeNode("Guid Declarations", IDefaultMutableTreeNode
.SPD_GUIDDECLARATIONS
,
2540 iTree
.addNode(new IDefaultMutableTreeNode("Protocol Declarations",
2541 IDefaultMutableTreeNode
.SPD_PROTOCOLDECLARATIONS
, true, id
));
2542 iTree
.addNode(new IDefaultMutableTreeNode("Ppi Declarations", IDefaultMutableTreeNode
.SPD_PPIDECLARATIONS
,
2544 iTree
.addNode(new IDefaultMutableTreeNode("Pcd Declarations", IDefaultMutableTreeNode
.SPD_PCDDECLARATIONS
,
2548 private void insertPlatformTreeNode(Identification id
) {
2549 iTree
.addNode(new IDefaultMutableTreeNode("Platform Definitions",
2550 IDefaultMutableTreeNode
.FPD_PLATFORMDEFINITIONS
, true, id
));
2551 iTree
.addNode(new IDefaultMutableTreeNode("Flash", IDefaultMutableTreeNode
.FPD_FLASH
, true, id
));
2552 iTree
.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode
.FPD_FRAMEWORKMODULES
,
2554 iTree
.addNode(new IDefaultMutableTreeNode("Pcd Dynamic Build Declarations",
2555 IDefaultMutableTreeNode
.FPD_PCDDYNAMICBUILDDECLARATIONS
, true, id
));
2556 iTree
.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode
.FPD_BUILDOPTIONS
, true, id
));
2560 Operate when double click a tree node
2563 private void doubleClickModuleTreeNode() {
2564 Identification id
= null;
2565 int intCategory
= -1;
2568 id
= iTree
.getSelectNode().getId();
2569 intCategory
= iTree
.getSelectCategory();
2571 // If the node is not opened yet
2572 // Insert top level elements first
2574 //if (intCategory == IDefaultMutableTreeNode.MSA_HEADER || intCategory == IDefaultMutableTreeNode.SPD_MSAFILES) {
2575 if (intCategory
== IDefaultMutableTreeNode
.MSA_HEADER
) {
2577 if (intCategory
== IDefaultMutableTreeNode
.MSA_HEADER
) {
2578 path
= iTree
.getSelectNode().getId().getPath();
2580 if (intCategory
== IDefaultMutableTreeNode
.SPD_MSAFILES
) {
2581 path
= iTree
.getSelectNode().getId().getPath();
2586 if (intCategory
== IDefaultMutableTreeNode
.SPD_HEADER
) {
2587 path
= iTree
.getSelectNode().getId().getPath();
2591 if (intCategory
== IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
2592 path
= iTree
.getSelectNode().getId().getPath();
2597 // Show editor panel
2599 if (intCategory
>= IDefaultMutableTreeNode
.MSA_HEADER
&& intCategory
< IDefaultMutableTreeNode
.SPD_HEADER
) {
2600 showModuleElement(intCategory
, openingModuleList
.getOpeningModuleById(id
));
2601 this.currentOpeningModuleIndex
= openingModuleList
.findIndexOfListById(id
);
2603 if (intCategory
>= IDefaultMutableTreeNode
.SPD_HEADER
2604 && intCategory
< IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
2605 showPackageElement(intCategory
, openingPackageList
.getOpeningPackageById(id
));
2606 this.currentOpeningPackageIndex
= openingPackageList
.findIndexOfListById(id
);
2608 if (intCategory
>= IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
2609 showPlatformElement(intCategory
, openingPlatformList
.getOpeningPlatformById(id
));
2610 this.currentOpeningPlatformIndex
= openingPlatformList
.findIndexOfListById(id
);
2612 } catch (RuntimeException e
) {
2613 Log
.log("double click category: " + intCategory
);
2614 Log
.log("double click id path: " + id
.getPath());
2615 Log
.log("double click exception: " + e
.getMessage());
2616 e
.printStackTrace();
2621 Show content of editor panel via selected element
2627 private void showPlatformElement(int elementType
, OpeningPlatformType fpd
) {
2628 this.cleanDesktopPanePlatform();
2630 switch (elementType
) {
2631 case IDefaultMutableTreeNode
.FPD_PLATFORMDEFINITIONS
:
2632 FpdPlatformDefs frmFpdPlatformDefs
= new FpdPlatformDefs(fpd
);
2633 getJDesktopPanePlatform().add(frmFpdPlatformDefs
, 1);
2635 case IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
:
2636 FpdHeader frmFpdHeader
= new FpdHeader(fpd
);
2637 getJDesktopPanePlatform().add(frmFpdHeader
, 1);
2639 case IDefaultMutableTreeNode
.FPD_FLASH
:
2640 FpdFlash frmFpdFlash
= new FpdFlash(fpd
);
2641 getJDesktopPanePlatform().add(frmFpdFlash
, 1);
2643 case IDefaultMutableTreeNode
.FPD_FRAMEWORKMODULES
:
2644 FpdFrameworkModules frmFpdFrameworkModules
= new FpdFrameworkModules(fpd
);
2645 getJDesktopPanePlatform().add(frmFpdFrameworkModules
, 1);
2647 case IDefaultMutableTreeNode
.FPD_PCDDYNAMICBUILDDECLARATIONS
:
2648 FpdDynamicPcdBuildDefinitions frmFpdDynamicPcdBuildDefinitions
= new FpdDynamicPcdBuildDefinitions(fpd
);
2649 getJDesktopPanePlatform().add(frmFpdDynamicPcdBuildDefinitions
, 1);
2651 case IDefaultMutableTreeNode
.FPD_BUILDOPTIONS
:
2652 FpdBuildOptions frmFpdBuildOptions
= new FpdBuildOptions(fpd
);
2653 getJDesktopPanePlatform().add(frmFpdBuildOptions
, 1);
2656 this.jTabbedPaneEditor
.setSelectedIndex(2);
2657 resizeDesktopPanel();
2661 Show content of editor panel via selected element
2667 private void showPackageElement(int elementType
, OpeningPackageType spd
) {
2668 this.cleanDesktopPanePackage();
2669 Tools
.dirForNewSpd
= spd
.getId().getPath();
2670 switch (elementType
) {
2671 case IDefaultMutableTreeNode
.SPD_HEADER
:
2672 SpdHeader frmSpdHeader
= new SpdHeader(spd
);
2673 getJDesktopPanePackage().add(frmSpdHeader
, 1);
2675 case IDefaultMutableTreeNode
.SPD_PACKAGEDEFINITIONS
:
2676 SpdPackageDefinitions frmSpdPackageDefinitions
= new SpdPackageDefinitions(spd
);
2677 getJDesktopPanePackage().add(frmSpdPackageDefinitions
, 1);
2679 case IDefaultMutableTreeNode
.SPD_LIBRARYCLASSDECLARATIONS
:
2680 SpdLibClassDecls frmSlcd
= new SpdLibClassDecls(spd
);
2681 getJDesktopPanePackage().add(frmSlcd
, 1);
2683 case IDefaultMutableTreeNode
.SPD_MSAFILES
:
2684 SpdMsaFiles frmSmf
= new SpdMsaFiles(spd
);
2685 getJDesktopPanePackage().add(frmSmf
, 1);
2687 case IDefaultMutableTreeNode
.SPD_PACKAGEHEADERS
:
2688 SpdPackageHeaders frmSph
= new SpdPackageHeaders(spd
);
2689 getJDesktopPanePackage().add(frmSph
, 1);
2691 case IDefaultMutableTreeNode
.SPD_GUIDDECLARATIONS
:
2692 SpdGuidDecls frmSgd
= new SpdGuidDecls(spd
);
2693 getJDesktopPanePackage().add(frmSgd
, 1);
2695 case IDefaultMutableTreeNode
.SPD_PROTOCOLDECLARATIONS
:
2696 SpdProtocolDecls frmSprod
= new SpdProtocolDecls(spd
);
2697 getJDesktopPanePackage().add(frmSprod
, 1);
2699 case IDefaultMutableTreeNode
.SPD_PPIDECLARATIONS
:
2700 SpdPpiDecls frmSppid
= new SpdPpiDecls(spd
);
2701 getJDesktopPanePackage().add(frmSppid
, 1);
2703 case IDefaultMutableTreeNode
.SPD_PCDDECLARATIONS
:
2704 SpdPcdDefs frmSpcdd
= new SpdPcdDefs(spd
);
2705 getJDesktopPanePackage().add(frmSpcdd
, 1);
2708 this.jTabbedPaneEditor
.setSelectedIndex(1);
2709 resizeDesktopPanel();
2713 Show content of editor panel via selected element
2719 private void showModuleElement(int elementType
, OpeningModuleType msa
) {
2720 this.cleanDesktopPaneModule();
2721 switch (elementType
) {
2722 case IDefaultMutableTreeNode
.MSA_HEADER
:
2723 MsaHeader frmMsaHeader
= new MsaHeader(msa
);
2724 getJDesktopPaneModule().add(frmMsaHeader
, 1);
2726 case IDefaultMutableTreeNode
.MSA_MODULEDEFINITIONS
:
2727 ModuleDefinitions frmMd
= new ModuleDefinitions(msa
);
2728 getJDesktopPaneModule().add(frmMd
, 1);
2730 case IDefaultMutableTreeNode
.MSA_LIBRARYCLASSDEFINITIONS
:
2731 ModuleLibraryClassDefinitions frmMlcd
= new ModuleLibraryClassDefinitions(msa
);
2732 getJDesktopPaneModule().add(frmMlcd
, 1);
2734 case IDefaultMutableTreeNode
.MSA_PACKAGEDEPENDENCIES
:
2735 ModulePackageDependencies frmMpd
= new ModulePackageDependencies(msa
);
2736 getJDesktopPaneModule().add(frmMpd
, 1);
2738 case IDefaultMutableTreeNode
.MSA_SOURCEFILES
:
2739 ModuleSourceFiles frmMsf
= new ModuleSourceFiles(msa
);
2740 getJDesktopPaneModule().add(frmMsf
, 1);
2742 case IDefaultMutableTreeNode
.MSA_PROTOCOLS
:
2743 ModuleProtocols frmMp
= new ModuleProtocols(msa
);
2744 getJDesktopPaneModule().add(frmMp
, 1);
2746 case IDefaultMutableTreeNode
.MSA_EVENTS
:
2747 ModuleEvents frmMe
= new ModuleEvents(msa
);
2748 getJDesktopPaneModule().add(frmMe
, 1);
2750 case IDefaultMutableTreeNode
.MSA_HOBS
:
2751 ModuleHobs frmMh
= new ModuleHobs(msa
);
2752 getJDesktopPaneModule().add(frmMh
, 1);
2754 case IDefaultMutableTreeNode
.MSA_PPIS
:
2755 ModulePpis frmMpp
= new ModulePpis(msa
);
2756 getJDesktopPaneModule().add(frmMpp
, 1);
2758 case IDefaultMutableTreeNode
.MSA_VARIABLES
:
2759 ModuleVariables frmMv
= new ModuleVariables(msa
);
2760 getJDesktopPaneModule().add(frmMv
, 1);
2762 case IDefaultMutableTreeNode
.MSA_BOOTMODES
:
2763 ModuleBootModes frmMbm
= new ModuleBootModes(msa
);
2764 getJDesktopPaneModule().add(frmMbm
, 1);
2766 case IDefaultMutableTreeNode
.MSA_SYSTEMTABLES
:
2767 ModuleSystemTables frmMst
= new ModuleSystemTables(msa
);
2768 getJDesktopPaneModule().add(frmMst
, 1);
2770 case IDefaultMutableTreeNode
.MSA_DATAHUBS
:
2771 ModuleDataHubs frmMdh
= new ModuleDataHubs(msa
);
2772 getJDesktopPaneModule().add(frmMdh
, 1);
2774 case IDefaultMutableTreeNode
.MSA_HIIPACKAGES
:
2775 ModuleHiiPackages frmMf
= new ModuleHiiPackages(msa
);
2776 getJDesktopPaneModule().add(frmMf
, 1);
2778 case IDefaultMutableTreeNode
.MSA_GUIDS
:
2779 ModuleGuids frmGuid
= new ModuleGuids(msa
);
2780 getJDesktopPaneModule().add(frmGuid
, 1);
2782 case IDefaultMutableTreeNode
.MSA_EXTERNS
:
2783 ModuleExterns frmMex
= new ModuleExterns(msa
);
2784 getJDesktopPaneModule().add(frmMex
, 1);
2786 case IDefaultMutableTreeNode
.MSA_PCDS
:
2787 ModulePCDs frmPcd
= new ModulePCDs(msa
);
2788 getJDesktopPaneModule().add(frmPcd
, 1);
2791 this.jTabbedPaneEditor
.setSelectedIndex(0);
2792 resizeDesktopPanel();
2796 // Define operations of menu
2802 private void fileNew() {
2805 // Selece new file type
2807 NewFileChooser nfc
= new NewFileChooser(this, true);
2808 result
= nfc
.showDialog();
2810 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2813 } else if (result
== DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
) {
2817 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2818 result
= smb
.showDialog();
2820 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2824 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2825 PackageSurfaceAreaDocument
.PackageSurfaceArea psa
= null;
2826 if (this.openingPackageList
.existsPackage(smb
.getMid().getPackageId())) {
2827 psa
= openingPackageList
.getPackageSurfaceAreaFromId(smb
.getMid().getPackageId());
2830 wt
.addModuleToPackage(smb
.getMid(), psa
);
2831 } catch (IOException e
) {
2832 Log
.wrn("Upddate MsaFiles of Package", e
.getMessage());
2833 Log
.err("Upddate MsaFiles of Package", e
.getMessage());
2835 } catch (XmlException e
) {
2836 Log
.wrn("Upddate MsaFiles of Package", e
.getMessage());
2837 Log
.err("Upddate MsaFiles of Package", e
.getMessage());
2839 } catch (Exception e
) {
2840 Log
.wrn("Upddate MsaFiles of Package", e
.getMessage());
2841 Log
.err("Upddate MsaFiles of Package", e
.getMessage());
2844 this.openModule(smb
.getMid().getPath(), smb
.getMid());
2846 } else if (result
== DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
) {
2850 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2851 result
= smb
.showDialog();
2853 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2857 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2859 wt
.addPackageToDatabase(smb
.getPid());
2860 } catch (Exception e
) {
2861 Log
.err("addPackageToDatabase", e
.getMessage());
2863 vPackageList
.addElement(smb
.getPid());
2866 // Add to Module Description node
2868 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(vPackageList
.lastElement().getName(),
2869 IDefaultMutableTreeNode
.MODULE_PACKAGE
,
2870 false, vPackageList
.lastElement());
2872 iTree
.addNode(dmtnModuleDescription
, node
);
2875 // Add new SpdHeader node to the tree
2877 node
= new IDefaultMutableTreeNode(vPackageList
.lastElement().getName(),
2878 IDefaultMutableTreeNode
.SPD_HEADER
, true, vPackageList
.lastElement());
2879 iTree
.addNode(dmtnPackageDescription
, node
);
2881 this.openPackage(smb
.getPid().getPath());
2883 } else if (result
== DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
) {
2885 // To new a platform
2887 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2888 result
= smb
.showDialog();
2890 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2894 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2896 wt
.addPlatformToDatabase(smb
.getFid());
2897 } catch (Exception e
) {
2898 Log
.err("addPlatformToDatabase", e
.getMessage());
2900 vPlatformList
.addElement(smb
.getFid());
2902 // Add new SpdHeader node to the tree
2904 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(vPlatformList
.lastElement().getName(),
2905 IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
,
2906 true, vPlatformList
.lastElement());
2907 iTree
.addNode(dmtnPlatformDescription
, node
);
2908 this.openPlatform(smb
.getFid().getPath());
2917 private void open() {
2918 JFileChooser fc
= new JFileChooser(Workspace
.getCurrentWorkspace());
2919 fc
.setAcceptAllFileFilterUsed(false);
2920 IFileFilter iffM
= new IFileFilter(DataType
.MODULE_SURFACE_AREA_EXT
);
2921 IFileFilter iffP
= new IFileFilter(DataType
.PACKAGE_SURFACE_AREA_EXT
);
2922 IFileFilter iffF
= new IFileFilter(DataType
.PLATFORM_SURFACE_AREA_EXT
);
2923 fc
.addChoosableFileFilter(iffM
);
2924 fc
.addChoosableFileFilter(iffP
);
2925 fc
.addChoosableFileFilter(iffF
);
2926 fc
.setFileFilter(iffM
);
2928 int result
= fc
.showOpenDialog(new JPanel());
2930 if (result
== JFileChooser
.APPROVE_OPTION
) {
2931 String path
= fc
.getSelectedFile().getPath();
2932 String match
= path
.substring(path
.length() - 4);
2933 if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.MODULE_SURFACE_AREA_EXT
)) {
2935 } else if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.PACKAGE_SURFACE_AREA_EXT
)) {
2937 } else if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.PLATFORM_SURFACE_AREA_EXT
)) {
2947 private void close() {
2948 switch (this.jTabbedPaneEditor
.getSelectedIndex()) {
2950 // Current is module
2953 if (this.currentOpeningModuleIndex
> -1) {
2954 if (!openingModuleList
.getModuleSaved(currentOpeningModuleIndex
)) {
2955 int result
= showSaveDialog();
2956 if (result
== JOptionPane
.YES_OPTION
) {
2959 if (result
== JOptionPane
.NO_OPTION
) {
2962 if (result
== JOptionPane
.CANCEL_OPTION
) {
2966 iTree
.removeNodeChildrenByPath(openingModuleList
.getTreePathByIndex(currentOpeningModuleIndex
));
2967 this.openingModuleList
.removeFromOpeningModuleListByIndex(this.currentOpeningModuleIndex
);
2968 this.cleanDesktopPaneModule();
2969 this.currentOpeningModuleIndex
= -1;
2973 // Current is package
2976 if (this.currentOpeningPackageIndex
> -1) {
2977 if (!openingPackageList
.getPackageSaved(currentOpeningPackageIndex
)) {
2978 int result
= showSaveDialog();
2979 if (result
== JOptionPane
.YES_OPTION
) {
2982 if (result
== JOptionPane
.NO_OPTION
) {
2985 if (result
== JOptionPane
.CANCEL_OPTION
) {
2989 iTree
.removeNodeChildrenByPath(openingPackageList
.getTreePathByIndex(currentOpeningPackageIndex
));
2990 this.openingPackageList
.removeFromOpeningPackageListByIndex(this.currentOpeningPackageIndex
);
2991 this.cleanDesktopPanePackage();
2992 this.currentOpeningPackageIndex
= -1;
2996 // Current is platform
2999 if (this.currentOpeningPlatformIndex
> -1) {
3000 if (!openingPlatformList
.getPlatformSaved(currentOpeningPlatformIndex
)) {
3001 int result
= showSaveDialog();
3002 if (result
== JOptionPane
.YES_OPTION
) {
3005 if (result
== JOptionPane
.NO_OPTION
) {
3008 if (result
== JOptionPane
.CANCEL_OPTION
) {
3012 iTree
.removeNodeChildrenByPath(openingPlatformList
.getTreePathByIndex(currentOpeningPlatformIndex
));
3013 this.openingPlatformList
.removeFromOpeningPlatformListByIndex(this.currentOpeningPlatformIndex
);
3014 this.cleanDesktopPanePlatform();
3015 this.currentOpeningPlatformIndex
= -1;
3022 Close all opening files and clean all showing internal frame
3025 private void closeAll() {
3027 if (!openingModuleList
.isSaved() || !openingPackageList
.isSaved() || !openingPlatformList
.isSaved()) {
3028 result
= showSaveDialog();
3030 if (result
== JOptionPane
.YES_OPTION
) {
3033 if (result
== JOptionPane
.NO_OPTION
) {
3038 if (result
== JOptionPane
.CANCEL_OPTION
) {
3041 this.cleanDesktopPane();
3042 this.getCompontentsFromFrameworkDatabase();
3043 openingModuleList
.removeAllFromOpeningModuleList();
3044 openingPackageList
.removeAllFromOpeningPackageList();
3045 openingPlatformList
.removeAllFromOpeningPlatformList();
3046 this.makeEmptyTree();
3050 Save currentModule when press button OK
3053 private void save() {
3054 switch (this.jTabbedPaneEditor
.getSelectedIndex()) {
3056 if (this.currentOpeningModuleIndex
> -1) {
3057 saveModule(this.currentOpeningModuleIndex
);
3061 if (this.currentOpeningPackageIndex
> -1) {
3062 savePackage(this.currentOpeningPackageIndex
);
3066 if (this.currentOpeningPlatformIndex
> -1) {
3067 savePlatform(this.currentOpeningPlatformIndex
);
3073 private void saveAs() {
3077 private void saveAll() {
3081 for (int index
= 0; index
< openingModuleList
.size(); index
++) {
3082 if (!openingModuleList
.getModuleSaved(index
)) {
3088 // Save all packages
3090 for (int index
= 0; index
< openingPackageList
.size(); index
++) {
3091 if (!openingPackageList
.getPackageSaved(index
)) {
3097 // Save all platforms
3099 for (int index
= 0; index
< openingPlatformList
.size(); index
++) {
3100 if (!openingPlatformList
.getPlatformSaved(index
)) {
3101 savePlatform(index
);
3107 To save changed items before exit.
3110 private void exit() {
3112 if (!openingModuleList
.isSaved() || !openingPackageList
.isSaved() || !openingPlatformList
.isSaved()) {
3113 result
= showSaveDialog();
3115 if (result
== JOptionPane
.YES_OPTION
) {
3118 if (result
== JOptionPane
.NO_OPTION
) {
3121 if (result
== JOptionPane
.CANCEL_OPTION
) {
3129 Switch current workspace to others
3132 private void changeWorkspace() {
3133 SwitchWorkspace sw
= new SwitchWorkspace(this, true);
3134 int result
= sw
.showDialog();
3135 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3137 } else if (result
== DataType
.RETURN_TYPE_OK
) {
3139 // Reinit whole window
3142 this.setTitle(DataType
.PROJECT_NAME
+ " " + DataType
.PROJECT_VERSION
+ " " + "- ["
3143 + Workspace
.getCurrentWorkspace() + "]");
3149 To create a Far file from current workspace
3152 private void createFar() {
3153 CreateStepOne cso
= new CreateStepOne(this, true);
3154 int result
= cso
.showDialog();
3155 if (result
== DataType
.RETURN_TYPE_OK
) {
3156 String strReturn
= "Create Far Done!";
3157 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3158 JOptionPane
.INFORMATION_MESSAGE
);
3164 To install a Far file to current workspace
3167 private void installFar() {
3168 InstallStepOne iso
= new InstallStepOne(this, true);
3169 int result
= iso
.showDialog();
3170 if (result
== DataType
.RETURN_TYPE_OK
) {
3171 String strReturn
= "<html>Install Far Done! <br>The WORKSPACE will be refreshed!</html>";
3172 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3173 JOptionPane
.INFORMATION_MESSAGE
);
3180 To remove a Far's items from current workspace
3183 private void removeFar() {
3184 DeleteStepOne dso
= new DeleteStepOne(this, true);
3185 int result
= dso
.showDialog();
3186 if (result
== DataType
.RETURN_TYPE_OK
) {
3187 String strReturn
= "<html>Delete Far Done! <br>The WORKSPACE will be refreshed!</html>";
3188 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3189 JOptionPane
.INFORMATION_MESSAGE
);
3196 To update an existing Far file
3199 private void updateFar() {
3200 UpdateStepOne uso
= new UpdateStepOne(this, true);
3201 int result
= uso
.showDialog();
3202 if (result
== DataType
.RETURN_TYPE_OK
) {
3203 String strReturn
= "<html>Update Far Done! <br>The WORKSPACE will be refreshed!</html>";
3204 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3205 JOptionPane
.INFORMATION_MESSAGE
);
3212 Show Tool Chain Configuration Dialog to setup Tool Chain
3215 private void setupToolChainConfiguration() {
3216 ToolChainConfig tcc
= ToolChainConfig
.getInstance();
3224 private void cloneItem() {
3228 // Check if there is any item can be cloned
3230 if (iTree
.getSelectionPath() == null) {
3231 Log
.wrn("Clone", "Please select a target to clone!");
3234 int category
= iTree
.getSelectCategory();
3235 Identification id
= iTree
.getSelectNode().getId();
3236 if (category
== IDefaultMutableTreeNode
.MODULE
|| category
== IDefaultMutableTreeNode
.PACKAGE
3237 || category
== IDefaultMutableTreeNode
.PLATFORM
) {
3238 Log
.wrn("Clone", "Please select a target to clone!");
3242 if (category
== IDefaultMutableTreeNode
.WORKSPACE
) {
3243 mode
= DataType
.RETURN_TYPE_WORKSPACE
;
3246 if (category
>= IDefaultMutableTreeNode
.MSA_HEADER
&& category
< IDefaultMutableTreeNode
.SPD_HEADER
) {
3247 mode
= DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
;
3249 if (category
>= IDefaultMutableTreeNode
.SPD_HEADER
&& category
< IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
3250 mode
= DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
;
3252 if (category
>= IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
3253 mode
= DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
;
3256 Clone c
= new Clone(this, true, mode
, id
);
3257 int result
= c
.showDialog();
3259 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3262 if (result
== DataType
.RETURN_TYPE_WORKSPACE
) {
3263 Tools
.showInformationMessage("Workspace Clone Finished");
3265 if (result
== DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
) {
3266 Tools
.showInformationMessage("Module Surface Area Clone Finished");
3267 vModuleList
.addElement(c
.getMid());
3268 addModuleToTree(c
.getMid());
3270 if (result
== DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
) {
3271 Tools
.showInformationMessage("Package Surface Area Clone Finished");
3272 vPackageList
.addElement(c
.getPid());
3274 // Add new SpdHeader node to the tree
3276 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(vPackageList
.lastElement().getName(),
3277 IDefaultMutableTreeNode
.SPD_HEADER
, true,
3278 vPackageList
.lastElement());
3279 iTree
.addNode(dmtnPackageDescription
, node
);
3281 if (result
== DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
) {
3282 Tools
.showInformationMessage("Platform Surface Area Clone Finished");
3283 vPlatformList
.addElement(c
.getFid());
3285 // Add new SpdHeader node to the tree
3287 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(vPlatformList
.lastElement().getName(),
3288 IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
,
3289 true, vPlatformList
.lastElement());
3290 iTree
.addNode(dmtnPlatformDescription
, node
);
3291 //this.openPlatform(c.getFid().getPath());
3293 if (result
== DataType
.RETURN_TYPE_OK
) {
3298 public void valueChanged(TreeSelectionEvent arg0
) {
3299 // TODO Auto-generated method stub
3303 public void menuCanceled(MenuEvent arg0
) {
3304 // TODO Auto-generated method stub
3308 public void menuDeselected(MenuEvent arg0
) {
3309 // TODO Auto-generated method stub
3313 public void menuSelected(MenuEvent arg0
) {
3314 if (arg0
.getSource() == jMenuFile
) {
3316 // Enable close/close all if some files are opened
3318 jMenuItemFileClose
.setEnabled(openingModuleList
.isOpend() || openingPackageList
.isOpend()
3319 || openingPlatformList
.isOpend());
3320 jMenuItemFileCloseAll
.setEnabled(openingModuleList
.isOpend() || openingPackageList
.isOpend()
3321 || openingPlatformList
.isOpend());
3324 // Enable save/save all if some files are changed
3326 jMenuItemFileSave
.setEnabled(!openingModuleList
.isSaved() || !openingPackageList
.isSaved()
3327 || !openingPlatformList
.isSaved());
3328 jMenuItemFileSaveAll
.setEnabled(!openingModuleList
.isSaved() || !openingPackageList
.isSaved()
3329 || !openingPlatformList
.isSaved());
3332 if (arg0
.getSource() == jMenuTools
) {
3334 // Enable clone when select some items
3336 if (iTree
.getSelectionPath() == null) {
3337 jMenuItemToolsClone
.setEnabled(false);
3339 int category
= iTree
.getSelectCategory();
3340 if (category
== IDefaultMutableTreeNode
.MODULE
|| category
== IDefaultMutableTreeNode
.PACKAGE
3341 || category
== IDefaultMutableTreeNode
.PLATFORM
3342 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE
3343 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
3344 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
) {
3345 jMenuItemToolsClone
.setEnabled(false);
3347 jMenuItemToolsClone
.setEnabled(true);