3 The main GUI for module editor.
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.frameworkwizard
;
18 import java
.awt
.event
.ActionEvent
;
19 import java
.awt
.event
.ComponentEvent
;
20 import java
.awt
.event
.KeyEvent
;
21 import java
.awt
.event
.KeyListener
;
22 import java
.awt
.event
.MouseEvent
;
23 import java
.awt
.event
.MouseListener
;
24 import java
.awt
.event
.WindowEvent
;
25 import java
.io
.IOException
;
26 import java
.util
.Iterator
;
28 import java
.util
.Vector
;
30 import javax
.swing
.JButton
;
31 import javax
.swing
.JCheckBoxMenuItem
;
32 import javax
.swing
.JDesktopPane
;
33 import javax
.swing
.JFileChooser
;
34 import javax
.swing
.JFrame
;
35 import javax
.swing
.JInternalFrame
;
36 import javax
.swing
.JMenu
;
37 import javax
.swing
.JMenuBar
;
38 import javax
.swing
.JMenuItem
;
39 import javax
.swing
.JOptionPane
;
40 import javax
.swing
.JPanel
;
41 import javax
.swing
.JScrollPane
;
42 import javax
.swing
.JSplitPane
;
43 import javax
.swing
.JTabbedPane
;
44 import javax
.swing
.event
.MenuEvent
;
45 import javax
.swing
.event
.MenuListener
;
46 import javax
.swing
.event
.TreeSelectionEvent
;
47 import javax
.swing
.event
.TreeSelectionListener
;
48 import javax
.swing
.tree
.TreePath
;
50 import org
.apache
.xmlbeans
.XmlException
;
51 import org
.tianocore
.PackageSurfaceAreaDocument
;
52 import org
.tianocore
.frameworkwizard
.common
.DataType
;
53 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
54 import org
.tianocore
.frameworkwizard
.common
.IFileFilter
;
55 import org
.tianocore
.frameworkwizard
.common
.Log
;
56 import org
.tianocore
.frameworkwizard
.common
.SaveFile
;
57 import org
.tianocore
.frameworkwizard
.common
.Tools
;
58 import org
.tianocore
.frameworkwizard
.common
.Identifications
.Identification
;
59 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningModuleType
;
60 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
61 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
62 import org
.tianocore
.frameworkwizard
.common
.find
.FindResult
;
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
.ModuleEvents
;
75 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleExterns
;
76 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleGuids
;
77 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleHiiPackages
;
78 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleHobs
;
79 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleLibraryClassDefinitions
;
80 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePCDs
;
81 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePackageDependencies
;
82 import org
.tianocore
.frameworkwizard
.module
.ui
.ModulePpis
;
83 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleProtocols
;
84 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleSourceFiles
;
85 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleSystemTables
;
86 import org
.tianocore
.frameworkwizard
.module
.ui
.ModuleVariables
;
87 import org
.tianocore
.frameworkwizard
.module
.ui
.MsaHeader
;
88 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
89 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdGuidDecls
;
90 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdHeader
;
91 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdLibClassDecls
;
92 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdMsaFiles
;
93 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPackageHeaders
;
94 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPcdDefs
;
95 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdPpiDecls
;
96 import org
.tianocore
.frameworkwizard
.packaging
.ui
.SpdProtocolDecls
;
97 import org
.tianocore
.frameworkwizard
.platform
.PlatformIdentification
;
98 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdBuildOptions
;
99 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdDynamicPcdBuildDefinitions
;
100 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdFlash
;
101 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdFrameworkModules
;
102 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdHeader
;
103 import org
.tianocore
.frameworkwizard
.platform
.ui
.FpdPlatformDefs
;
104 import org
.tianocore
.frameworkwizard
.workspace
.Workspace
;
105 import org
.tianocore
.frameworkwizard
.workspace
.WorkspaceTools
;
106 import org
.tianocore
.frameworkwizard
.workspace
.ui
.SwitchWorkspace
;
107 import org
.tianocore
.frameworkwizard
.toolchain
.Preferences
;
110 The class is used to show main GUI of FrameworkWizard
111 It extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener and MenuListener
114 public class FrameworkWizardUI
extends IFrame
implements KeyListener
, MouseListener
, TreeSelectionListener
,
117 /// Define class Serial Version UID
119 private static final long serialVersionUID
= -7103240960573031772L;
122 /// Used to record current operation target
124 private int currentOpeningModuleIndex
= -1;
126 private int currentOpeningPackageIndex
= -1;
128 private int currentOpeningPlatformIndex
= -1;
131 /// Used to generate tree structure
133 private IDefaultMutableTreeNode dmtnRoot
= null;
135 private IDefaultMutableTreeNode dmtnModuleDescription
= null;
137 private IDefaultMutableTreeNode dmtnPackageDescription
= null;
139 private IDefaultMutableTreeNode dmtnPlatformDescription
= null;
144 private JPanel jContentPane
= null;
146 private JMenuBar jMenuBar
= null;
148 private JMenu jMenuFile
= null;
150 private JMenuItem jMenuItemFileNew
= null;
152 private JMenuItem jMenuItemFileRefresh
= null;
154 private JMenuItem jMenuItemFileSaveAs
= null;
156 private JMenuItem jMenuItemFileExit
= null;
158 private JMenu jMenuEdit
= null;
160 private JDesktopPane jDesktopPaneModule
= null;
162 private JDesktopPane jDesktopPanePackage
= null;
164 private JDesktopPane jDesktopPanePlatform
= null;
166 private JTabbedPane jTabbedPaneTree
= null;
168 private JTabbedPane jTabbedPaneEditor
= null;
170 private IDesktopManager iDesktopManager
= new IDesktopManager();
172 private JScrollPane jScrollPaneTree
= null;
174 private ITree iTree
= null;
176 private JMenu jMenuHelp
= null;
178 private JMenuItem jMenuItemHelpAbout
= null;
180 private JMenuItem jMenuItemEditDelete
= null;
182 private WorkspaceTools wt
= new WorkspaceTools();
184 private JMenuItem jMenuItemFileSave
= null;
186 private JMenuItem jMenuItemFileClose
= null;
188 private JMenu jMenuTools
= null;
190 private JMenu jMenuWindow
= null;
192 private JPanel jPanelOperation
= null;
194 private JButton jButtonOk
= null;
196 private JButton jButtonCancel
= null;
198 private JMenuItem jMenuItemFileOpen
= null;
200 private JMenuItem jMenuItemFileCloseAll
= null;
202 private JMenuItem jMenuItemFileSaveAll
= null;
204 private JMenuItem jMenuItemFilePageSetup
= null;
206 private JMenuItem jMenuItemFilePrint
= null;
208 private JMenuItem jMenuItemFileImport
= null;
210 private JMenuItem jMenuItemFileProperties
= null;
212 private JMenu jMenuFileRecentFiles
= null;
214 private JSplitPane jSplitPane
= null;
216 private JMenuItem jMenuItemEditUndo
= null;
218 private JMenuItem jMenuItemEditRedo
= null;
220 private JMenuItem jMenuItemEditCut
= null;
222 private JMenuItem jMenuItemEditCopy
= null;
224 private JMenuItem jMenuItemEditPaste
= null;
226 private JMenuItem jMenuItemEditSelectAll
= null;
228 private JMenuItem jMenuItemEditFindNext
= null;
230 private JMenu jMenuView
= null;
232 private JMenu jMenuViewToolbars
= null;
234 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsFile
= null;
236 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsEdit
= null;
238 private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsWindow
= null;
240 private JMenuItem jMenuItemViewStandard
= null;
242 private JMenuItem jMenuItemViewAdvanced
= null;
244 private JMenu jMenuProject
= null;
246 private JMenuItem jMenuItemProjectAdmin
= null;
248 private JMenuItem jMenuItemProjectChangeWorkspace
= null;
250 private JMenuItem jMenuItemToolsBuildPreferences
= null;
252 // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null;
254 // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null;
256 private JMenuItem jMenuItemToolsToolChainConfiguration
= null;
258 private JMenuItem jMenuItemToolsClone
= null;
260 private JMenuItem jMenuItemToolsCodeScan
= null;
262 private JMenuItem jMenuItemWindowDisplaySide
= null;
264 private JMenuItem jMenuItemWindowDisplayTopBottom
= null;
266 private JMenuItem jMenuItemViewXML
= null;
268 private JMenuItem jMenuItemWindowTabView
= null;
270 private JMenuItem jMenuItemWindowSource
= null;
272 private JMenuItem jMenuItemWindowXML
= null;
274 private JMenuItem jMenuItemWindowPreferences
= null;
276 private JMenuItem jMenuItemHelpContents
= null;
278 private JMenuItem jMenuItemHelpIndex
= null;
280 private JMenuItem jMenuItemHelpSearch
= null;
282 private JMenuItem jMenuItemProjectInstallFar
= null;
284 private JMenuItem jMenuItemProjectUpdateFar
= null;
286 private JMenuItem jMenuItemProjectRemoveFar
= null;
288 private JMenuItem jMenuItemProjectCreateFar
= null;
290 private JMenu jMenuEditFind
= null;
292 private JMenuItem jMenuItemEditFindPcd
= null;
294 private JMenuItem jMenuItemEditFindLibraryClass
= null;
296 private JMenuItem jMenuItemEditFindPpi
= null;
298 private JMenuItem jMenuItemEditFindProtocol
= null;
300 private JMenuItem jMenuItemEditFindGuid
= null;
302 private JMenuItem jMenuItemEditFindLibraryInstance
= null;
305 /// A static definition for this class itself
307 private static FrameworkWizardUI fwui
= null;
310 If the class hasn't an instnace, new one.
312 @return FrameworkWizardUI The instance of this class
315 public static FrameworkWizardUI
getInstance() {
317 fwui
= new FrameworkWizardUI();
323 This method initializes jMenuBar
325 @return javax.swing.JMenuBar Main menu bar for the entire GUI
328 private JMenuBar
getjJMenuBar() {
329 if (jMenuBar
== null) {
330 jMenuBar
= new JMenuBar();
331 jMenuBar
.setPreferredSize(new java
.awt
.Dimension(0, 18));
332 jMenuBar
.add(getJMenuFile());
333 jMenuBar
.add(getJMenuEdit());
334 jMenuBar
.add(getJMenuView());
335 jMenuBar
.add(getJMenuProject());
336 jMenuBar
.add(getJMenuTools());
337 jMenuBar
.add(getJMenuWindow());
338 jMenuBar
.add(getJMenuHelp());
344 This method initializes jSplitPane
346 @return javax.swing.JSplitPane
349 private JSplitPane
getJSplitPane() {
350 if (jSplitPane
== null) {
351 jSplitPane
= new JSplitPane(JSplitPane
.HORIZONTAL_SPLIT
, getJTabbedPaneTree(), getJTabbedPaneEditor());
352 jSplitPane
.setBounds(new java
.awt
.Rectangle(0, 1, DataType
.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH
,
353 DataType
.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT
));
354 jSplitPane
.addComponentListener(this);
360 This method initializes jTabbedPaneEditor
362 @return javax.swing.JTabbedPane
365 private JTabbedPane
getJTabbedPaneEditor() {
366 if (jTabbedPaneEditor
== null) {
367 jTabbedPaneEditor
= new JTabbedPane();
368 jTabbedPaneEditor
.setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
369 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
370 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
371 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
373 .setMinimumSize(new java
.awt
.Dimension(
374 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
375 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
376 jTabbedPaneEditor
.addTab("Module", null, getJDesktopPaneModule(), null);
377 jTabbedPaneEditor
.addTab("Package", null, getJDesktopPanePackage(), null);
378 jTabbedPaneEditor
.addTab("Platform", null, getJDesktopPanePlatform(), null);
380 return jTabbedPaneEditor
;
384 This method initializes jTabbedPaneTree
386 @return javax.swing.JTabbedPane
389 private JTabbedPane
getJTabbedPaneTree() {
390 if (jTabbedPaneTree
== null) {
391 jTabbedPaneTree
= new JTabbedPane();
393 .setPreferredSize(new java
.awt
.Dimension(
394 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
395 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
397 .setMinimumSize(new java
.awt
.Dimension(DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
398 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
399 jTabbedPaneTree
.addTab("Workspace Explorer", null, getJScrollPaneTree(), null);
401 return jTabbedPaneTree
;
405 This method initializes jMenuFile
407 @return javax.swing.JMenu jMenuModule
410 private JMenu
getJMenuFile() {
411 if (jMenuFile
== null) {
413 // Set jMenuFile's attributes
415 jMenuFile
= new JMenu();
416 jMenuFile
.setText("File");
417 jMenuFile
.setMnemonic('F');
418 jMenuFile
.addMenuListener(this);
421 // Add sub menu items
423 jMenuFile
.add(getJMenuItemFileNew());
424 jMenuFile
.add(getJMenuItemFileOpen());
425 jMenuFile
.add(getJMenuItemFileClose());
426 jMenuFile
.add(getJMenuItemFileCloseAll());
427 jMenuFile
.addSeparator();
429 jMenuFile
.add(getJMenuFileRecentFiles());
430 jMenuFile
.add(getJMenuItemFileSave());
431 jMenuFile
.add(getJMenuItemFileSaveAs());
432 jMenuFile
.add(getJMenuItemFileSaveAll());
433 jMenuFile
.addSeparator();
435 jMenuFile
.add(getJMenuItemFileRefresh());
436 jMenuFile
.addSeparator();
438 jMenuFile
.add(getJMenuItemFilePageSetup());
439 jMenuFile
.add(getJMenuItemFilePrint());
440 jMenuFile
.add(getJMenuItemFileImport());
441 jMenuFile
.add(getJMenuItemFileProperties());
443 jMenuFile
.add(getJMenuItemFileExit());
449 This method initializes jMenuItemFileSaveAs
451 @return javax.swing.JMenuItem jMenuItemFileSaveAs
454 private JMenuItem
getJMenuItemFileSaveAs() {
455 if (jMenuItemFileSaveAs
== null) {
456 jMenuItemFileSaveAs
= new JMenuItem();
457 jMenuItemFileSaveAs
.setText("Save As...");
458 jMenuItemFileSaveAs
.setMnemonic('a');
459 jMenuItemFileSaveAs
.addActionListener(this);
460 jMenuItemFileSaveAs
.setEnabled(false);
461 jMenuItemFileSaveAs
.setVisible(false);
463 return jMenuItemFileSaveAs
;
467 This method initializes jMenuItemFileRefresh
469 @return javax.swing.JMenuItem jMenuItemFileRefresh
472 private JMenuItem
getJMenuItemFileRefresh() {
473 if (jMenuItemFileRefresh
== null) {
474 jMenuItemFileRefresh
= new JMenuItem();
475 jMenuItemFileRefresh
.setText("Refresh");
476 jMenuItemFileRefresh
.setMnemonic('R');
477 jMenuItemFileRefresh
.addActionListener(this);
478 jMenuItemFileRefresh
.setVisible(true);
480 return jMenuItemFileRefresh
;
484 This method initializes jMenuItemModuleExit
486 @return javax.swing.JMenuItem jMenuItemModuleExit
489 private JMenuItem
getJMenuItemFileExit() {
490 if (jMenuItemFileExit
== null) {
491 jMenuItemFileExit
= new JMenuItem();
492 jMenuItemFileExit
.setText("Exit");
493 jMenuItemFileExit
.setMnemonic('x');
494 jMenuItemFileExit
.addActionListener(this);
496 return jMenuItemFileExit
;
500 This method initializes jMenuEdit
502 @return javax.swing.JMenu jMenuEdit
505 private JMenu
getJMenuEdit() {
506 if (jMenuEdit
== null) {
508 // Set jMenuEdit's attributes
510 jMenuEdit
= new JMenu();
511 jMenuEdit
.setText("Edit");
512 jMenuEdit
.setMnemonic('E');
513 jMenuEdit
.setVisible(true);
516 // Add sub menu items
518 jMenuEdit
.add(getJMenuItemEditUndo());
519 jMenuEdit
.add(getJMenuItemEditRedo());
520 //jMenuEdit.addSeparator();
522 jMenuEdit
.add(getJMenuItemEditCut());
523 jMenuEdit
.add(getJMenuItemEditCopy());
524 jMenuEdit
.add(getJMenuItemEditPaste());
525 jMenuEdit
.add(getJMenuItemEditDelete());
526 //jMenuEdit.addSeparator();
528 jMenuEdit
.add(getJMenuItemEditSelectAll());
529 jMenuEdit
.add(getJMenuEditFind());
530 jMenuEdit
.add(getJMenuItemEditFindNext());
531 //jMenuEdit.addSeparator();
537 This method initializes jDesktopPane
539 @return javax.swing.JDesktopPane jDesktopPane
542 private JDesktopPane
getJDesktopPaneModule() {
543 if (jDesktopPaneModule
== null) {
544 jDesktopPaneModule
= new JDesktopPane();
546 .setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
547 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
548 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
549 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
551 .setMinimumSize(new java
.awt
.Dimension(
552 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
553 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
554 jDesktopPaneModule
.setDesktopManager(iDesktopManager
);
555 jDesktopPaneModule
.addComponentListener(this);
557 return jDesktopPaneModule
;
561 This method initializes jDesktopPane
563 @return javax.swing.JDesktopPane jDesktopPane
566 private JDesktopPane
getJDesktopPanePackage() {
567 if (jDesktopPanePackage
== null) {
568 jDesktopPanePackage
= new JDesktopPane();
570 .setBounds(new java
.awt
.Rectangle(DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
571 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
572 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
573 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
575 .setMinimumSize(new java
.awt
.Dimension(
576 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
577 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
578 jDesktopPanePackage
.setDesktopManager(iDesktopManager
);
579 jDesktopPanePackage
.addComponentListener(this);
581 return jDesktopPanePackage
;
585 This method initializes jDesktopPane
587 @return javax.swing.JDesktopPane jDesktopPane
590 private JDesktopPane
getJDesktopPanePlatform() {
591 if (jDesktopPanePlatform
== null) {
592 jDesktopPanePlatform
= new JDesktopPane();
594 .setBounds(new java
.awt
.Rectangle(
595 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_X
,
596 DataType
.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y
,
597 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
598 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
600 .setMinimumSize(new java
.awt
.Dimension(
601 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH
,
602 DataType
.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT
));
603 jDesktopPanePlatform
.setDesktopManager(iDesktopManager
);
604 jDesktopPanePlatform
.addComponentListener(this);
606 return jDesktopPanePlatform
;
610 This method initializes jScrollPaneTree
612 @return javax.swing.JScrollPane jScrollPaneTree
615 private JScrollPane
getJScrollPaneTree() {
616 if (jScrollPaneTree
== null) {
617 jScrollPaneTree
= new JScrollPane();
619 .setPreferredSize(new java
.awt
.Dimension(
620 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
,
621 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
623 .setMinimumSize(new java
.awt
.Dimension(
624 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH
/ 2,
625 DataType
.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT
));
626 jScrollPaneTree
.setViewportView(getITree());
628 return jScrollPaneTree
;
632 This method initializes iTree
634 @return org.tianocore.packaging.common.ui.ITree iTree
637 private ITree
getITree() {
639 //Before open a real module, use an empty root node for the tree
646 This method initializes jMenuHelp
648 @return javax.swing.JMenu jMenuHelp
651 private JMenu
getJMenuHelp() {
652 if (jMenuHelp
== null) {
654 // Set jMenuHelp's attributes
656 jMenuHelp
= new JMenu();
657 jMenuHelp
.setText("Help");
658 jMenuHelp
.setMnemonic('H');
661 // Add sub menu items
663 jMenuHelp
.add(getJMenuItemHelpContents());
664 jMenuHelp
.add(getJMenuItemHelpIndex());
665 jMenuHelp
.add(getJMenuItemHelpSearch());
667 jMenuHelp
.add(getJMenuItemHelpAbout());
673 This method initializes jMenuItemHelpAbout
675 @return javax.swing.JMenuItem jMenuItemHelpAbout
678 private JMenuItem
getJMenuItemHelpAbout() {
679 if (jMenuItemHelpAbout
== null) {
680 jMenuItemHelpAbout
= new JMenuItem();
681 jMenuItemHelpAbout
.setText("About...");
682 jMenuItemHelpAbout
.setMnemonic('A');
683 jMenuItemHelpAbout
.addActionListener(this);
685 return jMenuItemHelpAbout
;
689 This method initializes jMenuItemEditDelete
691 @return javax.swing.JMenuItem jMenuItemEditDelete
694 private JMenuItem
getJMenuItemEditDelete() {
695 if (jMenuItemEditDelete
== null) {
696 jMenuItemEditDelete
= new JMenuItem();
697 jMenuItemEditDelete
.setText("Delete");
698 jMenuItemEditDelete
.setMnemonic('D');
699 jMenuItemEditDelete
.setVisible(false);
700 jMenuItemEditDelete
.setEnabled(false);
701 jMenuItemEditDelete
.addActionListener(this);
703 //Disabled first when no module is open
705 jMenuItemEditDelete
.setEnabled(false);
707 return jMenuItemEditDelete
;
711 This method initializes jMenuFileNew
713 @return javax.swing.JMenuItem jMenuFileNew
716 private JMenuItem
getJMenuItemFileNew() {
717 if (jMenuItemFileNew
== null) {
718 jMenuItemFileNew
= new JMenuItem();
719 jMenuItemFileNew
.setText("New...");
720 jMenuItemFileNew
.setMnemonic('N');
721 jMenuItemFileNew
.addActionListener(this);
723 return jMenuItemFileNew
;
727 This method initializes jMenuItemFileSave
729 @return javax.swing.JMenuItem jMenuItemModuleSave
732 private JMenuItem
getJMenuItemFileSave() {
733 if (jMenuItemFileSave
== null) {
734 jMenuItemFileSave
= new JMenuItem();
735 jMenuItemFileSave
.setText("Save");
736 jMenuItemFileSave
.setMnemonic('S');
737 jMenuItemFileSave
.addActionListener(this);
738 jMenuItemFileSave
.setEnabled(true);
740 return jMenuItemFileSave
;
744 This method initializes jMenuItemModuleClose
746 @return javax.swing.JMenuItem jMenuItemModuleClose
749 private JMenuItem
getJMenuItemFileClose() {
750 if (jMenuItemFileClose
== null) {
751 jMenuItemFileClose
= new JMenuItem();
752 jMenuItemFileClose
.setText("Close");
753 jMenuItemFileClose
.setMnemonic('C');
754 jMenuItemFileClose
.setEnabled(true);
755 jMenuItemFileClose
.addActionListener(this);
757 return jMenuItemFileClose
;
761 This method initializes jMenuTools
764 @return javax.swing.JMenu jMenuTools
767 private JMenu
getJMenuTools() {
768 if (jMenuTools
== null) {
770 // Set jMenuTools's attributes
772 jMenuTools
= new JMenu();
773 jMenuTools
.setText("Tools");
774 jMenuTools
.setMnemonic('T');
775 jMenuTools
.addMenuListener(this);
778 // Add sub menu items
781 jMenuTools
.add(getJMenuItemToolsClone());
782 jMenuTools
.add(getJMenuItemToolsCodeScan());
783 jMenuTools
.addSeparator();
785 jMenuTools
.add(getJMenuItemToolsToolChainConfiguration());
786 jMenuTools
.add(getJMenuItemToolsBuildPreferences());
792 This method initializes jMenuWindow
795 @return javax.swing.JMenu jMenuWindow
798 private JMenu
getJMenuWindow() {
799 if (jMenuWindow
== null) {
801 // Set jMenuWindow's attribute
803 jMenuWindow
= new JMenu();
804 jMenuWindow
.setText("Window");
805 jMenuWindow
.setMnemonic('W');
806 jMenuWindow
.setVisible(false);
809 // Add sub menu items
811 jMenuWindow
.add(getJMenuItemWindowDisplaySide());
812 jMenuWindow
.add(getJMenuItemWindowDisplayTopBottom());
813 jMenuWindow
.addSeparator();
815 jMenuWindow
.add(getJMenuItemWindowTabView());
816 jMenuWindow
.addSeparator();
818 jMenuWindow
.add(getJMenuItemWindowSource());
819 jMenuWindow
.add(getJMenuItemWindowXML());
820 jMenuWindow
.addSeparator();
822 jMenuWindow
.add(getJMenuItemWindowPreferences());
828 This method initializes jPanelOperation
831 @return javax.swing.JPanel jPanelOperation
834 private JPanel
getJPanelOperation() {
835 if (jPanelOperation
== null) {
836 jPanelOperation
= new JPanel();
837 jPanelOperation
.setLayout(null);
838 jPanelOperation
.setBounds(new java
.awt
.Rectangle(295, 520, 500, 25));
839 jPanelOperation
.add(getJButtonOk(), null);
840 jPanelOperation
.add(getJButtonCancel(), null);
841 jPanelOperation
.setVisible(false);
843 return jPanelOperation
;
847 This method initializes jButtonOk
850 @return javax.swing.JButton jButtonOk
853 private JButton
getJButtonOk() {
854 if (jButtonOk
== null) {
855 jButtonOk
= new JButton();
856 jButtonOk
.setBounds(new java
.awt
.Rectangle(395, 2, 90, 20));
857 jButtonOk
.setText("Ok");
858 jButtonOk
.setEnabled(false);
859 jButtonOk
.addActionListener(this);
865 This method initializes jButtonCancel
868 @return javax.swing.JButton jButtonCancel
871 private JButton
getJButtonCancel() {
872 if (jButtonCancel
== null) {
873 jButtonCancel
= new JButton();
874 jButtonCancel
.setBounds(new java
.awt
.Rectangle(395, 2, 90, 20));
875 jButtonCancel
.setText("Cancel");
876 jButtonCancel
.setEnabled(false);
877 jButtonCancel
.addActionListener(this);
878 jButtonCancel
.setVisible(false);
880 return jButtonCancel
;
884 This method initializes jMenuItemFileOpen
886 @return javax.swing.JMenuItem jMenuItemFileOpen
889 private JMenuItem
getJMenuItemFileOpen() {
890 if (jMenuItemFileOpen
== null) {
891 jMenuItemFileOpen
= new JMenuItem();
892 jMenuItemFileOpen
.setText("Open...");
893 jMenuItemFileOpen
.setMnemonic('O');
894 jMenuItemFileOpen
.addActionListener(this);
896 return jMenuItemFileOpen
;
900 This method initializes jMenuItemFileCloseAll
902 @return javax.swing.JMenuItem jMenuItemFileOpen
905 private JMenuItem
getJMenuItemFileCloseAll() {
906 if (jMenuItemFileCloseAll
== null) {
907 jMenuItemFileCloseAll
= new JMenuItem();
908 jMenuItemFileCloseAll
.setText("Close All");
909 jMenuItemFileCloseAll
.setMnemonic('A');
910 jMenuItemFileCloseAll
.setEnabled(true);
911 jMenuItemFileCloseAll
.addActionListener(this);
913 return jMenuItemFileCloseAll
;
917 This method initializes jMenuItemFileSaveAll
919 @return javax.swing.JMenuItem jMenuItemFileSaveAll
922 private JMenuItem
getJMenuItemFileSaveAll() {
923 if (jMenuItemFileSaveAll
== null) {
924 jMenuItemFileSaveAll
= new JMenuItem();
925 jMenuItemFileSaveAll
.setText("Save All");
926 jMenuItemFileSaveAll
.setMnemonic('v');
927 jMenuItemFileSaveAll
.setEnabled(true);
928 jMenuItemFileSaveAll
.addActionListener(this);
930 return jMenuItemFileSaveAll
;
934 This method initializes jMenuItemFilePageSetup
936 @return javax.swing.JMenuItem
939 private JMenuItem
getJMenuItemFilePageSetup() {
940 if (jMenuItemFilePageSetup
== null) {
941 jMenuItemFilePageSetup
= new JMenuItem();
942 jMenuItemFilePageSetup
.setText("Page Setup");
943 jMenuItemFilePageSetup
.setMnemonic('u');
944 jMenuItemFilePageSetup
.setEnabled(false);
945 jMenuItemFilePageSetup
.addActionListener(this);
946 jMenuItemFilePageSetup
.setVisible(false);
948 return jMenuItemFilePageSetup
;
952 This method initializes jMenuItemFilePrint
954 @return javax.swing.JMenuItem
957 private JMenuItem
getJMenuItemFilePrint() {
958 if (jMenuItemFilePrint
== null) {
959 jMenuItemFilePrint
= new JMenuItem();
960 jMenuItemFilePrint
.setText("Print");
961 jMenuItemFilePrint
.setMnemonic('P');
962 jMenuItemFilePrint
.setEnabled(false);
963 jMenuItemFilePrint
.addActionListener(this);
964 jMenuItemFilePrint
.setVisible(false);
966 return jMenuItemFilePrint
;
970 This method initializes jMenuItemFileImport
972 @return javax.swing.JMenuItem
975 private JMenuItem
getJMenuItemFileImport() {
976 if (jMenuItemFileImport
== null) {
977 jMenuItemFileImport
= new JMenuItem();
978 jMenuItemFileImport
.setText("Import");
979 jMenuItemFileImport
.setMnemonic('I');
980 jMenuItemFileImport
.setEnabled(false);
981 jMenuItemFileImport
.addActionListener(this);
982 jMenuItemFileImport
.setVisible(false);
984 return jMenuItemFileImport
;
988 This method initializes jMenuItemFileProperties
990 @return javax.swing.JMenuItem
993 private JMenuItem
getJMenuItemFileProperties() {
994 if (jMenuItemFileProperties
== null) {
995 jMenuItemFileProperties
= new JMenuItem();
996 jMenuItemFileProperties
.setText("Properties");
997 jMenuItemFileProperties
.setMnemonic('t');
998 jMenuItemFileProperties
.setEnabled(false);
999 jMenuItemFileProperties
.addActionListener(this);
1000 jMenuItemFileProperties
.setVisible(false);
1002 return jMenuItemFileProperties
;
1006 This method initializes jMenuFileRecentFiles
1008 @return javax.swing.JMenu
1011 private JMenu
getJMenuFileRecentFiles() {
1012 if (jMenuFileRecentFiles
== null) {
1013 jMenuFileRecentFiles
= new JMenu();
1014 jMenuFileRecentFiles
.setText("Recent Files");
1015 jMenuFileRecentFiles
.setMnemonic('F');
1016 jMenuFileRecentFiles
.setEnabled(false);
1017 jMenuFileRecentFiles
.addActionListener(this);
1018 jMenuFileRecentFiles
.setVisible(false);
1020 return jMenuFileRecentFiles
;
1024 This method initializes jMenuItemEditUndo
1026 @return javax.swing.JMenuItem
1029 private JMenuItem
getJMenuItemEditUndo() {
1030 if (jMenuItemEditUndo
== null) {
1031 jMenuItemEditUndo
= new JMenuItem();
1032 jMenuItemEditUndo
.setText("Undo");
1033 jMenuItemEditUndo
.setMnemonic('U');
1034 jMenuItemEditUndo
.setEnabled(false);
1035 jMenuItemEditUndo
.setVisible(false);
1036 jMenuItemEditUndo
.addActionListener(this);
1038 return jMenuItemEditUndo
;
1042 This method initializes jMenuItemEditRedo
1044 @return javax.swing.JMenuItem
1047 private JMenuItem
getJMenuItemEditRedo() {
1048 if (jMenuItemEditRedo
== null) {
1049 jMenuItemEditRedo
= new JMenuItem();
1050 jMenuItemEditRedo
.setText("Redo");
1051 jMenuItemEditRedo
.setMnemonic('R');
1052 jMenuItemEditRedo
.setEnabled(false);
1053 jMenuItemEditRedo
.setVisible(false);
1054 jMenuItemEditRedo
.addActionListener(this);
1056 return jMenuItemEditRedo
;
1060 This method initializes jMenuItemEditCut
1062 @return javax.swing.JMenuItem
1065 private JMenuItem
getJMenuItemEditCut() {
1066 if (jMenuItemEditCut
== null) {
1067 jMenuItemEditCut
= new JMenuItem();
1068 jMenuItemEditCut
.setText("Cut");
1069 jMenuItemEditCut
.setMnemonic('t');
1070 jMenuItemEditCut
.setEnabled(false);
1071 jMenuItemEditCut
.setVisible(false);
1072 jMenuItemEditCut
.addActionListener(this);
1074 return jMenuItemEditCut
;
1078 This method initializes jMenuItemEditCopy
1080 @return javax.swing.JMenuItem
1083 private JMenuItem
getJMenuItemEditCopy() {
1084 if (jMenuItemEditCopy
== null) {
1085 jMenuItemEditCopy
= new JMenuItem();
1086 jMenuItemEditCopy
.setText("Copy");
1087 jMenuItemEditCopy
.setMnemonic('C');
1088 jMenuItemEditCopy
.setEnabled(false);
1089 jMenuItemEditCopy
.setVisible(false);
1090 jMenuItemEditCopy
.addActionListener(this);
1092 return jMenuItemEditCopy
;
1096 This method initializes jMenuItemEditPaste
1098 return javax.swing.JMenuItem
1101 private JMenuItem
getJMenuItemEditPaste() {
1102 if (jMenuItemEditPaste
== null) {
1103 jMenuItemEditPaste
= new JMenuItem();
1104 jMenuItemEditPaste
.setText("Paste");
1105 jMenuItemEditPaste
.setMnemonic('P');
1106 jMenuItemEditPaste
.setEnabled(false);
1107 jMenuItemEditPaste
.setVisible(false);
1108 jMenuItemEditPaste
.addActionListener(this);
1110 return jMenuItemEditPaste
;
1114 This method initializes jMenuItem
1116 @return javax.swing.JMenuItem
1119 private JMenuItem
getJMenuItemEditSelectAll() {
1120 if (jMenuItemEditSelectAll
== null) {
1121 jMenuItemEditSelectAll
= new JMenuItem();
1122 jMenuItemEditSelectAll
.setText("Select All");
1123 jMenuItemEditSelectAll
.setMnemonic('A');
1124 jMenuItemEditSelectAll
.setEnabled(false);
1125 jMenuItemEditSelectAll
.setVisible(false);
1126 jMenuItemEditSelectAll
.addActionListener(this);
1128 return jMenuItemEditSelectAll
;
1132 This method initializes jMenuItemEditFindNext
1134 @return javax.swing.JMenuItem
1137 private JMenuItem
getJMenuItemEditFindNext() {
1138 if (jMenuItemEditFindNext
== null) {
1139 jMenuItemEditFindNext
= new JMenuItem();
1140 jMenuItemEditFindNext
.setText("Find Next");
1141 jMenuItemEditFindNext
.setMnemonic('n');
1142 jMenuItemEditFindNext
.setEnabled(false);
1143 jMenuItemEditFindNext
.setVisible(false);
1144 jMenuItemEditFindNext
.addActionListener(this);
1146 return jMenuItemEditFindNext
;
1150 This method initializes jMenuView
1152 @return javax.swing.JMenu
1155 private JMenu
getJMenuView() {
1156 if (jMenuView
== null) {
1158 // Set jMenuView's attributes
1160 jMenuView
= new JMenu();
1161 jMenuView
.setText("View");
1162 jMenuView
.setMnemonic('V');
1163 jMenuView
.setVisible(false);
1166 // Add sub menu items
1168 jMenuView
.add(getJMenuViewToolbars());
1169 jMenuView
.add(getJMenuItemViewAdvanced());
1170 jMenuView
.add(getJMenuItemViewStandard());
1171 jMenuView
.add(getJMenuItemViewXML());
1177 This method initializes jMenuViewToolbars
1179 @return javax.swing.JMenu
1182 private JMenu
getJMenuViewToolbars() {
1183 if (jMenuViewToolbars
== null) {
1184 jMenuViewToolbars
= new JMenu();
1185 jMenuViewToolbars
.setText("Toolbars");
1186 jMenuViewToolbars
.setMnemonic('T');
1188 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsFile());
1189 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsEdit());
1190 jMenuViewToolbars
.add(getJCheckBoxMenuItemViewToolbarsWindow());
1192 return jMenuViewToolbars
;
1196 This method initializes jCheckBoxMenuItemViewToolbarsFile
1198 @return javax.swing.JCheckBoxMenuItem
1201 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsFile() {
1202 if (jCheckBoxMenuItemViewToolbarsFile
== null) {
1203 jCheckBoxMenuItemViewToolbarsFile
= new JCheckBoxMenuItem();
1204 jCheckBoxMenuItemViewToolbarsFile
.setText("File");
1205 jCheckBoxMenuItemViewToolbarsFile
.setEnabled(false);
1206 jCheckBoxMenuItemViewToolbarsFile
.addActionListener(this);
1208 return jCheckBoxMenuItemViewToolbarsFile
;
1212 This method initializes jCheckBoxMenuItemViewToolbarsEdit
1214 @return javax.swing.JCheckBoxMenuItem
1217 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsEdit() {
1218 if (jCheckBoxMenuItemViewToolbarsEdit
== null) {
1219 jCheckBoxMenuItemViewToolbarsEdit
= new JCheckBoxMenuItem();
1220 jCheckBoxMenuItemViewToolbarsEdit
.setText("Edit");
1221 jCheckBoxMenuItemViewToolbarsEdit
.setEnabled(false);
1222 jCheckBoxMenuItemViewToolbarsEdit
.addActionListener(this);
1224 return jCheckBoxMenuItemViewToolbarsEdit
;
1228 This method initializes jCheckBoxMenuItemViewToolbarsWindow
1230 @return javax.swing.JCheckBoxMenuItem
1233 private JCheckBoxMenuItem
getJCheckBoxMenuItemViewToolbarsWindow() {
1234 if (jCheckBoxMenuItemViewToolbarsWindow
== null) {
1235 jCheckBoxMenuItemViewToolbarsWindow
= new JCheckBoxMenuItem();
1236 jCheckBoxMenuItemViewToolbarsWindow
.setText("Window");
1237 jCheckBoxMenuItemViewToolbarsWindow
.setEnabled(false);
1238 jCheckBoxMenuItemViewToolbarsWindow
.addActionListener(this);
1240 return jCheckBoxMenuItemViewToolbarsWindow
;
1244 This method initializes jMenuItemStandard
1246 @return javax.swing.JMenuItem
1249 private JMenuItem
getJMenuItemViewStandard() {
1250 if (jMenuItemViewStandard
== null) {
1251 jMenuItemViewStandard
= new JMenuItem();
1252 jMenuItemViewStandard
.setText("Standard");
1253 jMenuItemViewStandard
.setMnemonic('S');
1254 jMenuItemViewStandard
.setEnabled(false);
1255 jMenuItemViewStandard
.addActionListener(this);
1257 return jMenuItemViewStandard
;
1261 This method initializes jMenuItemAdvanced
1263 @return javax.swing.JMenuItem
1266 private JMenuItem
getJMenuItemViewAdvanced() {
1267 if (jMenuItemViewAdvanced
== null) {
1268 jMenuItemViewAdvanced
= new JMenuItem();
1269 jMenuItemViewAdvanced
.setText("Advanced");
1270 jMenuItemViewAdvanced
.setMnemonic('A');
1271 jMenuItemViewAdvanced
.setEnabled(false);
1272 jMenuItemViewAdvanced
.addActionListener(this);
1274 return jMenuItemViewAdvanced
;
1278 This method initializes jMenuProject
1280 @return javax.swing.JMenu
1283 private JMenu
getJMenuProject() {
1284 if (jMenuProject
== null) {
1286 // Set jMenuProject's attributes
1288 jMenuProject
= new JMenu();
1289 jMenuProject
.setText("Project");
1290 jMenuProject
.setMnemonic('P');
1293 // Add sub menu items
1295 jMenuProject
.add(getJMenuItemProjectAdmin());
1297 jMenuProject
.add(getJMenuItemProjectChangeWorkspace());
1298 jMenuProject
.addSeparator();
1300 jMenuProject
.add(getJMenuItemProjectCreateFar());
1301 jMenuProject
.add(getJMenuItemProjectInstallFar());
1302 jMenuProject
.add(getJMenuItemProjectUpdateFar());
1303 jMenuProject
.add(getJMenuItemProjectRemoveFar());
1306 return jMenuProject
;
1310 This method initializes jMenuItemProjectAdmin
1312 @return javax.swing.JMenuItem
1315 private JMenuItem
getJMenuItemProjectAdmin() {
1316 if (jMenuItemProjectAdmin
== null) {
1317 jMenuItemProjectAdmin
= new JMenuItem();
1318 jMenuItemProjectAdmin
.setText("Admin...");
1319 jMenuItemProjectAdmin
.setMnemonic('A');
1320 jMenuItemProjectAdmin
.setEnabled(false);
1321 jMenuItemProjectAdmin
.addActionListener(this);
1322 jMenuItemProjectAdmin
.setVisible(false);
1324 return jMenuItemProjectAdmin
;
1328 This method initializes jMenuItemProjectChangeWorkspace
1330 @return javax.swing.JMenuItem
1333 private JMenuItem
getJMenuItemProjectChangeWorkspace() {
1334 if (jMenuItemProjectChangeWorkspace
== null) {
1335 jMenuItemProjectChangeWorkspace
= new JMenuItem();
1336 jMenuItemProjectChangeWorkspace
.setText("Change WORKSPACE...");
1337 jMenuItemProjectChangeWorkspace
.setMnemonic('W');
1338 jMenuItemProjectChangeWorkspace
.setEnabled(true);
1339 jMenuItemProjectChangeWorkspace
.addActionListener(this);
1341 return jMenuItemProjectChangeWorkspace
;
1345 This method initializes jMenuProjectBuildPreferences
1347 @return javax.swing.JMenu
1350 private JMenuItem
getJMenuItemToolsBuildPreferences() {
1351 if (jMenuItemToolsBuildPreferences
== null) {
1352 jMenuItemToolsBuildPreferences
= new JMenuItem();
1353 jMenuItemToolsBuildPreferences
.setText("Build Preferences");
1354 jMenuItemToolsBuildPreferences
.setMnemonic('P');
1355 jMenuItemToolsBuildPreferences
.setEnabled(true);
1356 jMenuItemToolsBuildPreferences
.addActionListener(this);
1358 return jMenuItemToolsBuildPreferences
;
1362 This method initializes jMenuItemToolsToolChainConfiguration
1364 @return javax.swing.JMenuItem
1367 private JMenuItem
getJMenuItemToolsToolChainConfiguration() {
1368 if (jMenuItemToolsToolChainConfiguration
== null) {
1369 jMenuItemToolsToolChainConfiguration
= new JMenuItem();
1370 jMenuItemToolsToolChainConfiguration
.setText("Tool Chain Configuration...");
1371 jMenuItemToolsToolChainConfiguration
.setMnemonic('C');
1372 jMenuItemToolsToolChainConfiguration
.addActionListener(this);
1374 return jMenuItemToolsToolChainConfiguration
;
1378 This method initializes jMenuItemToolsClone
1380 @return javax.swing.JMenuItem
1383 private JMenuItem
getJMenuItemToolsClone() {
1384 if (jMenuItemToolsClone
== null) {
1385 jMenuItemToolsClone
= new JMenuItem();
1386 jMenuItemToolsClone
.setText("Clone...");
1387 jMenuItemToolsClone
.setMnemonic('l');
1388 jMenuItemToolsClone
.setEnabled(true);
1389 jMenuItemToolsClone
.addActionListener(this);
1391 return jMenuItemToolsClone
;
1395 This method initializes jMenuItemToolsCodeScan
1397 @return javax.swing.JMenuItem
1400 private JMenuItem
getJMenuItemToolsCodeScan() {
1401 if (jMenuItemToolsCodeScan
== null) {
1402 jMenuItemToolsCodeScan
= new JMenuItem();
1403 jMenuItemToolsCodeScan
.setText("Code Scan...");
1404 jMenuItemToolsCodeScan
.setMnemonic('S');
1405 jMenuItemToolsCodeScan
.setEnabled(false);
1406 jMenuItemToolsCodeScan
.addActionListener(this);
1407 jMenuItemToolsCodeScan
.setVisible(false);
1409 return jMenuItemToolsCodeScan
;
1413 This method initializes jMenuItemWindowSplitVertical
1415 @return javax.swing.JMenuItem
1418 private JMenuItem
getJMenuItemWindowDisplaySide() {
1419 if (jMenuItemWindowDisplaySide
== null) {
1420 jMenuItemWindowDisplaySide
= new JMenuItem();
1421 jMenuItemWindowDisplaySide
.setText("Display Side by Side");
1422 jMenuItemWindowDisplaySide
.setMnemonic('S');
1423 jMenuItemWindowDisplaySide
.setEnabled(false);
1424 jMenuItemWindowDisplaySide
.addActionListener(this);
1426 return jMenuItemWindowDisplaySide
;
1430 This method initializes jMenuItemWindowSplitHorizontal
1432 @return javax.swing.JMenuItem
1435 private JMenuItem
getJMenuItemWindowDisplayTopBottom() {
1436 if (jMenuItemWindowDisplayTopBottom
== null) {
1437 jMenuItemWindowDisplayTopBottom
= new JMenuItem();
1438 jMenuItemWindowDisplayTopBottom
.setText("Display Top and Bottom");
1439 jMenuItemWindowDisplayTopBottom
.setMnemonic('B');
1440 jMenuItemWindowDisplayTopBottom
.setEnabled(false);
1441 jMenuItemWindowDisplayTopBottom
.addActionListener(this);
1443 return jMenuItemWindowDisplayTopBottom
;
1447 This method initializes jMenuItemViewXML
1449 @return javax.swing.JMenuItem
1452 private JMenuItem
getJMenuItemViewXML() {
1453 if (jMenuItemViewXML
== null) {
1454 jMenuItemViewXML
= new JMenuItem();
1455 jMenuItemViewXML
.setText("XML");
1456 jMenuItemViewXML
.setMnemonic('X');
1457 jMenuItemViewXML
.setEnabled(false);
1458 jMenuItemViewXML
.addActionListener(this);
1460 return jMenuItemViewXML
;
1464 This method initializes jMenuItemWindowTabView
1466 @return javax.swing.JMenuItem
1469 private JMenuItem
getJMenuItemWindowTabView() {
1470 if (jMenuItemWindowTabView
== null) {
1471 jMenuItemWindowTabView
= new JMenuItem();
1472 jMenuItemWindowTabView
.setText("Tab View");
1473 jMenuItemWindowTabView
.setMnemonic('T');
1474 jMenuItemWindowTabView
.setEnabled(false);
1475 jMenuItemWindowTabView
.addActionListener(this);
1477 return jMenuItemWindowTabView
;
1481 This method initializes jMenuItemWindowSource
1483 @return javax.swing.JMenuItem
1486 private JMenuItem
getJMenuItemWindowSource() {
1487 if (jMenuItemWindowSource
== null) {
1488 jMenuItemWindowSource
= new JMenuItem();
1489 jMenuItemWindowSource
.setText("Source");
1490 jMenuItemWindowSource
.setMnemonic('S');
1491 jMenuItemWindowSource
.setEnabled(false);
1492 jMenuItemWindowSource
.addActionListener(this);
1494 return jMenuItemWindowSource
;
1498 This method initializes jMenuItemWindowXML
1500 @return javax.swing.JMenuItem
1503 private JMenuItem
getJMenuItemWindowXML() {
1504 if (jMenuItemWindowXML
== null) {
1505 jMenuItemWindowXML
= new JMenuItem();
1506 jMenuItemWindowXML
.setText("XML");
1507 jMenuItemWindowXML
.setMnemonic('X');
1508 jMenuItemWindowXML
.setEnabled(false);
1509 jMenuItemWindowXML
.addActionListener(this);
1511 return jMenuItemWindowXML
;
1515 This method initializes jMenuItemWindowPreferences
1517 @return javax.swing.JMenuItem
1520 private JMenuItem
getJMenuItemWindowPreferences() {
1521 if (jMenuItemWindowPreferences
== null) {
1522 jMenuItemWindowPreferences
= new JMenuItem();
1523 jMenuItemWindowPreferences
.setText("Preferences");
1524 jMenuItemWindowPreferences
.setMnemonic('P');
1525 jMenuItemWindowPreferences
.setEnabled(false);
1526 jMenuItemWindowPreferences
.addActionListener(this);
1528 return jMenuItemWindowPreferences
;
1532 This method initializes jMenuItemHelpContents
1534 @return javax.swing.JMenuItem
1537 private JMenuItem
getJMenuItemHelpContents() {
1538 if (jMenuItemHelpContents
== null) {
1539 jMenuItemHelpContents
= new JMenuItem();
1540 jMenuItemHelpContents
.setText("Contents");
1541 jMenuItemHelpContents
.setMnemonic('C');
1542 jMenuItemHelpContents
.setEnabled(false);
1543 jMenuItemHelpContents
.addActionListener(this);
1544 jMenuItemHelpContents
.setVisible(false);
1546 return jMenuItemHelpContents
;
1550 This method initializes jMenuItemHelpIndex
1552 @return javax.swing.JMenuItem
1555 private JMenuItem
getJMenuItemHelpIndex() {
1556 if (jMenuItemHelpIndex
== null) {
1557 jMenuItemHelpIndex
= new JMenuItem();
1558 jMenuItemHelpIndex
.setText("Index");
1559 jMenuItemHelpIndex
.setMnemonic('I');
1560 jMenuItemHelpIndex
.setEnabled(false);
1561 jMenuItemHelpIndex
.addActionListener(this);
1562 jMenuItemHelpIndex
.setVisible(false);
1564 return jMenuItemHelpIndex
;
1568 This method initializes jMenuItemHelpSearch
1570 @return javax.swing.JMenuItem
1573 private JMenuItem
getJMenuItemHelpSearch() {
1574 if (jMenuItemHelpSearch
== null) {
1575 jMenuItemHelpSearch
= new JMenuItem();
1576 jMenuItemHelpSearch
.setText("Search");
1577 jMenuItemHelpSearch
.setMnemonic('S');
1578 jMenuItemHelpSearch
.setEnabled(false);
1579 jMenuItemHelpSearch
.addActionListener(this);
1580 jMenuItemHelpSearch
.setVisible(false);
1582 return jMenuItemHelpSearch
;
1586 * This method initializes jMenuItemToolsInstallPackage
1588 * @return javax.swing.JMenuItem
1590 private JMenuItem
getJMenuItemProjectInstallFar() {
1591 if (jMenuItemProjectInstallFar
== null) {
1592 jMenuItemProjectInstallFar
= new JMenuItem();
1593 jMenuItemProjectInstallFar
.setText("Install FAR");
1594 jMenuItemProjectInstallFar
.setMnemonic('I');
1595 jMenuItemProjectInstallFar
.setEnabled(true);
1596 jMenuItemProjectInstallFar
.addActionListener(this);
1598 return jMenuItemProjectInstallFar
;
1602 * This method initializes jMenuItemToolsUpdatePackage
1604 * @return javax.swing.JMenuItem
1606 private JMenuItem
getJMenuItemProjectUpdateFar() {
1607 if (jMenuItemProjectUpdateFar
== null) {
1608 jMenuItemProjectUpdateFar
= new JMenuItem();
1609 jMenuItemProjectUpdateFar
.setText("Update FAR");
1610 jMenuItemProjectUpdateFar
.setMnemonic('U');
1611 jMenuItemProjectUpdateFar
.setEnabled(true);
1612 jMenuItemProjectUpdateFar
.addActionListener(this);
1613 jMenuItemProjectUpdateFar
.setVisible(true);
1615 return jMenuItemProjectUpdateFar
;
1619 * This method initializes jMenuItemRemovePackage
1621 * @return javax.swing.JMenuItem
1623 private JMenuItem
getJMenuItemProjectRemoveFar() {
1624 if (jMenuItemProjectRemoveFar
== null) {
1625 jMenuItemProjectRemoveFar
= new JMenuItem();
1626 jMenuItemProjectRemoveFar
.setText("Remove FAR");
1627 jMenuItemProjectRemoveFar
.setMnemonic('R');
1628 jMenuItemProjectRemoveFar
.setEnabled(true);
1629 jMenuItemProjectRemoveFar
.addActionListener(this);
1631 return jMenuItemProjectRemoveFar
;
1635 * This method initializes jMenuItemProjectCreateFar
1637 * @return javax.swing.JMenuItem
1639 private JMenuItem
getJMenuItemProjectCreateFar() {
1640 if (jMenuItemProjectCreateFar
== null) {
1641 jMenuItemProjectCreateFar
= new JMenuItem();
1642 jMenuItemProjectCreateFar
.setText("Create FAR");
1643 jMenuItemProjectCreateFar
.setMnemonic('C');
1644 jMenuItemProjectCreateFar
.addActionListener(this);
1646 return jMenuItemProjectCreateFar
;
1650 * This method initializes jMenuEditFind
1652 * @return javax.swing.JMenu
1654 private JMenu
getJMenuEditFind() {
1655 if (jMenuEditFind
== null) {
1656 jMenuEditFind
= new JMenu();
1657 jMenuEditFind
.setText("Find");
1658 jMenuEditFind
.setMnemonic('F');
1660 jMenuEditFind
.add(getJMenuItemEditFindPpi());
1661 jMenuEditFind
.add(getJMenuItemEditFindProtocol());
1662 jMenuEditFind
.add(getJMenuItemEditFindGuid());
1663 jMenuEditFind
.add(getJMenuItemEditFindPcd());
1664 jMenuEditFind
.add(getJMenuItemEditFindLibraryClass());
1665 jMenuEditFind
.add(getJMenuItemEditFindLibraryInstance());
1667 return jMenuEditFind
;
1671 * This method initializes jMenuItemEditFindPcd
1673 * @return javax.swing.JMenuItem
1675 private JMenuItem
getJMenuItemEditFindPcd() {
1676 if (jMenuItemEditFindPcd
== null) {
1677 jMenuItemEditFindPcd
= new JMenuItem();
1678 jMenuItemEditFindPcd
.setText("All PCD entries");
1679 jMenuItemEditFindPcd
.setMnemonic('P');
1680 jMenuItemEditFindPcd
.addActionListener(this);
1682 return jMenuItemEditFindPcd
;
1686 * This method initializes jMenuItemEditFindLibraryClass
1688 * @return javax.swing.JMenuItem
1690 private JMenuItem
getJMenuItemEditFindLibraryClass() {
1691 if (jMenuItemEditFindLibraryClass
== null) {
1692 jMenuItemEditFindLibraryClass
= new JMenuItem();
1693 jMenuItemEditFindLibraryClass
.setText("All Library Classes");
1694 jMenuItemEditFindLibraryClass
.setMnemonic('C');
1695 jMenuItemEditFindLibraryClass
.addActionListener(this);
1697 return jMenuItemEditFindLibraryClass
;
1701 * This method initializes jMenuItemEditFindPpi
1703 * @return javax.swing.JMenuItem
1705 private JMenuItem
getJMenuItemEditFindPpi() {
1706 if (jMenuItemEditFindPpi
== null) {
1707 jMenuItemEditFindPpi
= new JMenuItem();
1708 jMenuItemEditFindPpi
.setText("All PPIs");
1709 jMenuItemEditFindPpi
.setMnemonic('I');
1710 jMenuItemEditFindPpi
.addActionListener(this);
1712 return jMenuItemEditFindPpi
;
1716 * This method initializes jMenuItemEditFindProtocol
1718 * @return javax.swing.JMenuItem
1720 private JMenuItem
getJMenuItemEditFindProtocol() {
1721 if (jMenuItemEditFindProtocol
== null) {
1722 jMenuItemEditFindProtocol
= new JMenuItem();
1723 jMenuItemEditFindProtocol
.setText("All Protocols");
1724 jMenuItemEditFindProtocol
.setMnemonic('r');
1725 jMenuItemEditFindProtocol
.addActionListener(this);
1727 return jMenuItemEditFindProtocol
;
1731 * This method initializes jMenuItemEditFindGuid
1733 * @return javax.swing.JMenuItem
1735 private JMenuItem
getJMenuItemEditFindGuid() {
1736 if (jMenuItemEditFindGuid
== null) {
1737 jMenuItemEditFindGuid
= new JMenuItem();
1738 jMenuItemEditFindGuid
.setText("All GUIDs");
1739 jMenuItemEditFindGuid
.setMnemonic('G');
1740 jMenuItemEditFindGuid
.addActionListener(this);
1742 return jMenuItemEditFindGuid
;
1746 * This method initializes jMenuItemEditFindLibraryInstance
1748 * @return javax.swing.JMenuItem
1750 private JMenuItem
getJMenuItemEditFindLibraryInstance() {
1751 if (jMenuItemEditFindLibraryInstance
== null) {
1752 jMenuItemEditFindLibraryInstance
= new JMenuItem();
1753 jMenuItemEditFindLibraryInstance
.setText("All Library Instances");
1754 jMenuItemEditFindLibraryInstance
.setMnemonic('n');
1755 jMenuItemEditFindLibraryInstance
.addActionListener(this);
1756 jMenuItemEditFindLibraryInstance
.setVisible(false);
1758 return jMenuItemEditFindLibraryInstance
;
1762 * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
1764 * Main class, start the GUI
1767 public static void main(String
[] args
) {
1768 FrameworkWizardUI module
= FrameworkWizardUI
.getInstance();
1769 module
.setVisible(true);
1773 This is the default constructor
1776 public FrameworkWizardUI() {
1782 This method initializes this
1786 private void init() {
1788 // Show splash screen
1790 SplashScreen ss
= new SplashScreen();
1791 ss
.setVisible(true);
1794 // Set current workspace and check
1795 // Check if exists WORKSPACE
1798 Workspace
.setCurrentWorkspace(System
.getenv("WORKSPACE"));
1799 if (!Workspace
.checkCurrentWorkspace()) {
1800 JOptionPane
.showConfirmDialog(null, "Workspace is not setup correctly. Please setup first.", "Warning",
1801 JOptionPane
.DEFAULT_OPTION
, JOptionPane
.WARNING_MESSAGE
);
1812 // Close splash screen
1819 this.setSize(DataType
.MAIN_FRAME_PREFERRED_SIZE_WIDTH
, DataType
.MAIN_FRAME_PREFERRED_SIZE_HEIGHT
);
1820 this.setResizable(true);
1821 this.setJMenuBar(getjJMenuBar());
1822 this.setContentPane(getJContentPane());
1823 this.setTitle(DataType
.PROJECT_NAME
+ " " + DataType
.PROJECT_VERSION
+ " " + "- ["
1824 + Workspace
.getCurrentWorkspace() + "]");
1825 this.setExitType(1);
1830 this.setExtendedState(JFrame
.MAXIMIZED_BOTH
);
1834 This method initializes jContentPane
1836 @return javax.swing.JPanel jContentPane
1839 private JPanel
getJContentPane() {
1840 if (jContentPane
== null) {
1841 jContentPane
= new JPanel();
1842 jContentPane
.setLayout(null);
1843 jContentPane
.add(getJPanelOperation(), null);
1844 jContentPane
.add(getJSplitPane(), null);
1846 return jContentPane
;
1850 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1852 * Override actionPerformed to listen all actions
1855 public void actionPerformed(ActionEvent arg0
) {
1857 // Operations of Menu
1859 if (arg0
.getSource() == this.jMenuItemFileNew
) {
1863 if (arg0
.getSource() == this.jMenuItemFileOpen
) {
1867 if (arg0
.getSource() == this.jMenuItemFileClose
) {
1871 if (arg0
.getSource() == this.jMenuItemFileCloseAll
) {
1873 this.makeEmptyTree();
1876 if (arg0
.getSource() == this.jMenuItemFileSave
) {
1880 if (arg0
.getSource() == this.jMenuItemFileSaveAs
) {
1884 if (arg0
.getSource() == this.jMenuItemFileSaveAll
) {
1888 if (arg0
.getSource() == this.jMenuItemFileRefresh
) {
1891 this.makeEmptyTree();
1894 if (arg0
.getSource() == this.jMenuItemFileExit
) {
1898 if (arg0
.getSource() == this.jMenuItemEditFindPpi
) {
1902 if (arg0
.getSource() == this.jMenuItemEditFindProtocol
) {
1903 this.findProtocol();
1906 if (arg0
.getSource() == this.jMenuItemEditFindGuid
) {
1910 if (arg0
.getSource() == this.jMenuItemEditFindPcd
) {
1914 if (arg0
.getSource() == this.jMenuItemEditFindLibraryClass
) {
1915 this.findLibraryClass();
1918 if (arg0
.getSource() == this.jMenuItemEditFindLibraryInstance
) {
1919 this.findLibraryInstance();
1922 if (arg0
.getSource() == jMenuItemToolsBuildPreferences
) {
1923 configBuildPreferences();
1926 if (arg0
.getSource() == this.jMenuItemProjectChangeWorkspace
) {
1927 this.changeWorkspace();
1930 if (arg0
.getSource() == this.jMenuItemProjectCreateFar
) {
1934 if (arg0
.getSource() == this.jMenuItemProjectInstallFar
) {
1938 if (arg0
.getSource() == this.jMenuItemProjectRemoveFar
) {
1942 if (arg0
.getSource() == this.jMenuItemProjectUpdateFar
) {
1946 if (arg0
.getSource() == this.jMenuItemToolsClone
) {
1950 if (arg0
.getSource() == this.jMenuItemToolsToolChainConfiguration
) {
1951 this.setupToolChainConfiguration();
1954 if (arg0
.getSource() == this.jMenuItemHelpAbout
) {
1955 About a
= new About(this, true);
1956 int result
= a
.showDialog();
1957 if (result
== DataType
.RETURN_TYPE_OK
) {
1964 Create an empty tree if no file is open
1967 private void makeEmptyTree() {
1971 dmtnRoot
= new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode
.WORKSPACE
, false, null, null);
1974 // Make Module Description
1976 dmtnModuleDescription
= new IDefaultMutableTreeNode("Modules", IDefaultMutableTreeNode
.MODULE_DESCRIPTION
,
1977 false, null, dmtnRoot
);
1980 // First add package
1982 if (GlobalData
.vPackageList
.size() > 0) {
1983 for (int index
= 0; index
< GlobalData
.vPackageList
.size(); index
++) {
1984 IDefaultMutableTreeNode dmtnModulePackage
= null;
1985 IDefaultMutableTreeNode dmtnModulePackageLibrary
= null;
1986 IDefaultMutableTreeNode dmtnModulePackageModule
= null;
1988 dmtnModulePackage
= new IDefaultMutableTreeNode(GlobalData
.vPackageList
.elementAt(index
).getName(),
1989 IDefaultMutableTreeNode
.MODULE_PACKAGE
, false,
1990 GlobalData
.vPackageList
.elementAt(index
),
1991 this.dmtnModuleDescription
);
1992 dmtnModulePackageLibrary
= new IDefaultMutableTreeNode("Library",
1993 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
,
1994 false, GlobalData
.vPackageList
.elementAt(index
),
1995 this.dmtnModuleDescription
);
1996 dmtnModulePackageModule
= new IDefaultMutableTreeNode("Module",
1997 IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
1998 false, GlobalData
.vPackageList
.elementAt(index
),
1999 this.dmtnModuleDescription
);
2001 // And then add each module in its package
2003 Vector
<ModuleIdentification
> vModule
= wt
.getAllModules(GlobalData
.vPackageList
.elementAt(index
));
2004 for (int indexJ
= 0; indexJ
< vModule
.size(); indexJ
++) {
2005 if (vModule
.get(indexJ
).isLibrary()) {
2006 dmtnModulePackageLibrary
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2007 IDefaultMutableTreeNode
.MODULE
, false,
2008 vModule
.get(indexJ
),
2009 this.dmtnModuleDescription
));
2011 dmtnModulePackageModule
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2012 IDefaultMutableTreeNode
.MODULE
, false,
2013 vModule
.get(indexJ
),
2014 this.dmtnModuleDescription
));
2017 if (dmtnModulePackageModule
.getChildCount() > 0) {
2018 dmtnModulePackage
.add(dmtnModulePackageModule
);
2020 if (dmtnModulePackageLibrary
.getChildCount() > 0) {
2021 dmtnModulePackage
.add(dmtnModulePackageLibrary
);
2024 dmtnModuleDescription
.add(dmtnModulePackage
);
2029 // Make Package Description
2031 dmtnPackageDescription
= new IDefaultMutableTreeNode("Packages", IDefaultMutableTreeNode
.PACKAGE_DESCRIPTION
,
2032 false, null, this.dmtnRoot
);
2033 if (GlobalData
.vPackageList
.size() > 0) {
2034 for (int index
= 0; index
< GlobalData
.vPackageList
.size(); index
++) {
2035 dmtnPackageDescription
.add(new IDefaultMutableTreeNode(GlobalData
.vPackageList
.elementAt(index
)
2037 IDefaultMutableTreeNode
.PACKAGE
, false,
2038 GlobalData
.vPackageList
.elementAt(index
),
2039 this.dmtnPackageDescription
));
2044 // Make Platform Description
2046 dmtnPlatformDescription
= new IDefaultMutableTreeNode("Platforms",
2047 IDefaultMutableTreeNode
.PLATFORM_DESCRIPTION
, false,
2048 null, this.dmtnRoot
);
2049 if (GlobalData
.vPlatformList
.size() > 0) {
2050 for (int index
= 0; index
< GlobalData
.vPlatformList
.size(); index
++) {
2051 dmtnPlatformDescription
.add(new IDefaultMutableTreeNode(GlobalData
.vPlatformList
.elementAt(index
)
2053 IDefaultMutableTreeNode
.PLATFORM
, false,
2054 GlobalData
.vPlatformList
.elementAt(index
),
2055 this.dmtnPlatformDescription
));
2060 // Add sub nodes to root node
2062 dmtnRoot
.add(dmtnModuleDescription
);
2063 dmtnRoot
.add(dmtnPackageDescription
);
2064 dmtnRoot
.add(dmtnPlatformDescription
);
2065 iTree
= new ITree(dmtnRoot
);
2066 iTree
.addMouseListener(this);
2067 iTree
.addKeyListener(this);
2068 jScrollPaneTree
.setViewportView(iTree
);
2072 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
2074 * Override windowClosing to popup warning message to confirm quit
2077 public void windowClosing(WindowEvent arg0
) {
2082 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
2084 * Override mouseClicked to check if need display popup menu
2087 public void mouseClicked(MouseEvent arg0
) {
2089 // When double click
2091 if (arg0
.getClickCount() == 2) {
2092 doubleClickModuleTreeNode();
2096 public void mouseEntered(MouseEvent arg0
) {
2097 // TODO Auto-generated method stub
2100 public void mouseExited(MouseEvent arg0
) {
2101 // TODO Auto-generated method stub
2104 public void mousePressed(MouseEvent arg0
) {
2105 // TODO Auto-generated method stub
2108 public void mouseReleased(MouseEvent arg0
) {
2109 // TODO Auto-generated method stub
2113 Remove all Internal Frame of Module Desktop Pane
2116 private void cleanDesktopPaneModule() {
2117 if (jDesktopPaneModule
!= null) {
2118 JInternalFrame
[] iif
= this.jDesktopPaneModule
.getAllFrames();
2119 for (int index
= 0; index
< iif
.length
; index
++) {
2120 iif
[index
].dispose();
2126 Remove all Internal Frame of package Desktop Pane
2129 private void cleanDesktopPanePackage() {
2130 if (jDesktopPanePlatform
!= null) {
2131 JInternalFrame
[] iif
= this.jDesktopPanePackage
.getAllFrames();
2132 for (int index
= 0; index
< iif
.length
; index
++) {
2133 iif
[index
].dispose();
2139 Remove all Internal Frame of platform Desktop Pane
2142 private void cleanDesktopPanePlatform() {
2143 if (jDesktopPanePlatform
!= null) {
2144 JInternalFrame
[] iif
= this.jDesktopPanePlatform
.getAllFrames();
2145 for (int index
= 0; index
< iif
.length
; index
++) {
2146 iif
[index
].dispose();
2152 Remove all Internal Frame of all Desktop Panes
2155 private void cleanDesktopPane() {
2156 cleanDesktopPaneModule();
2157 cleanDesktopPanePackage();
2158 cleanDesktopPanePlatform();
2162 Set file filter as input ext
2168 private int getNewFilePath(String ext
) {
2169 JFileChooser fc
= new JFileChooser(Workspace
.getCurrentWorkspace());
2170 fc
.setAcceptAllFileFilterUsed(false);
2171 fc
.addChoosableFileFilter(new IFileFilter(ext
));
2172 return fc
.showSaveDialog(new JPanel());
2176 Add a module to tree
2178 @param mid The module node to be added
2181 private void addModuleToTree(ModuleIdentification mid
) {
2183 // Add new MsaHeader node to the tree
2185 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(mid
.getName(), IDefaultMutableTreeNode
.MODULE
,
2186 false, mid
, this.dmtnModuleDescription
);
2188 // First find the module belongs to which package
2190 IDefaultMutableTreeNode packageNode
= iTree
.getNodeById(dmtnModuleDescription
, mid
.getPackageId(),
2191 IDefaultMutableTreeNode
.MODULE_PACKAGE
);
2193 // To check if has module node or library node
2195 IDefaultMutableTreeNode parentModuleNode
= null;
2196 IDefaultMutableTreeNode parentLibraryNode
= null;
2197 boolean hasModule
= false;
2198 boolean hasLibrary
= false;
2199 for (int index
= 0; index
< packageNode
.getChildCount(); index
++) {
2200 IDefaultMutableTreeNode iNode
= (IDefaultMutableTreeNode
) packageNode
.getChildAt(index
);
2201 if (iNode
.getCategory() == IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
) {
2203 parentLibraryNode
= iNode
;
2205 if (iNode
.getCategory() == IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
) {
2207 parentModuleNode
= iNode
;
2214 if (!mid
.isLibrary()) {
2216 // Create parent node first if has no parent node
2219 parentModuleNode
= new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2220 false, mid
.getPackageId(), this.dmtnModuleDescription
);
2221 iTree
.addNode(packageNode
, parentModuleNode
);
2224 iTree
.addNode(parentModuleNode
, node
);
2230 if (mid
.isLibrary()) {
2232 // Create parent node first if has no parent node
2235 parentLibraryNode
= new IDefaultMutableTreeNode("Library",
2236 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
, false,
2237 mid
.getPackageId(), this.dmtnModuleDescription
);
2238 iTree
.addNode(packageNode
, parentLibraryNode
);
2241 iTree
.addNode(parentLibraryNode
, node
);
2248 @param path input file path
2251 private void openModule(String path
, IDefaultMutableTreeNode belongNode
) {
2252 ModuleIdentification id
= GlobalData
.openingModuleList
.getIdByPath(path
);
2255 // The module is not in existing packages
2257 Log
.wrn("Open Module", "The module does not belong to any package in the current workspace!");
2262 // Make the node selected
2264 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(belongNode
, id
, IDefaultMutableTreeNode
.MODULE
)));
2267 // Update opening Module list information
2269 if (!iTree
.getSelectNode().isOpening()) {
2271 // Insert sub node of module
2273 insertModuleTreeNode(id
, belongNode
);
2274 iTree
.getSelectNode().setOpening(true);
2277 // Update opening module list
2279 GlobalData
.openingModuleList
.setModuleOpen(id
, true);
2280 Set
<TreePath
> temp
= GlobalData
.openingModuleList
.getTreePathById(id
);
2281 temp
.add(iTree
.getSelectionPath());
2282 GlobalData
.openingModuleList
.setTreePathById(id
, temp
);
2285 // Select msa header node and show it in editor panel
2288 .setSelectionPath(iTree
2289 .getPathOfNode(iTree
2290 .getNodeById(belongNode
, id
, IDefaultMutableTreeNode
.MSA_HEADER
)));
2291 showModuleElement(IDefaultMutableTreeNode
.MSA_HEADER
, GlobalData
.openingModuleList
.getOpeningModuleById(id
));
2292 this.currentOpeningModuleIndex
= GlobalData
.openingModuleList
.findIndexOfListById(id
);
2298 @param path input file path
2301 private void openPackage(String path
) {
2302 PackageIdentification id
= GlobalData
.openingPackageList
.getIdByPath(path
);
2305 // The package is not in current workspace
2307 Log
.wrn("Open Package", "The package has not been installed in the current workspace!");
2312 // Make the node selected
2314 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPackageDescription
, id
,
2315 IDefaultMutableTreeNode
.PACKAGE
)));
2317 // Update opening package list information
2319 if (!GlobalData
.openingPackageList
.getPackageOpen(id
)) {
2321 // Insert sub node of module
2323 insertPackageTreeNode(id
);
2324 iTree
.getSelectNode().setOpening(true);
2327 // Update opening module list
2329 GlobalData
.openingPackageList
.setPackageOpen(id
, true);
2330 Set
<TreePath
> temp
= GlobalData
.openingPackageList
.getTreePathById(id
);
2331 temp
.add(iTree
.getSelectionPath());
2332 GlobalData
.openingPackageList
.setTreePathById(id
, temp
);
2335 // Show spd header in editor panel
2337 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPackageDescription
, id
,
2338 IDefaultMutableTreeNode
.SPD_HEADER
)));
2339 showPackageElement(IDefaultMutableTreeNode
.SPD_HEADER
, GlobalData
.openingPackageList
.getOpeningPackageById(id
));
2340 this.currentOpeningPackageIndex
= GlobalData
.openingPackageList
.findIndexOfListById(id
);
2346 @param path input file path
2349 private void openPlatform(String path
) {
2350 PlatformIdentification id
= GlobalData
.openingPlatformList
.getIdByPath(path
);
2353 // The platform is not in current workspace
2355 Log
.wrn("Open Platform", "The platform has not been installed in the current workspace!");
2360 // Make the node selected
2362 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPlatformDescription
, id
,
2363 IDefaultMutableTreeNode
.PLATFORM
)));
2365 // Update opening package list information
2367 if (!GlobalData
.openingPlatformList
.getPlatformOpen(id
)) {
2369 // Insert sub node of module
2371 insertPlatformTreeNode(id
);
2372 iTree
.getSelectNode().setOpening(true);
2375 // Update opening module list
2377 GlobalData
.openingPlatformList
.setPlatformOpen(id
, true);
2378 Set
<TreePath
> temp
= GlobalData
.openingPlatformList
.getTreePathById(id
);
2379 temp
.add(iTree
.getSelectionPath());
2380 GlobalData
.openingPlatformList
.setTreePathById(id
, temp
);
2383 // Show fpd header in editor panel
2385 iTree
.setSelectionPath(iTree
.getPathOfNode(iTree
.getNodeById(this.dmtnPlatformDescription
, id
,
2386 IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
)));
2387 showPlatformElement(IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
,
2388 GlobalData
.openingPlatformList
.getOpeningPlatformById(id
));
2389 this.currentOpeningPlatformIndex
= GlobalData
.openingPlatformList
.findIndexOfListById(id
);
2396 private void saveModule(int index
) {
2397 OpeningModuleType omt
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(index
);
2399 if (getNewFilePath(DataType
.MODULE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2404 SaveFile
.saveMsaFile(omt
.getId().getPath(), omt
.getXmlMsa());
2405 GlobalData
.openingModuleList
.setNew(omt
.getId(), false);
2406 GlobalData
.openingModuleList
.setModuleSaved(omt
.getId(), true);
2407 } catch (Exception e
) {
2408 Log
.wrn("Save Module", e
.getMessage());
2409 Log
.err("Save Module", e
.getMessage());
2417 private void savePackage(int index
) {
2418 OpeningPackageType opt
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(index
);
2420 if (getNewFilePath(DataType
.PACKAGE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2425 SaveFile
.saveSpdFile(opt
.getId().getPath(), opt
.getXmlSpd());
2426 GlobalData
.openingPackageList
.setNew(opt
.getId(), false);
2427 GlobalData
.openingPackageList
.setPackageSaved(opt
.getId(), true);
2428 } catch (Exception e
) {
2429 Log
.wrn("Save Package", e
.getMessage());
2430 Log
.err("Save Package", e
.getMessage());
2438 private void savePlatform(int index
) {
2439 OpeningPlatformType opt
= GlobalData
.openingPlatformList
.getOpeningPlatformByIndex(index
);
2441 if (getNewFilePath(DataType
.PACKAGE_SURFACE_AREA_EXT
) != JFileChooser
.APPROVE_OPTION
) {
2446 SaveFile
.saveFpdFile(opt
.getId().getPath(), opt
.getXmlFpd());
2447 GlobalData
.openingPlatformList
.setNew(opt
.getId(), false);
2448 GlobalData
.openingPlatformList
.setPlatformSaved(opt
.getId(), true);
2449 } catch (Exception e
) {
2450 Log
.wrn("Save Package", e
.getMessage());
2451 Log
.err("Save Package", e
.getMessage());
2455 public void componentResized(ComponentEvent arg0
) {
2456 if (this.jSplitPane
!= null) {
2457 this.jSplitPane
.setSize(this.getWidth() - DataType
.MAIN_FRAME_WIDTH_SPACING
,
2458 this.getHeight() - DataType
.MAIN_FRAME_HEIGHT_SPACING
);
2459 this.jSplitPane
.validate();
2460 resizeDesktopPanel();
2465 Resize JDesktopPanel
2468 private void resizeDesktopPanel() {
2469 resizeDesktopPanel(this.jDesktopPaneModule
);
2470 resizeDesktopPanel(this.jDesktopPanePackage
);
2471 resizeDesktopPanel(this.jDesktopPanePlatform
);
2475 Resize JDesktopPanel
2478 private void resizeDesktopPanel(JDesktopPane jdk
) {
2479 JInternalFrame
[] iif
= jdk
.getAllFrames();
2480 for (int index
= 0; index
< iif
.length
; index
++) {
2481 iif
[index
].setSize(jdk
.getWidth(), jdk
.getHeight());
2485 private void insertModuleTreeNode(Identification id
, IDefaultMutableTreeNode belongNode
) {
2486 iTree
.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode
.MSA_HEADER
, true, id
,
2488 iTree
.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode
.MSA_SOURCEFILES
, true, id
,
2490 iTree
.addNode(new IDefaultMutableTreeNode("Library Class Definitions",
2491 IDefaultMutableTreeNode
.MSA_LIBRARYCLASSDEFINITIONS
, true, id
,
2494 .addNode(new IDefaultMutableTreeNode("Package Dependencies",
2495 IDefaultMutableTreeNode
.MSA_PACKAGEDEPENDENCIES
, true, id
, belongNode
));
2496 iTree
.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode
.MSA_PROTOCOLS
, true, id
,
2498 iTree
.addNode(new IDefaultMutableTreeNode("Events", IDefaultMutableTreeNode
.MSA_EVENTS
, true, id
, belongNode
));
2499 iTree
.addNode(new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode
.MSA_HOBS
, true, id
, belongNode
));
2500 iTree
.addNode(new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode
.MSA_PPIS
, true, id
, belongNode
));
2501 iTree
.addNode(new IDefaultMutableTreeNode("Variables", IDefaultMutableTreeNode
.MSA_VARIABLES
, true, id
,
2503 iTree
.addNode(new IDefaultMutableTreeNode("Boot Modes", IDefaultMutableTreeNode
.MSA_BOOTMODES
, true, id
,
2505 iTree
.addNode(new IDefaultMutableTreeNode("System Tables", IDefaultMutableTreeNode
.MSA_SYSTEMTABLES
, true, id
,
2507 iTree
.addNode(new IDefaultMutableTreeNode("Data Hubs", IDefaultMutableTreeNode
.MSA_DATAHUBS
, true, id
,
2509 iTree
.addNode(new IDefaultMutableTreeNode("Hii Packages", IDefaultMutableTreeNode
.MSA_HIIPACKAGES
, true, id
,
2511 iTree
.addNode(new IDefaultMutableTreeNode("Guids", IDefaultMutableTreeNode
.MSA_GUIDS
, true, id
, belongNode
));
2512 iTree
.addNode(new IDefaultMutableTreeNode("External Defintions", IDefaultMutableTreeNode
.MSA_EXTERNS
, true, id
,
2514 iTree
.addNode(new IDefaultMutableTreeNode("Pcd Coded", IDefaultMutableTreeNode
.MSA_PCDS
, true, id
, belongNode
));
2517 private void insertPackageTreeNode(Identification id
) {
2518 IDefaultMutableTreeNode idmtTemp
= this.dmtnPackageDescription
;
2519 iTree
.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode
.SPD_HEADER
, true, id
,
2521 iTree
.addNode(new IDefaultMutableTreeNode("Library Class Declarations",
2522 IDefaultMutableTreeNode
.SPD_LIBRARYCLASSDECLARATIONS
, true, id
,
2524 iTree
.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode
.SPD_MSAFILES
, false, id
,
2526 iTree
.addNode(new IDefaultMutableTreeNode("Package Includes", IDefaultMutableTreeNode
.SPD_PACKAGEHEADERS
, true,
2528 iTree
.addNode(new IDefaultMutableTreeNode("Guid Declarations", IDefaultMutableTreeNode
.SPD_GUIDDECLARATIONS
,
2529 true, id
, idmtTemp
));
2531 .addNode(new IDefaultMutableTreeNode("Protocol Declarations",
2532 IDefaultMutableTreeNode
.SPD_PROTOCOLDECLARATIONS
, true, id
, idmtTemp
));
2533 iTree
.addNode(new IDefaultMutableTreeNode("Ppi Declarations", IDefaultMutableTreeNode
.SPD_PPIDECLARATIONS
,
2534 true, id
, idmtTemp
));
2535 iTree
.addNode(new IDefaultMutableTreeNode("Pcd Declarations", IDefaultMutableTreeNode
.SPD_PCDDECLARATIONS
,
2536 true, id
, idmtTemp
));
2538 // Add modules in this package
2540 IDefaultMutableTreeNode dmtnModulePackageLibrary
= null;
2541 IDefaultMutableTreeNode dmtnModulePackageModule
= null;
2543 dmtnModulePackageLibrary
= new IDefaultMutableTreeNode("Library",
2544 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
, false,
2546 dmtnModulePackageModule
= new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2547 false, id
, idmtTemp
);
2549 Vector
<ModuleIdentification
> vModule
= wt
.getAllModules(new PackageIdentification(id
));
2550 for (int indexJ
= 0; indexJ
< vModule
.size(); indexJ
++) {
2551 if (vModule
.get(indexJ
).isLibrary()) {
2552 dmtnModulePackageLibrary
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2553 IDefaultMutableTreeNode
.MODULE
, false,
2554 vModule
.get(indexJ
), idmtTemp
));
2556 dmtnModulePackageModule
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2557 IDefaultMutableTreeNode
.MODULE
, false,
2558 vModule
.get(indexJ
), idmtTemp
));
2561 if (dmtnModulePackageModule
.getChildCount() > 0) {
2562 iTree
.addNode(dmtnModulePackageModule
);
2564 if (dmtnModulePackageLibrary
.getChildCount() > 0) {
2565 iTree
.addNode(dmtnModulePackageLibrary
);
2569 private void insertPlatformTreeNode(Identification id
) {
2570 IDefaultMutableTreeNode idmtTemp
= this.dmtnPlatformDescription
;
2571 iTree
.addNode(new IDefaultMutableTreeNode("Platform Header", IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
, true,
2573 iTree
.addNode(new IDefaultMutableTreeNode("Platform Definitions",
2574 IDefaultMutableTreeNode
.FPD_PLATFORMDEFINITIONS
, true, id
, idmtTemp
));
2575 iTree
.addNode(new IDefaultMutableTreeNode("Flash Information", IDefaultMutableTreeNode
.FPD_FLASH
, true, id
,
2577 iTree
.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode
.FPD_FRAMEWORKMODULES
,
2578 true, id
, idmtTemp
));
2579 iTree
.addNode(new IDefaultMutableTreeNode("Dynamic PCD Build Declarations",
2580 IDefaultMutableTreeNode
.FPD_PCDDYNAMICBUILDDECLARATIONS
, true, id
,
2582 iTree
.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode
.FPD_BUILDOPTIONS
, true, id
,
2586 // Add modules in this platform
2588 IDefaultMutableTreeNode dmtnModulePackageLibrary
= null;
2589 IDefaultMutableTreeNode dmtnModulePackageModule
= null;
2591 dmtnModulePackageLibrary
= new IDefaultMutableTreeNode("Library",
2592 IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
, false,
2594 dmtnModulePackageModule
= new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
,
2595 false, id
, idmtTemp
);
2597 Vector
<ModuleIdentification
> vModule
= wt
.getAllModules(new PlatformIdentification(id
));
2598 for (int indexJ
= 0; indexJ
< vModule
.size(); indexJ
++) {
2599 if (vModule
.get(indexJ
).isLibrary()) {
2600 dmtnModulePackageLibrary
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2601 IDefaultMutableTreeNode
.MODULE
, false,
2602 vModule
.get(indexJ
), idmtTemp
));
2604 dmtnModulePackageModule
.add(new IDefaultMutableTreeNode(vModule
.get(indexJ
).getName(),
2605 IDefaultMutableTreeNode
.MODULE
, false,
2606 vModule
.get(indexJ
), idmtTemp
));
2609 if (dmtnModulePackageModule
.getChildCount() > 0) {
2610 iTree
.addNode(dmtnModulePackageModule
);
2612 if (dmtnModulePackageLibrary
.getChildCount() > 0) {
2613 iTree
.addNode(dmtnModulePackageLibrary
);
2618 Operate when double click a tree node
2621 private void doubleClickModuleTreeNode() {
2622 Identification id
= null;
2623 int intCategory
= -1;
2625 IDefaultMutableTreeNode belongNode
= null;
2628 id
= iTree
.getSelectNode().getId();
2629 intCategory
= iTree
.getSelectCategory();
2630 belongNode
= iTree
.getSelectNode().getBelongNode();
2633 // If id is null, return directly
2640 // If the node is not opened yet
2641 // Insert top level elements first
2643 if (intCategory
== IDefaultMutableTreeNode
.MODULE
) {
2644 path
= iTree
.getSelectNode().getId().getPath();
2645 openModule(path
, belongNode
);
2648 if (intCategory
== IDefaultMutableTreeNode
.PACKAGE
) {
2649 path
= iTree
.getSelectNode().getId().getPath();
2653 if (intCategory
== IDefaultMutableTreeNode
.PLATFORM
) {
2654 path
= iTree
.getSelectNode().getId().getPath();
2660 // Show editor panel
2662 if (intCategory
>= IDefaultMutableTreeNode
.MSA_HEADER
&& intCategory
< IDefaultMutableTreeNode
.SPD_HEADER
) {
2663 showModuleElement(intCategory
,
2664 GlobalData
.openingModuleList
.getOpeningModuleById(new ModuleIdentification(id
)));
2665 this.currentOpeningModuleIndex
= GlobalData
.openingModuleList
2666 .findIndexOfListById(new ModuleIdentification(
2669 if (intCategory
>= IDefaultMutableTreeNode
.SPD_HEADER
2670 && intCategory
< IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
2671 showPackageElement(intCategory
,
2672 GlobalData
.openingPackageList
.getOpeningPackageById(new PackageIdentification(id
)));
2673 this.currentOpeningPackageIndex
= GlobalData
.openingPackageList
2674 .findIndexOfListById(new PackageIdentification(
2677 if (intCategory
>= IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
) {
2678 showPlatformElement(
2680 GlobalData
.openingPlatformList
2681 .getOpeningPlatformById(new PlatformIdentification(id
)));
2682 this.currentOpeningPlatformIndex
= GlobalData
.openingPlatformList
2683 .findIndexOfListById(new PlatformIdentification(
2686 } catch (Exception e
) {
2687 Log
.err("double click category: " + intCategory
);
2688 Log
.err("double click belong node: " + belongNode
.toString());
2689 Log
.err("double click id path: " + id
);
2690 Log
.err("double click exception: " + e
.getMessage());
2695 Show content of editor panel via selected element
2701 private void showPlatformElement(int elementType
, OpeningPlatformType fpd
) {
2702 this.cleanDesktopPanePlatform();
2704 switch (elementType
) {
2705 case IDefaultMutableTreeNode
.FPD_PLATFORMDEFINITIONS
:
2706 FpdPlatformDefs frmFpdPlatformDefs
= new FpdPlatformDefs(fpd
);
2707 getJDesktopPanePlatform().add(frmFpdPlatformDefs
, 1);
2709 case IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
:
2710 FpdHeader frmFpdHeader
= new FpdHeader(fpd
);
2711 getJDesktopPanePlatform().add(frmFpdHeader
, 1);
2713 case IDefaultMutableTreeNode
.FPD_FLASH
:
2714 FpdFlash frmFpdFlash
= new FpdFlash(fpd
);
2715 getJDesktopPanePlatform().add(frmFpdFlash
, 1);
2717 case IDefaultMutableTreeNode
.FPD_FRAMEWORKMODULES
:
2718 FpdFrameworkModules frmFpdFrameworkModules
= new FpdFrameworkModules(fpd
);
2719 getJDesktopPanePlatform().add(frmFpdFrameworkModules
, 1);
2721 case IDefaultMutableTreeNode
.FPD_PCDDYNAMICBUILDDECLARATIONS
:
2722 FpdDynamicPcdBuildDefinitions frmFpdDynamicPcdBuildDefinitions
= new FpdDynamicPcdBuildDefinitions(fpd
);
2723 getJDesktopPanePlatform().add(frmFpdDynamicPcdBuildDefinitions
, 1);
2725 case IDefaultMutableTreeNode
.FPD_BUILDOPTIONS
:
2726 FpdBuildOptions frmFpdBuildOptions
= new FpdBuildOptions(fpd
);
2727 getJDesktopPanePlatform().add(frmFpdBuildOptions
, 1);
2730 this.jTabbedPaneEditor
.setSelectedIndex(2);
2731 resizeDesktopPanel();
2735 Show content of editor panel via selected element
2741 private void showPackageElement(int elementType
, OpeningPackageType spd
) {
2742 this.cleanDesktopPanePackage();
2743 Tools
.dirForNewSpd
= spd
.getId().getPath();
2744 switch (elementType
) {
2745 case IDefaultMutableTreeNode
.SPD_HEADER
:
2746 SpdHeader frmSpdHeader
= new SpdHeader(spd
);
2747 getJDesktopPanePackage().add(frmSpdHeader
, 1);
2749 case IDefaultMutableTreeNode
.SPD_LIBRARYCLASSDECLARATIONS
:
2750 SpdLibClassDecls frmSlcd
= new SpdLibClassDecls(spd
);
2751 getJDesktopPanePackage().add(frmSlcd
, 1);
2753 case IDefaultMutableTreeNode
.SPD_MSAFILES
:
2754 SpdMsaFiles frmSmf
= new SpdMsaFiles(spd
);
2755 getJDesktopPanePackage().add(frmSmf
, 1);
2757 case IDefaultMutableTreeNode
.SPD_PACKAGEHEADERS
:
2758 SpdPackageHeaders frmSph
= new SpdPackageHeaders(spd
);
2759 getJDesktopPanePackage().add(frmSph
, 1);
2761 case IDefaultMutableTreeNode
.SPD_GUIDDECLARATIONS
:
2762 SpdGuidDecls frmSgd
= new SpdGuidDecls(spd
);
2763 getJDesktopPanePackage().add(frmSgd
, 1);
2765 case IDefaultMutableTreeNode
.SPD_PROTOCOLDECLARATIONS
:
2766 SpdProtocolDecls frmSprod
= new SpdProtocolDecls(spd
);
2767 getJDesktopPanePackage().add(frmSprod
, 1);
2769 case IDefaultMutableTreeNode
.SPD_PPIDECLARATIONS
:
2770 SpdPpiDecls frmSppid
= new SpdPpiDecls(spd
);
2771 getJDesktopPanePackage().add(frmSppid
, 1);
2773 case IDefaultMutableTreeNode
.SPD_PCDDECLARATIONS
:
2774 SpdPcdDefs frmSpcdd
= new SpdPcdDefs(spd
);
2775 getJDesktopPanePackage().add(frmSpcdd
, 1);
2778 this.jTabbedPaneEditor
.setSelectedIndex(1);
2779 resizeDesktopPanel();
2783 Show content of editor panel via selected element
2789 private void showModuleElement(int elementType
, OpeningModuleType msa
) {
2790 this.cleanDesktopPaneModule();
2791 switch (elementType
) {
2792 case IDefaultMutableTreeNode
.MSA_HEADER
:
2793 MsaHeader frmMsaHeader
= new MsaHeader(msa
);
2794 getJDesktopPaneModule().add(frmMsaHeader
, 1);
2796 case IDefaultMutableTreeNode
.MSA_LIBRARYCLASSDEFINITIONS
:
2797 ModuleLibraryClassDefinitions frmMlcd
= new ModuleLibraryClassDefinitions(msa
);
2798 getJDesktopPaneModule().add(frmMlcd
, 1);
2800 case IDefaultMutableTreeNode
.MSA_PACKAGEDEPENDENCIES
:
2801 ModulePackageDependencies frmMpd
= new ModulePackageDependencies(msa
);
2802 getJDesktopPaneModule().add(frmMpd
, 1);
2804 case IDefaultMutableTreeNode
.MSA_SOURCEFILES
:
2805 ModuleSourceFiles frmMsf
= new ModuleSourceFiles(msa
);
2806 getJDesktopPaneModule().add(frmMsf
, 1);
2808 case IDefaultMutableTreeNode
.MSA_PROTOCOLS
:
2809 ModuleProtocols frmMp
= new ModuleProtocols(msa
);
2810 getJDesktopPaneModule().add(frmMp
, 1);
2812 case IDefaultMutableTreeNode
.MSA_EVENTS
:
2813 ModuleEvents frmMe
= new ModuleEvents(msa
);
2814 getJDesktopPaneModule().add(frmMe
, 1);
2816 case IDefaultMutableTreeNode
.MSA_HOBS
:
2817 ModuleHobs frmMh
= new ModuleHobs(msa
);
2818 getJDesktopPaneModule().add(frmMh
, 1);
2820 case IDefaultMutableTreeNode
.MSA_PPIS
:
2821 ModulePpis frmMpp
= new ModulePpis(msa
);
2822 getJDesktopPaneModule().add(frmMpp
, 1);
2824 case IDefaultMutableTreeNode
.MSA_VARIABLES
:
2825 ModuleVariables frmMv
= new ModuleVariables(msa
);
2826 getJDesktopPaneModule().add(frmMv
, 1);
2828 case IDefaultMutableTreeNode
.MSA_BOOTMODES
:
2829 ModuleBootModes frmMbm
= new ModuleBootModes(msa
);
2830 getJDesktopPaneModule().add(frmMbm
, 1);
2832 case IDefaultMutableTreeNode
.MSA_SYSTEMTABLES
:
2833 ModuleSystemTables frmMst
= new ModuleSystemTables(msa
);
2834 getJDesktopPaneModule().add(frmMst
, 1);
2836 case IDefaultMutableTreeNode
.MSA_DATAHUBS
:
2837 ModuleDataHubs frmMdh
= new ModuleDataHubs(msa
);
2838 getJDesktopPaneModule().add(frmMdh
, 1);
2840 case IDefaultMutableTreeNode
.MSA_HIIPACKAGES
:
2841 ModuleHiiPackages frmMf
= new ModuleHiiPackages(msa
);
2842 getJDesktopPaneModule().add(frmMf
, 1);
2844 case IDefaultMutableTreeNode
.MSA_GUIDS
:
2845 ModuleGuids frmGuid
= new ModuleGuids(msa
);
2846 getJDesktopPaneModule().add(frmGuid
, 1);
2848 case IDefaultMutableTreeNode
.MSA_EXTERNS
:
2849 ModuleExterns frmMex
= new ModuleExterns(msa
);
2850 getJDesktopPaneModule().add(frmMex
, 1);
2852 case IDefaultMutableTreeNode
.MSA_PCDS
:
2853 ModulePCDs frmPcd
= new ModulePCDs(msa
);
2854 getJDesktopPaneModule().add(frmPcd
, 1);
2857 this.jTabbedPaneEditor
.setSelectedIndex(0);
2858 resizeDesktopPanel();
2862 // Define operations of menu
2868 private void fileNew() {
2871 // Selece new file type
2873 NewFileChooser nfc
= new NewFileChooser(this, true);
2874 result
= nfc
.showDialog();
2876 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2879 } else if (result
== DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
) {
2883 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2884 result
= smb
.showDialog();
2886 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2890 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2891 ModuleIdentification mid
= smb
.getMid();
2894 // Update package of workspace first
2896 PackageSurfaceAreaDocument
.PackageSurfaceArea psa
= null;
2897 if (GlobalData
.openingPackageList
.existsPackage(mid
.getPackageId())) {
2898 psa
= GlobalData
.openingPackageList
.getPackageSurfaceAreaFromId(mid
.getPackageId());
2901 wt
.addModuleToPackage(mid
, psa
);
2902 } catch (IOException e
) {
2903 Log
.wrn("Update MsaFiles in Package", e
.getMessage());
2904 Log
.err("Update MsaFiles in Package", e
.getMessage());
2906 } catch (XmlException e
) {
2907 Log
.wrn("Update MsaFiles in Package", e
.getMessage());
2908 Log
.err("Update MsaFiles in Package", e
.getMessage());
2910 } catch (Exception e
) {
2911 Log
.wrn("Update MsaFiles in Package", e
.getMessage());
2912 Log
.err("Update MsaFiles in Package", e
.getMessage());
2917 // Update Global Data
2919 GlobalData
.openingModuleList
.insertToOpeningModuleList(mid
, smb
.getMsa());
2920 GlobalData
.vModuleList
.addElement(mid
);
2923 // Create new node on the tree
2925 addModuleToTree(mid
);
2930 this.openModule(mid
.getPath(), this.dmtnModuleDescription
);
2933 } else if (result
== DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
) {
2937 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2938 result
= smb
.showDialog();
2940 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2944 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2945 PackageIdentification pid
= smb
.getPid();
2948 wt
.addPackageToDatabase(smb
.getPid());
2949 } catch (Exception e
) {
2950 Log
.err("addPackageToDatabase", e
.getMessage());
2954 // Update Global Data
2956 GlobalData
.openingPackageList
.insertToOpeningPackageList(pid
, smb
.getSpd());
2957 GlobalData
.vPackageList
.addElement(pid
);
2960 // Add to Module Description node
2962 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(pid
.getName(),
2963 IDefaultMutableTreeNode
.MODULE_PACKAGE
,
2964 false, pid
, this.dmtnModuleDescription
);
2966 iTree
.addNode(dmtnModuleDescription
, node
);
2969 // Add new SpdHeader node to the tree
2971 node
= new IDefaultMutableTreeNode(pid
.getName(), IDefaultMutableTreeNode
.PACKAGE
, true, pid
,
2972 this.dmtnPackageDescription
);
2973 iTree
.addNode(dmtnPackageDescription
, node
);
2975 this.openPackage(pid
.getPath());
2978 } else if (result
== DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
) {
2980 // To new a platform
2982 SelectModuleBelong smb
= new SelectModuleBelong(this, true, result
);
2983 result
= smb
.showDialog();
2985 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
2989 } else if (result
== DataType
.RETURN_TYPE_OK
) {
2990 PlatformIdentification fid
= smb
.getFid();
2993 wt
.addPlatformToDatabase(fid
);
2994 } catch (Exception e
) {
2995 Log
.err("addPlatformToDatabase", e
.getMessage());
2999 // Update global data
3001 GlobalData
.openingPlatformList
.insertToOpeningPlatformList(fid
, smb
.getFpd());
3002 GlobalData
.vPlatformList
.addElement(fid
);
3004 // Add new SpdHeader node to the tree
3006 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(fid
.getName(),
3007 IDefaultMutableTreeNode
.PLATFORM
, true,
3008 fid
, this.dmtnPlatformDescription
);
3009 iTree
.addNode(dmtnPlatformDescription
, node
);
3010 this.openPlatform(fid
.getPath());
3020 private void open() {
3021 JFileChooser fc
= new JFileChooser(Workspace
.getCurrentWorkspace());
3022 fc
.setAcceptAllFileFilterUsed(false);
3023 IFileFilter iffM
= new IFileFilter(DataType
.MODULE_SURFACE_AREA_EXT
);
3024 IFileFilter iffP
= new IFileFilter(DataType
.PACKAGE_SURFACE_AREA_EXT
);
3025 IFileFilter iffF
= new IFileFilter(DataType
.PLATFORM_SURFACE_AREA_EXT
);
3026 fc
.addChoosableFileFilter(iffM
);
3027 fc
.addChoosableFileFilter(iffP
);
3028 fc
.addChoosableFileFilter(iffF
);
3029 fc
.setFileFilter(iffM
);
3031 int result
= fc
.showOpenDialog(new JPanel());
3033 if (result
== JFileChooser
.APPROVE_OPTION
) {
3034 String path
= fc
.getSelectedFile().getPath();
3035 String match
= path
.substring(path
.length() - 4);
3036 if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.MODULE_SURFACE_AREA_EXT
)) {
3037 openModule(path
, this.dmtnModuleDescription
);
3038 } else if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.PACKAGE_SURFACE_AREA_EXT
)) {
3040 } else if (match
.equals(DataType
.FILE_EXT_SEPARATOR
+ DataType
.PLATFORM_SURFACE_AREA_EXT
)) {
3050 private void close() {
3051 TreePath item
= null;
3052 switch (this.jTabbedPaneEditor
.getSelectedIndex()) {
3054 // Current is module
3057 if (this.currentOpeningModuleIndex
> -1) {
3058 if (!GlobalData
.openingModuleList
.getModuleSaved(currentOpeningModuleIndex
)) {
3059 int result
= showSaveDialog();
3060 if (result
== JOptionPane
.YES_OPTION
) {
3063 if (result
== JOptionPane
.NO_OPTION
) {
3066 if (result
== JOptionPane
.CANCEL_OPTION
) {
3072 // Remove all tree paths for the module
3074 Set
<TreePath
> openingTreePaths
= GlobalData
.openingModuleList
3075 .getTreePathByIndex(currentOpeningModuleIndex
);
3076 Iterator
<TreePath
> openingTreePathsIter
= openingTreePaths
.iterator();
3077 while (openingTreePathsIter
.hasNext()) {
3078 item
= openingTreePathsIter
.next();
3079 iTree
.getNodeByPath(item
).setOpening(false);
3080 iTree
.removeNodeChildrenByPath(item
);
3083 GlobalData
.openingModuleList
.setModuleOpen(this.currentOpeningModuleIndex
, false);
3084 this.cleanDesktopPaneModule();
3085 this.currentOpeningModuleIndex
= -1;
3089 // Current is package
3092 if (this.currentOpeningPackageIndex
> -1) {
3093 if (!GlobalData
.openingPackageList
.getPackageSaved(currentOpeningPackageIndex
)) {
3094 int result
= showSaveDialog();
3095 if (result
== JOptionPane
.YES_OPTION
) {
3098 if (result
== JOptionPane
.NO_OPTION
) {
3101 if (result
== JOptionPane
.CANCEL_OPTION
) {
3107 // Remove all tree paths for the module
3109 Set
<TreePath
> openingTreePaths
= GlobalData
.openingPackageList
3110 .getTreePathByIndex(currentOpeningPackageIndex
);
3111 Iterator
<TreePath
> openingTreePathsIter
= openingTreePaths
.iterator();
3112 while (openingTreePathsIter
.hasNext()) {
3113 item
= openingTreePathsIter
.next();
3114 iTree
.getNodeByPath(item
).setOpening(false);
3115 iTree
.removeNodeChildrenByPath(item
);
3118 GlobalData
.openingPackageList
.setPackageOpen(this.currentOpeningPackageIndex
, false);
3119 this.cleanDesktopPanePackage();
3120 this.currentOpeningPackageIndex
= -1;
3124 // Current is platform
3127 if (this.currentOpeningPlatformIndex
> -1) {
3128 if (!GlobalData
.openingPlatformList
.getPlatformSaved(currentOpeningPlatformIndex
)) {
3129 int result
= showSaveDialog();
3130 if (result
== JOptionPane
.YES_OPTION
) {
3133 if (result
== JOptionPane
.NO_OPTION
) {
3136 if (result
== JOptionPane
.CANCEL_OPTION
) {
3142 // Remove all tree paths for the module
3144 Set
<TreePath
> openingTreePaths
= GlobalData
.openingPlatformList
3145 .getTreePathByIndex(currentOpeningPlatformIndex
);
3146 Iterator
<TreePath
> openingTreePathsIter
= openingTreePaths
.iterator();
3147 while (openingTreePathsIter
.hasNext()) {
3148 item
= openingTreePathsIter
.next();
3149 iTree
.getNodeByPath(item
).setOpening(false);
3150 iTree
.removeNodeChildrenByPath(item
);
3153 GlobalData
.openingPlatformList
.setPlatformOpen(this.currentOpeningPlatformIndex
, false);
3154 this.cleanDesktopPanePlatform();
3155 this.currentOpeningPlatformIndex
= -1;
3162 Close all opening files and clean all showing internal frame
3165 private void closeAll() {
3167 if (!GlobalData
.openingModuleList
.isSaved() || !GlobalData
.openingPackageList
.isSaved()
3168 || !GlobalData
.openingPlatformList
.isSaved()) {
3169 result
= showSaveDialog();
3171 if (result
== JOptionPane
.YES_OPTION
) {
3174 if (result
== JOptionPane
.NO_OPTION
) {
3179 if (result
== JOptionPane
.CANCEL_OPTION
) {
3182 this.cleanDesktopPane();
3183 GlobalData
.openingModuleList
.closeAll();
3184 GlobalData
.openingPackageList
.closeAll();
3185 GlobalData
.openingPlatformList
.closeAll();
3189 Refresh all global data from disk to memory
3192 private void refresh() {
3197 Save currentModule when press button OK
3200 private void save() {
3201 switch (this.jTabbedPaneEditor
.getSelectedIndex()) {
3203 if (this.currentOpeningModuleIndex
> -1) {
3204 saveModule(this.currentOpeningModuleIndex
);
3208 if (this.currentOpeningPackageIndex
> -1) {
3209 savePackage(this.currentOpeningPackageIndex
);
3213 if (this.currentOpeningPlatformIndex
> -1) {
3214 savePlatform(this.currentOpeningPlatformIndex
);
3220 private void saveAs() {
3224 private void saveAll() {
3228 for (int index
= 0; index
< GlobalData
.openingModuleList
.size(); index
++) {
3229 if (!GlobalData
.openingModuleList
.getModuleSaved(index
)) {
3235 // Save all packages
3237 for (int index
= 0; index
< GlobalData
.openingPackageList
.size(); index
++) {
3238 if (!GlobalData
.openingPackageList
.getPackageSaved(index
)) {
3244 // Save all platforms
3246 for (int index
= 0; index
< GlobalData
.openingPlatformList
.size(); index
++) {
3247 if (!GlobalData
.openingPlatformList
.getPlatformSaved(index
)) {
3248 savePlatform(index
);
3254 To save changed items before exit.
3257 private void exit() {
3259 if (!GlobalData
.openingModuleList
.isSaved() || !GlobalData
.openingPackageList
.isSaved()
3260 || !GlobalData
.openingPlatformList
.isSaved()) {
3261 result
= showSaveDialog();
3263 if (result
== JOptionPane
.YES_OPTION
) {
3266 if (result
== JOptionPane
.NO_OPTION
) {
3269 if (result
== JOptionPane
.CANCEL_OPTION
) {
3277 To find all defined PPIs in workspace
3280 private void findPpi() {
3281 FindResult fr
= FindResult
.getInstance("PPI");
3282 fr
.setVisible(true);
3286 To find all defined PROTOCOLs in workspace
3289 private void findProtocol() {
3290 FindResult fr
= FindResult
.getInstance("PROTOCOL");
3291 fr
.setVisible(true);
3295 To find all defined PROTOCOLs in workspace
3298 private void findGuid() {
3299 FindResult fr
= FindResult
.getInstance("GUID");
3300 fr
.setVisible(true);
3304 To find all defined PROTOCOLs in workspace
3307 private void findPcd() {
3308 FindResult fr
= FindResult
.getInstance("PCD");
3309 fr
.setVisible(true);
3313 To find all defined Library Classes in workspace
3316 private void findLibraryClass() {
3317 FindResult fr
= FindResult
.getInstance("LIBRARY_CLASS");
3318 fr
.setVisible(true);
3322 To find all defined Library Instances in workspace
3325 private void findLibraryInstance() {
3326 FindResult fr
= FindResult
.getInstance("LIBRARY_INSTANCE");
3327 fr
.setVisible(true);
3331 Switch current workspace to others
3334 private void changeWorkspace() {
3335 SwitchWorkspace sw
= new SwitchWorkspace(this, true);
3336 int result
= sw
.showDialog();
3337 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3339 } else if (result
== DataType
.RETURN_TYPE_OK
) {
3341 // Reinit whole window
3344 this.setTitle(DataType
.PROJECT_NAME
+ " " + DataType
.PROJECT_VERSION
+ " " + "- ["
3345 + Workspace
.getCurrentWorkspace() + "]");
3355 To create a Far file from current workspace
3358 private void createFar() {
3359 CreateStepOne cso
= new CreateStepOne(this, true);
3360 int result
= cso
.showDialog();
3361 if (result
== DataType
.RETURN_TYPE_OK
) {
3362 String strReturn
= "Far Creation Completed!";
3363 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3364 JOptionPane
.INFORMATION_MESSAGE
);
3370 To install a Far file to current workspace
3373 private void installFar() {
3374 InstallStepOne iso
= new InstallStepOne(this, true);
3375 int result
= iso
.showDialog();
3376 if (result
== DataType
.RETURN_TYPE_OK
) {
3377 String strReturn
= "<html>Far Installalation completed!<br>Refreshing the WORKSPACE!</html>";
3378 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3379 JOptionPane
.INFORMATION_MESSAGE
);
3382 this.makeEmptyTree();
3388 To remove a Far's items from current workspace
3391 private void removeFar() {
3392 DeleteStepOne dso
= new DeleteStepOne(this, true);
3393 int result
= dso
.showDialog();
3394 if (result
== DataType
.RETURN_TYPE_OK
) {
3395 String strReturn
= "<html>Far Deletion completed!<br>Refreshing the WORKSPACE!</html>";
3396 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3397 JOptionPane
.INFORMATION_MESSAGE
);
3400 this.makeEmptyTree();
3406 To update an existing Far file
3409 private void updateFar() {
3410 UpdateStepOne uso
= new UpdateStepOne(this, true);
3411 int result
= uso
.showDialog();
3412 if (result
== DataType
.RETURN_TYPE_OK
) {
3413 String strReturn
= "<html>Far Update completed!<br>Refreshing the WORKSPACE!</html>";
3414 JOptionPane
.showConfirmDialog(null, strReturn
, "Done", JOptionPane
.DEFAULT_OPTION
,
3415 JOptionPane
.INFORMATION_MESSAGE
);
3418 this.makeEmptyTree();
3424 Show Tool Chain Configuration Dialog to setup Tool Chain
3427 private void setupToolChainConfiguration() {
3428 ToolChainConfig tcc
= ToolChainConfig
.getInstance();
3432 private void configBuildPreferences() {
3433 Preferences bt
= Preferences
.getInstance();
3441 private void cloneItem() {
3445 // Check if there is any item can be cloned
3447 if (iTree
.getSelectionPath() == null) {
3448 Log
.wrn("Clone", "Please select a target to clone!");
3451 int category
= iTree
.getSelectCategory();
3452 Identification id
= iTree
.getSelectNode().getId();
3454 if (category
== IDefaultMutableTreeNode
.WORKSPACE
) {
3455 mode
= DataType
.RETURN_TYPE_WORKSPACE
;
3458 if ((category
== IDefaultMutableTreeNode
.MODULE
)
3459 || (category
>= IDefaultMutableTreeNode
.MSA_HEADER
&& category
< IDefaultMutableTreeNode
.SPD_HEADER
)) {
3460 mode
= DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
;
3462 if ((category
== IDefaultMutableTreeNode
.PACKAGE
)
3463 || (category
>= IDefaultMutableTreeNode
.SPD_HEADER
&& category
< IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
)) {
3464 mode
= DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
;
3466 if ((category
== IDefaultMutableTreeNode
.PLATFORM
) || (category
>= IDefaultMutableTreeNode
.FPD_PLATFORMHEADER
)) {
3467 mode
= DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
;
3470 Clone c
= new Clone(this, true, mode
, id
);
3471 int result
= c
.showDialog();
3473 if (result
== DataType
.RETURN_TYPE_CANCEL
) {
3476 if (result
== DataType
.RETURN_TYPE_WORKSPACE
) {
3477 Tools
.showInformationMessage("Workspace Clone Completed!");
3479 if (result
== DataType
.RETURN_TYPE_MODULE_SURFACE_AREA
) {
3480 Tools
.showInformationMessage("Module Clone Completed!");
3481 addModuleToTree(c
.getMid());
3483 if (result
== DataType
.RETURN_TYPE_PACKAGE_SURFACE_AREA
) {
3484 Tools
.showInformationMessage("Package Clone Completed!");
3486 // Add new SpdHeader node to the tree
3488 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(GlobalData
.vPackageList
.lastElement().getName(),
3489 IDefaultMutableTreeNode
.PACKAGE
, false,
3490 GlobalData
.vPackageList
.lastElement(),
3491 this.dmtnPackageDescription
);
3492 iTree
.addNode(this.dmtnPackageDescription
, node
);
3494 if (result
== DataType
.RETURN_TYPE_PLATFORM_SURFACE_AREA
) {
3495 Tools
.showInformationMessage("Platform Surface Area Clone Finished");
3497 // Add new SpdHeader node to the tree
3499 IDefaultMutableTreeNode node
= new IDefaultMutableTreeNode(
3500 GlobalData
.vPlatformList
.lastElement().getName(),
3501 IDefaultMutableTreeNode
.PLATFORM
, false,
3502 GlobalData
.vPlatformList
.lastElement(),
3503 this.dmtnPlatformDescription
);
3504 iTree
.addNode(this.dmtnPlatformDescription
, node
);
3506 if (result
== DataType
.RETURN_TYPE_OK
) {
3511 public void valueChanged(TreeSelectionEvent arg0
) {
3512 // TODO Auto-generated method stub
3516 public void menuCanceled(MenuEvent arg0
) {
3517 // TODO Auto-generated method stub
3521 public void menuDeselected(MenuEvent arg0
) {
3522 // TODO Auto-generated method stub
3526 public void menuSelected(MenuEvent arg0
) {
3527 if (arg0
.getSource() == jMenuFile
) {
3529 // Enable close/close all if some files are opened
3531 jMenuItemFileClose
.setEnabled(GlobalData
.openingModuleList
.isOpen()
3532 || GlobalData
.openingPackageList
.isOpen()
3533 || GlobalData
.openingPlatformList
.isOpen());
3534 jMenuItemFileCloseAll
.setEnabled(GlobalData
.openingModuleList
.isOpen()
3535 || GlobalData
.openingPackageList
.isOpen()
3536 || GlobalData
.openingPlatformList
.isOpen());
3539 // Enable save/save all if some files are changed
3541 jMenuItemFileSave
.setEnabled(!GlobalData
.openingModuleList
.isSaved()
3542 || !GlobalData
.openingPackageList
.isSaved()
3543 || !GlobalData
.openingPlatformList
.isSaved());
3544 jMenuItemFileSaveAll
.setEnabled(!GlobalData
.openingModuleList
.isSaved()
3545 || !GlobalData
.openingPackageList
.isSaved()
3546 || !GlobalData
.openingPlatformList
.isSaved());
3549 if (arg0
.getSource() == jMenuTools
) {
3551 // Enable clone when select some items
3553 if (iTree
.getSelectionPath() == null) {
3554 jMenuItemToolsClone
.setEnabled(false);
3556 int category
= iTree
.getSelectCategory();
3557 if (category
== IDefaultMutableTreeNode
.MODULE_DESCRIPTION
3558 || category
== IDefaultMutableTreeNode
.PACKAGE_DESCRIPTION
3559 || category
== IDefaultMutableTreeNode
.PLATFORM_DESCRIPTION
3560 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE
3561 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE_LIBRARY
3562 || category
== IDefaultMutableTreeNode
.MODULE_PACKAGE_MODULE
) {
3563 jMenuItemToolsClone
.setEnabled(false);
3565 jMenuItemToolsClone
.setEnabled(true);
3571 public void keyTyped(KeyEvent arg0
) {
3572 // TODO Auto-generated method stub
3576 public void keyPressed(KeyEvent arg0
) {
3577 // TODO Auto-generated method stub
3581 public void keyReleased(KeyEvent arg0
) {
3582 if (arg0
.getSource() == this.iTree
) {
3583 if (arg0
.getKeyCode() == KeyEvent
.VK_ENTER
) {
3584 this.doubleClickModuleTreeNode();