Fix the bug of leaving empty GuidTypeList, SupArchList attributes in xml file.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1038 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-07-18 09:53:52 +00:00
parent 562d28495d
commit 2c85fbc88a
4 changed files with 87 additions and 35 deletions

View File

@ -1216,18 +1216,31 @@ public class SpdFileContents {
e.setCName(cName); e.setCName(cName);
e.setGuidValue(guid); e.setGuidValue(guid);
e.setHelpText(help); e.setHelpText(help);
e.setGuidTypeList(guidTypeList); if (guidTypeList != null) {
e.setSupArchList(archList); e.setGuidTypeList(guidTypeList);
e.setSupModuleList(modTypeList); }
// if (guidTypeList != null && guidTypeList.size() > 0) { else{
// e.setGuidTypeList(new ArrayList<String>(guidTypeList)); if (e.isSetGuidTypeList()) {
// } e.unsetGuidTypeList();
// if (archList != null && archList.size() > 0){ }
// e.setSupArchList(new ArrayList<String>(archList)); }
// } if (archList != null) {
// if (modTypeList != null && modTypeList.size() > 0) { e.setSupArchList(archList);
// e.setSupModuleList(new ArrayList<String>(modTypeList)); }
// } else {
if (e.isSetSupArchList()) {
e.unsetSupArchList();
}
}
if (modTypeList != null){
e.setSupModuleList(modTypeList);
}
else {
if (e.isSetSupModuleList()) {
e.unsetSupModuleList();
}
}
return; return;
} }
if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) { if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
@ -1237,14 +1250,23 @@ public class SpdFileContents {
pe.setCName(cName); pe.setCName(cName);
pe.setGuidValue(guid); pe.setGuidValue(guid);
pe.setHelpText(help); pe.setHelpText(help);
pe.setSupArchList(archList); if (archList != null) {
pe.setSupModuleList(modTypeList); pe.setSupArchList(archList);
// if (archList != null && archList.size() > 0){ }
// pe.setSupArchList(new ArrayList<String>(archList)); else {
// } if (pe.isSetSupArchList()) {
// if (modTypeList != null && modTypeList.size() > 0) { pe.unsetSupArchList();
// pe.setSupModuleList(new ArrayList<String>(modTypeList)); }
// } }
if (modTypeList != null){
pe.setSupModuleList(modTypeList);
}
else {
if (pe.isSetSupModuleList()) {
pe.unsetSupModuleList();
}
}
return; return;
} }
if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) { if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
@ -1254,14 +1276,23 @@ public class SpdFileContents {
ppe.setCName(cName); ppe.setCName(cName);
ppe.setGuidValue(guid); ppe.setGuidValue(guid);
ppe.setHelpText(help); ppe.setHelpText(help);
ppe.setSupArchList(archList); if (archList != null) {
ppe.setSupModuleList(modTypeList); ppe.setSupArchList(archList);
// if (archList != null && archList.size() > 0){ }
// ppe.setSupArchList(new ArrayList<String>(archList)); else {
// } if (ppe.isSetSupArchList()) {
// if (archList != null && modTypeList.size() > 0) { ppe.unsetSupArchList();
// ppe.setSupModuleList(new ArrayList<String>(modTypeList)); }
// } }
if (modTypeList != null){
ppe.setSupModuleList(modTypeList);
}
else {
if (ppe.isSetSupModuleList()) {
ppe.unsetSupModuleList();
}
}
return; return;
} }

View File

@ -252,9 +252,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
int row = arg0.getFirstRow(); int row = arg0.getFirstRow();
TableModel m = (TableModel)arg0.getSource(); TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){ if (arg0.getType() == TableModelEvent.UPDATE){
if (docConsole != null) {
docConsole.setSaved(false);
}
updateRow(row, m); updateRow(row, m);
} }
} }
@ -280,7 +278,9 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
if (!dataValidation(rowData)){ if (!dataValidation(rowData)){
return; return;
} }
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList); sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
} }
/** /**
@ -549,9 +549,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
if (!dataValidation(row)) { if (!dataValidation(row)) {
return; return;
} }
if (docConsole != null) {
docConsole.setSaved(false);
}
model.addRow(row); model.addRow(row);
jTable.changeSelection(model.getRowCount()-1, 0, false, false); jTable.changeSelection(model.getRowCount()-1, 0, false, false);
addRow(row); addRow(row);
@ -610,17 +608,35 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
protected void addRow(String[] row) { protected void addRow(String[] row) {
Vector<String> vArch = iCheckBoxList.getAllCheckedItemsString(); Vector<String> vArch = iCheckBoxList.getAllCheckedItemsString();
if (vArch.size() == 0) {
vArch = null;
}
Vector<String> vModType = iCheckBoxList2.getAllCheckedItemsString(); Vector<String> vModType = iCheckBoxList2.getAllCheckedItemsString();
if (vModType.size() == 0) {
vModType = null;
}
Vector<String> vguidType = iCheckBoxList1.getAllCheckedItemsString(); Vector<String> vguidType = iCheckBoxList1.getAllCheckedItemsString();
if (vguidType.size() == 0) {
vguidType = null;
}
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType); sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType);
} }
protected void removeRow(int i){ protected void removeRow(int i){
sfc.removeSpdGuidDeclaration(i); sfc.removeSpdGuidDeclaration(i);
if (docConsole != null) {
docConsole.setSaved(false);
}
} }
protected void clearAllRow(){ protected void clearAllRow(){
sfc.removeSpdGuidDeclaration(); sfc.removeSpdGuidDeclaration();
if (docConsole != null) {
docConsole.setSaved(false);
}
} }
/** /**

View File

@ -108,9 +108,11 @@ public class SpdPpiDecls extends SpdGuidDecls {
protected void removeRow(int i){ protected void removeRow(int i){
sfc.removeSpdPpiDeclaration(i); sfc.removeSpdPpiDeclaration(i);
docConsole.setSaved(false);
} }
protected void clearAllRow(){ protected void clearAllRow(){
sfc.removeSpdPpiDeclaration(); sfc.removeSpdPpiDeclaration();
docConsole.setSaved(false);
} }
} }

View File

@ -102,14 +102,17 @@ public class SpdProtocolDecls extends SpdGuidDecls {
if (!dataValidation(row)){ if (!dataValidation(row)){
return; return;
} }
docConsole.setSaved(false);
sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5])); sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));
} }
protected void removeRow(int i){ protected void removeRow(int i){
sfc.removeSpdProtocolDeclaration(i); sfc.removeSpdProtocolDeclaration(i);
docConsole.setSaved(false);
} }
protected void clearAllRow(){ protected void clearAllRow(){
sfc.removeSpdProtocolDeclaration(); sfc.removeSpdProtocolDeclaration();
docConsole.setSaved(false);
} }
} }