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