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