]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java
1. Fix EDKT463: When wizard new or clone a msa/spd/fpd, should follow these rules
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Identifications / OpeningPackageType.java
CommitLineData
79cb6fdb 1/** @file\r
2 \r
3 The file is used to define opening package type\r
4 \r
5 Copyright (c) 2006, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 \r
14 **/\r
15package org.tianocore.frameworkwizard.common.Identifications;\r
16\r
fc87d0ba 17import java.io.IOException;\r
18\r
19import org.apache.xmlbeans.XmlException;\r
79cb6fdb 20import org.tianocore.PackageSurfaceAreaDocument;\r
fc87d0ba 21import org.tianocore.frameworkwizard.common.Log;\r
22import org.tianocore.frameworkwizard.common.OpenFile;\r
739c6b04 23import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
79cb6fdb 24\r
25public class OpeningPackageType extends OpeningFileType {\r
26 //\r
27 // Define class members\r
28 //\r
29 private PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd = null;\r
30 \r
739c6b04 31 private PackageIdentification id = null;\r
32 \r
79cb6fdb 33 public OpeningPackageType() {\r
34 \r
35 }\r
36 \r
739c6b04 37 public OpeningPackageType(PackageIdentification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd) {\r
38 this.id = identification;\r
79cb6fdb 39 this.xmlSpd = spd;\r
40 }\r
79cb6fdb 41\r
42 public PackageSurfaceAreaDocument.PackageSurfaceArea getXmlSpd() {\r
43 return xmlSpd;\r
44 }\r
45\r
46 public void setXmlSpd(PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd) {\r
47 this.xmlSpd = xmlSpd;\r
48 }\r
739c6b04 49\r
50 public PackageIdentification getId() {\r
51 return id;\r
52 }\r
53\r
54 public void setId(PackageIdentification id) {\r
55 this.id = id;\r
56 }\r
fc87d0ba 57 \r
58 public void reload() {\r
59 if (this.id != null) {\r
60 String path = id.getPath();\r
61 if (path.length() > 0) {\r
62 try {\r
63 this.xmlSpd = OpenFile.openSpdFile(id.getPath());\r
64 } catch (IOException e) {\r
65 Log.err("Open Package Surface Area " + path, e.getMessage());\r
66 } catch (XmlException e) {\r
67 Log.err("Open Package Surface Area " + path, e.getMessage());\r
68 } catch (Exception e) {\r
69 Log.err("Open Package Surface Area " + path, "Invalid file type");\r
70 }\r
71 }\r
72 }\r
73 }\r
79cb6fdb 74}\r