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