79cb6fdb |
1 | /** @file\r |
2 | \r |
3 | The file is used to define opening platform 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 | package org.tianocore.frameworkwizard.common.Identifications;\r |
16 | \r |
fc87d0ba |
17 | import java.io.IOException;\r |
18 | \r |
19 | import org.apache.xmlbeans.XmlException;\r |
79cb6fdb |
20 | import org.tianocore.PlatformSurfaceAreaDocument;\r |
fc87d0ba |
21 | import org.tianocore.frameworkwizard.common.Log;\r |
22 | import org.tianocore.frameworkwizard.common.OpenFile;\r |
739c6b04 |
23 | import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r |
79cb6fdb |
24 | \r |
25 | public class OpeningPlatformType extends OpeningFileType {\r |
26 | //\r |
27 | // Define class members\r |
28 | //\r |
29 | private PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd = null;\r |
30 | \r |
739c6b04 |
31 | private PlatformIdentification id = null;\r |
32 | \r |
79cb6fdb |
33 | public OpeningPlatformType() {\r |
34 | \r |
35 | }\r |
36 | \r |
739c6b04 |
37 | public OpeningPlatformType(PlatformIdentification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r |
38 | this.id = identification;\r |
79cb6fdb |
39 | this.xmlFpd = fpd;\r |
40 | }\r |
41 | \r |
79cb6fdb |
42 | public PlatformSurfaceAreaDocument.PlatformSurfaceArea getXmlFpd() {\r |
43 | return xmlFpd;\r |
44 | }\r |
45 | \r |
46 | public void setXmlFpd(PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {\r |
47 | this.xmlFpd = xmlFpd;\r |
48 | }\r |
739c6b04 |
49 | \r |
50 | public PlatformIdentification getId() {\r |
51 | return id;\r |
52 | }\r |
53 | \r |
54 | public void setId(PlatformIdentification 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.xmlFpd = OpenFile.openFpdFile(id.getPath());\r |
64 | } catch (IOException e) {\r |
65 | Log.err("Open Platform Surface Area " + path, e.getMessage());\r |
66 | } catch (XmlException e) {\r |
67 | Log.err("Open Platform Surface Area " + path, e.getMessage());\r |
68 | } catch (Exception e) {\r |
69 | Log.err("Open Platform Surface Area " + path, "Invalid file type");\r |
70 | }\r |
71 | }\r |
72 | }\r |
73 | }\r |
79cb6fdb |
74 | }\r |