]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.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 / OpeningModuleType.java
CommitLineData
79cb6fdb 1/** @file\r
2 \r
3 The file is used to define opening module 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
15\r
16package org.tianocore.frameworkwizard.common.Identifications;\r
17\r
fc87d0ba 18import java.io.IOException;\r
19\r
20import org.apache.xmlbeans.XmlException;\r
79cb6fdb 21import org.tianocore.ModuleSurfaceAreaDocument;\r
fc87d0ba 22import org.tianocore.frameworkwizard.common.Log;\r
23import org.tianocore.frameworkwizard.common.OpenFile;\r
739c6b04 24import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
79cb6fdb 25\r
26public class OpeningModuleType extends OpeningFileType{\r
27 //\r
28 // Define class members\r
29 //\r
30 private ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa = null;\r
31 \r
739c6b04 32 private ModuleIdentification id = null;\r
33 \r
79cb6fdb 34 public OpeningModuleType() {\r
35 \r
36 }\r
37 \r
739c6b04 38 public OpeningModuleType(ModuleIdentification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa) {\r
39 this.id = identification;\r
79cb6fdb 40 this.xmlMsa = msa;\r
41 }\r
79cb6fdb 42\r
43 public ModuleSurfaceAreaDocument.ModuleSurfaceArea getXmlMsa() {\r
44 return xmlMsa;\r
45 }\r
46\r
47 public void setXmlMsa(ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {\r
48 this.xmlMsa = xmlMsa;\r
49 }\r
739c6b04 50\r
51 public ModuleIdentification getId() {\r
52 return id;\r
53 }\r
54\r
55 public void setId(ModuleIdentification id) {\r
56 this.id = id;\r
57 }\r
fc87d0ba 58 \r
59 public void reload() {\r
60 if (this.id != null) {\r
61 String path = id.getPath();\r
62 if (path.length() > 0) {\r
63 try {\r
64 this.xmlMsa = OpenFile.openMsaFile(id.getPath());\r
65 } catch (IOException e) {\r
66 Log.err("Open Module Surface Area " + path, e.getMessage());\r
67 } catch (XmlException e) {\r
68 Log.err("Open Module Surface Area " + path, e.getMessage());\r
69 } catch (Exception e) {\r
70 Log.err("Open Module Surface Area " + path, "Invalid file type");\r
71 }\r
72 }\r
73 }\r
74 }\r
79cb6fdb 75}\r