X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FJava%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdModuleSA.java;h=e46a9bbeaff6377fcdf5b3d93b18ee8b7f6f2ef5;hp=8f6d31057f6956589ed9692086201246b8c2f15f;hb=8cc715257a4ff625a9db7c51b051a3c36c194598;hpb=e4f1ff6cf9c37627f59d099d650e2c3972f9ecaa diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index 8f6d31057f..e46a9bbeaf 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -160,6 +160,9 @@ public class FpdModuleSA extends JDialog implements ActionListener { jTabbedPane.setSelectedIndex(0); initPcdBuildDefinition(i); ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); + if (mi == null) { + return; + } int tabIndex = jTabbedPane.indexOfTab("Libraries"); if (mi.isLibrary()) { jTabbedPane.setEnabledAt(tabIndex, false); @@ -193,18 +196,24 @@ public class FpdModuleSA extends JDialog implements ActionListener { } public void initLibraries(String key) { + libClassTableModel.setRowCount(0); + libInstanceTableModel.setRowCount(0); + selectedInstancesTableModel.setRowCount(0); + Vector errorMsg = new Vector(); try { // // display library classes that need to be resolved. also potential instances for them. // - resolveLibraryInstances(moduleKey); + resolveLibraryInstances(moduleKey, errorMsg); } catch (Exception e) { - JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage()); + String exceptionMsg = e.getCause() + " " + e.getMessage(); + errorMsg.add(exceptionMsg); + JOptionPane.showMessageDialog(frame, exceptionMsg); } // // display lib instances already selected for key // - selectedInstancesTableModel.setRowCount(0); + int instanceCount = ffc.getLibraryInstancesCount(key); if (instanceCount != 0) { String[][] saa = new String[instanceCount][5]; @@ -223,15 +232,25 @@ public class FpdModuleSA extends JDialog implements ActionListener { // re-evaluate lib instance usage when adding a already-selected lib instance. // try { - resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]); + resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4], errorMsg); } catch (Exception e) { - JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage()); + String exceptionMsg = e.getCause() + " " + e.getMessage(); + if (!errorMsg.contains(exceptionMsg)) { + JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage()); + } } selectedInstancesTableModel.addRow(saa[i]); } } } + if (errorMsg.size() > 0) { + String errors = ""; + for (int i = 0; i < errorMsg.size(); ++i) { + errors += " " + errorMsg.get(i) + "\n"; + } + JOptionPane.showMessageDialog(frame, errors); + } showClassToResolved(); } @@ -323,7 +342,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { } } - private void resolveLibraryInstances(String key) throws MultipleInstanceException, NoInstanceException{ + private void resolveLibraryInstances(String key, Vector errorMsg) throws MultipleInstanceException, NoInstanceException{ ModuleIdentification mi = WorkspaceProfile.getModuleId(key); PackageIdentification[] depPkgList = null; @@ -398,7 +417,12 @@ public class FpdModuleSA extends JDialog implements ActionListener { } ArrayList instances = getInstancesForClass(cls, depPkgList); if (instances.size() == 0) { - throw new NoInstanceException (cls.className); +// throw new NoInstanceException (cls.className); + String exceptionMsg = new NoInstanceException (cls.className).getMessage(); + if (!errorMsg.contains(exceptionMsg)) { + errorMsg.add(exceptionMsg); + } + } classInstanceMap.put(cls, instances); @@ -538,6 +562,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { private void showClassToResolved(){ libClassTableModel.setRowCount(0); + libInstanceTableModel.setRowCount(0); if (classConsumed == null || classConsumed.size() == 0) { return; } @@ -553,7 +578,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { libClassTableModel.addRow(s); } } - libInstanceTableModel.setRowCount(0); + } private void addLibInstance (ModuleIdentification libMi) throws Exception{ @@ -1172,12 +1197,22 @@ public class FpdModuleSA extends JDialog implements ActionListener { libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3), libInstanceTableModel.getValueAt(row, 4)}; selectedInstancesTableModel.addRow(s); + + Vector errorMsg = new Vector(); try { - resolveLibraryInstances(instanceValue); + resolveLibraryInstances(instanceValue, errorMsg); } catch (Exception exp) { JOptionPane.showMessageDialog(frame, exp.getMessage()); } + + if (errorMsg.size() > 0) { + String errors = ""; + for (int i = 0; i < errorMsg.size(); ++i) { + errors += " " + errorMsg.get(i) + "\n"; + } + JOptionPane.showMessageDialog(frame, errors); + } showClassToResolved(); } }); @@ -1331,7 +1366,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { // oldFvList.removeAll(newFvList); for (int j = 0; j < oldFvList.size(); ++j) { - ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); + ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), "IMAGES", 1, moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); } // // add module to Fvs that were not in oldFvList. @@ -1339,7 +1374,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { oldFvList = getVectorFromString (originalFvBinding); newFvList.removeAll(oldFvList); for (int i = 0; i < newFvList.size(); ++i) { - ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); + ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), "IMAGES", 1, moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); } docConsole.setSaved(false); } @@ -1783,25 +1818,37 @@ private JButton getJButtonUpdatePcd() { String cName = model.getValueAt(row, 0)+""; String tsGuid = model.getValueAt(row, 1)+""; String oldItemType = model.getValueAt(row, 2)+""; + String dataType = model.getValueAt(row, 5)+""; String newItemType = jComboBoxItemType.getSelectedItem()+""; + String newValue = jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem()+""; + if (newValue.length() == 0){ - model.setValueAt(jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem(), row, 6); + if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) { + newValue = "0"; + } + if (dataType.equals("BOOLEAN")){ + newValue = "FALSE"; + } + if (dataType.equals("VOID*")) { + newValue = "L\"\""; + } + } String[] pcdInfo = {"", "", ""}; Vector validPcdTypes = new Vector(); getPcdInfo (moduleKey, cName, tsGuid, pcdInfo, validPcdTypes); if (pcdInfo[1].equals("FIXED_AT_BUILD") && model.getValueAt(row, 5).equals("VOID*")) { try { - jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(model.getValueAt(row, 6)+"")+""); + jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(newValue)+""); } catch (Exception exp) { JOptionPane.showMessageDialog(frame, "PCD Value MalFormed: " + exp.getMessage()); return; } } - model.setValueAt(jTextFieldMaxDatumSize.getText(), row, 4); + String newMaxDatumSize = jTextFieldMaxDatumSize.getText(); - if (newItemType != oldItemType) { + if (!newItemType.equals(oldItemType)) { Vector moduleInfo = new Vector(); try { boolean changable = itemTypeCouldBeChanged (cName, tsGuid, newItemType, moduleInfo); @@ -1827,8 +1874,11 @@ private JButton getJButtonUpdatePcd() { model.setValueAt(newItemType, row, 2); } - ffc.updatePcdData(moduleKey, cName, tsGuid, model.getValueAt(row, 2)+"", model.getValueAt(row, 4)+"", model.getValueAt(row, 6)+""); + ffc.updatePcdData(moduleKey, cName, tsGuid, model.getValueAt(row, 2)+"", newMaxDatumSize, newValue); docConsole.setSaved(false); + model.setValueAt(newValue, row, 6); + model.setValueAt(newMaxDatumSize, row, 4); + } }); }