a. Sync FV info with FDF file contents when editing FV information.
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 5 Sep 2006 10:31:51 +0000 (10:31 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 5 Sep 2006 10:31:51 +0000 (10:31 +0000)
b. display module GUID in FrameworkModules if that module no longer exists in workspace.
c. modify SourceFiles to reflect changes in Wizard Package/Platform part.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1466 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkWizard/FrameworkWizard.msa
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java

index 262e30aa3889af52fbe879148eb825f2699737ba..b8166c5f36aef11265ddc8553a33a54991fdf96b 100644 (file)
@@ -205,15 +205,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java</Filename>\r
     <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java</Filename>\r
     <Filename>src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java</Filename>\r
+    <Filename>src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java</Filename>\r
     <Filename>src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java</Filename>\r
-    <Filename>src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java</Filename>\r
-    <Filename>src/org/tianocore/frameworkwizard/platform/ui/global/Spd.java</Filename>\r
+    <Filename>src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java</Filename>\r
+    <Filename>src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java</Filename>\r
     <Filename>src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java</Filename>\r
-    <Filename>src/org/tianocore/frameworkwizard/platform/ui/id/FpdModuleIdentification.java</Filename>\r
-    <Filename>src/org/tianocore/frameworkwizard/platform/ui/id/Identification.java</Filename>\r
-    <Filename>src/org/tianocore/frameworkwizard/platform/ui/id/ModuleIdentification.java</Filename>\r
-    <Filename>src/org/tianocore/frameworkwizard/platform/ui/id/PackageIdentification.java</Filename>\r
-    <Filename>src/org/tianocore/frameworkwizard/platform/ui/id/PlatformIdentification.java</Filename>\r
+    <Filename>src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java</Filename>\r
     <Filename>src/org/tianocore/frameworkwizard/workspace/Workspace.java</Filename>\r
     <Filename>src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java</Filename>\r
     <Filename>src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java</Filename>\r
index 9e2f955599a4130847bee90aac003e4b48a78ad6..20b5c10568c8c7237e260b2504ac49cbd81a3251 100644 (file)
@@ -2698,6 +2698,9 @@ public class FpdFileContents {
         while (li.hasNext()) {\r
             FvImagesDocument.FvImages.FvImage fi = li.next();\r
             updateFvImageNamesInFvImage (fi, oldFvName, newFvName);\r
+            if (fi.getFvImageNamesList().size() == 0) {\r
+                li.remove();\r
+            }\r
         }\r
     }\r
     \r
@@ -2712,18 +2715,13 @@ public class FpdFileContents {
         \r
         if (cursor.toChild(qFvImageNames)) {\r
             do {\r
-                if (cursor.getTextValue().equals(oldFvName)){\r
+                String xmlValue = cursor.getTextValue();\r
+                if (xmlValue.equals(oldFvName)){\r
                     if (newFvName != null) {\r
                         cursor.setTextValue(newFvName);\r
                     }\r
                     else {\r
-                        if (fi.getFvImageNamesList().size() == 1) {\r
-                            removeElement(fi);\r
-                            break;\r
-                        }\r
-                        else {\r
                             cursor.removeXml();\r
-                        }\r
                     }\r
                 }\r
             }while (cursor.toNextSibling(qFvImageNames));\r
index e40caf9445e2e8c913ea2f513d3fc731c7d25609..74999ef5ec944fa5bf75838b8d18b6d2294347c5 100644 (file)
@@ -16,7 +16,6 @@ import java.awt.BorderLayout;
 import javax.swing.JPanel;\r
 \r
 import javax.swing.AbstractAction;\r
-import javax.swing.DefaultCellEditor;\r
 import javax.swing.JFileChooser;\r
 import javax.swing.JFrame;\r
 import javax.swing.JOptionPane;\r
@@ -64,7 +63,6 @@ import javax.swing.event.ListSelectionListener;
 import javax.swing.event.TableModelEvent;\r
 import javax.swing.event.TableModelListener;\r
 import javax.swing.table.DefaultTableModel;\r
-import javax.swing.table.TableColumn;\r
 import javax.swing.table.TableModel;\r
 import javax.swing.JComboBox;\r
 import java.awt.Dimension;\r
@@ -161,7 +159,8 @@ public class FpdFlash extends IInternalFrame {
     private int selectedRowInFvAdditionalTable = -1;\r
     private String oldFvName = null;\r
     private Vector<String> vBlockSize = new Vector<String>();\r
-    private String erasePolarity = null;\r
+    private String determinedFvBlockSize = null;\r
+    private String erasePolarity = "";\r
     boolean memModified = false;\r
     \r
     \r
@@ -183,6 +182,11 @@ public class FpdFlash extends IInternalFrame {
     public FpdFlash(OpeningPlatformType opt) {\r
         this(opt.getXmlFpd());\r
         docConsole = opt;\r
+        if (memModified) {\r
+            docConsole.setSaved(false);\r
+            JOptionPane.showMessageDialog(frame, "Platform Synced with FDF file.");\r
+            memModified = false;\r
+        }\r
     }\r
     \r
     /**\r
@@ -1178,23 +1182,45 @@ public class FpdFlash extends IInternalFrame {
     private void initFvInFdfTable(String fdfPath){\r
         Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();\r
         getFvInfoFromFdf(fdfPath, vFvInfo);\r
-        getFlashInfoFromFdf (fdfPath, vBlockSize, erasePolarity);\r
-        ffc.setTypedFvImageNameValue("Attributes", "ErasePolarity", erasePolarity);\r
+        getFlashInfoFromFdf (fdfPath);\r
+        if (!erasePolarity.equals("1") && !erasePolarity.equals("0")) {\r
+            JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid Erase Polarity.");\r
+        }\r
+        else {\r
+            ffc.setTypedFvImageNameValue("Attributes", "ErasePolarity", erasePolarity);\r
+        }\r
+        \r
         // BugBug: assume all blocks have same size;\r
-        String blkSize = vBlockSize.get(0);\r
+        \r
+        String blkSize = "0x10000";\r
+        if (vBlockSize.size() > 0) {\r
+            blkSize = vBlockSize.get(0);\r
+            if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {\r
+                JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used.");\r
+                blkSize = "0x10000";\r
+            }\r
+        }\r
+        determinedFvBlockSize = blkSize;\r
         \r
         getFvInFdfTableModel().setRowCount(0);\r
         for (int j = 0; j < vFvInfo.size(); ++j) {\r
             FvInfoFromFdf fvInfo = vFvInfo.get(j);\r
             String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};\r
+            // if FV addtional table contains the same FV from fdf file, remove that row.\r
+            for (int k = 0; k < jTableFvAdditional.getRowCount(); ++k) {\r
+                if (fvAdditionalTableModel.getValueAt(k, 0).equals(row[0])) {\r
+                    fvAdditionalTableModel.removeRow(k);\r
+                }\r
+            }\r
             getFvInFdfTableModel().addRow(row);\r
             try {\r
                 int blockSize = Integer.decode(blkSize);\r
                 int fvSize = Integer.decode(row[1]);\r
                 int numBlocks = fvSize/blockSize;\r
+                HashMap<String, String> mOptions = new HashMap<String, String>();\r
                 // if no options for this FV before, generate a new options entry for this FV.\r
                 if (ffc.getFvImagesFvImageWithName(row[0], "Options") == null) {\r
-                    HashMap<String, String> mOptions = new HashMap<String, String>();\r
+                    \r
                     mOptions.put("EFI_BLOCK_SIZE", blkSize);\r
                     mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");\r
                     mOptions.put("EFI_FILE_NAME", row[2]);\r
@@ -1202,9 +1228,20 @@ public class FpdFlash extends IInternalFrame {
                     memModified = true;\r
                 }\r
                 else {\r
-                    ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize);\r
-                    ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "");\r
-                    ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2]);\r
+                    ffc.getFvImagesFvImageOptions(row[0], mOptions);\r
+                    if (mOptions.get("EFI_BLOCK_SIZE") == null || !mOptions.get("EFI_BLOCK_SIZE").equalsIgnoreCase(blkSize)) {\r
+                        ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize);\r
+                        memModified = true;\r
+                    }\r
+                    if (mOptions.get("EFI_NUM_BLOCKS") == null || Integer.decode(mOptions.get("EFI_NUM_BLOCKS")) != numBlocks) {\r
+                        ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "");\r
+                        memModified = true;\r
+                    }\r
+                    if (mOptions.get("EFI_FILE_NAME") == null || !mOptions.get("EFI_FILE_NAME").equals(row[2])) {\r
+                        ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2]);\r
+                        memModified = true;\r
+                    }\r
+                    \r
                 }\r
             }\r
             catch (NumberFormatException e){\r
@@ -1683,6 +1720,7 @@ public class FpdFlash extends IInternalFrame {
                     int row = arg0.getFirstRow();\r
                     int col = arg0.getColumn();\r
                     TableModel m = (TableModel) arg0.getSource();\r
+                    \r
                     if (arg0.getType() == TableModelEvent.UPDATE) {\r
                         if (col == 0) {\r
                             String newFvName = m.getValueAt(row, 0) + "";\r
@@ -1712,10 +1750,54 @@ public class FpdFlash extends IInternalFrame {
                                 String[] fvNames = {newFvName};\r
                                 ffc.AddFvImageFvImageNames(fvNames);\r
                             }\r
-                            \r
+                            docConsole.setSaved(false);\r
                             oldFvName = newFvName;\r
                         }\r
-                        docConsole.setSaved(false);\r
+                        \r
+                        if (col == 1) {\r
+                            String fvSize = m.getValueAt(row, col) + "";\r
+                            if (!DataValidation.isInt(fvSize) && !DataValidation.isHexDoubleWordDataType(fvSize)) {\r
+                                JOptionPane.showMessageDialog(frame, "FV size should be Integer or Hex format.");\r
+                                return;\r
+                            }\r
+                            HashMap<String, String> mFvOpts = new HashMap<String, String>();\r
+                            ffc.getFvImagesFvImageOptions(oldFvName, mFvOpts);\r
+                            String blkSize = mFvOpts.get("EFI_BLOCK_SIZE");\r
+                            if (blkSize == null) {\r
+                                ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", determinedFvBlockSize);\r
+                                int fs = Integer.decode(fvSize);\r
+                                int bs = Integer.decode(determinedFvBlockSize);\r
+                                ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"");\r
+                                docConsole.setSaved(false);\r
+                            }\r
+                            else {\r
+                                if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {\r
+                                    int retVal = JOptionPane.showConfirmDialog(frame, "Confirm", "FPD file contains error block size format. Would you like to replace it with a default value?", JOptionPane.YES_NO_OPTION);\r
+                                    if (retVal == JOptionPane.YES_OPTION) {\r
+                                        ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", determinedFvBlockSize);\r
+                                        int fs = Integer.decode(fvSize);\r
+                                        int bs = Integer.decode(determinedFvBlockSize);\r
+                                        ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"");\r
+                                        docConsole.setSaved(false);\r
+                                        return;\r
+                                    }\r
+                                    else {\r
+                                        return;\r
+                                    }\r
+                                    \r
+                                }\r
+                                int fs = Integer.decode(fvSize);\r
+                                int bs = Integer.decode(blkSize);\r
+                                ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"");\r
+                                docConsole.setSaved(false);\r
+                            }\r
+                        }\r
+                        \r
+                        if (col == 2) {\r
+                            ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_FILE_NAME", m.getValueAt(row, col)+"");\r
+                            docConsole.setSaved(false);\r
+                        }\r
+                        \r
                     }\r
                 }\r
             });\r
@@ -1879,12 +1961,12 @@ public class FpdFlash extends IInternalFrame {
         \r
         jTextFieldFdf.setText("");\r
         String fdfFile = ffc.getFlashDefinitionFile();\r
-        if (fdfFile != null) {\r
+        if (fdfFile != null && fdfFile.length() > 0) {\r
             jTextFieldFdf.setText(fdfFile);\r
+            String fdfPath = System.getenv("WORKSPACE") + File.separator + fdfFile;\r
+            initFvInFdfTable(fdfPath);\r
         }\r
         \r
-        String fdfPath = System.getenv("WORKSPACE") + File.separator + fdfFile;\r
-        initFvInFdfTable(fdfPath);\r
         initFvAdditionalTable();\r
     }\r
     \r
@@ -1911,7 +1993,7 @@ public class FpdFlash extends IInternalFrame {
         return jContentPane;\r
     }\r
     \r
-    private void getFlashInfoFromFdf (String fdfPath, Vector<String> vBlockSize, String erasePolarity) {\r
+    private void getFlashInfoFromFdf (String fdfPath) {\r
         File fdf = new File(fdfPath);\r
         if (!fdf.exists()) {\r
             return;\r
@@ -1936,7 +2018,7 @@ public class FpdFlash extends IInternalFrame {
                 // ErasePolarity\r
                 //\r
                 if (str.startsWith("ErasePolarity")) {\r
-                    erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(","));\r
+                    erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(",")).trim();\r
                 }\r
                 //\r
                 // dig into Block section.\r
index bab107737d49d835538a404fe404a95a76ddf939..b831703235e3519336c60b5c6d1266c9beda48fe 100644 (file)
@@ -717,6 +717,13 @@ public class FpdFrameworkModules extends IInternalFrame {
                     }\r
                     al.add(saa[i][ffcModArch]);\r
                 }\r
+                else {\r
+                    row[modNameColForFpdModTable] = saa[i][ffcModGuid];\r
+                    row[modVerColForFpdModTable] = saa[i][ffcModVer];\r
+                    row[pkgNameColForFpdModTable] = saa[i][ffcPkgGuid];\r
+                    row[pkgVerColForFpdModTable] = saa[i][ffcPkgVer];\r
+                    row[archColForFpdModTable] = saa[i][ffcModArch];\r
+                }\r
                 row[forceDbgColForFpdModTable] = ffc.getModuleSAForceDebug(i);\r
                 modelFpdModules.addRow(row);\r
 \r