1. Fix EDKT273 "Externs are not being grouped together in MSA Files"

2. Fix EDKT274 "Wrong display in Extern when selecting "Specification"

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1580 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-09-21 01:07:28 +00:00
parent da4f6c6cae
commit 3b7a9058fd
11 changed files with 1230 additions and 346 deletions

View File

@ -62,6 +62,10 @@ public class DataType {
public static final String UNIX_LINE_SEPARATOR = "\n"; public static final String UNIX_LINE_SEPARATOR = "\n";
public static final String LINE_SEPARATOR = UNIX_LINE_SEPARATOR;
public static final String HTML_LINE_SEPARATOR = "<br>";
public static final String EMPTY_SELECT_ITEM = "----"; public static final String EMPTY_SELECT_ITEM = "----";
public static final String DOS_FILE_SEPARATOR = "\\"; public static final String DOS_FILE_SEPARATOR = "\\";

View File

@ -24,19 +24,23 @@ public class EnumerationData {
public final static String EXTERNS_SPECIFICATION = "Specification"; public final static String EXTERNS_SPECIFICATION = "Specification";
public final static String EXTERNS_IMAGE = "Image";
public final static String EXTERNS_MODULE_ENTRY_POINT = "ModuleEntryPoint"; public final static String EXTERNS_MODULE_ENTRY_POINT = "ModuleEntryPoint";
public final static String EXTERNS_MODULE_UNLOAD_IMAGE = "ModuleUnloadImage"; public final static String EXTERNS_MODULE_UNLOAD_IMAGE = "ModuleUnloadImage";
public final static String EXTERNS_LIBRARY = "Library";
public final static String EXTERNS_CONSTRUCTOR = "Constructor"; public final static String EXTERNS_CONSTRUCTOR = "Constructor";
public final static String EXTERNS_DESTRUCTOR = "Destructor"; public final static String EXTERNS_DESTRUCTOR = "Destructor";
public final static String EXTERNS_DRIVER = "Driver";
public final static String EXTERNS_DRIVER_BINDING = "DriverBinding"; public final static String EXTERNS_DRIVER_BINDING = "DriverBinding";
public final static String EXTERNS_COMPONENT_NAME = "ComponentName"; public final static String EXTERNS_COMPONENT_NAME = "ComponentName";
public final static String EXTERNS_DRIVER_CONFIG = "DriverConfig"; public final static String EXTERNS_DRIVER_CONFIG = "DriverConfig";
public final static String EXTERNS_DRIVER_DIAG = "DriverDiag"; public final static String EXTERNS_DRIVER_DIAG = "DriverDiag";
public final static String EXTERNS_SET_VIRTUAL_ADDRESS_MAP_CALL_BACK = "SetVirtualAddressMapCallBack"; public final static String EXTERNS_CALL_BACK = "Call Back";
public final static String EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK = "ExitBootServicesCallBack"; public final static String EXTERNS_VIRTUAL_ADDRESS_MAP_CALL_BACK = "VirtualAddressMap";
public final static String EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK = "ExitBootServices";
// //
// Common data // Common data
@ -669,28 +673,33 @@ public class EnumerationData {
private void initExternTypes() { private void initExternTypes() {
vExternTypes.removeAllElements(); vExternTypes.removeAllElements();
vExternTypes.addElement(EnumerationData.EXTERNS_PCD_IS_DRIVER);
vExternTypes.addElement(EnumerationData.EXTERNS_SPECIFICATION); vExternTypes.addElement(EnumerationData.EXTERNS_SPECIFICATION);
vExternTypes.addElement(EnumerationData.EXTERNS_IMAGE);
vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER);
vExternTypes.addElement(EnumerationData.EXTERNS_LIBRARY);
vExternTypes.addElement(EnumerationData.EXTERNS_CALL_BACK);
vExternTypes.addElement(EnumerationData.EXTERNS_MODULE_ENTRY_POINT); // vExternTypes.addElement(EnumerationData.EXTERNS_PCD_IS_DRIVER);
vExternTypes.addElement(EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE); //
// vExternTypes.addElement(EnumerationData.EXTERNS_SPECIFICATION);
//
// vExternTypes.addElement(EnumerationData.EXTERNS_MODULE_ENTRY_POINT);
// vExternTypes.addElement(EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE);
//
// vExternTypes.addElement(EnumerationData.EXTERNS_CONSTRUCTOR);
// vExternTypes.addElement(EnumerationData.EXTERNS_DESTRUCTOR);
vExternTypes.addElement(EnumerationData.EXTERNS_CONSTRUCTOR); // vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER_BINDING);
vExternTypes.addElement(EnumerationData.EXTERNS_DESTRUCTOR); // vExternTypes.addElement(EnumerationData.EXTERNS_COMPONENT_NAME);
// vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER_CONFIG);
vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER_BINDING); // vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER_DIAG);
vExternTypes.addElement(EnumerationData.EXTERNS_COMPONENT_NAME); //
vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER_CONFIG); // vExternTypes.addElement(EnumerationData.EXTERNS_SET_VIRTUAL_ADDRESS_MAP_CALL_BACK);
vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER_DIAG); // vExternTypes.addElement(EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK);
vExternTypes.addElement(EnumerationData.EXTERNS_SET_VIRTUAL_ADDRESS_MAP_CALL_BACK);
vExternTypes.addElement(EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK);
} }
private void initPcdDriverTypes() { private void initPcdDriverTypes() {
vPcdDriverTypes.removeAllElements(); vPcdDriverTypes.removeAllElements();
vPcdDriverTypes.addElement(DataType.EMPTY_SELECT_ITEM);
vPcdDriverTypes.addElement("PEI_PCD_DRIVER"); vPcdDriverTypes.addElement("PEI_PCD_DRIVER");
vPcdDriverTypes.addElement("DXE_PCD_DRIVER"); vPcdDriverTypes.addElement("DXE_PCD_DRIVER");
} }

View File

@ -632,4 +632,21 @@ public class Tools {
count = wholeString.split(searchString).length; count = wholeString.split(searchString).length;
return count; return count;
} }
/**
* Check the input data is empty or not
*
* @param strValue
* The input data which need be checked
*
* @retval true - The input data is empty
* @retval fals - The input data is not empty
*
*/
public static boolean isEmpty(String strValue) {
if (strValue.length() > 0) {
return false;
}
return true;
}
} }

View File

