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