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