@ -23,6 +23,7 @@ import java.awt.event.ActionListener;
import javax.swing.JDialog; import javax.swing.JDialog;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.Tools;
/** /**
The class is used to override Dialog to provides customized interfaces The class is used to override Dialog to provides customized interfaces
@ -148,10 +149,7 @@ public class IDialog extends JDialog implements ActionListener {
**/ **/
public boolean isEmpty(String strValue) { public boolean isEmpty(String strValue) {
if (strValue.length() > 0) { return Tools.isEmpty(strValue);
return false;
}
return true;
} }
/** /**

View File

@ -27,6 +27,8 @@ import java.awt.event.WindowListener;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import org.tianocore.frameworkwizard.common.Tools;
/** /**
The class is used to override Frame to provides customized interfaces The class is used to override Frame to provides customized interfaces
It extends JFrame implements ActionListener and WindowListener It extends JFrame implements ActionListener and WindowListener
@ -228,10 +230,7 @@ public class IFrame extends JFrame implements ActionListener, WindowListener, Co
**/ **/
public boolean isEmpty(String strValue) { public boolean isEmpty(String strValue) {
if (strValue.length() > 0) { return Tools.isEmpty(strValue);
return false;
}
return true;
} }
/** /**

View File

@ -35,6 +35,8 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener; import javax.swing.event.TableModelListener;
import org.tianocore.frameworkwizard.common.Tools;
/** /**
* The class is used to override JInternalFrame to provides customized * The class is used to override JInternalFrame to provides customized
* interfaces It extends JInternalFrame implements ActionListener * interfaces It extends JInternalFrame implements ActionListener
@ -124,10 +126,7 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
* *
*/ */
public boolean isEmpty(String strValue) { public boolean isEmpty(String strValue) {
if (strValue.length() > 0) { return Tools.isEmpty(strValue);
return false;
}
return true;
} }
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {

View File

@ -17,12 +17,20 @@ package org.tianocore.frameworkwizard.module.Identifications.Externs;
import java.util.Vector; import java.util.Vector;
import org.tianocore.frameworkwizard.common.EnumerationData;
public class ExternsIdentification { public class ExternsIdentification {
// //
// Define class members // Define class members
// //
private String name = null; private String name0 = null;
private String name1 = null;
private String name2 = null;
private String name3 = null;
private String type = null; private String type = null;
@ -30,11 +38,28 @@ public class ExternsIdentification {
private String featureFlag = null; private String featureFlag = null;
public ExternsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3) { public ExternsIdentification(String arg0, String arg1) {
this.name = (arg0 == null ? "" : arg0); this.name0 = (arg0 == null ? "" : arg0);
this.type = (arg1 == null ? "" : arg1); this.type = (arg1 == null ? "" : arg1);
this.featureFlag = (arg2 == null ? "" : arg2); }
this.supArchList = arg3;
public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4) {
this.name0 = (arg0 == null ? "" : arg0);
this.name1 = (arg1 == null ? "" : arg1);
this.type = (arg2 == null ? "" : arg2);
this.featureFlag = (arg3 == null ? "" : arg3);
this.supArchList = arg4;
}
public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
Vector<String> arg6) {
this.name0 = (arg0 == null ? "" : arg0);
this.name1 = (arg1 == null ? "" : arg1);
this.name2 = (arg2 == null ? "" : arg2);
this.name3 = (arg3 == null ? "" : arg3);
this.type = (arg4 == null ? "" : arg4);
this.featureFlag = (arg5 == null ? "" : arg5);
this.supArchList = arg6;
} }
public String getFeatureFlag() { public String getFeatureFlag() {
@ -45,14 +70,6 @@ public class ExternsIdentification {
this.featureFlag = featureFlag; this.featureFlag = featureFlag;
} }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Vector<String> getSupArchList() { public Vector<String> getSupArchList() {
return supArchList; return supArchList;
} }
@ -62,9 +79,34 @@ public class ExternsIdentification {
} }
public boolean equals(ExternsIdentification pi) { public boolean equals(ExternsIdentification pi) {
if (this.name.equals(pi.name)) { if (this.type.equals(pi.type)) {
if (this.type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
if (this.name0.equals(pi.name0)) {
return true; return true;
} }
}
if (this.type.equals(EnumerationData.EXTERNS_IMAGE)) {
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
return true;
}
}
if (this.type.equals(EnumerationData.EXTERNS_LIBRARY)) {
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
return true;
}
}
if (this.type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
return true;
}
}
if (this.type.equals(EnumerationData.EXTERNS_DRIVER)) {
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1) && this.name2.equals(pi.name2) && this.name3.equals(pi.name3)) {
return true;
}
}
}
return false; return false;
} }
@ -75,4 +117,36 @@ public class ExternsIdentification {
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
public String getName0() {
return name0;
}
public void setName0(String name0) {
this.name0 = name0;
}
public String getName1() {
return name1;
}
public void setName1(String name1) {
this.name1 = name1;
}
public String getName2() {
return name2;
}
public void setName2(String name2) {
this.name2 = name2;
}
public String getName3() {
return name3;
}
public void setName3(String name3) {
this.name3 = name3;
}
} }

View File

@ -16,6 +16,7 @@ package org.tianocore.frameworkwizard.module.Identifications.Externs;
import java.util.Vector; import java.util.Vector;
import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.EnumerationData; import org.tianocore.frameworkwizard.common.EnumerationData;
public class ExternsVector { public class ExternsVector {
@ -31,15 +32,6 @@ public class ExternsVector {
return -1; return -1;
} }
public int findExterns(String name) {
for (int index = 0; index < vExterns.size(); index++) {
if (vExterns.elementAt(index).getName().equals(name)) {
return index;
}
}
return -1;
}
public ExternsIdentification getExterns(int index) { public ExternsIdentification getExterns(int index) {
if (index > -1) { if (index > -1) {
return vExterns.elementAt(index); return vExterns.elementAt(index);
@ -49,22 +41,8 @@ public class ExternsVector {
} }
public void addExterns(ExternsIdentification arg0) { public void addExterns(ExternsIdentification arg0) {
boolean isExistPcd = false;
if (arg0.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
for (int index = 0; index < size(); index++) {
if (getExterns(index).getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
setExterns(arg0, index);
isExistPcd = true;
break;
}
}
if (!isExistPcd) {
vExterns.addElement(arg0); vExterns.addElement(arg0);
} }
} else {
vExterns.addElement(arg0);
}
}
public void setExterns(ExternsIdentification arg0, int arg1) { public void setExterns(ExternsIdentification arg0, int arg1) {
vExterns.setElementAt(arg0, arg1); vExterns.setElementAt(arg0, arg1);
@ -91,22 +69,106 @@ public class ExternsVector {
vExterns = Externs; vExterns = Externs;
} }
public Vector<String> getExternsName() {
Vector<String> v = new Vector<String>();
for (int index = 0; index < this.vExterns.size(); index++) {
v.addElement(vExterns.get(index).getName());
}
return v;
}
public int size() { public int size() {
return this.vExterns.size(); return this.vExterns.size();
} }
public Vector<String> toStringVector(int index) { public Vector<String> toStringVector(int index) {
Vector<String> v = new Vector<String>(); Vector<String> v = new Vector<String>();
v.addElement(getExterns(index).getName());
//
// For Specification
//
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
v.addElement(getExterns(index).getType()); v.addElement(getExterns(index).getType());
v.addElement(getExterns(index).getType() + " Name");
v.addElement(getExterns(index).getName0());
return v;
}
//
// For Image
//
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
v.addElement(getExterns(index).getType());
String name = "";
String value = "";
name = EnumerationData.EXTERNS_MODULE_ENTRY_POINT;
value = this.getExterns(index).getName0();
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE;
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
+ DataType.HTML_LINE_SEPARATOR;
v.addElement("<html>" + name + "<html>");
v.addElement("<html>" + value + "<html>");
return v;
}
//
// For Library
//
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
v.addElement(getExterns(index).getType());
String name = "";
String value = "";
name = EnumerationData.EXTERNS_CONSTRUCTOR;
value = this.getExterns(index).getName0();
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DESTRUCTOR;
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
+ DataType.HTML_LINE_SEPARATOR;
v.addElement("<html>" + name + "<html>");
v.addElement("<html>" + value + "<html>");
return v;
}
//
// For Driver
//
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
v.addElement(getExterns(index).getType());
String name = "";
String value = "";
name = EnumerationData.EXTERNS_DRIVER_BINDING;
value = this.getExterns(index).getName0();
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_COMPONENT_NAME;
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1();
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_CONFIG;
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName2();
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_DIAG;
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName3()
+ DataType.HTML_LINE_SEPARATOR;
v.addElement("<html>" + name + "<html>");
v.addElement("<html>" + value + "<html>");
return v;
}
//
// For Call Back
//
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
v.addElement(getExterns(index).getType());
String name = "";
String value = "";
name = EnumerationData.EXTERNS_VIRTUAL_ADDRESS_MAP_CALL_BACK;
value = this.getExterns(index).getName0();
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK;
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
+ DataType.HTML_LINE_SEPARATOR;
v.addElement("<html>" + name + "<html>");
v.addElement("<html>" + value + "<html>");
return v;
}
//
// Return a empty v
//
return v; return v;
} }
} }

View File

