]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | UIAction class.\r | |
3 | \r | |
4 | This class is the parent action class of UI wizard.\r | |
5 | \r | |
6 | Copyright (c) 2006, Intel Corporation\r | |
7 | All rights reserved. This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | package org.tianocore.build.pcd.action;\r | |
18 | \r | |
19 | import org.tianocore.build.pcd.exception.UIException;\r | |
20 | \r | |
21 | /** This class is the parent class for all UI wizard action.\r | |
22 | **/\r | |
23 | public abstract class UIAction {\r | |
24 | ///\r | |
25 | /// original message level. when finish this action, original \r | |
26 | /// message level will be restored.\r | |
27 | ///\r | |
28 | private int originalMessageLevel;\r | |
29 | \r | |
30 | /**\r | |
31 | Check the parameter for this aciton.\r | |
32 | \r | |
33 | This function will be overrided by child class.\r | |
34 | **/\r | |
35 | abstract void checkParamter() throws UIException;\r | |
36 | \r | |
37 | /**\r | |
38 | Perform action.\r | |
39 | \r | |
40 | This function will be overrided by child class.\r | |
41 | **/\r | |
42 | abstract void performAction() throws UIException;\r | |
43 | \r | |
44 | /**\r | |
45 | set the message level for this action.\r | |
46 | \r | |
47 | @param messageLevel message level wanted.\r | |
48 | **/\r | |
49 | public void setMessageLevel(int messageLevel) {\r | |
50 | originalMessageLevel = ActionMessage.messageLevel;\r | |
51 | ActionMessage.messageLevel = messageLevel;\r | |
52 | }\r | |
53 | \r | |
54 | /**\r | |
55 | log message for UI wizard aciton.\r | |
56 | \r | |
57 | @param actionObj aciton instance object.\r | |
58 | @param logStr log message string\r | |
59 | **/\r | |
60 | public static void logMsg(Object actionObj, String logStr) {\r | |
61 | System.out.println(logStr);\r | |
62 | }\r | |
63 | \r | |
64 | /**\r | |
65 | Warning message for UI wizard action.\r | |
66 | \r | |
67 | @param warningObj action instance object.\r | |
68 | @param warningStr warning message string.\r | |
69 | **/\r | |
70 | public static void warningMsg(Object warningObj, String warningStr) {\r | |
71 | System.out.println(warningStr);\r | |
72 | }\r | |
73 | \r | |
74 | /**\r | |
75 | Entry function for all UI wizard actions.\r | |
76 | **/\r | |
77 | public void execute() throws UIException {\r | |
78 | checkParamter();\r | |
79 | performAction();\r | |
80 | \r | |
81 | ActionMessage.messageLevel = originalMessageLevel;\r | |
82 | }\r | |
83 | }\r |