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