]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java
7084e75dacc6834602fec5c5d31525a9af59f491
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / SelectModuleBelong.java
1 /** @file
2
3 The file is used to let user choose to create module in an existing package
4 or to create a new package first.
5
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16 package org.tianocore.frameworkwizard;
17
18 import java.awt.Component;
19 import java.awt.event.ActionEvent;
20 import java.io.File;
21 import java.util.Vector;
22
23 import javax.swing.ButtonGroup;
24 import javax.swing.JButton;
25 import javax.swing.JComboBox;
26 import javax.swing.JFileChooser;
27 import javax.swing.JLabel;
28 import javax.swing.JPanel;
29 import javax.swing.JTextField;
30
31 import org.tianocore.MsaHeaderDocument;
32 import org.tianocore.SpdHeaderDocument;
33 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
34 import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
35 import org.tianocore.PlatformHeaderDocument.PlatformHeader;
36 import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
37 import org.tianocore.frameworkwizard.common.DataType;
38 import org.tianocore.frameworkwizard.common.DataValidation;
39 import org.tianocore.frameworkwizard.common.IFileFilter;
40 import org.tianocore.frameworkwizard.common.Log;
41 import org.tianocore.frameworkwizard.common.SaveFile;
42 import org.tianocore.frameworkwizard.common.Tools;
43 import org.tianocore.frameworkwizard.common.ui.IDialog;
44 import org.tianocore.frameworkwizard.common.ui.IFrame;
45 import org.tianocore.frameworkwizard.common.ui.StarLabel;
46 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
47 import org.tianocore.frameworkwizard.packaging.PackageIdentification;
48 import org.tianocore.frameworkwizard.platform.PlatformIdentification;
49 import org.tianocore.frameworkwizard.workspace.Workspace;
50 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
51 import javax.swing.JRadioButton;
52
53 public class SelectModuleBelong extends IDialog {
54
55 /**
56 Define class members
57
58 **/
59 private static final long serialVersionUID = 4171355136991448972L;
60
61 private JPanel jContentPane = null;
62
63 private JComboBox jComboBoxExistingPackage = null;
64
65 private JButton jButtonOk = null;
66
67 private JButton jButtonCancel = null;
68
69 private Vector<PackageIdentification> packages = null;
70
71 private JLabel jLabelPackage = null;
72
73 private JLabel jLabelFilePath = null;
74
75 private JTextField jTextFieldFilePath = null;
76
77 private JButton jButtonBrowse = null;
78
79 private JLabel jLabelName = null;
80
81 private JTextField jTextFieldName = null;
82
83 private JLabel jLabelGuid = null;
84
85 private JTextField jTextFieldGuid = null;
86
87 private JButton jButtonGen = null;
88
89 private JLabel jLabelVersion = null;
90
91 private JTextField jTextFieldVersion = null;
92
93 private StarLabel jStarLabel1 = null;
94
95 private StarLabel jStarLabel2 = null;
96
97 private StarLabel jStarLabel3 = null;
98
99 private StarLabel jStarLabel4 = null;
100
101 private StarLabel jStarLabel5 = null;
102
103 private ButtonGroup bg = new ButtonGroup();
104
105 private WorkspaceTools wt = new WorkspaceTools();
106
107 private ModuleIdentification mid = null;
108
109 private PackageIdentification pid = null;
110
111 private PlatformIdentification fid = null;
112
113 private ModuleSurfaceArea msa = null;
114
115 private PackageSurfaceArea spd = null;
116
117 private PlatformSurfaceArea fpd = null;
118
119 private int mode = -1;
120
121 private JLabel jLabelIsLibrary = null;
122
123 private JRadioButton jRadioButtonYes = null;
124
125 private JRadioButton jRadioButtonNo = null;
126
127 /**
128 * This method initializes jComboBoxExistingPackage
129 *
130 * @return javax.swing.JComboBox
131 */
132 private JComboBox getJComboBoxExistingPackage() {
133 if (jComboBoxExistingPackage == null) {
134 jComboBoxExistingPackage = new JComboBox();
135 jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(140, 10, 340, 20));
136 }
137 return jComboBoxExistingPackage;
138 }
139
140 /**
141 * This method initializes jButtonNext
142 *
143 * @return javax.swing.JButton
144 */
145 private JButton getJButtonOk() {
146 if (jButtonOk == null) {
147 jButtonOk = new JButton();
148 jButtonOk.setBounds(new java.awt.Rectangle(310, 165, 80, 20));
149 jButtonOk.setText("Ok");
150 jButtonOk.addActionListener(this);
151 }
152 return jButtonOk;
153 }
154
155 /**
156 * This method initializes jButtonCancel
157 *
158 * @return javax.swing.JButton
159 */
160 private JButton getJButtonCancel() {
161 if (jButtonCancel == null) {
162 jButtonCancel = new JButton();
163 jButtonCancel.setBounds(new java.awt.Rectangle(395, 165, 80, 20));
164 jButtonCancel.setText("Cancel");
165 jButtonCancel.addActionListener(this);
166 }
167 return jButtonCancel;
168 }
169
170 /**
171 * This method initializes jTextFieldFilePath
172 *
173 * @return javax.swing.JTextField
174 */
175 private JTextField getJTextFieldFilePath() {
176 if (jTextFieldFilePath == null) {
177 jTextFieldFilePath = new JTextField();
178 jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 60, 250, 20));
179 }
180 return jTextFieldFilePath;
181 }
182
183 /**
184 * This method initializes jButtonBrowse
185 *
186 * @return javax.swing.JButton
187 */
188 private JButton getJButtonBrowse() {
189 if (jButtonBrowse == null) {
190 jButtonBrowse = new JButton();
191 jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20));
192 jButtonBrowse.setText("Browse");
193 jButtonBrowse.addActionListener(this);
194 }
195 return jButtonBrowse;
196 }
197
198 /**
199 * This method initializes jTextFieldModuleName
200 *
201 * @return javax.swing.JTextField
202 */
203 private JTextField getJTextFieldName() {
204 if (jTextFieldName == null) {
205 jTextFieldName = new JTextField();
206 jTextFieldName.setBounds(new java.awt.Rectangle(140, 85, 340, 20));
207 }
208 return jTextFieldName;
209 }
210
211 /**
212 * This method initializes jTextFieldGuid
213 *
214 * @return javax.swing.JTextField
215 */
216 private JTextField getJTextFieldGuid() {
217 if (jTextFieldGuid == null) {
218 jTextFieldGuid = new JTextField();
219 jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 110, 250, 20));
220 }
221 return jTextFieldGuid;
222 }
223
224 /**
225 * This method initializes jButtonGen
226 *
227 * @return javax.swing.JButton
228 */
229 private JButton getJButtonGen() {
230 if (jButtonGen == null) {
231 jButtonGen = new JButton();
232 jButtonGen.setBounds(new java.awt.Rectangle(395, 110, 85, 20));
233 jButtonGen.setText("GEN");
234 jButtonGen.addActionListener(this);
235 }
236 return jButtonGen;
237 }
238
239 /**
240 * This method initializes jTextFieldVersion
241 *
242 * @return javax.swing.JTextField
243 */
244 private JTextField getJTextFieldVersion() {
245 if (jTextFieldVersion == null) {
246 jTextFieldVersion = new JTextField();
247 jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 135, 340, 20));
248 }
249 return jTextFieldVersion;
250 }
251
252 /**
253 * This method initializes jRadioButtonYes
254 *
255 * @return javax.swing.JRadioButton
256 */
257 private JRadioButton getJRadioButtonYes() {
258 if (jRadioButtonYes == null) {
259 jRadioButtonYes = new JRadioButton();
260 jRadioButtonYes.setBounds(new java.awt.Rectangle(140, 35, 100, 20));
261 jRadioButtonYes.setSelected(false);
262 jRadioButtonYes.setText("Yes");
263 }
264 return jRadioButtonYes;
265 }
266
267 /**
268 * This method initializes jRadioButtonNo
269 *
270 * @return javax.swing.JRadioButton
271 */
272 private JRadioButton getJRadioButtonNo() {
273 if (jRadioButtonNo == null) {
274 jRadioButtonNo = new JRadioButton();
275 jRadioButtonNo.setBounds(new java.awt.Rectangle(300, 35, 110, 20));
276 jRadioButtonNo.setSelected(true);
277 jRadioButtonNo.setText("No");
278 }
279 return jRadioButtonNo;
280 }
281
282 /**
283 * @param args
284 */
285 public static void main(String[] args) {
286 SelectModuleBelong smb = new SelectModuleBelong();
287 smb.setVisible(true);
288 }
289
290 /**
291 * This is the default constructor
292 */
293 public SelectModuleBelong() {
294 super();
295 init();
296 }
297
298 /**
299 * This is the default constructor
300 */
301 public SelectModuleBelong(IFrame parentFrame, boolean modal, int fileType) {
302 super(parentFrame, modal);
303 this.mode = fileType;
304 init();
305 initExistingPackage();
306 if (mode != DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
307 this.jStarLabel1.setVisible(false);
308 this.jLabelPackage.setVisible(false);
309 this.jComboBoxExistingPackage.setVisible(false);
310 this.jLabelIsLibrary.setVisible(false);
311 this.jRadioButtonYes.setVisible(false);
312 this.jRadioButtonNo.setVisible(false);
313 upLocation(this.jStarLabel2, 50);
314 upLocation(this.jStarLabel3, 50);
315 upLocation(this.jStarLabel4, 50);
316 upLocation(this.jStarLabel5, 50);
317 upLocation(this.jLabelFilePath, 50);
318 upLocation(this.jLabelName, 50);
319 upLocation(this.jLabelGuid, 50);
320 upLocation(this.jLabelVersion, 50);
321 upLocation(this.jTextFieldFilePath, 50);
322 upLocation(this.jTextFieldName, 50);
323 upLocation(this.jTextFieldGuid, 50);
324 upLocation(this.jTextFieldVersion, 50);
325 upLocation(this.jButtonBrowse, 50);
326 upLocation(this.jButtonGen, 50);
327 }
328 }
329
330 /**
331 * This method initializes this
332 *
333 * @return void
334 */
335 private void init() {
336 this.setSize(500, 230);
337 this.setContentPane(getJContentPane());
338 this.setTitle("New");
339 this.centerWindow();
340 }
341
342 /**
343 * This method initializes jContentPane
344 *
345 * @return javax.swing.JPanel
346 */
347 private JPanel getJContentPane() {
348 if (jContentPane == null) {
349 jLabelIsLibrary = new JLabel();
350 jLabelIsLibrary.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
351 jLabelIsLibrary.setText("Is this a Library");
352 jLabelVersion = new JLabel();
353 jLabelVersion.setBounds(new java.awt.Rectangle(15, 135, 120, 20));
354 jLabelVersion.setText("Version");
355 jLabelGuid = new JLabel();
356 jLabelGuid.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
357 jLabelGuid.setText("Guid");
358 jLabelName = new JLabel();
359 jLabelName.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
360 jLabelName.setText("Module Name");
361 jLabelFilePath = new JLabel();
362 jLabelFilePath.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
363 jLabelFilePath.setText("File Path");
364 jLabelPackage = new JLabel();
365 jLabelPackage.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
366 jLabelPackage.setText("Choose a Package");
367 jContentPane = new JPanel();
368 jContentPane.setLayout(null);
369 jContentPane.setSize(new java.awt.Dimension(490, 198));
370 jContentPane.add(getJComboBoxExistingPackage(), null);
371 jContentPane.add(getJButtonOk(), null);
372 jContentPane.add(getJButtonCancel(), null);
373 jContentPane.add(jLabelPackage, null);
374 jContentPane.add(jLabelFilePath, null);
375 jContentPane.add(getJTextFieldFilePath(), null);
376 jContentPane.add(getJButtonBrowse(), null);
377 jContentPane.add(jLabelName, null);
378 jContentPane.add(getJTextFieldName(), null);
379 jContentPane.add(jLabelGuid, null);
380 jContentPane.add(getJTextFieldGuid(), null);
381 jContentPane.add(getJButtonGen(), null);
382 jContentPane.add(jLabelVersion, null);
383 jContentPane.add(getJTextFieldVersion(), null);
384
385 jStarLabel1 = new StarLabel();
386 jStarLabel1.setLocation(new java.awt.Point(0, 10));
387 jStarLabel2 = new StarLabel();
388 jStarLabel2.setLocation(new java.awt.Point(0, 60));
389 jStarLabel3 = new StarLabel();
390 jStarLabel3.setLocation(new java.awt.Point(0, 85));
391 jStarLabel4 = new StarLabel();
392 jStarLabel4.setLocation(new java.awt.Point(0, 110));
393 jStarLabel5 = new StarLabel();
394 jStarLabel5.setLocation(new java.awt.Point(0, 135));
395 jContentPane.add(jStarLabel1, null);
396 jContentPane.add(jStarLabel2, null);
397 jContentPane.add(jStarLabel3, null);
398 jContentPane.add(jStarLabel4, null);
399 jContentPane.add(jStarLabel5, null);
400 jContentPane.add(jLabelIsLibrary, null);
401 jContentPane.add(getJRadioButtonYes(), null);
402 jContentPane.add(getJRadioButtonNo(), null);
403 bg.add(getJRadioButtonNo());
404 bg.add(getJRadioButtonYes());
405 }
406 return jContentPane;
407 }
408
409 /**
410 Query all existing packages and fill them into combox
411
412 **/
413 private void initExistingPackage() {
414 packages = wt.getAllPackages();
415 for (int index = 0; index < packages.size(); index++) {
416 this.jComboBoxExistingPackage.addItem(packages.elementAt(index).getName());
417 }
418 }
419
420 /* (non-Javadoc)
421 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
422 *
423 * Override actionPerformed to listen all actions
424 */
425 public void actionPerformed(ActionEvent arg0) {
426 if (arg0.getSource() == jButtonCancel) {
427 this.setVisible(false);
428 this.returnType = DataType.RETURN_TYPE_CANCEL;
429 }
430
431 if (arg0.getSource() == jButtonOk) {
432 if (this.check()) {
433 this.save();
434 } else {
435 return;
436 }
437 this.setVisible(false);
438 this.returnType = DataType.RETURN_TYPE_OK;
439 }
440
441 if (arg0.getSource() == this.jButtonGen) {
442 this.jTextFieldGuid.setText(Tools.generateUuidString());
443 }
444
445 if (arg0.getSource() == this.jButtonBrowse) {
446 JFileChooser fc = new JFileChooser();
447 fc.setAcceptAllFileFilterUsed(false);
448
449 if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
450 fc.setCurrentDirectory(new File(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())
451 .getPath()));
452 fc.addChoosableFileFilter(new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT));
453 }
454 if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
455 fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
456 fc.addChoosableFileFilter(new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT));
457 }
458 if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
459 fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
460 fc.addChoosableFileFilter(new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT));
461 }
462 int result = fc.showSaveDialog(new JPanel());
463 if (result == JFileChooser.APPROVE_OPTION) {
464 this.jTextFieldFilePath.setText(Tools.addPathExt(fc.getSelectedFile().getPath(), mode));
465 }
466 }
467 }
468
469 /**
470 Data validation for all fields
471
472 @retval true - All datas are valid
473 @retval false - At least one data is invalid
474
475 **/
476 public boolean check() {
477 //
478 // Check if all required fields are not empty
479 //
480 if (isEmpty(this.jTextFieldFilePath.getText())) {
481 Log.wrn("New File", "A File Path must be entered!");
482 return false;
483 }
484 if (isEmpty(this.jTextFieldName.getText())) {
485 Log.wrn("New File", "A Name must be entered");
486 return false;
487 }
488 if (isEmpty(this.jTextFieldGuid.getText())) {
489 Log.wrn("New File", "The Guid must be entered!");
490 return false;
491 }
492 if (isEmpty(this.jTextFieldVersion.getText())) {
493 Log.wrn("New File", "A Version number must be entered!");
494 return false;
495 }
496
497 //
498 // Check if all fields have correct data types
499 //
500 if (!DataValidation.isBaseName(this.jTextFieldName.getText())) {
501 Log.wrn("New File", "Incorrect data type for the Name!");
502 return false;
503 }
504 if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
505 Log.wrn("New File", "Incorrect data type for Guid, which must be in registry format! (8-4-4-4-12)");
506 return false;
507 }
508
509 if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
510 //
511 // Check if the module is already existed in current package
512 //
513 String packagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();
514 String modulePath = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
515 Vector<String> msaFile = wt.getAllModulesOfPackage(packagePath);
516
517 for (int index = 0; index < msaFile.size(); index++) {
518 if (msaFile.elementAt(index).equals(modulePath)) {
519 Log.wrn("New File", "This module is already exists in the selected package!");
520 return false;
521 }
522 }
523 }
524
525 if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
526 //
527 // Check if the package is already existed in database
528 //
529 String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
530 Vector<PackageIdentification> vPackageList = wt.getAllPackages();
531 if (vPackageList != null && vPackageList.size() > 0) {
532 for (int index = 0; index < vPackageList.size(); index++) {
533 if (vPackageList.get(index).getPath().equals(path)) {
534 Log.wrn("New File", "This package is already exists in this workspace!");
535 return false;
536 }
537 }
538 }
539 }
540
541 if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
542 //
543 // Check if the platform is already existed in database
544 //
545 String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
546 Vector<PlatformIdentification> vPlatfromList = wt.getAllPlatforms();
547 if (vPlatfromList != null && vPlatfromList.size() > 0) {
548 for (int index = 0; index < vPlatfromList.size(); index++) {
549 if (vPlatfromList.get(index).getPath().equals(path)) {
550 Log.wrn("New File", "This platform is already exists in this workspace!");
551 return false;
552 }
553 }
554 }
555 }
556
557 return true;
558 }
559
560 /**
561 Save file
562
563 **/
564 public void save() {
565 if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
566 this.saveModule();
567 }
568 if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
569 this.savePackage();
570 }
571 if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
572 this.savePlatform();
573 }
574 }
575
576 /**
577 Save all components of Msa Header
578
579 **/
580 private void saveModule() {
581 msa = null;
582 String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
583
584 //
585 // Save to memory
586 //
587 try {
588 MsaHeaderDocument.MsaHeader msaHeader = null;
589
590 msa = ModuleSurfaceArea.Factory.newInstance();
591 msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
592
593 msaHeader.setModuleName(this.jTextFieldName.getText());
594 msaHeader.setGuidValue(this.jTextFieldGuid.getText());
595 msaHeader.setVersion(this.jTextFieldVersion.getText());
596
597 msa.setMsaHeader(msaHeader);
598 } catch (Exception e) {
599 Log.err("Save ModuleSurfaceArea Document", e.getMessage());
600 return;
601 }
602
603 //
604 // Save to real file
605 //
606 try {
607 SaveFile.saveMsaFile(path, msa);
608 } catch (Exception e) {
609 Log.wrn("Save Module to file system", e.getMessage());
610 Log.err("Save Module to file system", e.getMessage());
611 return;
612 }
613
614 //
615 // Save to identification
616 //
617 mid = new ModuleIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
618 this.jTextFieldVersion.getText(), path, jRadioButtonYes.isSelected());
619 mid.setPackageId(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()));
620 }
621
622 /**
623 Save all components of Spd Header
624
625 **/
626 private void savePackage() {
627 spd = null;
628 String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
629
630 //
631 // Save to memory
632 //
633 try {
634 SpdHeaderDocument.SpdHeader spdHeader = null;
635
636 spd = PackageSurfaceArea.Factory.newInstance();
637 spdHeader = SpdHeaderDocument.SpdHeader.Factory.newInstance();
638
639 spdHeader.setPackageName(this.jTextFieldName.getText());
640 spdHeader.setGuidValue(this.jTextFieldGuid.getText());
641 spdHeader.setVersion(this.jTextFieldVersion.getText());
642
643 spd.setSpdHeader(spdHeader);
644 } catch (Exception e) {
645 Log.wrn("Save Package Surface Area Description Document", e.getMessage());
646 return;
647 }
648
649 //
650 // Save to real file
651 //
652 try {
653 SaveFile.saveSpdFile(path, spd);
654
655 } catch (Exception e) {
656 Log.wrn("Save Package to file system", e.getMessage());
657 Log.err("Save Package to file system", e.getMessage());
658 return;
659 }
660
661 //
662 // Save to identification
663 //
664 pid = new PackageIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
665 this.jTextFieldVersion.getText(), path);
666 }
667
668 /**
669 Save all components of Fpd Header
670
671 **/
672 private void savePlatform() {
673 fpd = null;
674 String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
675
676 //
677 // Save to memory
678 //
679 try {
680 PlatformHeader fpdHeader = null;
681
682 fpd = PlatformSurfaceArea.Factory.newInstance();
683 fpdHeader = PlatformHeader.Factory.newInstance();
684
685 fpdHeader.setPlatformName(this.jTextFieldName.getText());
686 fpdHeader.setGuidValue(this.jTextFieldGuid.getText());
687 fpdHeader.setVersion(this.jTextFieldVersion.getText());
688
689 fpd.setPlatformHeader(fpdHeader);
690 } catch (Exception e) {
691 Log.wrn("Save Framework Platform Description Document", e.getMessage());
692 return;
693 }
694
695 //
696 // Save to real file
697 //
698 try {
699 SaveFile.saveFpdFile(path, fpd);
700
701 } catch (Exception e) {
702 Log.wrn("Save Platform to file system", e.getMessage());
703 Log.err("Save Platform to file system", e.getMessage());
704 return;
705 }
706
707 //
708 // Save to identification
709 //
710 fid = new PlatformIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
711 this.jTextFieldVersion.getText(), path);
712 }
713
714 public ModuleIdentification getMid() {
715 return mid;
716 }
717
718 public PlatformIdentification getFid() {
719 return fid;
720 }
721
722 public PackageIdentification getPid() {
723 return pid;
724 }
725
726 private void upLocation(Component c, int size) {
727 c.setLocation(c.getLocation().x, c.getLocation().y - size);
728 }
729
730 public PlatformSurfaceArea getFpd() {
731 return fpd;
732 }
733
734 public ModuleSurfaceArea getMsa() {
735 return msa;
736 }
737
738 public PackageSurfaceArea getSpd() {
739 return spd;
740 }
741 }