diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java index ecaf8587a6..bc9a8c23a8 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java @@ -457,27 +457,35 @@ public class FpdBuildOptions extends IInternalFrame { initFfsTable(); this.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameDeactivated(InternalFrameEvent e) { - if (jTableFfs.isEditing()) { - jTableFfs.getCellEditor().stopCellEditing(); - } - if (jTableFfsSection.isEditing()) { - jTableFfsSection.getCellEditor().stopCellEditing(); - } + if (jTableAntTasks.isEditing()) { jTableAntTasks.getCellEditor().stopCellEditing(); } - if (jTableFfsSubSection.isEditing()) { - jTableFfsSubSection.getCellEditor().stopCellEditing(); - } - if (jTableFfsAttribs.isEditing()) { - jTableFfsAttribs.getCellEditor().stopCellEditing(); - } if (jTableOptions.isEditing()) { jTableOptions.getCellEditor().stopCellEditing(); } + stopEditingInTables (); } }); } + + private void stopEditingInTables () { + if (jTableFfs.isEditing()) { + jTableFfs.getCellEditor().stopCellEditing(); + } + if (jTableFfsSection.isEditing()) { + jTableFfsSection.getCellEditor().stopCellEditing(); + } + if (jTableFfsSections.isEditing()) { + jTableFfsSections.getCellEditor().stopCellEditing(); + } + if (jTableFfsSubSection.isEditing()) { + jTableFfsSubSection.getCellEditor().stopCellEditing(); + } + if (jTableFfsAttribs.isEditing()) { + jTableFfsAttribs.getCellEditor().stopCellEditing(); + } + } /** * This method initializes jPanel13 @@ -629,6 +637,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jTableFfs.getSelectedRow() < 0) { return; } + stopEditingInTables(); docConsole.setSaved(false); ffc.removeBuildOptionsFfs(jTableFfs.getSelectedRow()); ffsTableModel.removeRow(jTableFfs.getSelectedRow()); @@ -758,6 +767,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jTableFfs.getSelectedRow() < 0) { return; } + stopEditingInTables(); if (jTableFfsAttribs.getSelectedRow() >= 0) { docConsole.setSaved(false); ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow()); @@ -1067,6 +1077,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) { return; } + stopEditingInTables(); docConsole.setSaved(false); sectionTableModel.removeRow(jTableFfsSection.getSelectedRow()); ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), @@ -1116,15 +1127,22 @@ public class FpdBuildOptions extends IInternalFrame { jButtonFfsSubSectionRemove.setText("Remove"); jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0 - || jTableFfsSubSection.getSelectedRow() < 0) { + int selectedFfsRow = jTableFfs.getSelectedRow(); + int selectedSectionsRow = jTableFfsSections.getSelectedRow(); + int selectedSubSectionRow = jTableFfsSubSection.getSelectedRow(); + if (selectedFfsRow < 0 || selectedSectionsRow < 0 + || selectedSubSectionRow < 0) { return; } + stopEditingInTables(); docConsole.setSaved(false); - subsectionsTableModel.removeRow(jTableFfsSubSection.getSelectedRow()); - ffc.removeBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), - jTableFfsSections.getSelectedRow(), - jTableFfsSubSection.getSelectedRow()); + subsectionsTableModel.removeRow(selectedSubSectionRow); + ffc.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow, + selectedSectionsRow, + selectedSubSectionRow); + if (subsectionsTableModel.getRowCount() == 0) { + sectionsTableModel.removeRow(selectedSectionsRow); + } } }); } @@ -1172,6 +1190,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) { return; } + stopEditingInTables(); docConsole.setSaved(false); sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow()); ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index fdf5fb55e7..130b625e75 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -402,6 +402,9 @@ public class FpdFileContents { String[][] saaLib = new String[libCount][5]; getLibraryInstances(moduleKey, saaLib); ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); + if (mi == null) { + throw new Exception ("Module does NOT exist in workspace."); + } Vector vMi = new Vector(); // // create vector for module & library instance MIs. @@ -417,6 +420,9 @@ public class FpdFileContents { for (int j = 0; j < vMi.size(); ++j) { ModuleIdentification nextMi = vMi.get(j); + if (nextMi == null) { + continue; + } if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], nextMi)) { continue nextPcd; } 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 db54307c43..96d2ccf3b2 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);