@ -29,7 +29,6 @@ import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import org.tianocore.ExternsDocument; import org.tianocore.ExternsDocument;
import org.tianocore.PcdDriverTypes;
import org.tianocore.ExternsDocument.Externs; import org.tianocore.ExternsDocument.Externs;
import org.tianocore.ExternsDocument.Externs.Extern; import org.tianocore.ExternsDocument.Externs.Extern;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
@ -184,8 +183,9 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
jTable = new JTable(model); jTable = new JTable(model);
jTable.setRowHeight(20); jTable.setRowHeight(20);
model.addColumn("Name");
model.addColumn("Type"); model.addColumn("Type");
model.addColumn("Name");
model.addColumn("Value");
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTable.getSelectionModel().addListSelectionListener(this); jTable.getSelectionModel().addListSelectionListener(this);
@ -195,10 +195,6 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
return jTable; return jTable;
} }
public static void main(String[] args) {
}
/** /**
This method initializes this This method initializes this
@ -221,17 +217,6 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
this.externs = inExterns; this.externs = inExterns;
if (this.externs != null) { if (this.externs != null) {
//
// Get PcdIsDriver
//
if (this.externs.getPcdIsDriver() != null) {
String arg0 = this.externs.getPcdIsDriver().toString();
String arg1 = EnumerationData.EXTERNS_PCD_IS_DRIVER;
id = new ExternsIdentification(arg0, arg1, null, null);
vid.addExterns(id);
}
// //
// Get specification // Get specification
// //
@ -240,7 +225,7 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
String arg0 = externs.getSpecificationList().get(index); String arg0 = externs.getSpecificationList().get(index);
String arg1 = EnumerationData.EXTERNS_SPECIFICATION; String arg1 = EnumerationData.EXTERNS_SPECIFICATION;
id = new ExternsIdentification(arg0, arg1, null, null); id = new ExternsIdentification(arg0, arg1);
vid.addExterns(id); vid.addExterns(id);
} }
} }
@ -250,57 +235,63 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
// //
if (this.externs.getExternList().size() > 0) { if (this.externs.getExternList().size() > 0) {
for (int index = 0; index < this.externs.getExternList().size(); index++) { for (int index = 0; index < this.externs.getExternList().size(); index++) {
String arg0 = null; //
String arg1 = null; // Get common data
if (this.externs.getExternList().get(index).getModuleEntryPoint() != null) { //
arg0 = this.externs.getExternList().get(index).getModuleEntryPoint(); String featureFlag = externs.getExternList().get(index).getFeatureFlag();
arg1 = EnumerationData.EXTERNS_MODULE_ENTRY_POINT; Vector<String> arch = Tools
}
if (this.externs.getExternList().get(index).getModuleUnloadImage() != null) {
arg0 = this.externs.getExternList().get(index).getModuleUnloadImage();
arg1 = EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE;
}
if (this.externs.getExternList().get(index).getConstructor() != null) {
arg0 = this.externs.getExternList().get(index).getConstructor();
arg1 = EnumerationData.EXTERNS_CONSTRUCTOR;
}
if (this.externs.getExternList().get(index).getDestructor() != null) {
arg0 = this.externs.getExternList().get(index).getDestructor();
arg1 = EnumerationData.EXTERNS_DESTRUCTOR;
}
if (this.externs.getExternList().get(index).getDriverBinding() != null) {
arg0 = this.externs.getExternList().get(index).getDriverBinding();
arg1 = EnumerationData.EXTERNS_DRIVER_BINDING;
}
if (this.externs.getExternList().get(index).getComponentName() != null) {
arg0 = this.externs.getExternList().get(index).getComponentName();
arg1 = EnumerationData.EXTERNS_COMPONENT_NAME;
}
if (this.externs.getExternList().get(index).getDriverConfig() != null) {
arg0 = this.externs.getExternList().get(index).getDriverConfig();
arg1 = EnumerationData.EXTERNS_DRIVER_CONFIG;
}
if (this.externs.getExternList().get(index).getDriverDiag() != null) {
arg0 = this.externs.getExternList().get(index).getDriverDiag();
arg1 = EnumerationData.EXTERNS_DRIVER_DIAG;
}
if (this.externs.getExternList().get(index).getSetVirtualAddressMapCallBack() != null) {
arg0 = this.externs.getExternList().get(index).getSetVirtualAddressMapCallBack();
arg1 = EnumerationData.EXTERNS_SET_VIRTUAL_ADDRESS_MAP_CALL_BACK;
}
if (this.externs.getExternList().get(index).getExitBootServicesCallBack() != null) {
arg0 = this.externs.getExternList().get(index).getExitBootServicesCallBack();
arg1 = EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK;
}
String arg2 = externs.getExternList().get(index).getFeatureFlag();
Vector<String> arg3 = Tools
.convertListToVector(externs.getExternList().get(index).getSupArchList()); .convertListToVector(externs.getExternList().get(index).getSupArchList());
id = new ExternsIdentification(arg0, arg1, arg2, arg3); //
// Get Image data
//
if (this.externs.getExternList().get(index).getModuleEntryPoint() != null
|| this.externs.getExternList().get(index).getModuleUnloadImage() != null) {
String moduleEntryPoint = this.externs.getExternList().get(index).getModuleEntryPoint();
String moduleUnloadImage = this.externs.getExternList().get(index).getModuleUnloadImage();
String type = EnumerationData.EXTERNS_IMAGE;
id = new ExternsIdentification(moduleEntryPoint, moduleUnloadImage, type, featureFlag, arch);
}
//
// Get Library Data
//
if (this.externs.getExternList().get(index).getConstructor() != null
|| this.externs.getExternList().get(index).getDestructor() != null) {
String constructor = this.externs.getExternList().get(index).getConstructor();
String destructor = this.externs.getExternList().get(index).getDestructor();
String type = EnumerationData.EXTERNS_LIBRARY;
id = new ExternsIdentification(constructor, destructor, type, featureFlag, arch);
}
//
// Get Driver Data
//
if (this.externs.getExternList().get(index).getDriverBinding() != null) {
String driverBinding = this.externs.getExternList().get(index).getDriverBinding();
String componentName = this.externs.getExternList().get(index).getComponentName();
String driverConfig = this.externs.getExternList().get(index).getDriverConfig();
String driverDiag = this.externs.getExternList().get(index).getDriverDiag();
String type = EnumerationData.EXTERNS_DRIVER;
id = new ExternsIdentification(driverBinding, componentName, driverConfig, driverDiag, type,
featureFlag, arch);
}
//
// Get Call Back Data
//
if (this.externs.getExternList().get(index).getSetVirtualAddressMapCallBack() != null
|| this.externs.getExternList().get(index).getExitBootServicesCallBack() != null) {
String virtualAddressMap = this.externs.getExternList().get(index)
.getSetVirtualAddressMapCallBack();
String exitBootServices = this.externs.getExternList().get(index).getExitBootServicesCallBack();
String type = EnumerationData.EXTERNS_CALL_BACK;
id = new ExternsIdentification(virtualAddressMap, exitBootServices, type, featureFlag, arch);
}
//
// Add id to vector
//
vid.addExterns(id); vid.addExterns(id);
} }
} }
@ -391,7 +382,45 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
if (vid.size() > 0) { if (vid.size() > 0) {
for (int index = 0; index < vid.size(); index++) { for (int index = 0; index < vid.size(); index++) {
int line = 1;
//
// For Specification
//
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
line = 1;
}
//
// For Image
//
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
line = 2;
}
//
// For Library
//
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
line = 2;
}
//
// For Driver
//
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
line = 4;
}
//
// For Call Back
//
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
line = 2;
}
model.addRow(vid.toStringVector(index)); model.addRow(vid.toStringVector(index));
jTable.setRowHeight(index, line * 18);
} }
} }
this.jTable.repaint(); this.jTable.repaint();
@ -439,96 +468,106 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
try { try {
int count = this.vid.size(); int count = this.vid.size();
this.externs = Externs.Factory.newInstance(); //
// // // Save pcd and flash map information first
// // Save PcdIsDriver first //
// // Externs ex = Externs.Factory.newInstance();
// if (!this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals(DataType.EMPTY_SELECT_ITEM)) { if (this.externs.getPcdIsDriver() != null) {
// externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem() ex.setPcdIsDriver(this.externs.getPcdIsDriver());
// .toString())); }
// } if (this.externs.getTianoR8FlashMapH()) {
ex.setTianoR8FlashMapH(this.externs.getTianoR8FlashMapH());
}
this.externs = ex;
//
// Save externs
//
if (count > 0) { if (count > 0) {
for (int index = 0; index < count; index++) { for (int index = 0; index < count; index++) {
//
// Save Pcd Is Driver
//
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(vid.getExterns(index).getName()));
continue;
}
// //
// Save specfication // Save specfication
// //
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) { if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
if (!isEmpty(vid.getExterns(index).getName())) { if (!isEmpty(vid.getExterns(index).getName0())) {
this.externs.addNewSpecification(); this.externs.addNewSpecification();
this.externs.setSpecificationArray(externs.getSpecificationList().size() - 1, this.externs.setSpecificationArray(externs.getSpecificationList().size() - 1,
vid.getExterns(index).getName()); vid.getExterns(index).getName0());
continue;
} }
} else { }
//
// Save extern
//
Extern e = Extern.Factory.newInstance(); Extern e = Extern.Factory.newInstance();
//
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_MODULE_ENTRY_POINT)) { // Save image
if (!isEmpty(vid.getExterns(index).getName())) { //
e.setModuleEntryPoint(vid.getExterns(index).getName()); if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
e = Extern.Factory.newInstance();
if (!isEmpty(vid.getExterns(index).getName0())) {
e.setModuleEntryPoint(vid.getExterns(index).getName0());
} }
if (!isEmpty(vid.getExterns(index).getName1())) {
e.setModuleUnloadImage(vid.getExterns(index).getName1());
} }
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE)) {
if (!isEmpty(vid.getExterns(index).getName())) {
e.setModuleUnloadImage(vid.getExterns(index).getName());
} }
} }
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CONSTRUCTOR)) { //
if (!isEmpty(vid.getExterns(index).getName())) { // Save library
e.setConstructor(vid.getExterns(index).getName()); //
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
e = Extern.Factory.newInstance();
if (!isEmpty(vid.getExterns(index).getName0())) {
e.setConstructor(vid.getExterns(index).getName0());
} }
if (!isEmpty(vid.getExterns(index).getName1())) {
e.setDestructor(vid.getExterns(index).getName1());
} }
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DESTRUCTOR)) {
if (!isEmpty(vid.getExterns(index).getName())) {
e.setDestructor(vid.getExterns(index).getName());
} }
} }
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER_BINDING)) { //
if (!isEmpty(vid.getExterns(index).getName())) { // Save call back
e.setDriverBinding(vid.getExterns(index).getName()); //
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
e = Extern.Factory.newInstance();
if (!isEmpty(vid.getExterns(index).getName0())) {
e.setSetVirtualAddressMapCallBack(vid.getExterns(index).getName0());
} }
if (!isEmpty(vid.getExterns(index).getName1())) {
e.setExitBootServicesCallBack(vid.getExterns(index).getName1());
} }
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_COMPONENT_NAME)) {
if (!isEmpty(vid.getExterns(index).getName())) {
e.setComponentName(vid.getExterns(index).getName());
}
}
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER_CONFIG)) {
if (!isEmpty(vid.getExterns(index).getName())) {
e.setDriverConfig(vid.getExterns(index).getName());
}
}
if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER_DIAG)) {
if (!isEmpty(vid.getExterns(index).getName())) {
e.setDriverDiag(vid.getExterns(index).getName());
} }
} }
if (vid.getExterns(index).getType() //
.equals(EnumerationData.EXTERNS_SET_VIRTUAL_ADDRESS_MAP_CALL_BACK)) { // Save driver
if (!isEmpty(vid.getExterns(index).getName())) { //
e.setSetVirtualAddressMapCallBack(vid.getExterns(index).getName()); if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())
|| !isEmpty(vid.getExterns(index).getName2()) || !isEmpty(vid.getExterns(index).getName3())) {
e = Extern.Factory.newInstance();
if (!isEmpty(vid.getExterns(index).getName0())) {
e.setDriverBinding(vid.getExterns(index).getName0());
} }
if (!isEmpty(vid.getExterns(index).getName1())) {
e.setComponentName(vid.getExterns(index).getName1());
}
if (!isEmpty(vid.getExterns(index).getName2())) {
e.setDriverConfig(vid.getExterns(index).getName2());
}
if (!isEmpty(vid.getExterns(index).getName3())) {
e.setDriverDiag(vid.getExterns(index).getName3());
} }
if (vid.getExterns(index).getType()
.equals(EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK)) {
if (!isEmpty(vid.getExterns(index).getName())) {
e.setExitBootServicesCallBack(vid.getExterns(index).getName());
} }
} }
//
// Save common data
//
if (!isEmpty(vid.getExterns(index).getFeatureFlag())) { if (!isEmpty(vid.getExterns(index).getFeatureFlag())) {
e.setFeatureFlag(vid.getExterns(index).getFeatureFlag()); e.setFeatureFlag(vid.getExterns(index).getFeatureFlag());
} }
@ -541,7 +580,6 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
this.externs.setExternArray(this.externs.getExternList().size() - 1, e); this.externs.setExternArray(this.externs.getExternList().size() - 1, e);
} }
} }
}
this.msa.setExterns(externs); this.msa.setExterns(externs);
this.omt.setSaved(false); this.omt.setSaved(false);

View File

@ -29,10 +29,12 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.JTextField; import javax.swing.JTextField;
import org.tianocore.ExternsDocument;
import org.tianocore.ModuleDefinitionsDocument; import org.tianocore.ModuleDefinitionsDocument;
import org.tianocore.ModuleSurfaceAreaDocument; import org.tianocore.ModuleSurfaceAreaDocument;
import org.tianocore.ModuleTypeDef; import org.tianocore.ModuleTypeDef;
import org.tianocore.MsaHeaderDocument; import org.tianocore.MsaHeaderDocument;
import org.tianocore.PcdDriverTypes;
import org.tianocore.LicenseDocument.License; import org.tianocore.LicenseDocument.License;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
@ -152,8 +154,6 @@ public class MsaHeader extends IInternalFrame {
private StarLabel jStarLabel14 = null; private StarLabel jStarLabel14 = null;
// private StarLabel jStarLabel15 = null;
private JCheckBox jCheckBoxIa32 = null; private JCheckBox jCheckBoxIa32 = null;
private JCheckBox jCheckBoxX64 = null; private JCheckBox jCheckBoxX64 = null;
@ -166,6 +166,12 @@ public class MsaHeader extends IInternalFrame {
private JCheckBox jCheckBoxPpc = null; private JCheckBox jCheckBoxPpc = null;
private JComboBox jComboBoxPcdIsDriver = null;
private JCheckBox jCheckBoxPcd = null;
private JCheckBox jCheckBoxFlashMap = null;
// //
// Not used for UI // Not used for UI
// //
@ -175,6 +181,8 @@ public class MsaHeader extends IInternalFrame {
private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
private ExternsDocument.Externs ex = null;
private OpeningModuleType omt = null; private OpeningModuleType omt = null;
private EnumerationData ed = new EnumerationData(); private EnumerationData ed = new EnumerationData();
@ -399,7 +407,6 @@ public class MsaHeader extends IInternalFrame {
jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"); jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
jTextFieldSpecification.setBorder(null); jTextFieldSpecification.setBorder(null);
jTextFieldSpecification.setSize(new java.awt.Dimension(320, 20)); jTextFieldSpecification.setSize(new java.awt.Dimension(320, 20));
jTextFieldSpecification.setLocation(new java.awt.Point(2, dialogHeight - 30)); jTextFieldSpecification.setLocation(new java.awt.Point(2, dialogHeight - 30));
jTextFieldSpecification.setEditable(false); jTextFieldSpecification.setEditable(false);
@ -622,6 +629,23 @@ public class MsaHeader extends IInternalFrame {
return jTextFieldOutputFileBasename; return jTextFieldOutputFileBasename;
} }
/**
* This method initializes jComboBoxPcdIsDriver
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxPcdIsDriver() {
if (jComboBoxPcdIsDriver == null) {
jComboBoxPcdIsDriver = new JComboBox();
jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPcdIsDriver.setBounds(new java.awt.Rectangle(160, 530, 320, 20));
jComboBoxPcdIsDriver.addItemListener(this);
jComboBoxPcdIsDriver.setEnabled(false);
Tools.generateComboBoxByVector(jComboBoxPcdIsDriver, ed.getVPcdDriverTypes());
}
return jComboBoxPcdIsDriver;
}
/** /**
This is the default constructor This is the default constructor
@ -654,8 +678,14 @@ public class MsaHeader extends IInternalFrame {
md.setSupportedArchitectures(ed.getVSupportedArchitectures()); md.setSupportedArchitectures(ed.getVSupportedArchitectures());
msa.setModuleDefinitions(md); msa.setModuleDefinitions(md);
} }
//
// Init items of Header, Definitions and Externs
//
init(msa.getMsaHeader()); init(msa.getMsaHeader());
init(msa.getModuleDefinitions()); init(msa.getModuleDefinitions());
init(msa.getExterns());
this.setVisible(true); this.setVisible(true);
this.setViewMode(false); this.setViewMode(false);
} }
@ -767,6 +797,25 @@ public class MsaHeader extends IInternalFrame {
} }
} }
/**
This method initializes this
Fill values to all fields if these values are not empty
@param inEx The input data of ExternsDocument.Externs
**/
private void init(ExternsDocument.Externs inEx) {
if (inEx != null) {
this.ex = inEx;
if (ex.getPcdIsDriver() != null) {
this.jCheckBoxPcd.setSelected(true);
this.jComboBoxPcdIsDriver.setEnabled(true);
this.jComboBoxPcdIsDriver.setSelectedItem(ex.getPcdIsDriver());
}
this.jCheckBoxFlashMap.setSelected(ex.getTianoR8FlashMapH());
}
}
/** /**
This method initializes jContentPane This method initializes jContentPane
@ -903,6 +952,10 @@ public class MsaHeader extends IInternalFrame {
jContentPane.add(getJCheckBoxEbc(), null); jContentPane.add(getJCheckBoxEbc(), null);
jContentPane.add(getJCheckBoxArm(), null); jContentPane.add(getJCheckBoxArm(), null);
jContentPane.add(getJCheckBoxPpc(), null); jContentPane.add(getJCheckBoxPpc(), null);
jContentPane.add(getJCheckBoxPcd(), null);
jContentPane.add(getJComboBoxPcdIsDriver(), null);
jContentPane.add(getJCheckBoxFlashMap(), null);
} }
return jContentPane; return jContentPane;
} }
@ -923,14 +976,20 @@ public class MsaHeader extends IInternalFrame {
this.setEdited(true); this.setEdited(true);
this.dispose(); this.dispose();
} }
if (arg0.getSource() == jButtonCancel) { if (arg0.getSource() == jButtonCancel) {
this.setEdited(false); this.setEdited(false);
} }
if (arg0.getSource() == jButtonGenerateGuid) { if (arg0.getSource() == jButtonGenerateGuid) {
jTextFieldGuid.setText(Tools.generateUuidString()); jTextFieldGuid.setText(Tools.generateUuidString());
jTextFieldGuid.requestFocus(); jTextFieldGuid.requestFocus();
jButtonGenerateGuid.requestFocus(); jButtonGenerateGuid.requestFocus();
} }
if (arg0.getSource() == this.jCheckBoxPcd) {
this.jComboBoxPcdIsDriver.setEnabled(this.jCheckBoxPcd.isSelected());
}
} }
/** /**
@ -997,7 +1056,8 @@ public class MsaHeader extends IInternalFrame {
return false; return false;
} }
if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) { if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
Log.wrn("Update Msa Header", "Incorrect data type for Abstract, is should be a sentence describing the module."); Log.wrn("Update Msa Header",
"Incorrect data type for Abstract, is should be a sentence describing the module.");
//this.jTextFieldAbstract.requestFocus(); //this.jTextFieldAbstract.requestFocus();
return false; return false;
} }
@ -1119,6 +1179,7 @@ public class MsaHeader extends IInternalFrame {
Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth); Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);
Tools.resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth); Tools.resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth);
Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth); Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);
Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);
Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth, Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON); DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
@ -1347,6 +1408,92 @@ public class MsaHeader extends IInternalFrame {
} }
} }
//
// Check Pcd is Driver
//
if (arg0.getSource() == this.jCheckBoxPcd) {
if ((this.ex == null) && this.jCheckBoxPcd.isSelected()) {
this.ex = ExternsDocument.Externs.Factory.newInstance();
this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()
.toString()));
this.msa.setExterns(this.ex);
}
if ((this.ex != null) && (this.ex.getPcdIsDriver() == null) && this.jCheckBoxPcd.isSelected()) {
this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()
.toString()));
this.msa.setExterns(this.ex);
}
if ((this.ex != null) && (this.ex.getPcdIsDriver() != null)) {
if (this.jCheckBoxPcd.isSelected()
&& !this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals(
this.ex.getPcdIsDriver()
.toString())) {
this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()
.toString()));
this.msa.setExterns(this.ex);
}
if (!this.jCheckBoxPcd.isSelected()) {
ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
if (this.ex.getExternList() != null) {
for (int index = 0; index < this.ex.getExternList().size(); index++) {
newEx.addNewExtern();
newEx.setExternArray(index, this.ex.getExternArray(index));
}
}
if (this.ex.getSpecificationList() != null) {
for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
newEx.addNewSpecification();
newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
}
}
if (this.ex.getTianoR8FlashMapH()) {
newEx.setTianoR8FlashMapH(this.ex.getTianoR8FlashMapH());
}
this.ex = newEx;
this.msa.setExterns(this.ex);
}
}
}
//
// Check Flash Map
//
if (arg0.getSource() == this.jCheckBoxFlashMap) {
if ((this.ex == null) && this.jCheckBoxFlashMap.isSelected()) {
this.ex = ExternsDocument.Externs.Factory.newInstance();
this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
this.msa.setExterns(this.ex);
}
if ((this.ex != null) && this.jCheckBoxFlashMap.isSelected()) {
this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
this.msa.setExterns(this.ex);
}
if ((this.ex != null) && !this.jCheckBoxFlashMap.isSelected()) {
ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
if (this.ex.getExternList() != null) {
for (int index = 0; index < this.ex.getExternList().size(); index++) {
newEx.addNewExtern();
newEx.setExternArray(index, this.ex.getExternArray(index));
}
}
if (this.ex.getSpecificationList() != null) {
for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
newEx.addNewSpecification();
newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
}
}
if (this.ex.getPcdIsDriver() != null) {
newEx.setPcdIsDriver(this.ex.getPcdIsDriver());
}
this.ex = newEx;
this.msa.setExterns(this.ex);
}
}
this.save(); this.save();
} }
@ -1436,4 +1583,35 @@ public class MsaHeader extends IInternalFrame {
} }
} }
} }
/**
* This method initializes jCheckBoxPcd
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJCheckBoxPcd() {
if (jCheckBoxPcd == null) {
jCheckBoxPcd = new JCheckBox();
jCheckBoxPcd.setBounds(new java.awt.Rectangle(0, 530, 140, 20));
jCheckBoxPcd.setText("Is this a PCD Driver?");
jCheckBoxPcd.addFocusListener(this);
jCheckBoxPcd.addActionListener(this);
}
return jCheckBoxPcd;
}
/**
* This method initializes jCheckBoxFlashMap
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJCheckBoxFlashMap() {
if (jCheckBoxFlashMap == null) {
jCheckBoxFlashMap = new JCheckBox();
jCheckBoxFlashMap.setBounds(new java.awt.Rectangle(0, 555, 480, 20));
jCheckBoxFlashMap.setText("Are you using a legacy FlashMap header file?");
jCheckBoxFlashMap.addFocusListener(this);
}
return jCheckBoxFlashMap;
}
} }

View File

@ -34,6 +34,7 @@ import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsIdentification; import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsIdentification;
/** /**
@ -60,11 +61,9 @@ public class ExternsDlg extends IDialog implements ItemListener {
private JScrollPane jScrollPane = null; private JScrollPane jScrollPane = null;
private JComboBox jComboBoxPcdIsDriver = null; private JLabel jLabelSpecification = null;
private JLabel jLabelC_Name = null; private JTextField jTextFieldSpecification = null;
private JTextField jTextFieldC_Name = null;
private JLabel jLabelFeatureFlag = null; private JLabel jLabelFeatureFlag = null;
@ -78,6 +77,58 @@ public class ExternsDlg extends IDialog implements ItemListener {
private JButton jButtonCancel = null; private JButton jButtonCancel = null;
private StarLabel jStarLabel1 = null;
private JPanel jPanelSpecification = null;
private JPanel jPanelImage = null;
private JPanel jPanelDriver = null;
private JPanel jPanelLibrary = null;
private JPanel jPanelCallBack = null;
private JLabel jLabelModuleEntryPoint = null;
private JTextField jTextFieldModuleEntryPoint = null;
private JLabel jLabelModuleUnloadImage = null;
private JTextField jTextFieldModuleUnloadImage = null;
private JLabel jLabelDriverBinding = null;
private JTextField jTextFieldDriverBinding = null;
private JLabel jLabelComponentName = null;
private JTextField jTextFieldComponentName = null;
private JLabel jLabelDriverConfig = null;
private JTextField jTextFieldDriverConfig = null;
private JLabel jLabelDriverDiagnostic = null;
private JTextField jTextFieldDriverDiagnostic = null;
private JLabel jLabelConstructor = null;
private JTextField jTextFieldConstructor = null;
private JLabel jLabelDestructor = null;
private JTextField jTextFieldDestructor = null;
private JLabel jLabelVirtualAddressMap = null;
private JTextField jTextFieldVirtualAddressMap = null;
private JLabel jLabelExitBootServices = null;
private JTextField jTextFieldExitBootServices = null;
// //
// Not used by UI // Not used by UI
// //
@ -114,35 +165,19 @@ public class ExternsDlg extends IDialog implements ItemListener {
return jScrollPane; return jScrollPane;
} }
/**
* This method initializes jComboBoxPcdIsDriver
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxPcdIsDriver() {
if (jComboBoxPcdIsDriver == null) {
jComboBoxPcdIsDriver = new JComboBox();
jComboBoxPcdIsDriver.setLocation(new java.awt.Point(168, 37));
jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPcdIsDriver.setSize(new java.awt.Dimension(320, 20));
jComboBoxPcdIsDriver.addItemListener(this);
}
return jComboBoxPcdIsDriver;
}
/** /**
This method initializes jTextFieldC_Name This method initializes jTextFieldC_Name
@return javax.swing.JTextField @return javax.swing.JTextField
**/ **/
private JTextField getJTextFieldC_Name() { private JTextField getJTextFieldSpecification() {
if (jTextFieldC_Name == null) { if (jTextFieldSpecification == null) {
jTextFieldC_Name = new JTextField(); jTextFieldSpecification = new JTextField();
jTextFieldC_Name.setBounds(new java.awt.Rectangle(168, 37, 320, 20)); jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldSpecification.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
} }
return jTextFieldC_Name; return jTextFieldSpecification;
} }
/** /**
@ -170,7 +205,7 @@ public class ExternsDlg extends IDialog implements ItemListener {
private JButton getJButtonOk() { private JButton getJButtonOk() {
if (jButtonOk == null) { if (jButtonOk == null) {
jButtonOk = new JButton(); jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(300, 122, 90, 20)); jButtonOk.setBounds(new java.awt.Rectangle(300, 187, 90, 20));
jButtonOk.setText("Ok"); jButtonOk.setText("Ok");
jButtonOk.addActionListener(this); jButtonOk.addActionListener(this);
} }
@ -186,13 +221,273 @@ public class ExternsDlg extends IDialog implements ItemListener {
private JButton getJButtonCancel() { private JButton getJButtonCancel() {
if (jButtonCancel == null) { if (jButtonCancel == null) {
jButtonCancel = new JButton(); jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(400, 122, 90, 20)); jButtonCancel.setBounds(new java.awt.Rectangle(400, 187, 90, 20));
jButtonCancel.setText("Cancel"); jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this); jButtonCancel.addActionListener(this);
} }
return jButtonCancel; return jButtonCancel;
} }
/**
* This method initializes jPanelSpecification
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelSpecification() {
if (jPanelSpecification == null) {
jPanelSpecification = new JPanel();
jPanelSpecification.setBounds(new java.awt.Rectangle(0, 37, 505, 20));
jPanelSpecification.setLayout(null);
jLabelSpecification = new JLabel();
jLabelSpecification.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
jLabelSpecification.setText("Specification Name");
jPanelSpecification.add(jLabelSpecification, null);
jPanelSpecification.add(getJTextFieldSpecification(), null);
}
return jPanelSpecification;
}
/**
* This method initializes jPanelImage
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelImage() {
if (jPanelImage == null) {
jLabelModuleUnloadImage = new JLabel();
jLabelModuleUnloadImage.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
jLabelModuleUnloadImage.setText("Module Unload Image");
jLabelModuleEntryPoint = new JLabel();
jLabelModuleEntryPoint.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
jLabelModuleEntryPoint.setText("Module Entry Point");
jPanelImage = new JPanel();
jPanelImage.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
jPanelImage.setLayout(null);
jPanelImage.add(jLabelModuleEntryPoint, null);
jPanelImage.add(getJTextFieldModuleEntryPoint(), null);
jPanelImage.add(jLabelModuleUnloadImage, null);
jPanelImage.add(getJTextFieldModuleUnloadImage(), null);
}
return jPanelImage;
}
/**
* This method initializes jPanelDriver
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelDriver() {
if (jPanelDriver == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(0, 0));
jLabelDriverDiagnostic = new JLabel();
jLabelDriverDiagnostic.setBounds(new java.awt.Rectangle(12, 75, 140, 20));
jLabelDriverDiagnostic.setText("Driver Diagnostic");
jLabelDriverConfig = new JLabel();
jLabelDriverConfig.setBounds(new java.awt.Rectangle(12, 50, 140, 20));
jLabelDriverConfig.setText("Driver Config");
jLabelComponentName = new JLabel();
jLabelComponentName.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
jLabelComponentName.setText("Component Name");
jLabelDriverBinding = new JLabel();
jLabelDriverBinding.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
jLabelDriverBinding.setText("Driver Binding");
jPanelDriver = new JPanel();
jPanelDriver.setBounds(new java.awt.Rectangle(0, 37, 505, 95));
jPanelDriver.setLayout(null);
jPanelDriver.add(jStarLabel1, null);
jPanelDriver.add(jLabelDriverBinding, null);
jPanelDriver.add(getJTextFieldDriverBinding(), null);
jPanelDriver.add(jLabelComponentName, null);
jPanelDriver.add(getJTextFieldComponentName(), null);
jPanelDriver.add(jLabelDriverConfig, null);
jPanelDriver.add(getJTextFieldDriverConfig(), null);
jPanelDriver.add(jLabelDriverDiagnostic, null);
jPanelDriver.add(getJTextFieldDriverDiagnostic(), null);
}
return jPanelDriver;
}
/**
* This method initializes jPanelLibrary
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelLibrary() {
if (jPanelLibrary == null) {
jLabelDestructor = new JLabel();
jLabelDestructor.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
jLabelDestructor.setText("Destructor");
jLabelConstructor = new JLabel();
jLabelConstructor.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
jLabelConstructor.setText("Constructor");
jPanelLibrary = new JPanel();
jPanelLibrary.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
jPanelLibrary.setLayout(null);
jPanelLibrary.add(jLabelConstructor, null);
jPanelLibrary.add(getJTextFieldConstructor(), null);
jPanelLibrary.add(jLabelDestructor, null);
jPanelLibrary.add(getJTextFieldDestructor(), null);
}
return jPanelLibrary;
}
/**
* This method initializes jPanelCallBack
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelCallBack() {
if (jPanelCallBack == null) {
jLabelExitBootServices = new JLabel();
jLabelExitBootServices.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
jLabelExitBootServices.setText("Exit Boot Services");
jLabelVirtualAddressMap = new JLabel();
jLabelVirtualAddressMap.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
jLabelVirtualAddressMap.setText("Virtual Address Map");
jPanelCallBack = new JPanel();
jPanelCallBack.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
jPanelCallBack.setLayout(null);
jPanelCallBack.add(jLabelVirtualAddressMap, null);
jPanelCallBack.add(getJTextFieldVirtualAddressMap(), null);
jPanelCallBack.add(jLabelExitBootServices, null);
jPanelCallBack.add(getJTextFieldExitBootServices(), null);
}
return jPanelCallBack;
}
/**
* This method initializes jTextFieldModuleEntryPoint
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldModuleEntryPoint() {
if (jTextFieldModuleEntryPoint == null) {
jTextFieldModuleEntryPoint = new JTextField();
jTextFieldModuleEntryPoint.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
}
return jTextFieldModuleEntryPoint;
}
/**
* This method initializes jTextFieldModuleUnloadImage
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldModuleUnloadImage() {
if (jTextFieldModuleUnloadImage == null) {
jTextFieldModuleUnloadImage = new JTextField();
jTextFieldModuleUnloadImage.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
}
return jTextFieldModuleUnloadImage;
}
/**
* This method initializes jTextFieldDriverBinding
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldDriverBinding() {
if (jTextFieldDriverBinding == null) {
jTextFieldDriverBinding = new JTextField();
jTextFieldDriverBinding.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
}
return jTextFieldDriverBinding;
}
/**
* This method initializes jTextFieldComponentName
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldComponentName() {
if (jTextFieldComponentName == null) {
jTextFieldComponentName = new JTextField();
jTextFieldComponentName.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
}
return jTextFieldComponentName;
}
/**
* This method initializes jTextFieldDriverConfig
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldDriverConfig() {
if (jTextFieldDriverConfig == null) {
jTextFieldDriverConfig = new JTextField();
jTextFieldDriverConfig.setBounds(new java.awt.Rectangle(168, 50, 320, 20));
}
return jTextFieldDriverConfig;
}
/**
* This method initializes jTextFieldDriverDiagnostic
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldDriverDiagnostic() {
if (jTextFieldDriverDiagnostic == null) {
jTextFieldDriverDiagnostic = new JTextField();
jTextFieldDriverDiagnostic.setBounds(new java.awt.Rectangle(168, 75, 320, 20));
}
return jTextFieldDriverDiagnostic;
}
/**
* This method initializes jTextFieldConstructor
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldConstructor() {
if (jTextFieldConstructor == null) {
jTextFieldConstructor = new JTextField();
jTextFieldConstructor.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
}
return jTextFieldConstructor;
}
/**
* This method initializes jTextFieldDestructor
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldDestructor() {
if (jTextFieldDestructor == null) {
jTextFieldDestructor = new JTextField();
jTextFieldDestructor.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
}
return jTextFieldDestructor;
}
/**
* This method initializes jTextFieldVirtualAddressMap
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldVirtualAddressMap() {
if (jTextFieldVirtualAddressMap == null) {
jTextFieldVirtualAddressMap = new JTextField();
jTextFieldVirtualAddressMap.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
}
return jTextFieldVirtualAddressMap;
}
/**
* This method initializes jTextFieldExitBootServices
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldExitBootServices() {
if (jTextFieldExitBootServices == null) {
jTextFieldExitBootServices = new JTextField();
jTextFieldExitBootServices.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
}
return jTextFieldExitBootServices;
}
public static void main(String[] args) { public static void main(String[] args) {
} }
@ -202,7 +497,7 @@ public class ExternsDlg extends IDialog implements ItemListener {
**/ **/
private void init() { private void init() {
this.setSize(515, 200); this.setSize(515, 250);
this.setContentPane(getJScrollPane()); this.setContentPane(getJScrollPane());
this.setTitle("Externs"); this.setTitle("Externs");
initFrame(); initFrame();
@ -221,14 +516,56 @@ public class ExternsDlg extends IDialog implements ItemListener {
this.id = inExternsId; this.id = inExternsId;
if (this.id != null) { if (this.id != null) {
if (id.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { String type = id.getType();
this.jComboBoxPcdIsDriver.setSelectedItem(id.getName()); //
} else { // Filter the type to lock down the type
this.jTextFieldC_Name.setText(id.getName()); //
} this.jComboBoxType.removeAllItems();
this.jComboBoxType.setSelectedItem(id.getType()); this.jComboBoxType.addItem(type);
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList()); this.jArchCheckBox.setSelectedItems(id.getSupArchList());
//
// Init specification
//
if (type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
this.jTextFieldSpecification.setText(id.getName0());
}
//
// Init image
//
if (type.equals(EnumerationData.EXTERNS_IMAGE)) {
this.jTextFieldModuleEntryPoint.setText(id.getName0());
this.jTextFieldModuleUnloadImage.setText(id.getName1());
}
//
// Init library
//
if (type.equals(EnumerationData.EXTERNS_LIBRARY)) {
this.jTextFieldConstructor.setText(id.getName0());
this.jTextFieldDestructor.setText(id.getName1());
}
//
// Init driver
//
if (type.equals(EnumerationData.EXTERNS_DRIVER)) {
this.jTextFieldDriverBinding.setText(id.getName0());
this.jTextFieldComponentName.setText(id.getName1());
this.jTextFieldDriverConfig.setText(id.getName2());
this.jTextFieldDriverDiagnostic.setText(id.getName3());
}
//
// Init library
//
if (type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
this.jTextFieldVirtualAddressMap.setText(id.getName0());
this.jTextFieldExitBootServices.setText(id.getName1());
}
} }
} }
@ -255,23 +592,21 @@ public class ExternsDlg extends IDialog implements ItemListener {
jArchCheckBox = new ArchCheckBox(); jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(168, 62, 320, 20)); jArchCheckBox.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jLabelC_Name = new JLabel();
jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 140, 20));
jLabelC_Name.setText("Enter Value");
jLabelName = new JLabel(); jLabelName = new JLabel();
jLabelName.setText("Choose Extern Type"); jLabelName.setText("Choose Extern Type");
jLabelName.setBounds(new java.awt.Rectangle(12, 12, 168, 20)); jLabelName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
jLabelArch = new JLabel(); jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(12, 62, 168, 20)); jLabelArch.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
jLabelArch.setText("Supported Architectures"); jLabelArch.setText("Supported Architectures");
jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 87, 168, 20)); jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
jLabelFeatureFlag.setText("Feature Flag Expression"); jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelFeatureFlag.setEnabled(false); jLabelFeatureFlag.setEnabled(false);
jContentPane = new JPanel(); jContentPane = new JPanel();
jContentPane.setLayout(null); jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(505, 155)); jContentPane.setPreferredSize(new java.awt.Dimension(505, 200));
jContentPane.add(jLabelName, null); jContentPane.add(jLabelName, null);
jContentPane.add(getJComboBoxType(), null); jContentPane.add(getJComboBoxType(), null);
@ -279,12 +614,15 @@ public class ExternsDlg extends IDialog implements ItemListener {
jContentPane.add(jLabelArch, null); jContentPane.add(jLabelArch, null);
jContentPane.add(getJTextFieldFeatureFlag(), null); jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(getJComboBoxPcdIsDriver(), null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJTextFieldC_Name(), null);
jContentPane.add(jArchCheckBox, null); jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null); jContentPane.add(getJButtonCancel(), null);
jContentPane.add(getJPanelSpecification(), null);
jContentPane.add(getJPanelImage(), null);
jContentPane.add(getJPanelDriver(), null);
jContentPane.add(getJPanelLibrary(), null);
jContentPane.add(getJPanelCallBack(), null);
} }
return jContentPane; return jContentPane;
} }
@ -295,7 +633,11 @@ public class ExternsDlg extends IDialog implements ItemListener {
**/ **/
private void initFrame() { private void initFrame() {
Tools.generateComboBoxByVector(this.jComboBoxType, ed.getVExternTypes()); Tools.generateComboBoxByVector(this.jComboBoxType, ed.getVExternTypes());
Tools.generateComboBoxByVector(this.jComboBoxPcdIsDriver, ed.getVPcdDriverTypes()); this.jPanelSpecification.setVisible(true);
this.jPanelImage.setVisible(false);
this.jPanelLibrary.setVisible(false);
this.jPanelDriver.setVisible(false);
this.jPanelCallBack.setVisible(false);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -307,7 +649,7 @@ public class ExternsDlg extends IDialog implements ItemListener {
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) { if (arg0.getSource() == jButtonOk) {
if (checkAdd()) { if (checkAdd()) {
getCurrentExterns(); this.getCurrentExterns();
this.returnType = DataType.RETURN_TYPE_OK; this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false); this.setVisible(false);
} }
@ -332,26 +674,121 @@ public class ExternsDlg extends IDialog implements ItemListener {
// //
// //
// When and only When type is not "Pcd Is Driver" // Check specification
// //
if (!this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
// if (isEmpty(this.jTextFieldSpecification.getText())) {
// Check CName Log.wrn("Update Externs", "Please type specification's name");
//
if (isEmpty(this.jTextFieldC_Name.getText())) {
Log.wrn("Update Externs", "Value couldn't be empty");
return false; return false;
} }
if (!DataValidation.isSentence(this.jTextFieldSpecification.getText())) {
if (!isEmpty(this.jTextFieldC_Name.getText())) {
if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
if (!DataValidation.isSentence(this.jTextFieldC_Name.getText())) {
Log.wrn("Update Externs", "Incorrect data type for Specification"); Log.wrn("Update Externs", "Incorrect data type for Specification");
return false; return false;
} }
} else {
if (!DataValidation.isC_NameType(this.jTextFieldC_Name.getText())) { //
Log.wrn("Update Externs", "Incorrect data type for C Name"); // No need to check feature flag, return true directly here.
//
return true;
}
//
// Check image
//
if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_IMAGE)) {
if (isEmpty(this.jTextFieldModuleEntryPoint.getText())
&& isEmpty(this.jTextFieldModuleUnloadImage.getText())) {
Log.wrn("Update Externs", "At least one of ModuleEntryPoint or ModuleUnloadImage should have a value");
return false;
}
if (!isEmpty(this.jTextFieldModuleEntryPoint.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldModuleEntryPoint.getText())) {
Log.wrn("Update Externs", "Incorrect data type for Module Entry Point");
return false;
}
}
if (!isEmpty(this.jTextFieldModuleUnloadImage.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldModuleUnloadImage.getText())) {
Log.wrn("Update Externs", "Incorrect data type for Module Unload Image");
return false;
}
}
}
//
// Check library
//
if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_LIBRARY)) {
if (isEmpty(this.jTextFieldConstructor.getText()) && isEmpty(this.jTextFieldDestructor.getText())) {
Log.wrn("Update Externs", "At least one of Constructor or Destructor should have a value");
return false;
}
if (!isEmpty(this.jTextFieldConstructor.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldConstructor.getText())) {
Log.wrn("Update Externs", "Incorrect data type for Constructor");
return false;
}
}
if (!isEmpty(this.jTextFieldDestructor.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldDestructor.getText())) {
Log.wrn("Update Externs", "Incorrect data type for Destructor");
return false;
}
}
}
//
// Check driver
//
if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_DRIVER)) {
if (isEmpty(this.jTextFieldDriverBinding.getText())) {
Log.wrn("Update Externs", "DriverBinding must have a value");
return false;
}
if (!isEmpty(this.jTextFieldDriverBinding.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldDriverBinding.getText())) {
Log.wrn("Update Externs", "Incorrect data type for DriverBinding");
return false;
}
}
if (!isEmpty(this.jTextFieldComponentName.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldComponentName.getText())) {
Log.wrn("Update Externs", "Incorrect data type for ComponentName");
return false;
}
}
if (!isEmpty(this.jTextFieldDriverConfig.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldDriverConfig.getText())) {
Log.wrn("Update Externs", "Incorrect data type for DriverConfig");
return false;
}
}
if (!isEmpty(this.jTextFieldDriverDiagnostic.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldDriverDiagnostic.getText())) {
Log.wrn("Update Externs", "Incorrect data type for DriverDiagnostic");
return false;
}
}
}
//
// Check call back
//
if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_CALL_BACK)) {
if (isEmpty(this.jTextFieldVirtualAddressMap.getText())
&& isEmpty(this.jTextFieldExitBootServices.getText())) {
Log.wrn("Update Externs", "At least one of VirtualAddressMap or ExitBootServices should have a value");
return false;
}
if (!isEmpty(this.jTextFieldVirtualAddressMap.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldVirtualAddressMap.getText())) {
Log.wrn("Update Externs", "Incorrect data type for Virtual Address Map");
return false;
}
}
if (!isEmpty(this.jTextFieldExitBootServices.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldExitBootServices.getText())) {
Log.wrn("Update Externs", "Incorrect data type for Exit Boot Services");
return false; return false;
} }
} }
@ -366,29 +803,51 @@ public class ExternsDlg extends IDialog implements ItemListener {
return false; return false;
} }
} }
} else {
if (this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals(DataType.EMPTY_SELECT_ITEM)) {
Log.wrn("Update Externs", "You must select one PCD DRIVER type");
return false;
}
}
return true; return true;
} }
private ExternsIdentification getCurrentExterns() { private ExternsIdentification getCurrentExterns() {
String arg0 = ""; String arg0 = "";
if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { String arg1 = "";
arg0 = this.jComboBoxPcdIsDriver.getSelectedItem().toString(); String arg2 = "";
} else { String arg3 = "";
arg0 = this.jTextFieldC_Name.getText();
String type = this.jComboBoxType.getSelectedItem().toString();
String featureFlag = this.jTextFieldFeatureFlag.getText();
Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
if (type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
arg0 = this.jTextFieldSpecification.getText();
id = new ExternsIdentification(arg0, type);
} }
String arg1 = this.jComboBoxType.getSelectedItem().toString();
String arg2 = this.jTextFieldFeatureFlag.getText(); if (type.equals(EnumerationData.EXTERNS_IMAGE)) {
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector(); arg0 = this.jTextFieldModuleEntryPoint.getText();
arg1 = this.jTextFieldModuleUnloadImage.getText();
id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
}
if (type.equals(EnumerationData.EXTERNS_LIBRARY)) {
arg0 = this.jTextFieldConstructor.getText();
arg1 = this.jTextFieldDestructor.getText();
id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
}
if (type.equals(EnumerationData.EXTERNS_DRIVER)) {
arg0 = this.jTextFieldDriverBinding.getText();
arg1 = this.jTextFieldComponentName.getText();
arg2 = this.jTextFieldDriverConfig.getText();
arg3 = this.jTextFieldDriverDiagnostic.getText();
id = new ExternsIdentification(arg0, arg1, arg2, arg3, type, featureFlag, arch);
}
if (type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
arg0 = this.jTextFieldVirtualAddressMap.getText();
arg1 = this.jTextFieldExitBootServices.getText();
id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
}
id = new ExternsIdentification(arg0, arg1, arg2, arg3);
return id; return id;
} }
@ -400,19 +859,66 @@ public class ExternsDlg extends IDialog implements ItemListener {
*/ */
public void itemStateChanged(ItemEvent arg0) { public void itemStateChanged(ItemEvent arg0) {
if (arg0.getSource() == jComboBoxType && arg0.getStateChange() == ItemEvent.SELECTED) { if (arg0.getSource() == jComboBoxType && arg0.getStateChange() == ItemEvent.SELECTED) {
if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
this.jComboBoxPcdIsDriver.setVisible(true); this.jPanelSpecification.setVisible(true);
this.jTextFieldC_Name.setVisible(false); this.jPanelImage.setVisible(false);
this.jPanelLibrary.setVisible(false);
this.jPanelDriver.setVisible(false);
this.jPanelCallBack.setVisible(false);
this.jLabelArch.setEnabled(false); this.jLabelArch.setEnabled(false);
this.jArchCheckBox.setAllItemsEnabled(false); this.jArchCheckBox.setAllItemsEnabled(false);
} else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) { this.jLabelArch.setLocation(12, 62);
this.jLabelArch.setEnabled(false); this.jArchCheckBox.setLocation(168, 62);
this.jArchCheckBox.setAllItemsEnabled(false); this.jLabelFeatureFlag.setLocation(12, 87);
} else { this.jTextFieldFeatureFlag.setLocation(168, 87);
this.jComboBoxPcdIsDriver.setVisible(false); } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_IMAGE)) {
this.jTextFieldC_Name.setVisible(true); this.jPanelSpecification.setVisible(false);
this.jPanelImage.setVisible(true);
this.jPanelLibrary.setVisible(false);
this.jPanelDriver.setVisible(false);
this.jPanelCallBack.setVisible(false);
this.jLabelArch.setEnabled(true); this.jLabelArch.setEnabled(true);
this.jArchCheckBox.setAllItemsEnabled(true); this.jArchCheckBox.setAllItemsEnabled(true);
this.jLabelArch.setLocation(12, 87);
this.jArchCheckBox.setLocation(168, 87);
this.jLabelFeatureFlag.setLocation(12, 112);
this.jTextFieldFeatureFlag.setLocation(168, 112);
} else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_LIBRARY)) {
this.jPanelSpecification.setVisible(false);
this.jPanelImage.setVisible(false);
this.jPanelLibrary.setVisible(true);
this.jPanelDriver.setVisible(false);
this.jPanelCallBack.setVisible(false);
this.jLabelArch.setEnabled(true);
this.jArchCheckBox.setAllItemsEnabled(true);
this.jLabelArch.setLocation(12, 87);
this.jArchCheckBox.setLocation(168, 87);
this.jLabelFeatureFlag.setLocation(12, 112);
this.jTextFieldFeatureFlag.setLocation(168, 112);
} else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_DRIVER)) {
this.jPanelSpecification.setVisible(false);
this.jPanelImage.setVisible(false);
this.jPanelLibrary.setVisible(false);
this.jPanelDriver.setVisible(true);
this.jPanelCallBack.setVisible(false);
this.jLabelArch.setEnabled(true);
this.jArchCheckBox.setAllItemsEnabled(true);
this.jLabelArch.setLocation(12, 137);
this.jArchCheckBox.setLocation(168, 137);
this.jLabelFeatureFlag.setLocation(12, 162);
this.jTextFieldFeatureFlag.setLocation(168, 162);
} else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_CALL_BACK)) {
this.jPanelSpecification.setVisible(false);
this.jPanelImage.setVisible(false);
this.jPanelLibrary.setVisible(false);
this.jPanelDriver.setVisible(false);
this.jPanelCallBack.setVisible(true);
this.jLabelArch.setEnabled(true);
this.jArchCheckBox.setAllItemsEnabled(true);
this.jLabelArch.setLocation(12, 87);
this.jArchCheckBox.setLocation(168, 87);
this.jLabelFeatureFlag.setLocation(12, 112);
this.jTextFieldFeatureFlag.setLocation(168, 112);
} }
} }
} }