]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java
Adding a dialog for setting the Build Preferences in the target.txt file.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / FrameworkWizardUI.java
1 /** @file
2
3 The main GUI for module editor.
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 package org.tianocore.frameworkwizard;
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ComponentEvent;
20 import java.awt.event.MouseEvent;
21 import java.awt.event.MouseListener;
22 import java.awt.event.WindowEvent;
23 import java.io.IOException;
24 import java.util.Vector;
25
26 import javax.swing.JButton;
27 import javax.swing.JCheckBoxMenuItem;
28 import javax.swing.JDesktopPane;
29 import javax.swing.JFileChooser;
30 import javax.swing.JFrame;
31 import javax.swing.JInternalFrame;
32 import javax.swing.JMenu;
33 import javax.swing.JMenuBar;
34 import javax.swing.JMenuItem;
35 import javax.swing.JOptionPane;
36 import javax.swing.JPanel;
37 import javax.swing.JScrollPane;
38 import javax.swing.JSplitPane;
39 import javax.swing.JTabbedPane;
40 import javax.swing.event.MenuEvent;
41 import javax.swing.event.MenuListener;
42 import javax.swing.event.TreeSelectionEvent;
43 import javax.swing.event.TreeSelectionListener;
44
45 import org.apache.xmlbeans.XmlException;
46 import org.tianocore.PackageSurfaceAreaDocument;
47 import org.tianocore.frameworkwizard.common.DataType;
48 import org.tianocore.frameworkwizard.common.GlobalData;
49 import org.tianocore.frameworkwizard.common.IFileFilter;
50 import org.tianocore.frameworkwizard.common.Log;
51 import org.tianocore.frameworkwizard.common.SaveFile;
52 import org.tianocore.frameworkwizard.common.Tools;
53 import org.tianocore.frameworkwizard.common.Identifications.Identification;
54 import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
55 import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
56 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
57 //import org.tianocore.frameworkwizard.common.find.FindPPIsResult;
58 import org.tianocore.frameworkwizard.common.ui.IDefaultMutableTreeNode;
59 import org.tianocore.frameworkwizard.common.ui.IDesktopManager;
60 import org.tianocore.frameworkwizard.common.ui.IFrame;
61 import org.tianocore.frameworkwizard.common.ui.ITree;
62 import org.tianocore.frameworkwizard.far.createui.CreateStepOne;
63 import org.tianocore.frameworkwizard.far.deleteui.DeleteStepOne;
64 import org.tianocore.frameworkwizard.far.installui.InstallStepOne;
65 import org.tianocore.frameworkwizard.far.updateui.UpdateStepOne;
66 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
67 import org.tianocore.frameworkwizard.module.ui.ModuleBootModes;
68 import org.tianocore.frameworkwizard.module.ui.ModuleDataHubs;
69 import org.tianocore.frameworkwizard.module.ui.ModuleEvents;
70 import org.tianocore.frameworkwizard.module.ui.ModuleExterns;
71 import org.tianocore.frameworkwizard.module.ui.ModuleGuids;
72 import org.tianocore.frameworkwizard.module.ui.ModuleHiiPackages;
73 import org.tianocore.frameworkwizard.module.ui.ModuleHobs;
74 import org.tianocore.frameworkwizard.module.ui.ModuleLibraryClassDefinitions;
75 import org.tianocore.frameworkwizard.module.ui.ModulePCDs;
76 import org.tianocore.frameworkwizard.module.ui.ModulePackageDependencies;
77 import org.tianocore.frameworkwizard.module.ui.ModulePpis;
78 import org.tianocore.frameworkwizard.module.ui.ModuleProtocols;
79 import org.tianocore.frameworkwizard.module.ui.ModuleSourceFiles;
80 import org.tianocore.frameworkwizard.module.ui.ModuleSystemTables;
81 import org.tianocore.frameworkwizard.module.ui.ModuleVariables;
82 import org.tianocore.frameworkwizard.module.ui.MsaHeader;
83 import org.tianocore.frameworkwizard.packaging.PackageIdentification;
84 import org.tianocore.frameworkwizard.packaging.ui.SpdGuidDecls;
85 import org.tianocore.frameworkwizard.packaging.ui.SpdHeader;
86 import org.tianocore.frameworkwizard.packaging.ui.SpdLibClassDecls;
87 import org.tianocore.frameworkwizard.packaging.ui.SpdMsaFiles;
88 import org.tianocore.frameworkwizard.packaging.ui.SpdPackageHeaders;
89 import org.tianocore.frameworkwizard.packaging.ui.SpdPcdDefs;
90 import org.tianocore.frameworkwizard.packaging.ui.SpdPpiDecls;
91 import org.tianocore.frameworkwizard.packaging.ui.SpdProtocolDecls;
92 import org.tianocore.frameworkwizard.platform.PlatformIdentification;
93 import org.tianocore.frameworkwizard.platform.ui.FpdBuildOptions;
94 import org.tianocore.frameworkwizard.platform.ui.FpdDynamicPcdBuildDefinitions;
95 import org.tianocore.frameworkwizard.platform.ui.FpdFlash;
96 import org.tianocore.frameworkwizard.platform.ui.FpdFrameworkModules;
97 import org.tianocore.frameworkwizard.platform.ui.FpdHeader;
98 import org.tianocore.frameworkwizard.platform.ui.FpdPlatformDefs;
99 import org.tianocore.frameworkwizard.workspace.Workspace;
100 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
101 import org.tianocore.frameworkwizard.workspace.ui.SwitchWorkspace;
102 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(false);
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.addSeparator();
1634
1635 jMenuEditFind.add(getJMenuItemEditFindLibraryClass());
1636 jMenuEditFind.add(getJMenuItemEditFindLibraryInstance());
1637 }
1638 return jMenuEditFind;
1639 }
1640
1641 /**
1642 * This method initializes jMenuItemEditFindPcd
1643 *
1644 * @return javax.swing.JMenuItem
1645 */
1646 private JMenuItem getJMenuItemEditFindPcd() {
1647 if (jMenuItemEditFindPcd == null) {
1648 jMenuItemEditFindPcd = new JMenuItem();
1649 jMenuItemEditFindPcd.setText("All PCD entries");
1650 jMenuItemEditFindPcd.setMnemonic('P');
1651 jMenuItemEditFindPcd.addActionListener(this);
1652 }
1653 return jMenuItemEditFindPcd;
1654 }
1655
1656 /**
1657 * This method initializes jMenuItemEditFindLibraryClass
1658 *
1659 * @return javax.swing.JMenuItem
1660 */
1661 private JMenuItem getJMenuItemEditFindLibraryClass() {
1662 if (jMenuItemEditFindLibraryClass == null) {
1663 jMenuItemEditFindLibraryClass = new JMenuItem();
1664 jMenuItemEditFindLibraryClass.setText("All Library Classes");
1665 jMenuItemEditFindLibraryClass.setMnemonic('C');
1666 jMenuItemEditFindLibraryClass.addActionListener(this);
1667 }
1668 return jMenuItemEditFindLibraryClass;
1669 }
1670
1671 /**
1672 * This method initializes jMenuItemEditFindPpi
1673 *
1674 * @return javax.swing.JMenuItem
1675 */
1676 private JMenuItem getJMenuItemEditFindPpi() {
1677 if (jMenuItemEditFindPpi == null) {
1678 jMenuItemEditFindPpi = new JMenuItem();
1679 jMenuItemEditFindPpi.setText("All PPIs");
1680 jMenuItemEditFindPpi.setMnemonic('I');
1681 jMenuItemEditFindPpi.addActionListener(this);
1682 }
1683 return jMenuItemEditFindPpi;
1684 }
1685
1686 /**
1687 * This method initializes jMenuItemEditFindProtocol
1688 *
1689 * @return javax.swing.JMenuItem
1690 */
1691 private JMenuItem getJMenuItemEditFindProtocol() {
1692 if (jMenuItemEditFindProtocol == null) {
1693 jMenuItemEditFindProtocol = new JMenuItem();
1694 jMenuItemEditFindProtocol.setText("All Protocols");
1695 jMenuItemEditFindProtocol.setMnemonic('r');
1696 jMenuItemEditFindProtocol.addActionListener(this);
1697 }
1698 return jMenuItemEditFindProtocol;
1699 }
1700
1701 /**
1702 * This method initializes jMenuItemEditFindGuid
1703 *
1704 * @return javax.swing.JMenuItem
1705 */
1706 private JMenuItem getJMenuItemEditFindGuid() {
1707 if (jMenuItemEditFindGuid == null) {
1708 jMenuItemEditFindGuid = new JMenuItem();
1709 jMenuItemEditFindGuid.setText("All GUIDs");
1710 jMenuItemEditFindGuid.setMnemonic('G');
1711 jMenuItemEditFindGuid.addActionListener(this);
1712 }
1713 return jMenuItemEditFindGuid;
1714 }
1715
1716 /**
1717 * This method initializes jMenuItemEditFindLibraryInstance
1718 *
1719 * @return javax.swing.JMenuItem
1720 */
1721 private JMenuItem getJMenuItemEditFindLibraryInstance() {
1722 if (jMenuItemEditFindLibraryInstance == null) {
1723 jMenuItemEditFindLibraryInstance = new JMenuItem();
1724 jMenuItemEditFindLibraryInstance.setText("All Library Instances");
1725 jMenuItemEditFindLibraryInstance.setMnemonic('n');
1726 jMenuItemEditFindLibraryInstance.addActionListener(this);
1727 }
1728 return jMenuItemEditFindLibraryInstance;
1729 }
1730
1731 /* (non-Javadoc)
1732 * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
1733 *
1734 * Main class, start the GUI
1735 *
1736 */
1737 public static void main(String[] args) {
1738 FrameworkWizardUI module = FrameworkWizardUI.getInstance();
1739 module.setVisible(true);
1740 }
1741
1742 /**
1743 This is the default constructor
1744
1745 **/
1746 public FrameworkWizardUI() {
1747 super();
1748 init();
1749 }
1750
1751 /**
1752 This method initializes this
1753
1754
1755 **/
1756 private void init() {
1757 //
1758 // Set current workspace and check
1759 // Check if exists WORKSPACE
1760 //
1761 //
1762 Workspace.setCurrentWorkspace(System.getenv("WORKSPACE"));
1763 if (!Workspace.checkCurrentWorkspace()) {
1764 JOptionPane.showConfirmDialog(null, "Workspace is not setup correctly. Please setup first.", "Warning",
1765 JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
1766 this.dispose();
1767 System.exit(0);
1768 }
1769
1770 //
1771 // Init Global Data
1772 //
1773 GlobalData.init();
1774
1775 //
1776 // Init the frame
1777 //
1778 this.setSize(DataType.MAIN_FRAME_PREFERRED_SIZE_WIDTH, DataType.MAIN_FRAME_PREFERRED_SIZE_HEIGHT);
1779 this.setResizable(true);
1780 this.setJMenuBar(getjJMenuBar());
1781 this.setContentPane(getJContentPane());
1782 this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
1783 + Workspace.getCurrentWorkspace() + "]");
1784 this.setExitType(1);
1785
1786 //
1787 // max the window
1788 //
1789 this.setExtendedState(JFrame.MAXIMIZED_BOTH);
1790 }
1791
1792 /**
1793 This method initializes jContentPane
1794
1795 @return javax.swing.JPanel jContentPane
1796
1797 **/
1798 private JPanel getJContentPane() {
1799 if (jContentPane == null) {
1800 jContentPane = new JPanel();
1801 jContentPane.setLayout(null);
1802 jContentPane.add(getJPanelOperation(), null);
1803 jContentPane.add(getJSplitPane(), null);
1804 }
1805 return jContentPane;
1806 }
1807
1808 /* (non-Javadoc)
1809 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1810 *
1811 * Override actionPerformed to listen all actions
1812 *
1813 */
1814 public void actionPerformed(ActionEvent arg0) {
1815 //
1816 // Operations of Menu
1817 //
1818 if (arg0.getSource() == this.jMenuItemFileNew) {
1819 this.fileNew();
1820 }
1821
1822 if (arg0.getSource() == this.jMenuItemFileOpen) {
1823 this.open();
1824 }
1825
1826 if (arg0.getSource() == this.jMenuItemFileClose) {
1827 this.close();
1828 }
1829
1830 if (arg0.getSource() == this.jMenuItemFileCloseAll) {
1831 this.closeAll();
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() == jMenuItemToolsBuildPreferences) {
1855 configBuildPreferences();
1856 }
1857
1858 if (arg0.getSource() == this.jMenuItemProjectChangeWorkspace) {
1859 this.changeWorkspace();
1860 }
1861
1862 if (arg0.getSource() == this.jMenuItemProjectCreateFar) {
1863 this.createFar();
1864 }
1865
1866 if (arg0.getSource() == this.jMenuItemProjectInstallFar) {
1867 this.installFar();
1868 }
1869
1870 if (arg0.getSource() == this.jMenuItemProjectRemoveFar) {
1871 this.removeFar();
1872 }
1873
1874 if (arg0.getSource() == this.jMenuItemProjectUpdateFar) {
1875 this.updateFar();
1876 }
1877
1878 if (arg0.getSource() == this.jMenuItemToolsClone) {
1879 this.cloneItem();
1880 }
1881
1882 if (arg0.getSource() == this.jMenuItemToolsToolChainConfiguration) {
1883 this.setupToolChainConfiguration();
1884 }
1885
1886 if (arg0.getSource() == this.jMenuItemHelpAbout) {
1887 About a = new About(this, true);
1888 int result = a.showDialog();
1889 if (result == DataType.RETURN_TYPE_OK) {
1890 a.dispose();
1891 }
1892 }
1893 }
1894
1895 /**
1896 Create an empty tree if no file is open
1897
1898 **/
1899 private void makeEmptyTree() {
1900 //
1901 // Make root
1902 //
1903 dmtnRoot = new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode.WORKSPACE, -1);
1904
1905 //
1906 // Make Module Description
1907 //
1908 dmtnModuleDescription = new IDefaultMutableTreeNode("ModuleDescription", IDefaultMutableTreeNode.MODULE, -1);
1909
1910 //
1911 // First add package
1912 //
1913 if (GlobalData.vPackageList.size() > 0) {
1914 for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
1915 IDefaultMutableTreeNode dmtnModulePackage = null;
1916 IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
1917 IDefaultMutableTreeNode dmtnModulePackageModule = null;
1918
1919 dmtnModulePackage = new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index).getName(),
1920 IDefaultMutableTreeNode.MODULE_PACKAGE, false,
1921 GlobalData.vPackageList.elementAt(index));
1922 dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
1923 IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
1924 false, GlobalData.vPackageList.elementAt(index));
1925 dmtnModulePackageModule = new IDefaultMutableTreeNode("Module",
1926 IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
1927 false, GlobalData.vPackageList.elementAt(index));
1928 //
1929 // And then add each module in its package
1930 //
1931 Vector<ModuleIdentification> vModule = wt.getAllModules(GlobalData.vPackageList.elementAt(index));
1932 for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
1933 if (vModule.get(indexJ).isLibrary()) {
1934 dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
1935 IDefaultMutableTreeNode.MODULE, false,
1936 vModule.get(indexJ)));
1937 } else {
1938 dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
1939 IDefaultMutableTreeNode.MODULE, false,
1940 vModule.get(indexJ)));
1941 }
1942 }
1943 if (dmtnModulePackageModule.getChildCount() > 0) {
1944 dmtnModulePackage.add(dmtnModulePackageModule);
1945 }
1946 if (dmtnModulePackageLibrary.getChildCount() > 0) {
1947 dmtnModulePackage.add(dmtnModulePackageLibrary);
1948 }
1949
1950 dmtnModuleDescription.add(dmtnModulePackage);
1951 }
1952 }
1953
1954 //
1955 // Make Package Description
1956 //
1957 dmtnPackageDescription = new IDefaultMutableTreeNode("PackageDescription", IDefaultMutableTreeNode.PACKAGE, -1);
1958 if (GlobalData.vPackageList.size() > 0) {
1959 for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
1960 dmtnPackageDescription.add(new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index)
1961 .getName(),
1962 IDefaultMutableTreeNode.PACKAGE, false,
1963 GlobalData.vPackageList.elementAt(index)));
1964 }
1965 }
1966
1967 //
1968 // Make Platform Description
1969 //
1970 dmtnPlatformDescription = new IDefaultMutableTreeNode("PlatformDescription", IDefaultMutableTreeNode.PLATFORM,
1971 -1);
1972 if (GlobalData.vPlatformList.size() > 0) {
1973 for (int index = 0; index < GlobalData.vPlatformList.size(); index++) {
1974 dmtnPlatformDescription.add(new IDefaultMutableTreeNode(GlobalData.vPlatformList.elementAt(index)
1975 .getName(),
1976 IDefaultMutableTreeNode.PLATFORM, false,
1977 GlobalData.vPlatformList.elementAt(index)));
1978 }
1979 }
1980
1981 //
1982 // Add sub nodes to root node
1983 //
1984 dmtnRoot.add(dmtnModuleDescription);
1985 dmtnRoot.add(dmtnPackageDescription);
1986 dmtnRoot.add(dmtnPlatformDescription);
1987 iTree = new ITree(dmtnRoot);
1988 iTree.addMouseListener(this);
1989 jScrollPaneTree.setViewportView(iTree);
1990 }
1991
1992 /* (non-Javadoc)
1993 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
1994 *
1995 * Override windowClosing to popup warning message to confirm quit
1996 *
1997 */
1998 public void windowClosing(WindowEvent arg0) {
1999 this.exit();
2000 }
2001
2002 /* (non-Javadoc)
2003 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
2004 *
2005 * Override mouseClicked to check if need display popup menu
2006 *
2007 */
2008 public void mouseClicked(MouseEvent arg0) {
2009 if (arg0.getButton() == MouseEvent.BUTTON1) {
2010 }
2011 if (arg0.getButton() == MouseEvent.BUTTON3) {
2012 }
2013 //
2014 // When double click
2015 //
2016 if (arg0.getClickCount() == 2) {
2017 doubleClickModuleTreeNode();
2018 }
2019 }
2020
2021 public void mouseEntered(MouseEvent arg0) {
2022 // TODO Auto-generated method stub
2023 }
2024
2025 public void mouseExited(MouseEvent arg0) {
2026 // TODO Auto-generated method stub
2027 }
2028
2029 public void mousePressed(MouseEvent arg0) {
2030 // TODO Auto-generated method stub
2031 }
2032
2033 public void mouseReleased(MouseEvent arg0) {
2034 // TODO Auto-generated method stub
2035 }
2036
2037 /**
2038 Remove all Internal Frame of Module Desktop Pane
2039
2040 **/
2041 private void cleanDesktopPaneModule() {
2042 if (jDesktopPaneModule != null) {
2043 JInternalFrame[] iif = this.jDesktopPaneModule.getAllFrames();
2044 for (int index = 0; index < iif.length; index++) {
2045 iif[index].dispose();
2046 }
2047 }
2048 }
2049
2050 /**
2051 Remove all Internal Frame of package Desktop Pane
2052
2053 **/
2054 private void cleanDesktopPanePackage() {
2055 if (jDesktopPanePlatform != null) {
2056 JInternalFrame[] iif = this.jDesktopPanePackage.getAllFrames();
2057 for (int index = 0; index < iif.length; index++) {
2058 iif[index].dispose();
2059 }
2060 }
2061 }
2062
2063 /**
2064 Remove all Internal Frame of platform Desktop Pane
2065
2066 **/
2067 private void cleanDesktopPanePlatform() {
2068 if (jDesktopPanePlatform != null) {
2069 JInternalFrame[] iif = this.jDesktopPanePlatform.getAllFrames();
2070 for (int index = 0; index < iif.length; index++) {
2071 iif[index].dispose();
2072 }
2073 }
2074 }
2075
2076 /**
2077 Remove all Internal Frame of all Desktop Panes
2078
2079 **/
2080 private void cleanDesktopPane() {
2081 cleanDesktopPaneModule();
2082 cleanDesktopPanePackage();
2083 cleanDesktopPanePlatform();
2084 }
2085
2086 /**
2087 Set file filter as input ext
2088
2089 @param ext
2090 @return
2091
2092 **/
2093 private int getNewFilePath(String ext) {
2094 JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
2095 fc.setAcceptAllFileFilterUsed(false);
2096 fc.addChoosableFileFilter(new IFileFilter(ext));
2097 return fc.showSaveDialog(new JPanel());
2098 }
2099
2100 /**
2101 Add a module to tree
2102
2103 @param mid The module node to be added
2104
2105 **/
2106 private void addModuleToTree(ModuleIdentification mid) {
2107 //
2108 // Add new MsaHeader node to the tree
2109 //
2110 IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MODULE, true,
2111 mid);
2112 //
2113 // First find the module belongs to which package
2114 //
2115 IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
2116 IDefaultMutableTreeNode.MODULE_PACKAGE);
2117 //
2118 // To check if has module node or library node
2119 //
2120 IDefaultMutableTreeNode parentModuleNode = null;
2121 IDefaultMutableTreeNode parentLibraryNode = null;
2122 boolean hasModule = false;
2123 boolean hasLibrary = false;
2124 for (int index = 0; index < packageNode.getChildCount(); index++) {
2125 IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
2126 if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
2127 hasLibrary = true;
2128 parentLibraryNode = iNode;
2129 }
2130 if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
2131 hasModule = true;
2132 parentModuleNode = iNode;
2133 }
2134 }
2135
2136 //
2137 // If is a module
2138 //
2139 if (!mid.isLibrary()) {
2140 //
2141 // Create parent node first if has no parent node
2142 //
2143 if (!hasModule) {
2144 parentModuleNode = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
2145 false, mid.getPackageId());
2146 iTree.addNode(packageNode, parentModuleNode);
2147 }
2148
2149 iTree.addNode(parentModuleNode, node);
2150 }
2151
2152 //
2153 // If is a Library
2154 //
2155 if (mid.isLibrary()) {
2156 //
2157 // Create parent node first if has no parent node
2158 //
2159 if (!hasLibrary) {
2160 parentLibraryNode = new IDefaultMutableTreeNode("Library",
2161 IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
2162 mid.getPackageId());
2163 iTree.addNode(packageNode, parentLibraryNode);
2164 }
2165
2166 iTree.addNode(parentLibraryNode, node);
2167 }
2168 }
2169
2170 /**
2171 Open Module
2172
2173 @param path input file path
2174
2175 **/
2176 private void openModule(String path) {
2177 ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(path);
2178 if (id == null) {
2179 //
2180 // The module is not in existing packages
2181 //
2182 Log.wrn("Open Module", "The module hasn't been added to any package of current workspace!");
2183 return;
2184 }
2185
2186 //
2187 // Make the node selected
2188 //
2189 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,
2190 IDefaultMutableTreeNode.MODULE)));
2191 //
2192 // Update opening Module list information
2193 //
2194 if (!GlobalData.openingModuleList.getModuleOpen(id)) {
2195 //
2196 // Insert sub node of module
2197 //
2198 insertModuleTreeNode(id);
2199 iTree.getSelectNode().setOpening(true);
2200
2201 //
2202 // Update opening module list
2203 //
2204 GlobalData.openingModuleList.setModuleOpen(id, true);
2205 GlobalData.openingModuleList.setTreePathById(id, iTree.getSelectionPath());
2206 }
2207 //
2208 // Select msa header node and show it in editor panel
2209 //
2210 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,
2211 IDefaultMutableTreeNode.MSA_HEADER)));
2212 showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, GlobalData.openingModuleList.getOpeningModuleById(id));
2213 this.currentOpeningModuleIndex = GlobalData.openingModuleList.findIndexOfListById(id);
2214 }
2215
2216 /**
2217 Open Package
2218
2219 @param path input file path
2220
2221 **/
2222 private void openPackage(String path) {
2223 PackageIdentification id = GlobalData.openingPackageList.getIdByPath(path);
2224 if (id == null) {
2225 //
2226 // The package is not in current workspace
2227 //
2228 Log.wrn("Open Package", "The package hasn't been added to current workspace!");
2229 return;
2230 }
2231
2232 //
2233 // Make the node selected
2234 //
2235 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
2236 IDefaultMutableTreeNode.PACKAGE)));
2237 //
2238 // Update opening package list information
2239 //
2240 if (!GlobalData.openingPackageList.getPackageOpen(id)) {
2241 //
2242 // Insert sub node of module
2243 //
2244 insertPackageTreeNode(id);
2245 iTree.getSelectNode().setOpening(true);
2246
2247 //
2248 // Update opening module list
2249 //
2250 GlobalData.openingPackageList.setPackageOpen(id, true);
2251 GlobalData.openingPackageList.setTreePathById(id, iTree.getSelectionPath());
2252 }
2253 //
2254 // Show spd header in editor panel
2255 //
2256 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
2257 IDefaultMutableTreeNode.SPD_HEADER)));
2258 showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, GlobalData.openingPackageList.getOpeningPackageById(id));
2259 this.currentOpeningPackageIndex = GlobalData.openingPackageList.findIndexOfListById(id);
2260 }
2261
2262 /**
2263 Open Package
2264
2265 @param path input file path
2266
2267 **/
2268 private void openPlatform(String path) {
2269 PlatformIdentification id = GlobalData.openingPlatformList.getIdByPath(path);
2270 if (id == null) {
2271 //
2272 // The platform is not in current workspace
2273 //
2274 Log.wrn("Open Platform", "The platform hasn't been added to current workspace!");
2275 return;
2276 }
2277
2278 //
2279 // Make the node selected
2280 //
2281 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
2282 IDefaultMutableTreeNode.PLATFORM)));
2283 //
2284 // Update opening package list information
2285 //
2286 if (!GlobalData.openingPlatformList.getPlatformOpen(id)) {
2287 //
2288 // Insert sub node of module
2289 //
2290 insertPlatformTreeNode(id);
2291 iTree.getSelectNode().setOpening(true);
2292
2293 //
2294 // Update opening module list
2295 //
2296 GlobalData.openingPlatformList.setPlatformOpen(id, true);
2297 GlobalData.openingPlatformList.setTreePathById(id, iTree.getSelectionPath());
2298 }
2299 //
2300 // Show fpd header in editor panel
2301 //
2302 iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
2303 IDefaultMutableTreeNode.FPD_PLATFORMHEADER)));
2304 showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER,
2305 GlobalData.openingPlatformList.getOpeningPlatformById(id));
2306 this.currentOpeningPlatformIndex = GlobalData.openingPlatformList.findIndexOfListById(id);
2307 }
2308
2309 /**
2310 Save module
2311
2312 **/
2313 private void saveModule(int index) {
2314 OpeningModuleType omt = GlobalData.openingModuleList.getOpeningModuleByIndex(index);
2315 if (omt.isNew()) {
2316 if (getNewFilePath(DataType.MODULE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
2317 return;
2318 }
2319 }
2320 try {
2321 SaveFile.saveMsaFile(omt.getId().getPath(), omt.getXmlMsa());
2322 GlobalData.openingModuleList.setNew(omt.getId(), false);
2323 GlobalData.openingModuleList.setModuleSaved(omt.getId(), true);
2324 } catch (Exception e) {
2325 Log.wrn("Save Module", e.getMessage());
2326 Log.err("Save Module", e.getMessage());
2327 }
2328 }
2329
2330 /**
2331 Save package
2332
2333 **/
2334 private void savePackage(int index) {
2335 OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);
2336 if (opt.isNew()) {
2337 if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
2338 return;
2339 }
2340 }
2341 try {
2342 SaveFile.saveSpdFile(opt.getId().getPath(), opt.getXmlSpd());
2343 GlobalData.openingPackageList.setNew(opt.getId(), false);
2344 GlobalData.openingPackageList.setPackageSaved(opt.getId(), true);
2345 } catch (Exception e) {
2346 Log.wrn("Save Package", e.getMessage());
2347 Log.err("Save Package", e.getMessage());
2348 }
2349 }
2350
2351 /**
2352 Save platform
2353
2354 **/
2355 private void savePlatform(int index) {
2356 OpeningPlatformType opt = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index);
2357 if (opt.isNew()) {
2358 if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
2359 return;
2360 }
2361 }
2362 try {
2363 SaveFile.saveFpdFile(opt.getId().getPath(), opt.getXmlFpd());
2364 GlobalData.openingPlatformList.setNew(opt.getId(), false);
2365 GlobalData.openingPlatformList.setPlatformSaved(opt.getId(), true);
2366 } catch (Exception e) {
2367 Log.wrn("Save Package", e.getMessage());
2368 Log.err("Save Package", e.getMessage());
2369 }
2370 }
2371
2372 public void componentResized(ComponentEvent arg0) {
2373 if (this.jSplitPane != null) {
2374 this.jSplitPane.setSize(this.getWidth() - DataType.MAIN_FRAME_WIDTH_SPACING,
2375 this.getHeight() - DataType.MAIN_FRAME_HEIGHT_SPACING);
2376 this.jSplitPane.validate();
2377 resizeDesktopPanel();
2378 }
2379 }
2380
2381 /**
2382 Resize JDesktopPanel
2383
2384 */
2385 private void resizeDesktopPanel() {
2386 resizeDesktopPanel(this.jDesktopPaneModule);
2387 resizeDesktopPanel(this.jDesktopPanePackage);
2388 resizeDesktopPanel(this.jDesktopPanePlatform);
2389 }
2390
2391 /**
2392 Resize JDesktopPanel
2393
2394 */
2395 private void resizeDesktopPanel(JDesktopPane jdk) {
2396 JInternalFrame[] iif = jdk.getAllFrames();
2397 for (int index = 0; index < iif.length; index++) {
2398 iif[index].setSize(jdk.getWidth(), jdk.getHeight());
2399 }
2400 }
2401
2402 private void insertModuleTreeNode(Identification id) {
2403 iTree.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode.MSA_HEADER, true, id));
2404 iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id));
2405 iTree.addNode(new IDefaultMutableTreeNode("Library Class Definitions",
2406 IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS, true, id));
2407 iTree.addNode(new IDefaultMutableTreeNode("Package Dependencies",
2408 IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES, true, id));
2409 iTree.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode.MSA_PROTOCOLS, true, id));
2410 iTree.addNode(new IDefaultMutableTreeNode("Events", IDefaultMutableTreeNode.MSA_EVENTS, true, id));
2411 iTree.addNode(new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode.MSA_HOBS, true, id));
2412 iTree.addNode(new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode.MSA_PPIS, true, id));
2413 iTree.addNode(new IDefaultMutableTreeNode("Variables", IDefaultMutableTreeNode.MSA_VARIABLES, true, id));
2414 iTree.addNode(new IDefaultMutableTreeNode("Boot Modes", IDefaultMutableTreeNode.MSA_BOOTMODES, true, id));
2415 iTree.addNode(new IDefaultMutableTreeNode("System Tables", IDefaultMutableTreeNode.MSA_SYSTEMTABLES, true, id));
2416 iTree.addNode(new IDefaultMutableTreeNode("Data Hubs", IDefaultMutableTreeNode.MSA_DATAHUBS, true, id));
2417 iTree.addNode(new IDefaultMutableTreeNode("Hii Packages", IDefaultMutableTreeNode.MSA_HIIPACKAGES, true, id));
2418 iTree.addNode(new IDefaultMutableTreeNode("Guids", IDefaultMutableTreeNode.MSA_GUIDS, true, id));
2419 iTree.addNode(new IDefaultMutableTreeNode("Externs", IDefaultMutableTreeNode.MSA_EXTERNS, true, id));
2420 iTree.addNode(new IDefaultMutableTreeNode("PcdCoded", IDefaultMutableTreeNode.MSA_PCDS, true, id));
2421 }
2422
2423 private void insertPackageTreeNode(Identification id) {
2424 iTree.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode.SPD_HEADER, true, id));
2425 iTree.addNode(new IDefaultMutableTreeNode("Library Class Declarations",
2426 IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS, true, id));
2427 iTree.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode.SPD_MSAFILES, false, id));
2428 iTree.addNode(new IDefaultMutableTreeNode("Package Includes", IDefaultMutableTreeNode.SPD_PACKAGEHEADERS, true,
2429 id));
2430 iTree.addNode(new IDefaultMutableTreeNode("Guid Declarations", IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS,
2431 true, id));
2432 iTree.addNode(new IDefaultMutableTreeNode("Protocol Declarations",
2433 IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS, true, id));
2434 iTree.addNode(new IDefaultMutableTreeNode("Ppi Declarations", IDefaultMutableTreeNode.SPD_PPIDECLARATIONS,
2435 true, id));
2436 iTree.addNode(new IDefaultMutableTreeNode("Pcd Declarations", IDefaultMutableTreeNode.SPD_PCDDECLARATIONS,
2437 true, id));
2438 }
2439
2440 private void insertPlatformTreeNode(Identification id) {
2441 iTree.addNode(new IDefaultMutableTreeNode("Platform Header", IDefaultMutableTreeNode.FPD_PLATFORMHEADER, true,
2442 id));
2443 iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions",
2444 IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id));
2445 iTree.addNode(new IDefaultMutableTreeNode("Flash", IDefaultMutableTreeNode.FPD_FLASH, true, id));
2446 iTree.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES,
2447 true, id));
2448 iTree.addNode(new IDefaultMutableTreeNode("Pcd Dynamic Build Declarations",
2449 IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS, true, id));
2450 iTree.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode.FPD_BUILDOPTIONS, true, id));
2451 }
2452
2453 /**
2454 Operate when double click a tree node
2455
2456 **/
2457 private void doubleClickModuleTreeNode() {
2458 Identification id = null;
2459 int intCategory = -1;
2460 String path = null;
2461 boolean isOpen = false;
2462 try {
2463 id = iTree.getSelectNode().getId();
2464 intCategory = iTree.getSelectCategory();
2465 isOpen = iTree.getSelectNode().isOpening();
2466
2467 if (!isOpen) {
2468 //
2469 // If the node is not opened yet
2470 // Insert top level elements first
2471 //
2472 if (intCategory == IDefaultMutableTreeNode.MODULE) {
2473
2474 if (intCategory == IDefaultMutableTreeNode.MODULE) {
2475 path = iTree.getSelectNode().getId().getPath();
2476 }
2477 if (intCategory == IDefaultMutableTreeNode.PACKAGE) {
2478 path = iTree.getSelectNode().getId().getPath();
2479 }
2480 openModule(path);
2481 return;
2482 }
2483 if (intCategory == IDefaultMutableTreeNode.PACKAGE) {
2484 path = iTree.getSelectNode().getId().getPath();
2485 openPackage(path);
2486 return;
2487 }
2488 if (intCategory == IDefaultMutableTreeNode.PLATFORM) {
2489 path = iTree.getSelectNode().getId().getPath();
2490 openPlatform(path);
2491 return;
2492 }
2493 }
2494
2495 //
2496 // Show editor panel
2497 //
2498 if (intCategory >= IDefaultMutableTreeNode.MSA_HEADER && intCategory < IDefaultMutableTreeNode.SPD_HEADER) {
2499 showModuleElement(intCategory,
2500 GlobalData.openingModuleList.getOpeningModuleById(new ModuleIdentification(id)));
2501 this.currentOpeningModuleIndex = GlobalData.openingModuleList
2502 .findIndexOfListById(new ModuleIdentification(
2503 id));
2504 }
2505 if (intCategory >= IDefaultMutableTreeNode.SPD_HEADER
2506 && intCategory < IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
2507 showPackageElement(intCategory,
2508 GlobalData.openingPackageList.getOpeningPackageById(new PackageIdentification(id)));
2509 this.currentOpeningPackageIndex = GlobalData.openingPackageList
2510 .findIndexOfListById(new PackageIdentification(
2511 id));
2512 }
2513 if (intCategory >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
2514 showPlatformElement(
2515 intCategory,
2516 GlobalData.openingPlatformList
2517 .getOpeningPlatformById(new PlatformIdentification(id)));
2518 this.currentOpeningPlatformIndex = GlobalData.openingPlatformList
2519 .findIndexOfListById(new PlatformIdentification(
2520 id));
2521 }
2522 } catch (RuntimeException e) {
2523 Log.err("double click category: " + intCategory);
2524 Log.err("double click id path: " + id);
2525 Log.err("double click exception: " + e.getMessage());
2526 }
2527 }
2528
2529 /**
2530 Show content of editor panel via selected element
2531
2532 @param elementType
2533 @param fpd
2534
2535 **/
2536 private void showPlatformElement(int elementType, OpeningPlatformType fpd) {
2537 this.cleanDesktopPanePlatform();
2538
2539 switch (elementType) {
2540 case IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS:
2541 FpdPlatformDefs frmFpdPlatformDefs = new FpdPlatformDefs(fpd);
2542 getJDesktopPanePlatform().add(frmFpdPlatformDefs, 1);
2543 break;
2544 case IDefaultMutableTreeNode.FPD_PLATFORMHEADER:
2545 FpdHeader frmFpdHeader = new FpdHeader(fpd);
2546 getJDesktopPanePlatform().add(frmFpdHeader, 1);
2547 break;
2548 case IDefaultMutableTreeNode.FPD_FLASH:
2549 FpdFlash frmFpdFlash = new FpdFlash(fpd);
2550 getJDesktopPanePlatform().add(frmFpdFlash, 1);
2551 break;
2552 case IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES:
2553 FpdFrameworkModules frmFpdFrameworkModules = new FpdFrameworkModules(fpd);
2554 getJDesktopPanePlatform().add(frmFpdFrameworkModules, 1);
2555 break;
2556 case IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS:
2557 FpdDynamicPcdBuildDefinitions frmFpdDynamicPcdBuildDefinitions = new FpdDynamicPcdBuildDefinitions(fpd);
2558 getJDesktopPanePlatform().add(frmFpdDynamicPcdBuildDefinitions, 1);
2559 break;
2560 case IDefaultMutableTreeNode.FPD_BUILDOPTIONS:
2561 FpdBuildOptions frmFpdBuildOptions = new FpdBuildOptions(fpd);
2562 getJDesktopPanePlatform().add(frmFpdBuildOptions, 1);
2563 break;
2564 }
2565 this.jTabbedPaneEditor.setSelectedIndex(2);
2566 resizeDesktopPanel();
2567 }
2568
2569 /**
2570 Show content of editor panel via selected element
2571
2572 @param elementType
2573 @param spd
2574
2575 */
2576 private void showPackageElement(int elementType, OpeningPackageType spd) {
2577 this.cleanDesktopPanePackage();
2578 Tools.dirForNewSpd = spd.getId().getPath();
2579 switch (elementType) {
2580 case IDefaultMutableTreeNode.SPD_HEADER:
2581 SpdHeader frmSpdHeader = new SpdHeader(spd);
2582 getJDesktopPanePackage().add(frmSpdHeader, 1);
2583 break;
2584 case IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS:
2585 SpdLibClassDecls frmSlcd = new SpdLibClassDecls(spd);
2586 getJDesktopPanePackage().add(frmSlcd, 1);
2587 break;
2588 case IDefaultMutableTreeNode.SPD_MSAFILES:
2589 SpdMsaFiles frmSmf = new SpdMsaFiles(spd);
2590 getJDesktopPanePackage().add(frmSmf, 1);
2591 break;
2592 case IDefaultMutableTreeNode.SPD_PACKAGEHEADERS:
2593 SpdPackageHeaders frmSph = new SpdPackageHeaders(spd);
2594 getJDesktopPanePackage().add(frmSph, 1);
2595 break;
2596 case IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS:
2597 SpdGuidDecls frmSgd = new SpdGuidDecls(spd);
2598 getJDesktopPanePackage().add(frmSgd, 1);
2599 break;
2600 case IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS:
2601 SpdProtocolDecls frmSprod = new SpdProtocolDecls(spd);
2602 getJDesktopPanePackage().add(frmSprod, 1);
2603 break;
2604 case IDefaultMutableTreeNode.SPD_PPIDECLARATIONS:
2605 SpdPpiDecls frmSppid = new SpdPpiDecls(spd);
2606 getJDesktopPanePackage().add(frmSppid, 1);
2607 break;
2608 case IDefaultMutableTreeNode.SPD_PCDDECLARATIONS:
2609 SpdPcdDefs frmSpcdd = new SpdPcdDefs(spd);
2610 getJDesktopPanePackage().add(frmSpcdd, 1);
2611 break;
2612 }
2613 this.jTabbedPaneEditor.setSelectedIndex(1);
2614 resizeDesktopPanel();
2615 }
2616
2617 /**
2618 Show content of editor panel via selected element
2619
2620 @param elementType
2621 @param msa
2622
2623 */
2624 private void showModuleElement(int elementType, OpeningModuleType msa) {
2625 this.cleanDesktopPaneModule();
2626 switch (elementType) {
2627 case IDefaultMutableTreeNode.MSA_HEADER:
2628 MsaHeader frmMsaHeader = new MsaHeader(msa);
2629 getJDesktopPaneModule().add(frmMsaHeader, 1);
2630 break;
2631 case IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS:
2632 ModuleLibraryClassDefinitions frmMlcd = new ModuleLibraryClassDefinitions(msa);
2633 getJDesktopPaneModule().add(frmMlcd, 1);
2634 break;
2635 case IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES:
2636 ModulePackageDependencies frmMpd = new ModulePackageDependencies(msa);
2637 getJDesktopPaneModule().add(frmMpd, 1);
2638 break;
2639 case IDefaultMutableTreeNode.MSA_SOURCEFILES:
2640 ModuleSourceFiles frmMsf = new ModuleSourceFiles(msa);
2641 getJDesktopPaneModule().add(frmMsf, 1);
2642 break;
2643 case IDefaultMutableTreeNode.MSA_PROTOCOLS:
2644 ModuleProtocols frmMp = new ModuleProtocols(msa);
2645 getJDesktopPaneModule().add(frmMp, 1);
2646 break;
2647 case IDefaultMutableTreeNode.MSA_EVENTS:
2648 ModuleEvents frmMe = new ModuleEvents(msa);
2649 getJDesktopPaneModule().add(frmMe, 1);
2650 break;
2651 case IDefaultMutableTreeNode.MSA_HOBS:
2652 ModuleHobs frmMh = new ModuleHobs(msa);
2653 getJDesktopPaneModule().add(frmMh, 1);
2654 break;
2655 case IDefaultMutableTreeNode.MSA_PPIS:
2656 ModulePpis frmMpp = new ModulePpis(msa);
2657 getJDesktopPaneModule().add(frmMpp, 1);
2658 break;
2659 case IDefaultMutableTreeNode.MSA_VARIABLES:
2660 ModuleVariables frmMv = new ModuleVariables(msa);
2661 getJDesktopPaneModule().add(frmMv, 1);
2662 break;
2663 case IDefaultMutableTreeNode.MSA_BOOTMODES:
2664 ModuleBootModes frmMbm = new ModuleBootModes(msa);
2665 getJDesktopPaneModule().add(frmMbm, 1);
2666 break;
2667 case IDefaultMutableTreeNode.MSA_SYSTEMTABLES:
2668 ModuleSystemTables frmMst = new ModuleSystemTables(msa);
2669 getJDesktopPaneModule().add(frmMst, 1);
2670 break;
2671 case IDefaultMutableTreeNode.MSA_DATAHUBS:
2672 ModuleDataHubs frmMdh = new ModuleDataHubs(msa);
2673 getJDesktopPaneModule().add(frmMdh, 1);
2674 break;
2675 case IDefaultMutableTreeNode.MSA_HIIPACKAGES:
2676 ModuleHiiPackages frmMf = new ModuleHiiPackages(msa);
2677 getJDesktopPaneModule().add(frmMf, 1);
2678 break;
2679 case IDefaultMutableTreeNode.MSA_GUIDS:
2680 ModuleGuids frmGuid = new ModuleGuids(msa);
2681 getJDesktopPaneModule().add(frmGuid, 1);
2682 break;
2683 case IDefaultMutableTreeNode.MSA_EXTERNS:
2684 ModuleExterns frmMex = new ModuleExterns(msa);
2685 getJDesktopPaneModule().add(frmMex, 1);
2686 break;
2687 case IDefaultMutableTreeNode.MSA_PCDS:
2688 ModulePCDs frmPcd = new ModulePCDs(msa);
2689 getJDesktopPaneModule().add(frmPcd, 1);
2690 break;
2691 }
2692 this.jTabbedPaneEditor.setSelectedIndex(0);
2693 resizeDesktopPanel();
2694 }
2695
2696 //
2697 // Define operations of menu
2698 //
2699 /**
2700 New a file
2701
2702 **/
2703 private void fileNew() {
2704 int result = -1;
2705 //
2706 // Selece new file type
2707 //
2708 NewFileChooser nfc = new NewFileChooser(this, true);
2709 result = nfc.showDialog();
2710
2711 if (result == DataType.RETURN_TYPE_CANCEL) {
2712 nfc.dispose();
2713 return;
2714 } else if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
2715 //
2716 // To new a module
2717 //
2718 SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
2719 result = smb.showDialog();
2720
2721 if (result == DataType.RETURN_TYPE_CANCEL) {
2722 nfc.dispose();
2723 smb.dispose();
2724 return;
2725 } else if (result == DataType.RETURN_TYPE_OK) {
2726 ModuleIdentification mid = smb.getMid();
2727 if (mid != null) {
2728 //
2729 // Update package of workspace first
2730 //
2731 PackageSurfaceAreaDocument.PackageSurfaceArea psa = null;
2732 if (GlobalData.openingPackageList.existsPackage(mid.getPackageId())) {
2733 psa = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId());
2734 }
2735 try {
2736 wt.addModuleToPackage(mid, psa);
2737 } catch (IOException e) {
2738 Log.wrn("Upddate MsaFiles of Package", e.getMessage());
2739 Log.err("Upddate MsaFiles of Package", e.getMessage());
2740 return;
2741 } catch (XmlException e) {
2742 Log.wrn("Upddate MsaFiles of Package", e.getMessage());
2743 Log.err("Upddate MsaFiles of Package", e.getMessage());
2744 return;
2745 } catch (Exception e) {
2746 Log.wrn("Upddate MsaFiles of Package", e.getMessage());
2747 Log.err("Upddate MsaFiles of Package", e.getMessage());
2748 return;
2749 }
2750
2751 //
2752 // Update Global Data
2753 //
2754 GlobalData.openingModuleList.insertToOpeningModuleList(mid, smb.getMsa());
2755 GlobalData.vModuleList.addElement(mid);
2756
2757 //
2758 // Create new node on the tree
2759 //
2760 addModuleToTree(mid);
2761
2762 //
2763 // Open the node
2764 //
2765 this.openModule(mid.getPath());
2766 }
2767 }
2768 } else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
2769 //
2770 // To new a package
2771 //
2772 SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
2773 result = smb.showDialog();
2774
2775 if (result == DataType.RETURN_TYPE_CANCEL) {
2776 nfc.dispose();
2777 smb.dispose();
2778 return;
2779 } else if (result == DataType.RETURN_TYPE_OK) {
2780 PackageIdentification pid = smb.getPid();
2781 if (pid != null) {
2782 try {
2783 wt.addPackageToDatabase(smb.getPid());
2784 } catch (Exception e) {
2785 Log.err("addPackageToDatabase", e.getMessage());
2786 }
2787
2788 //
2789 // Update Global Data
2790 //
2791 GlobalData.openingPackageList.insertToOpeningPackageList(pid, smb.getSpd());
2792 GlobalData.vPackageList.addElement(pid);
2793
2794 //
2795 // Add to Module Description node
2796 //
2797 IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(pid.getName(),
2798 IDefaultMutableTreeNode.MODULE_PACKAGE,
2799 false, pid);
2800
2801 iTree.addNode(dmtnModuleDescription, node);
2802
2803 //
2804 // Add new SpdHeader node to the tree
2805 //
2806 node = new IDefaultMutableTreeNode(pid.getName(), IDefaultMutableTreeNode.PACKAGE, true, pid);
2807 iTree.addNode(dmtnPackageDescription, node);
2808
2809 this.openPackage(pid.getPath());
2810 }
2811 }
2812 } else if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
2813 //
2814 // To new a platform
2815 //
2816 SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
2817 result = smb.showDialog();
2818
2819 if (result == DataType.RETURN_TYPE_CANCEL) {
2820 nfc.dispose();
2821 smb.dispose();
2822 return;
2823 } else if (result == DataType.RETURN_TYPE_OK) {
2824 PlatformIdentification fid = smb.getFid();
2825 if (fid != null) {
2826 try {
2827 wt.addPlatformToDatabase(fid);
2828 } catch (Exception e) {
2829 Log.err("addPlatformToDatabase", e.getMessage());
2830 }
2831
2832 //
2833 // Update global data
2834 //
2835 GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, smb.getFpd());
2836 GlobalData.vPlatformList.addElement(fid);
2837 //
2838 // Add new SpdHeader node to the tree
2839 //
2840 IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(fid.getName(),
2841 IDefaultMutableTreeNode.PLATFORM, true,
2842 fid);
2843 iTree.addNode(dmtnPlatformDescription, node);
2844 this.openPlatform(fid.getPath());
2845 }
2846 }
2847 }
2848 }
2849
2850 /**
2851 Open a file
2852
2853 **/
2854 private void open() {
2855 JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
2856 fc.setAcceptAllFileFilterUsed(false);
2857 IFileFilter iffM = new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT);
2858 IFileFilter iffP = new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT);
2859 IFileFilter iffF = new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT);
2860 fc.addChoosableFileFilter(iffM);
2861 fc.addChoosableFileFilter(iffP);
2862 fc.addChoosableFileFilter(iffF);
2863 fc.setFileFilter(iffM);
2864
2865 int result = fc.showOpenDialog(new JPanel());
2866
2867 if (result == JFileChooser.APPROVE_OPTION) {
2868 String path = fc.getSelectedFile().getPath();
2869 String match = path.substring(path.length() - 4);
2870 if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.MODULE_SURFACE_AREA_EXT)) {
2871 openModule(path);
2872 } else if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.PACKAGE_SURFACE_AREA_EXT)) {
2873 openPackage(path);
2874 } else if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT)) {
2875 openPlatform(path);
2876 }
2877 }
2878 }
2879
2880 /**
2881 Close files
2882
2883 **/
2884 private void close() {
2885 switch (this.jTabbedPaneEditor.getSelectedIndex()) {
2886 //
2887 // Current is module
2888 //
2889 case 0:
2890 if (this.currentOpeningModuleIndex > -1) {
2891 if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) {
2892 int result = showSaveDialog();
2893 if (result == JOptionPane.YES_OPTION) {
2894 this.saveAll();
2895 }
2896 if (result == JOptionPane.NO_OPTION) {
2897 // Do nothing
2898 }
2899 if (result == JOptionPane.CANCEL_OPTION) {
2900 return;
2901 }
2902 }
2903 iTree
2904 .removeNodeChildrenByPath(GlobalData.openingModuleList
2905 .getTreePathByIndex(currentOpeningModuleIndex));
2906 GlobalData.openingModuleList.setModuleOpen(this.currentOpeningModuleIndex, false);
2907 this.cleanDesktopPaneModule();
2908 this.currentOpeningModuleIndex = -1;
2909 }
2910 break;
2911 //
2912 // Current is package
2913 //
2914 case 1:
2915 if (this.currentOpeningPackageIndex > -1) {
2916 if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) {
2917 int result = showSaveDialog();
2918 if (result == JOptionPane.YES_OPTION) {
2919 this.saveAll();
2920 }
2921 if (result == JOptionPane.NO_OPTION) {
2922 // Do nothing
2923 }
2924 if (result == JOptionPane.CANCEL_OPTION) {
2925 return;
2926 }
2927 }
2928 iTree
2929 .removeNodeChildrenByPath(GlobalData.openingPackageList
2930 .getTreePathByIndex(currentOpeningPackageIndex));
2931 GlobalData.openingPackageList.setPackageOpen(this.currentOpeningPackageIndex, false);
2932 this.cleanDesktopPanePackage();
2933 this.currentOpeningPackageIndex = -1;
2934 }
2935 break;
2936 //
2937 // Current is platform
2938 //
2939 case 2:
2940 if (this.currentOpeningPlatformIndex > -1) {
2941 if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) {
2942 int result = showSaveDialog();
2943 if (result == JOptionPane.YES_OPTION) {
2944 this.saveAll();
2945 }
2946 if (result == JOptionPane.NO_OPTION) {
2947 // Do nothing
2948 }
2949 if (result == JOptionPane.CANCEL_OPTION) {
2950 return;
2951 }
2952 }
2953 iTree
2954 .removeNodeChildrenByPath(GlobalData.openingPlatformList
2955 .getTreePathByIndex(currentOpeningPlatformIndex));
2956 GlobalData.openingPlatformList.setPlatformOpen(this.currentOpeningPlatformIndex, false);
2957 this.cleanDesktopPanePlatform();
2958 this.currentOpeningPlatformIndex = -1;
2959 }
2960 break;
2961 }
2962 }
2963
2964 /**
2965 Close all opening files and clean all showing internal frame
2966
2967 **/
2968 private void closeAll() {
2969 int result = -1;
2970 if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()
2971 || !GlobalData.openingPlatformList.isSaved()) {
2972 result = showSaveDialog();
2973 }
2974 if (result == JOptionPane.YES_OPTION) {
2975 this.saveAll();
2976 }
2977 if (result == JOptionPane.NO_OPTION) {
2978 //
2979 // Do nothing
2980 //
2981 }
2982 if (result == JOptionPane.CANCEL_OPTION) {
2983 return;
2984 }
2985 this.cleanDesktopPane();
2986 GlobalData.openingModuleList.closeAll();
2987 GlobalData.openingPackageList.closeAll();
2988 GlobalData.openingPlatformList.closeAll();
2989 this.makeEmptyTree();
2990 }
2991
2992 /**
2993 Save currentModule when press button OK
2994
2995 **/
2996 private void save() {
2997 switch (this.jTabbedPaneEditor.getSelectedIndex()) {
2998 case 0:
2999 if (this.currentOpeningModuleIndex > -1) {
3000 saveModule(this.currentOpeningModuleIndex);
3001 }
3002 break;
3003 case 1:
3004 if (this.currentOpeningPackageIndex > -1) {
3005 savePackage(this.currentOpeningPackageIndex);
3006 }
3007 break;
3008 case 2:
3009 if (this.currentOpeningPlatformIndex > -1) {
3010 savePlatform(this.currentOpeningPlatformIndex);
3011 }
3012 break;
3013 }
3014 }
3015
3016 private void saveAs() {
3017
3018 }
3019
3020 private void saveAll() {
3021 //
3022 // Save all modules
3023 //
3024 for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {
3025 if (!GlobalData.openingModuleList.getModuleSaved(index)) {
3026 saveModule(index);
3027 }
3028 }
3029
3030 //
3031 // Save all packages
3032 //
3033 for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
3034 if (!GlobalData.openingPackageList.getPackageSaved(index)) {
3035 savePackage(index);
3036 }
3037 }
3038
3039 //
3040 // Save all platforms
3041 //
3042 for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {
3043 if (!GlobalData.openingPlatformList.getPlatformSaved(index)) {
3044 savePlatform(index);
3045 }
3046 }
3047 }
3048
3049 /**
3050 To save changed items before exit.
3051
3052 **/
3053 private void exit() {
3054 int result = -1;
3055 if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()
3056 || !GlobalData.openingPlatformList.isSaved()) {
3057 result = showSaveDialog();
3058 }
3059 if (result == JOptionPane.YES_OPTION) {
3060 this.saveAll();
3061 }
3062 if (result == JOptionPane.NO_OPTION) {
3063 // Do nothing
3064 }
3065 if (result == JOptionPane.CANCEL_OPTION) {
3066 return;
3067 }
3068 this.dispose();
3069 System.exit(0);
3070 }
3071
3072 /**
3073 To find all defined PPIs in workspace
3074
3075 **/
3076 // private void findPpi() {
3077 // FindPPIsResult fpr = FindPPIsResult.getInstance();
3078 // fpr.setVisible(true);
3079 // }
3080
3081 /**
3082 Switch current workspace to others
3083
3084 **/
3085 private void changeWorkspace() {
3086 SwitchWorkspace sw = new SwitchWorkspace(this, true);
3087 int result = sw.showDialog();
3088 if (result == DataType.RETURN_TYPE_CANCEL) {
3089 return;
3090 } else if (result == DataType.RETURN_TYPE_OK) {
3091 //
3092 // Reinit whole window
3093 //
3094 closeAll();
3095 this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
3096 + Workspace.getCurrentWorkspace() + "]");
3097 //
3098 // Reinit Global Data
3099 //
3100 GlobalData.init();
3101 }
3102 sw.dispose();
3103 }
3104
3105 /**
3106 To create a Far file from current workspace
3107
3108 **/
3109 private void createFar() {
3110 CreateStepOne cso = new CreateStepOne(this, true);
3111 int result = cso.showDialog();
3112 if (result == DataType.RETURN_TYPE_OK) {
3113 String strReturn = "Create Far Done!";
3114 JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
3115 JOptionPane.INFORMATION_MESSAGE);
3116 }
3117 cso.dispose();
3118 }
3119
3120 /**
3121 To install a Far file to current workspace
3122
3123 **/
3124 private void installFar() {
3125 InstallStepOne iso = new InstallStepOne(this, true);
3126 int result = iso.showDialog();
3127 if (result == DataType.RETURN_TYPE_OK) {
3128 String strReturn = "<html>Install Far Done! <br>The WORKSPACE will be refreshed!</html>";
3129 JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
3130 JOptionPane.INFORMATION_MESSAGE);
3131 this.closeAll();
3132 }
3133 iso.dispose();
3134 }
3135
3136 /**
3137 To remove a Far's items from current workspace
3138
3139 **/
3140 private void removeFar() {
3141 DeleteStepOne dso = new DeleteStepOne(this, true);
3142 int result = dso.showDialog();
3143 if (result == DataType.RETURN_TYPE_OK) {
3144 String strReturn = "<html>Delete Far Done! <br>The WORKSPACE will be refreshed!</html>";
3145 JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
3146 JOptionPane.INFORMATION_MESSAGE);
3147 this.closeAll();
3148 }
3149 dso.dispose();
3150 }
3151
3152 /**
3153 To update an existing Far file
3154
3155 **/
3156 private void updateFar() {
3157 UpdateStepOne uso = new UpdateStepOne(this, true);
3158 int result = uso.showDialog();
3159 if (result == DataType.RETURN_TYPE_OK) {
3160 String strReturn = "<html>Update Far Done! <br>The WORKSPACE will be refreshed!</html>";
3161 JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
3162 JOptionPane.INFORMATION_MESSAGE);
3163 this.closeAll();
3164 }
3165 uso.dispose();
3166 }
3167
3168 /**
3169 Show Tool Chain Configuration Dialog to setup Tool Chain
3170
3171 **/
3172 private void setupToolChainConfiguration() {
3173 ToolChainConfig tcc = ToolChainConfig.getInstance();
3174 tcc.showDialog();
3175 }
3176
3177 private void configBuildPreferences() {
3178 Preferences bt = Preferences.getInstance();
3179 bt.showDialog();
3180 }
3181 /**
3182 Clone selected item
3183
3184 **/
3185 private void cloneItem() {
3186 int mode = -1;
3187
3188 //
3189 // Check if there is any item can be cloned
3190 //
3191 if (iTree.getSelectionPath() == null) {
3192 Log.wrn("Clone", "Please select a target to clone!");
3193 return;
3194 }
3195 int category = iTree.getSelectCategory();
3196 Identification id = iTree.getSelectNode().getId();
3197 if (category == IDefaultMutableTreeNode.MODULE || category == IDefaultMutableTreeNode.PACKAGE
3198 || category == IDefaultMutableTreeNode.PLATFORM) {
3199 Log.wrn("Clone", "Please select a target to clone!");
3200 return;
3201 }
3202
3203 if (category == IDefaultMutableTreeNode.WORKSPACE) {
3204 mode = DataType.RETURN_TYPE_WORKSPACE;
3205 id = null;
3206 }
3207 if (category >= IDefaultMutableTreeNode.MSA_HEADER && category < IDefaultMutableTreeNode.SPD_HEADER) {
3208 mode = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
3209 }
3210 if (category >= IDefaultMutableTreeNode.SPD_HEADER && category < IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
3211 mode = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
3212 }
3213 if (category >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
3214 mode = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
3215 }
3216
3217 Clone c = new Clone(this, true, mode, id);
3218 int result = c.showDialog();
3219
3220 if (result == DataType.RETURN_TYPE_CANCEL) {
3221 c.dispose();
3222 }
3223 if (result == DataType.RETURN_TYPE_WORKSPACE) {
3224 Tools.showInformationMessage("Workspace Clone Finished");
3225 }
3226 if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
3227 Tools.showInformationMessage("Module Surface Area Clone Finished");
3228 GlobalData.vModuleList.addElement(c.getMid());
3229 addModuleToTree(c.getMid());
3230 }
3231 if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
3232 Tools.showInformationMessage("Package Surface Area Clone Finished");
3233 GlobalData.vPackageList.addElement(c.getPid());
3234 //
3235 // Add new SpdHeader node to the tree
3236 //
3237 IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(GlobalData.vPackageList.lastElement().getName(),
3238 IDefaultMutableTreeNode.SPD_HEADER, true,
3239 GlobalData.vPackageList.lastElement());
3240 iTree.addNode(dmtnPackageDescription, node);
3241 }
3242 if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
3243 Tools.showInformationMessage("Platform Surface Area Clone Finished");
3244 GlobalData.vPlatformList.addElement(c.getFid());
3245 //
3246 // Add new SpdHeader node to the tree
3247 //
3248 IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(
3249 GlobalData.vPlatformList.lastElement().getName(),
3250 IDefaultMutableTreeNode.FPD_PLATFORMHEADER,
3251 true, GlobalData.vPlatformList.lastElement());
3252 iTree.addNode(dmtnPlatformDescription, node);
3253 //this.openPlatform(c.getFid().getPath());
3254 }
3255 if (result == DataType.RETURN_TYPE_OK) {
3256
3257 }
3258 }
3259
3260 public void valueChanged(TreeSelectionEvent arg0) {
3261 // TODO Auto-generated method stub
3262
3263 }
3264
3265 public void menuCanceled(MenuEvent arg0) {
3266 // TODO Auto-generated method stub
3267
3268 }
3269
3270 public void menuDeselected(MenuEvent arg0) {
3271 // TODO Auto-generated method stub
3272
3273 }
3274
3275 public void menuSelected(MenuEvent arg0) {
3276 if (arg0.getSource() == jMenuFile) {
3277 //
3278 // Enable close/close all if some files are opened
3279 //
3280 jMenuItemFileClose.setEnabled(GlobalData.openingModuleList.isOpen()
3281 || GlobalData.openingPackageList.isOpen()
3282 || GlobalData.openingPlatformList.isOpen());
3283 jMenuItemFileCloseAll.setEnabled(GlobalData.openingModuleList.isOpen()
3284 || GlobalData.openingPackageList.isOpen()
3285 || GlobalData.openingPlatformList.isOpen());
3286
3287 //
3288 // Enable save/save all if some files are changed
3289 //
3290 jMenuItemFileSave.setEnabled(!GlobalData.openingModuleList.isSaved()
3291 || !GlobalData.openingPackageList.isSaved()
3292 || !GlobalData.openingPlatformList.isSaved());
3293 jMenuItemFileSaveAll.setEnabled(!GlobalData.openingModuleList.isSaved()
3294 || !GlobalData.openingPackageList.isSaved()
3295 || !GlobalData.openingPlatformList.isSaved());
3296 }
3297
3298 if (arg0.getSource() == jMenuTools) {
3299 //
3300 // Enable clone when select some items
3301 //
3302 if (iTree.getSelectionPath() == null) {
3303 jMenuItemToolsClone.setEnabled(false);
3304 } else {
3305 int category = iTree.getSelectCategory();
3306 if (category == IDefaultMutableTreeNode.MODULE || category == IDefaultMutableTreeNode.PACKAGE
3307 || category == IDefaultMutableTreeNode.PLATFORM
3308 || category == IDefaultMutableTreeNode.MODULE_PACKAGE
3309 || category == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY
3310 || category == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
3311 jMenuItemToolsClone.setEnabled(false);
3312 } else {
3313 jMenuItemToolsClone.setEnabled(true);
3314 }
3315 }
3316 }
3317 }
3318 }