From d73991a143dc3200a47b50ecfd184ee43ede7900 Mon Sep 17 00:00:00 2001 From: jlin16 Date: Fri, 10 Nov 2006 09:13:10 +0000 Subject: [PATCH] For encapsulated sections in FFS layout in FpdBuildOptions, if no longer exists sections in an encapsulated section, remove from UI that section to be consistent with contents in FPD file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1930 6f19259b-4bc3-4df7-8a09-765794883524 --- .../platform/ui/FpdBuildOptions.java | 55 +++++++++++++------ .../platform/ui/FpdFileContents.java | 6 ++ .../platform/ui/FpdModuleSA.java | 3 + 3 files changed, 46 insertions(+), 18 deletions(-) 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); -- 2.39.2