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