]> git.proxmox.com Git - mirror_edk2.git/blob - 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
1 /** @file
2
3 The file is used to define opening package type
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 package org.tianocore.frameworkwizard.common.Identifications;
16
17 import java.io.IOException;
18
19 import org.apache.xmlbeans.XmlException;
20 import org.tianocore.PackageSurfaceAreaDocument;
21 import org.tianocore.frameworkwizard.common.Log;
22 import org.tianocore.frameworkwizard.common.OpenFile;
23 import org.tianocore.frameworkwizard.packaging.PackageIdentification;
24
25 public class OpeningPackageType extends OpeningFileType {
26 //
27 // Define class members
28 //
29 private PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd = null;
30
31 private PackageIdentification id = null;
32
33 public OpeningPackageType() {
34
35 }
36
37 public OpeningPackageType(PackageIdentification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd) {
38 this.id = identification;
39 this.xmlSpd = spd;
40 }
41
42 public PackageSurfaceAreaDocument.PackageSurfaceArea getXmlSpd() {
43 return xmlSpd;
44 }
45
46 public void setXmlSpd(PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd) {
47 this.xmlSpd = xmlSpd;
48 }
49
50 public PackageIdentification getId() {
51 return id;
52 }
53
54 public void setId(PackageIdentification id) {
55 this.id = id;
56 }
57
58 public void reload() {
59 if (this.id != null) {
60 String path = id.getPath();
61 if (path.length() > 0) {
62 try {
63 this.xmlSpd = OpenFile.openSpdFile(id.getPath());
64 } catch (IOException e) {
65 Log.err("Open Package Surface Area " + path, e.getMessage());
66 } catch (XmlException e) {
67 Log.err("Open Package Surface Area " + path, e.getMessage());
68 } catch (Exception e) {
69 Log.err("Open Package Surface Area " + path, "Invalid file type");
70 }
71 }
72 }
73 }
74 }