For encapsulated sections in FFS layout in FpdBuildOptions, if no longer exists secti...
authorjlin16 <jlin16@de2fecce-e211-0410-80a6-f3fac2684e05>
Fri, 10 Nov 2006 09:13:10 +0000 (09:13 +0000)
committerjlin16 <jlin16@de2fecce-e211-0410-80a6-f3fac2684e05>
Fri, 10 Nov 2006 09:13:10 +0000 (09:13 +0000)
git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@1930 de2fecce-e211-0410-80a6-f3fac2684e05

edk2/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java
edk2/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
edk2/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java

index ecaf858..bc9a8c2 100644 (file)
@@ -457,27 +457,35 @@ public class FpdBuildOptions extends IInternalFrame {
         initFfsTable();\r
         this.addInternalFrameListener(new InternalFrameAdapter() {\r
             public void internalFrameDeactivated(InternalFrameEvent e) {\r
-                if (jTableFfs.isEditing()) {\r
-                    jTableFfs.getCellEditor().stopCellEditing();\r
-                }\r
-                if (jTableFfsSection.isEditing()) {\r
-                    jTableFfsSection.getCellEditor().stopCellEditing();\r
-                }\r
+                \r
                 if (jTableAntTasks.isEditing()) {\r
                     jTableAntTasks.getCellEditor().stopCellEditing();\r
                 }\r
-                if (jTableFfsSubSection.isEditing()) {\r
-                    jTableFfsSubSection.getCellEditor().stopCellEditing();\r
-                }\r
-                if (jTableFfsAttribs.isEditing()) {\r
-                    jTableFfsAttribs.getCellEditor().stopCellEditing();\r
-                }\r
                 if (jTableOptions.isEditing()) {\r
                     jTableOptions.getCellEditor().stopCellEditing();\r
                 }\r
+                stopEditingInTables ();\r
             }\r
         });\r
     }\r
+    \r
+    private void stopEditingInTables () {\r
+        if (jTableFfs.isEditing()) {\r
+            jTableFfs.getCellEditor().stopCellEditing();\r
+        }\r
+        if (jTableFfsSection.isEditing()) {\r
+            jTableFfsSection.getCellEditor().stopCellEditing();\r
+        }\r
+        if (jTableFfsSections.isEditing()) {\r
+            jTableFfsSections.getCellEditor().stopCellEditing();\r
+        }\r
+        if (jTableFfsSubSection.isEditing()) {\r
+            jTableFfsSubSection.getCellEditor().stopCellEditing();\r
+        }\r
+        if (jTableFfsAttribs.isEditing()) {\r
+            jTableFfsAttribs.getCellEditor().stopCellEditing();\r
+        }\r
+    }\r
 \r
     /**\r
      * This method initializes jPanel13        \r
@@ -629,6 +637,7 @@ public class FpdBuildOptions extends IInternalFrame {
                     if (jTableFfs.getSelectedRow() < 0) {\r
                         return;\r
                     }\r
+                    stopEditingInTables();\r
                     docConsole.setSaved(false);\r
                     ffc.removeBuildOptionsFfs(jTableFfs.getSelectedRow());\r
                     ffsTableModel.removeRow(jTableFfs.getSelectedRow());\r
@@ -758,6 +767,7 @@ public class FpdBuildOptions extends IInternalFrame {
                     if (jTableFfs.getSelectedRow() < 0) {\r
                         return;\r
                     }\r
+                    stopEditingInTables();\r
                     if (jTableFfsAttribs.getSelectedRow() >= 0) {\r
                         docConsole.setSaved(false);\r
                         ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow());\r
@@ -1067,6 +1077,7 @@ public class FpdBuildOptions extends IInternalFrame {
                     if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) {\r
                         return;\r
                     }\r
+                    stopEditingInTables();\r
                     docConsole.setSaved(false);\r
                     sectionTableModel.removeRow(jTableFfsSection.getSelectedRow());\r
                     ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(),\r
@@ -1116,15 +1127,22 @@ public class FpdBuildOptions extends IInternalFrame {
             jButtonFfsSubSectionRemove.setText("Remove");\r
             jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() {\r
                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
-                    if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0\r
-                        || jTableFfsSubSection.getSelectedRow() < 0) {\r
+                    int selectedFfsRow = jTableFfs.getSelectedRow();\r
+                    int selectedSectionsRow = jTableFfsSections.getSelectedRow();\r
+                    int selectedSubSectionRow = jTableFfsSubSection.getSelectedRow();\r
+                    if (selectedFfsRow < 0 || selectedSectionsRow < 0\r
+                        || selectedSubSectionRow < 0) {\r
                         return;\r
                     }\r
+                    stopEditingInTables();\r
                     docConsole.setSaved(false);\r
-                    subsectionsTableModel.removeRow(jTableFfsSubSection.getSelectedRow());\r
-                    ffc.removeBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),\r
-                                                                     jTableFfsSections.getSelectedRow(),\r
-                                                                     jTableFfsSubSection.getSelectedRow());\r
+                    subsectionsTableModel.removeRow(selectedSubSectionRow);\r
+                    ffc.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow,\r
+                                                                     selectedSectionsRow,\r
+                                                                     selectedSubSectionRow);\r
+                    if (subsectionsTableModel.getRowCount() == 0) {\r
+                        sectionsTableModel.removeRow(selectedSectionsRow);\r
+                    }\r
                 }\r
             });\r
         }\r
@@ -1172,6 +1190,7 @@ public class FpdBuildOptions extends IInternalFrame {
                     if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {\r
                         return;\r
                     }\r
+                    stopEditingInTables();\r
                     docConsole.setSaved(false);\r
                     sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow());\r
                     ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(),\r
index fdf5fb5..130b625 100644 (file)
@@ -402,6 +402,9 @@ public class FpdFileContents {
         String[][] saaLib = new String[libCount][5];\r
         getLibraryInstances(moduleKey, saaLib);\r
         ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
+        if (mi == null) {\r
+            throw new Exception ("Module does NOT exist in workspace.");\r
+        }\r
         Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r
         //\r
         // create vector for module & library instance MIs.\r
@@ -417,6 +420,9 @@ public class FpdFileContents {
 \r
                 for (int j = 0; j < vMi.size(); ++j) {\r
                     ModuleIdentification nextMi = vMi.get(j);\r
+                    if (nextMi == null) {\r
+                        continue;\r
+                    }\r
                     if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], nextMi)) {\r
                         continue nextPcd;\r
                     }\r
index db54307..96d2ccf 100644 (file)
@@ -160,6 +160,9 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         jTabbedPane.setSelectedIndex(0);\r
         initPcdBuildDefinition(i);\r
         ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
+        if (mi == null) {\r
+            return;\r
+        }\r
         int tabIndex = jTabbedPane.indexOfTab("Libraries");\r
         if (mi.isLibrary()) {\r
             jTabbedPane.setEnabledAt(tabIndex, false);\r