a. Enhanced toolchain setting UI for ModuleSa build options and global build options.
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 4 Sep 2006 09:32:37 +0000 (09:32 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 4 Sep 2006 09:32:37 +0000 (09:32 +0000)
b. Fpd editor, Flash part UI FV operations.

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

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java
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/FpdModuleSA.java

index 6231d8a..57b7f2c 100644 (file)
@@ -1802,7 +1802,11 @@ public class FpdBuildOptions extends IInternalFrame {
             vArch.add("ARM");\r
             vArch.add("PPC");\r
             jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch));\r
+            \r
+            jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());\r
+            \r
             jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+           jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
             jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {\r
                 public void valueChanged(ListSelectionEvent e) {\r
                     selectedRow = -1;\r
index 12dd2fd..9e2f955 100644 (file)
@@ -988,7 +988,9 @@ public class FpdFileContents {
             \r
             if (opt.getSupArchList() != null){\r
                 saa[i][4] = listToString(opt.getSupArchList());\r
-\r
+            }\r
+            else {\r
+                saa[i][4] = "";\r
             }\r
             \r
             saa[i][5] = opt.getStringValue();\r
@@ -2589,7 +2591,19 @@ public class FpdFileContents {
     }\r
     \r
     public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {\r
+        FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();\r
+        if (fis == null || fis.getFvImageList() == null) {\r
+            return;\r
+        }\r
         \r
+        ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();\r
+        while (li.hasNext()) {\r
+            FvImagesDocument.FvImages.FvImage fi = li.next();\r
+            if (fi.getType().toString().equals("ImageName")) {\r
+                vImageNames.addAll(fi.getFvImageNamesList());\r
+                return;\r
+            }\r
+        }\r
     }\r
     \r
     public void AddFvImageFvImageNames (String[] fvNames) {\r
@@ -2672,6 +2686,10 @@ public class FpdFileContents {
         cursor.dispose();\r
     }\r
     \r
+    /**\r
+     * @param oldFvName\r
+     * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.\r
+     */\r
     public void updateFvImageNameAll (String oldFvName, String newFvName) {\r
         if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
             return;\r
@@ -2683,6 +2701,11 @@ public class FpdFileContents {
         }\r
     }\r
     \r
+    /**\r
+     * @param fi\r
+     * @param oldFvName The FV Name to be replaced.\r
+     * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.\r
+     */\r
     public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {\r
         QName qFvImageNames = new QName(xmlNs, "FvImageNames");\r
         XmlCursor cursor = fi.newCursor();\r
@@ -2690,7 +2713,18 @@ public class FpdFileContents {
         if (cursor.toChild(qFvImageNames)) {\r
             do {\r
                 if (cursor.getTextValue().equals(oldFvName)){\r
-                    cursor.setTextValue(newFvName);\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
         }\r
@@ -2738,18 +2772,50 @@ public class FpdFileContents {
         cursor.dispose();\r
     }\r
     \r
-    public int getFvImagesFvImageCount() {\r
+    public int getFvImagesFvImageCount(String type) {\r
         \r
         if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
             return 0;\r
         }\r
-        return getfpdFlash().getFvImages().getFvImageList().size();\r
+        List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+        ListIterator li = l.listIterator();\r
+        int i = 0;\r
+        while(li.hasNext()) {\r
+            FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+            if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+                continue;\r
+            }\r
+            \r
+            ++i;\r
+        }\r
+        \r
+        return i;\r
     }\r
     \r
-    /**Only Get Fv image setting - name and type.\r
+    public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {\r
+        Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();\r
+        if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
+            return vFvImage;\r
+        }\r
+        List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+        ListIterator li = l.listIterator();\r
+        while(li.hasNext()) {\r
+            FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+            if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+                continue;\r
+            }\r
+            if (fi.getFvImageNamesList().contains(fvName)) {\r
+                vFvImage.add(fi);\r
+            }\r
+        }\r
+        \r
+        return vFvImage;\r
+    }\r
+    /**\r
      * @param saa\r
+     * @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.\r
      */\r
-    public void getFvImagesFvImages(String[][] saa) {\r
+    public void getFvImagesFvImages(String[][] saa, String type) {\r
     \r
         if (getfpdFlash().getFvImages() == null) {\r
             return;\r
@@ -2762,6 +2828,9 @@ public class FpdFileContents {
         int i = 0;\r
         while(li.hasNext()) {\r
             FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+            if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+                continue;\r
+            }\r
             //\r
             // get FvImageNames array, space separated\r
             //\r
@@ -2780,6 +2849,108 @@ public class FpdFileContents {
         }\r
     }\r
     \r
+    /**Add name-value pair to FvImage element with type.\r
+     * @param fvName FV name to add name-value pair.\r
+     * @param type FvImage attribute.\r
+     * @param name\r
+     * @param value\r
+     */\r
+    public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value) {\r
+        if (getfpdFlash().getFvImages() == null) {\r
+            return;\r
+        }\r
+        List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+        if (l == null) {\r
+            return;\r
+        }\r
+        ListIterator li = l.listIterator();\r
+        while(li.hasNext()) {\r
+            FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+            if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+                continue;\r
+            }\r
+            if (!fi.getFvImageNamesList().contains(fvName)) {\r
+                continue;\r
+            }\r
+            setFvImagesFvImageNameValue (fi, name, value, null);\r
+        }\r
+    }\r
+    \r
+    /**Add to all FvImage elements with type, the name-value pair.\r
+     * @param type\r
+     * @param name\r
+     * @param value\r
+     */\r
+    public void setTypedFvImageNameValue (String type, String name, String value) {\r
+        if (getfpdFlash().getFvImages() == null) {\r
+            return;\r
+        }\r
+        List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+        if (l == null) {\r
+            return;\r
+        }\r
+        ListIterator li = l.listIterator();\r
+        while(li.hasNext()) {\r
+            FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+            if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+                continue;\r
+            }\r
+            setFvImagesFvImageNameValue (fi, name, value, null);\r
+        }\r
+    }\r
+    \r
+    /**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.\r
+     * @param fi\r
+     * @param name\r
+     * @param value\r
+     * @param newName\r
+     */\r
+    public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {\r
+        if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {\r
+            return;\r
+        }\r
+        \r
+        XmlCursor cursor = fi.getFvImageOptions().newCursor();\r
+        if (cursor.toFirstChild()) {\r
+            do {\r
+                FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();\r
+                if (nv.getName().equals(name)) {\r
+                    nv.setValue(value);\r
+                    if (newName != null) {\r
+                        nv.setName(newName);\r
+                    }\r
+                    cursor.dispose();\r
+                    return;\r
+                }\r
+            }while (cursor.toNextSibling());\r
+        }\r
+        \r
+        FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();\r
+        nv.setName(name);\r
+        nv.setValue(value);\r
+        if (newName != null) {\r
+            nv.setName(newName);\r
+        }\r
+        cursor.dispose();\r
+    }\r
+    \r
+    public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {\r
+        Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");\r
+        for (int i = 0; i < vFvImage.size(); ++i) {\r
+            FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);\r
+            if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {\r
+                continue;\r
+            }\r
+\r
+            ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()\r
+                                                                                            .getNameValueList()\r
+                                                                                            .listIterator();\r
+            while (li.hasNext()) {\r
+                FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();\r
+                m.put(nv.getName(), nv.getValue());\r
+            }\r
+        }\r
+    }\r
     /**Get FvImage Options for FvImage i\r
      * @param i the ith FvImage\r
      */\r
index a8d70e2..e40caf9 100644 (file)
@@ -25,6 +25,7 @@ import javax.swing.JButton;
 import javax.swing.ListSelectionModel;\r
 \r
 import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.common.DataValidation;\r
 import org.tianocore.frameworkwizard.common.GlobalData;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
@@ -152,13 +153,16 @@ public class FpdFlash extends IInternalFrame {
     private JButton jButtonFvInFdfOptions = null;\r
     private JScrollPane jScrollPaneFvAdditional = null;\r
     private JTable jTableFvAdditional = null;\r
-    private DefaultTableModel fvAddtionalTableModel = null;  //  @jve:decl-index=0:visual-constraint=""\r
+    private DefaultTableModel fvAdditionalTableModel = null;  //  @jve:decl-index=0:visual-constraint=""\r
     private JButton jButtonAddFv = null;\r
     private JButton jButtonDelFv = null;\r
     private JButton jButtonAddFvOptions = null;\r
     private int tabIndexForFv = -1;\r
     private int selectedRowInFvAdditionalTable = -1;\r
     private String oldFvName = null;\r
+    private Vector<String> vBlockSize = new Vector<String>();\r
+    private String erasePolarity = null;\r
+    boolean memModified = false;\r
     \r
     \r
     public FpdFlash() {\r
@@ -267,12 +271,12 @@ public class FpdFlash extends IInternalFrame {
                     fvImageParaTableModel.setRowCount(0);\r
                     fvPropertyTableModel.setRowCount(0);\r
                     \r
-                    if (ffc.getFvImagesFvImageCount() == 0) {\r
+                    if (ffc.getFvImagesFvImageCount("Attributes") == 0) {\r
                         return;\r
                     }\r
-                    String[][] saa = new String[ffc.getFvImagesFvImageCount()][2];\r
-                    ffc.getFvImagesFvImages(saa);\r
-                   \r
+                    String[][] saa = new String[ffc.getFvImagesFvImageCount("Attributes")][2];\r
+                    ffc.getFvImagesFvImages(saa, "Attributes");\r
+                    \r
                     int i = 0;\r
                     while (i < saa.length) {\r
                         fvImageParaTableModel.addRow(saa[i]);\r
@@ -622,10 +626,10 @@ public class FpdFlash extends IInternalFrame {
     private JComboBox getJComboBoxFvParaType() {\r
         if (jComboBoxFvParaType == null) {\r
             jComboBoxFvParaType = new JComboBox();\r
-            jComboBoxFvParaType.addItem("ImageName");\r
+//            jComboBoxFvParaType.addItem("ImageName");\r
             jComboBoxFvParaType.addItem("Attributes");\r
             jComboBoxFvParaType.addItem("Options");\r
-            jComboBoxFvParaType.addItem("Components");\r
+//            jComboBoxFvParaType.addItem("Components");\r
             jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20));\r
             jComboBoxFvParaType.setEnabled(false);\r
             jComboBoxFvParaType.addItemListener(new ItemListener() {\r
@@ -869,13 +873,13 @@ public class FpdFlash extends IInternalFrame {
             fvImageParaTableModel.addColumn("Type");\r
             \r
             \r
-            TableColumn typeCol = jTableFvInfo.getColumnModel().getColumn(1);\r
-            JComboBox cb = new JComboBox();\r
-            cb.addItem("ImageName");\r
-            cb.addItem("Attributes");\r
-            cb.addItem("Options");\r
-            cb.addItem("Components");\r
-            typeCol.setCellEditor(new DefaultCellEditor(cb));\r
+//            TableColumn typeCol = jTableFvInfo.getColumnModel().getColumn(1);\r
+//            JComboBox cb = new JComboBox();\r
+//            cb.addItem("ImageName");\r
+//            cb.addItem("Attributes");\r
+//            cb.addItem("Options");\r
+//            cb.addItem("Components");\r
+//            typeCol.setCellEditor(new DefaultCellEditor(cb));\r
             \r
             jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
             jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
@@ -931,7 +935,7 @@ public class FpdFlash extends IInternalFrame {
         if (jButtonDelFvImage == null) {\r
             jButtonDelFvImage = new JButton();\r
             jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(120,20));\r
-//            jButton6.setEnabled(false);\r
+            jButtonDelFvImage.setEnabled(false);\r
             jButtonDelFvImage.setText("Delete Row");\r
             jButtonDelFvImage.addActionListener(new AbstractAction() {\r
                 /**\r
@@ -1131,23 +1135,88 @@ public class FpdFlash extends IInternalFrame {
     }\r
     \r
     private void initFvAdditionalTable() {\r
-        \r
+        Vector<String> vFvNames = new Vector<String>();\r
+        ffc.getFvImagesFvImageFvImageNames(vFvNames);\r
+        for (int i = 0; i < vFvNames.size(); ++i) {\r
+            String fvName = vFvNames.get(i);\r
+            if (fvNameExists(fvName)) {\r
+                continue;\r
+            }\r
+            HashMap<String, String> mFvOpts = new HashMap<String, String>();\r
+            ffc.getFvImagesFvImageOptions(fvName, mFvOpts);\r
+            String bSize = "";\r
+            String numBlks = "";\r
+            String fvSize = "";\r
+            String fvFile = "";\r
+            if (mFvOpts.get("EFI_FILE_NAME") != null) {\r
+                fvFile = mFvOpts.get("EFI_FILE_NAME");\r
+            }\r
+            if (mFvOpts.get("EFI_BLOCK_SIZE") != null && mFvOpts.get("EFI_NUM_BLOCKS") != null) {\r
+                bSize = mFvOpts.get("EFI_BLOCK_SIZE");\r
+                numBlks = mFvOpts.get("EFI_NUM_BLOCKS");\r
+                boolean blockSizeWellFormat = true;\r
+                boolean numOfBlockWellFormat = true;\r
+                if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {\r
+                   blockSizeWellFormat = false;\r
+                   JOptionPane.showMessageDialog(frame, fvName + " block size bad format.");\r
+                } \r
+                if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {\r
+                   numOfBlockWellFormat = false;\r
+                   JOptionPane.showMessageDialog(frame, fvName + " number of blocks bad format.");\r
+                }\r
+                if (blockSizeWellFormat && numOfBlockWellFormat) {\r
+                    int size = Integer.decode(bSize);\r
+                    int num = Integer.decode(numBlks);\r
+                    fvSize = size*num + "";\r
+                }\r
+            }\r
+            fvAdditionalTableModel.addRow(new String[]{fvName, fvSize, fvFile});\r
+            addTabForFv(new FvInfoFromFdf(fvName, "", ""));\r
+        }\r
     }\r
 \r
     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
+        // BugBug: assume all blocks have same size;\r
+        String blkSize = vBlockSize.get(0);\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
             getFvInFdfTableModel().addRow(row);\r
+            try {\r
+                int blockSize = Integer.decode(blkSize);\r
+                int fvSize = Integer.decode(row[1]);\r
+                int numBlocks = fvSize/blockSize;\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
+                    mOptions.put("EFI_BLOCK_SIZE", blkSize);\r
+                    mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");\r
+                    mOptions.put("EFI_FILE_NAME", row[2]);\r
+                    ffc.genFvImagesFvImage(new String[]{row[0]}, "Options", mOptions);\r
+                    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
+                }\r
+            }\r
+            catch (NumberFormatException e){\r
+                JOptionPane.showMessageDialog(frame, e.getMessage());\r
+            }\r
         }\r
 \r
         for (int k = 0; k < vFvInfo.size(); ++k) {\r
             FvInfoFromFdf fvInfo = vFvInfo.get(k);\r
             addTabForFv(fvInfo);\r
         }\r
+        \r
     }\r
     \r
     private void addTabForFv (FvInfoFromFdf fvInfo) {\r
@@ -1300,6 +1369,7 @@ public class FpdFlash extends IInternalFrame {
             jButtonUpdateFvImage = new JButton();\r
             jButtonUpdateFvImage.setPreferredSize(new Dimension(120, 20));\r
             jButtonUpdateFvImage.setActionCommand("Update");\r
+            jButtonUpdateFvImage.setEnabled(false);\r
             jButtonUpdateFvImage.setText("Update FV");\r
             jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() {\r
                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
@@ -1590,7 +1660,7 @@ public class FpdFlash extends IInternalFrame {
             jTableFvAdditional = new JTable();\r
             jTableFvAdditional.setRowHeight(20);\r
             jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);\r
-            jTableFvAdditional.setModel(getFvAddtionalTableModel());\r
+            jTableFvAdditional.setModel(getFvAdditionalTableModel());\r
             \r
             jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() {\r
                 public void valueChanged(ListSelectionEvent e) {\r
@@ -1653,14 +1723,22 @@ public class FpdFlash extends IInternalFrame {
         return jTableFvAdditional;\r
     }\r
     \r
-    private boolean fvNameExists (String fvName) {\r
+    private boolean fvNameExistsInFvInFdfTable (String fvName) {\r
         for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) {\r
             if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) {\r
                 return true;\r
             }\r
         }\r
+        return false;\r
+    }\r
+    \r
+    private boolean fvNameExists (String fvName) {\r
+        if (fvNameExistsInFvInFdfTable(fvName)) {\r
+            return true;\r
+        }\r
+        \r
         for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) {\r
-            if (fvAddtionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {\r
+            if (fvAdditionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {\r
                 return true;\r
             }\r
         }\r
@@ -1668,18 +1746,18 @@ public class FpdFlash extends IInternalFrame {
     }\r
 \r
     /**\r
-     * This method initializes fvAddtionalTableModel   \r
+     * This method initializes fvAdditionalTableModel  \r
      *         \r
      * @return javax.swing.table.DefaultTableModel     \r
      */\r
-    private DefaultTableModel getFvAddtionalTableModel() {\r
-        if (fvAddtionalTableModel == null) {\r
-            fvAddtionalTableModel = new DefaultTableModel();\r
-            fvAddtionalTableModel.addColumn("FV Name");\r
-            fvAddtionalTableModel.addColumn("Size");\r
-            fvAddtionalTableModel.addColumn("Corresponding File Name");\r
+    private DefaultTableModel getFvAdditionalTableModel() {\r
+        if (fvAdditionalTableModel == null) {\r
+            fvAdditionalTableModel = new DefaultTableModel();\r
+            fvAdditionalTableModel.addColumn("FV Name");\r
+            fvAdditionalTableModel.addColumn("Size");\r
+            fvAdditionalTableModel.addColumn("Corresponding File Name");\r
         }\r
-        return fvAddtionalTableModel;\r
+        return fvAdditionalTableModel;\r
     }\r
 \r
     /**\r
@@ -1699,7 +1777,7 @@ public class FpdFlash extends IInternalFrame {
                         jTableFvAdditional.getCellEditor().stopCellEditing();\r
                     }\r
                     String[] row = {"", "", ""};\r
-                    fvAddtionalTableModel.addRow(row);\r
+                    fvAdditionalTableModel.addRow(row);\r
                 }\r
             });\r
         }\r
@@ -1715,11 +1793,26 @@ public class FpdFlash extends IInternalFrame {
         if (jButtonDelFv == null) {\r
             jButtonDelFv = new JButton();\r
             jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));\r
-            jButtonDelFv.setEnabled(false);\r
+            jButtonDelFv.setEnabled(true);\r
             jButtonDelFv.setText("Delete");\r
             jButtonDelFv.addActionListener(new java.awt.event.ActionListener() {\r
                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
-                    System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()\r
+                    //delete row in FvAdditional table.\r
+                    int selectedRow = jTableFvAdditional.getSelectedRow();\r
+                    if (selectedRow < 0) {\r
+                        return;\r
+                    }\r
+                    String fvName = fvAdditionalTableModel.getValueAt(selectedRow, 0) + "";\r
+                    fvAdditionalTableModel.removeRow(selectedRow);\r
+                    //\r
+                    //delete tab with selected FV name.\r
+                    //\r
+                    jTabbedPane.removeTabAt(jTabbedPane.indexOfTab(fvName));\r
+                    //delete FV Name from FvImages element.\r
+                    ffc.updateFvImageNameAll(fvName, null);\r
+                    //delete FvBinding from ModuleSA.\r
+                    ffc.removeFvBindingAll(fvName);\r
+                    docConsole.setSaved(false);\r
                 }\r
             });\r
         }\r
@@ -1775,6 +1868,9 @@ public class FpdFlash extends IInternalFrame {
                 if (jTableFvInfo.isEditing()) {\r
                     jTableFvInfo.getCellEditor().stopCellEditing();\r
                 }\r
+                if (jTableFvAdditional.isEditing()) {\r
+                    jTableFvAdditional.getCellEditor().stopCellEditing();\r
+                }\r
             }\r
         });\r
     }\r
@@ -1815,6 +1911,53 @@ public class FpdFlash extends IInternalFrame {
         return jContentPane;\r
     }\r
     \r
+    private void getFlashInfoFromFdf (String fdfPath, Vector<String> vBlockSize, String erasePolarity) {\r
+        File fdf = new File(fdfPath);\r
+        if (!fdf.exists()) {\r
+            return;\r
+        }\r
+        int lines = 0;\r
+\r
+        try {\r
+            FileReader reader = new FileReader(fdf);\r
+            BufferedReader in = new BufferedReader(reader);\r
+            String str;\r
+\r
+            while ((str = in.readLine()) != null) {\r
+                ++lines;\r
+                str = str.trim();\r
+                //\r
+                // skip empty line, comment (start with //) \r
+                //\r
+                if (str.length() == 0 || str.startsWith("//")) {\r
+                    continue;\r
+                }\r
+                //\r
+                // ErasePolarity\r
+                //\r
+                if (str.startsWith("ErasePolarity")) {\r
+                    erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(","));\r
+                }\r
+                //\r
+                // dig into Block section.\r
+                //\r
+                if (str.startsWith("Block") && str.endsWith("}")) {\r
+                    String[] blockSec = str.split(",");\r
+                    String nv = blockSec[1].trim();\r
+                    String[] sizeSec = nv.split("=");\r
+                    vBlockSize.add(sizeSec[1].trim());\r
+                }\r
+                \r
+            }\r
+            \r
+            reader.close();\r
+            in.close();\r
+        }\r
+        catch (Exception e) {\r
+           \r
+        }\r
+    }\r
+    \r
     private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {\r
         File fdf = new File(fdfPath);\r
         if (!fdf.exists()) {\r
@@ -2374,10 +2517,11 @@ class ImageParaTableModel extends DefaultTableModel {
     private static final long serialVersionUID = 1L;\r
     \r
    public boolean isCellEditable(int row, int col) {\r
-        if (getValueAt(row, 1).equals("ImageName") && col >=1) {\r
-            return false;\r
-        }\r
-        return true;\r
+//        if (getValueAt(row, 1).equals("ImageName") && col >=1) {\r
+//            return false;\r
+//        }\r
+//        return true;\r
+       return false;\r
     }\r
 }\r
 \r
index 6f591b7..14fd024 100644 (file)
@@ -4,6 +4,7 @@ import java.awt.BorderLayout;
 import java.awt.Dimension;\r
 import java.awt.Toolkit;\r
 \r
+import javax.swing.DefaultCellEditor;\r
 import javax.swing.JFrame;\r
 import javax.swing.JOptionPane;\r
 import javax.swing.JPanel;\r
@@ -1241,6 +1242,16 @@ public class FpdModuleSA extends JDialog implements ActionListener {
             optionsTableModel.addColumn("Contents");\r
             jTableModuleSaOptions = new JTable(optionsTableModel);\r
             jTableModuleSaOptions.setRowHeight(20);\r
+            \r
+            javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);\r
+            JComboBox cb = new JComboBox();\r
+            cb.addItem("MSFT");\r
+            cb.addItem("GCC");\r
+            cb.addItem("CYGWIN");\r
+            cb.addItem("INTEL");\r
+            cb.addItem("USER_DEFINED");\r
+            toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));\r
+            \r
             Vector<String> vArch = new Vector<String>();\r
             vArch.add("IA32");\r
             vArch.add("X64");\r
@@ -1249,6 +1260,9 @@ public class FpdModuleSA extends JDialog implements ActionListener {
             vArch.add("ARM");\r
             vArch.add("PPC");\r
             jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch));\r
+            \r
+            jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());\r
+            \r
             jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
                        jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
             jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() {\r