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