From: jlin16 Date: Wed, 27 Sep 2006 04:23:50 +0000 (+0000) Subject: Fix EDKT337,Double click on modules in "Framework Modules" of Platforms should be... X-Git-Tag: edk2-stable201903~24244 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=a0783edc77ae576d8032461935362f43293bc467 Fix EDKT337,Double click on modules in "Framework Modules" of Platforms should be supported. Fix EDKT334, Wizard should sync modules list in fpd with modules in fv_order. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1630 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java index 57b7f2cba0..7f06730fe4 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java @@ -294,22 +294,14 @@ public class FpdBuildOptions extends IInternalFrame { private JPanel jPanelSectionN = null; - private JPanel jPanelSectionC = null; - private JPanel jPanelSectionsN = null; - private JPanel jPanelSectionsC = null; - private JPanel jPanelSubSectionN = null; - private JPanel jPanelSubSectionC = null; - private JPanel jPanelOptionsContainer = null; private JPanel jPanelUserDefCenterN = null; - private JPanel jPanelUserDefCenterC = null; - /** * This method initializes jPanel * @@ -1245,7 +1237,7 @@ public class FpdBuildOptions extends IInternalFrame { jPanelFfsCTop = new JPanel(); jPanelFfsCTop.setLayout(new BorderLayout()); jPanelFfsCTop.add(getJPanelSectionN(), java.awt.BorderLayout.NORTH); - jPanelFfsCTop.add(getJPanelSectionC(), java.awt.BorderLayout.CENTER); + jPanelFfsCTop.add(getJScrollPaneFfsSection(), java.awt.BorderLayout.CENTER); } return jPanelFfsCTop; } @@ -1277,7 +1269,7 @@ public class FpdBuildOptions extends IInternalFrame { jPanelFfsCBottomTop = new JPanel(); jPanelFfsCBottomTop.setLayout(new BorderLayout()); jPanelFfsCBottomTop.add(getJPanelSectionsN(), java.awt.BorderLayout.NORTH); - jPanelFfsCBottomTop.add(getJPanelSectionsC(), java.awt.BorderLayout.CENTER); + jPanelFfsCBottomTop.add(getJScrollPaneFfsSections(), java.awt.BorderLayout.CENTER); } return jPanelFfsCBottomTop; } @@ -1292,7 +1284,7 @@ public class FpdBuildOptions extends IInternalFrame { jPanelFfsCBottomBottom = new JPanel(); jPanelFfsCBottomBottom.setLayout(new BorderLayout()); jPanelFfsCBottomBottom.add(getJPanelSubSectionN(), java.awt.BorderLayout.NORTH); - jPanelFfsCBottomBottom.add(getJPanelSubSectionC(), java.awt.BorderLayout.CENTER); + jPanelFfsCBottomBottom.add(getJScrollPaneFfsSubSection(), java.awt.BorderLayout.CENTER); } return jPanelFfsCBottomBottom; } @@ -1314,19 +1306,6 @@ public class FpdBuildOptions extends IInternalFrame { return jPanelSectionN; } - /** - * This method initializes jPanelSectionC - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelSectionC() { - if (jPanelSectionC == null) { - jPanelSectionC = new JPanel(); - jPanelSectionC.add(getJScrollPaneFfsSection(), null); - } - return jPanelSectionC; - } - /** * This method initializes jPanelSectionsN * @@ -1344,19 +1323,6 @@ public class FpdBuildOptions extends IInternalFrame { return jPanelSectionsN; } - /** - * This method initializes jPanelSectionsC - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelSectionsC() { - if (jPanelSectionsC == null) { - jPanelSectionsC = new JPanel(); - jPanelSectionsC.add(getJScrollPaneFfsSections(), null); - } - return jPanelSectionsC; - } - /** * This method initializes jPanelSubSectionN * @@ -1374,19 +1340,6 @@ public class FpdBuildOptions extends IInternalFrame { return jPanelSubSectionN; } - /** - * This method initializes jPanelSubSectionC - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelSubSectionC() { - if (jPanelSubSectionC == null) { - jPanelSubSectionC = new JPanel(); - jPanelSubSectionC.add(getJScrollPaneFfsSubSection(), null); - } - return jPanelSubSectionC; - } - /** * The following section contains all Build Options content */ @@ -1976,19 +1929,6 @@ public class FpdBuildOptions extends IInternalFrame { return jPanelUserDefCenterN; } - /** - * This method initializes jPanelUserDefCenterC - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelUserDefCenterC() { - if (jPanelUserDefCenterC == null) { - jPanelUserDefCenterC = new JPanel(); - jPanelUserDefCenterC.add(getJScrollPaneAntTasks(), null); - } - return jPanelUserDefCenterC; - } - /** * This method initializes jPanel8 * @@ -2044,7 +1984,7 @@ public class FpdBuildOptions extends IInternalFrame { jPanelUserDefCenter.setLayout(new BorderLayout()); jPanelUserDefCenter.add(getJPanelUserDefCenterN(), java.awt.BorderLayout.NORTH); - jPanelUserDefCenter.add(getJPanelUserDefCenterC(), java.awt.BorderLayout.CENTER); + jPanelUserDefCenter.add(getJScrollPaneAntTasks(), java.awt.BorderLayout.CENTER); } return jPanelUserDefCenter; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java index 8584657c91..0545906900 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java @@ -23,6 +23,7 @@ import javax.swing.JRadioButton; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JTextField; +import java.awt.GridLayout; public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { @@ -31,9 +32,6 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { */ private static final long serialVersionUID = 1L; private JPanel jContentPane = null; - private JPanel jPanelContentNorth = null; - private JPanel jPanelContentCenter = null; - private JPanel jPanelContentSouth = null; private JScrollPane jScrollPaneDynPcd = null; private JTable jTableDynPcd = null; private DynPcdTableModel modelPcd = null; @@ -63,6 +61,7 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { private JRadioButton jRadioButtonDefaultValue = null; private ButtonGroup bg = new ButtonGroup(); private JLabel jLabelPadd = null; + private JLabel jLabelPad1 = null; /** * This is the default constructor */ @@ -119,52 +118,13 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout()); - jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH); - jContentPane.add(getJPanelContentCenter(), java.awt.BorderLayout.CENTER); - jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH); + jContentPane.add(getJScrollPaneDynPcd(), java.awt.BorderLayout.NORTH); + jContentPane.add(getJPanelSkuInfo(), java.awt.BorderLayout.CENTER); + jContentPane.add(getJPanelDynPcdValue(), java.awt.BorderLayout.SOUTH); } return jContentPane; } - /** - * This method initializes jPanel - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelContentNorth() { - if (jPanelContentNorth == null) { - jPanelContentNorth = new JPanel(); - } - return jPanelContentNorth; - } - - /** - * This method initializes jPanel1 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelContentCenter() { - if (jPanelContentCenter == null) { - jPanelContentCenter = new JPanel(); - jPanelContentCenter.add(getJScrollPaneDynPcd(), null); - jPanelContentCenter.add(getJPanelSkuInfo(), null); - jPanelContentCenter.add(getJPanelDynPcdValue(), null); - } - return jPanelContentCenter; - } - - /** - * This method initializes jPanel2 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelContentSouth() { - if (jPanelContentSouth == null) { - jPanelContentSouth = new JPanel(); - } - return jPanelContentSouth; - } - /** * This method initializes jScrollPane * @@ -173,7 +133,7 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { private JScrollPane getJScrollPaneDynPcd() { if (jScrollPaneDynPcd == null) { jScrollPaneDynPcd = new JScrollPane(); - jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(600,200)); + jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(100,300)); jScrollPaneDynPcd.setViewportView(getJTableDynPcd()); } return jScrollPaneDynPcd; @@ -345,6 +305,14 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { */ private JPanel getJPanelDynPcdValue() { if (jPanelDynPcdValue == null) { + jLabelPad1 = new JLabel(); + jLabelPad1.setText(" "); + GridLayout gridLayout = new GridLayout(); + gridLayout.setColumns(5); + gridLayout.setRows(4); + gridLayout.setHgap(5); + gridLayout.setVgap(5); + jLabelVpdOffset = new JLabel(); jLabelVpdOffset.setPreferredSize(new java.awt.Dimension(80,20)); jLabelVpdOffset.setText("VPD Offset"); @@ -363,11 +331,9 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { jLabelVarName.setText("Variable Name"); jLabelVarName.setToolTipText(""); jLabelVarName.setPreferredSize(new java.awt.Dimension(90,20)); - FlowLayout flowLayout1 = new FlowLayout(); - flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); jPanelDynPcdValue = new JPanel(); jPanelDynPcdValue.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED)); - jPanelDynPcdValue.setLayout(flowLayout1); + jPanelDynPcdValue.setLayout(gridLayout); jPanelDynPcdValue.setPreferredSize(new java.awt.Dimension(600,120)); jPanelDynPcdValue.add(getJRadioButtonHii(), null); jPanelDynPcdValue.add(jLabelVarName, null); @@ -381,15 +347,16 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { jPanelDynPcdValue.add(getJTextFieldHiiDefaultValue(), null); jPanelDynPcdValue.add(getJRadioButtonVpd(), null); jPanelDynPcdValue.add(jLabelVpdOffset, null); - jPanelDynPcdValue.add(getJTextFieldVpdOffset(), null); jLabelPadd = new JLabel(); jLabelPadd.setText(" "); - jPanelDynPcdValue.add(jLabelPadd, null); + jPanelDynPcdValue.add(getJTextFieldVpdOffset(), null); jLabelVarName.setEnabled(false); jLabelVarGuid.setEnabled(false); jLabelHiiDefaultValue.setEnabled(false); jLabelVarOffset.setEnabled(false); jLabelVpdOffset.setEnabled(false); + jPanelDynPcdValue.add(jLabelPadd, null); + jPanelDynPcdValue.add(jLabelPad1, null); jPanelDynPcdValue.add(getJRadioButtonDefaultValue(), null); jPanelDynPcdValue.add(getJTextFieldDefaultValue(), null); bg.add(jRadioButtonHii); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 6ca15710c2..26d3d694c9 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -1897,6 +1897,138 @@ public class FpdFileContents { } + private boolean versionEqual (String v1, String v2) { + + if ((v1 == null || v1.length() == 0 || v1.equalsIgnoreCase("null")) + && (v2 == null || v2.length() == 0 || v2.equalsIgnoreCase("null"))) { + return true; + } + + if (v1 != null && v1.equals(v2)) { + return true; + } + + return false; + } + + public boolean moduleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { + boolean inList = false; + if (getUserExtsIncModCount(fvName) > 0) { + + XmlCursor cursor = getfpdBuildOpts().newCursor(); + QName elementUserExts = new QName (xmlNs, "UserExtensions"); + QName attribUserId = new QName ("UserID"); + QName elementFvName = new QName (xmlNs, "FvName"); + QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); + QName attribModuleGuid = new QName("ModuleGuid"); + QName attribModuleVersion = new QName("ModuleVersion"); + QName attribPackageGuid = new QName("PackageGuid"); + QName attribPackageVersion = new QName("PackageVersion"); + QName attribArch = new QName("Arch"); + + if (cursor.toChild(elementUserExts)) { + do { + cursor.push(); + if (cursor.getAttributeText(attribUserId).equals("IMAGES")) { + cursor.toChild(elementFvName); + String elementName = cursor.getTextValue(); + if (elementName.equals(fvName)) { + cursor.toNextSibling(elementIncludeModules); + if (cursor.toFirstChild()) { + + do { + String mg = cursor.getAttributeText(attribModuleGuid); + String mv = cursor.getAttributeText(attribModuleVersion); + String pg = cursor.getAttributeText(attribPackageGuid); + String pv = cursor.getAttributeText(attribPackageVersion); + String ar = cursor.getAttributeText(attribArch); + if (!moduleGuid.equalsIgnoreCase(mg)) { + continue; + } + if (!packageGuid.equalsIgnoreCase(pg)) { + continue; + } + if (!arch.equalsIgnoreCase(ar)) { + continue; + } + if (!versionEqual(moduleVersion, mv)) { + continue; + } + if (!versionEqual(packageVersion, pv)) { + continue; + } + inList = true; + break; + }while (cursor.toNextSibling()); + } + break; + } + } + cursor.pop(); + }while (cursor.toNextSibling(elementUserExts)); + } + cursor.dispose(); + } + return inList; + } + + public void removeModuleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { + if (getUserExtsIncModCount(fvName) > 0) { + + XmlCursor cursor = getfpdBuildOpts().newCursor(); + QName elementUserExts = new QName (xmlNs, "UserExtensions"); + QName attribUserId = new QName ("UserID"); + QName elementFvName = new QName (xmlNs, "FvName"); + QName elementIncludeModules = new QName(xmlNs, "IncludeModules"); + QName attribModuleGuid = new QName("ModuleGuid"); + QName attribModuleVersion = new QName("ModuleVersion"); + QName attribPackageGuid = new QName("PackageGuid"); + QName attribPackageVersion = new QName("PackageVersion"); + QName attribArch = new QName("Arch"); + + if (cursor.toChild(elementUserExts)) { + do { + cursor.push(); + if (cursor.getAttributeText(attribUserId).equals("IMAGES")) { + cursor.toChild(elementFvName); + String elementName = cursor.getTextValue(); + if (elementName.equals(fvName)) { + cursor.toNextSibling(elementIncludeModules); + if (cursor.toFirstChild()) { + + do { + String mg = cursor.getAttributeText(attribModuleGuid); + String mv = cursor.getAttributeText(attribModuleVersion); + String pg = cursor.getAttributeText(attribPackageGuid); + String pv = cursor.getAttributeText(attribPackageVersion); + String ar = cursor.getAttributeText(attribArch); + if (!moduleGuid.equalsIgnoreCase(mg)) { + continue; + } + if (!packageGuid.equalsIgnoreCase(pg)) { + continue; + } + if (!arch.equalsIgnoreCase(ar)) { + continue; + } + if (!versionEqual(moduleVersion, mv)) { + continue; + } + if (!versionEqual(packageVersion, pv)) { + continue; + } + cursor.removeXml(); + }while (cursor.toNextSibling()); + } + break; + } + } + cursor.pop(); + }while (cursor.toNextSibling(elementUserExts)); + } + cursor.dispose(); + } + } public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) { UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks(); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java index e97004c3ca..5eefacbdc3 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java @@ -2461,6 +2461,7 @@ public class FpdFlash extends IInternalFrame { if (mi != null) { name = mi.getName(); } + String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] }; modInFvTableModel.addRow(row); } @@ -2903,10 +2904,13 @@ public class FpdFlash extends IInternalFrame { String pv = modInFvTableModel.getValueAt(selectedRowLeft, 4)+""; String arch = modInFvTableModel.getValueAt(selectedRowLeft, 5)+""; String[] row = {name, mg, mv, pg, pv, arch}; - if (name.length() == 0 || name.equals("N/A")) { + String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch; + if (name.length() == 0 || name.equals("N/A") || ffc.getModuleSA(moduleKey) == null) { + JOptionPane.showMessageDialog(frame, "Module " + name + " not exists in platform. If you want to add back this module, please first add it into current platform. " + moduleKey ); + modInFvTableModel.removeRow(selectedRowLeft); return; } - + fpdModTableModel.addRow(row); int viewIndex = ((TableSorter) jTableFpdModules.getModel()).getViewIndexArray()[jTableFpdModules .getRowCount() - 1]; diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 7a5a9d134a..ae74471c21 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -38,6 +38,7 @@ import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import java.awt.FlowLayout; +import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -297,7 +298,19 @@ public class FpdFrameworkModules extends IInternalFrame { jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableAllModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - + jTableAllModules.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent e) { + if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { + java.awt.Point p = e.getPoint(); + int rowIndex = jTableAllModules.rowAtPoint(p); + TableSorter sorter = (TableSorter) jTableAllModules.getModel(); + rowIndex = sorter.getModelRowIndex(rowIndex); + addModuleIntoPlatform (rowIndex); + } + } + }); + + } return jTableAllModules; } @@ -319,6 +332,109 @@ public class FpdFrameworkModules extends IInternalFrame { } return jPanelTopSouth; } + + private void addModuleIntoPlatform (int selectedRow) { + String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + ""; + ModuleIdentification mi = miList.get(selectedRow); + Vector vArchs = null; + try { + vArchs = WorkspaceProfile.getModuleSupArchs(mi); + } + catch (Exception exp) { + JOptionPane.showMessageDialog(frame, exp.getMessage()); + } + + if (vArchs == null) { + JOptionPane.showMessageDialog(frame, "No Supported Architectures specified in MSA file."); + return; + } + + String archsAdded = ""; + String mg = mi.getGuid(); + String mv = mi.getVersion(); + String pg = mi.getPackageId().getGuid(); + String pv = mi.getPackageId().getVersion(); + String mType = SurfaceAreaQuery.getModuleType(mi); + + ArrayList al = fpdMsa.get(mg + mv + pg + pv); + if (al == null) { + // + // if existing ModuleSA does not specify version info. + // + al = fpdMsa.get(mg + "null" + pg + "null"); + if (al == null) { + al = fpdMsa.get(mg + "null" + pg + pv); + if (al == null){ + al = fpdMsa.get(mg + mv + pg + "null"); + if (al == null) { + al = new ArrayList(); + fpdMsa.put(mg + mv + pg + pv, al); + } + } + } + } + // + // filter from module SupArchs what archs has been added. + // + for (int i = 0; i < al.size(); ++i) { + vArchs.remove(al.get(i)); + } + // + // check whether archs conform to SupArch of platform. + // + Vector platformSupArch = new Vector(); + ffc.getPlatformDefsSupportedArchs(platformSupArch); + vArchs.retainAll(platformSupArch); + // + // Archs this Module supported have already been added. + // + if (vArchs.size() == 0) { + JOptionPane.showMessageDialog(frame, "This Module has already been added."); + return; + } + //ToDo put Arch instead of null + boolean errorOccurred = false; + for (int i = 0; i < vArchs.size(); ++i) { + String arch = vArchs.get(i); + al.add(arch); + archsAdded += arch + " "; + String[] row = { "", "", "", "", "", "", "" }; + + if (mi != null) { + row[modNameColForFpdModTable] = mi.getName(); + row[pkgNameColForFpdModTable] = mi.getPackageId().getName(); + row[pathColForFpdModTable] = path; + row[archColForFpdModTable] = arch; + row[pkgVerColForFpdModTable] = pv; + row[modVerColForFpdModTable] = mv; + row[typeColForFpdModTable] = mType; + + } + modelFpdModules.addRow(row); + + docConsole.setSaved(false); + try { + //ToDo : specify archs need to add. + ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); + } catch (Exception exception) { + JOptionPane.showMessageDialog(frame, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch + + ": " + exception.getMessage()); + errorOccurred = true; + } + } + + String s = "This Module with Architecture " + archsAdded; + if (errorOccurred) { + s += " was added with Error. Platform may NOT Build."; + } else { + s += " was added Successfully."; + } + JOptionPane.showMessageDialog(frame, s); + TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel(); + int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1]; + jTableFpdModules.changeSelection(viewIndex, 0, false, false); + + } /** * This method initializes jButtonAddModule @@ -339,105 +455,7 @@ public class FpdFrameworkModules extends IInternalFrame { TableSorter sorter = (TableSorter) jTableAllModules.getModel(); selectedRow = sorter.getModelRowIndex(selectedRow); - String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + ""; - ModuleIdentification mi = miList.get(selectedRow); - Vector vArchs = null; - try { - vArchs = WorkspaceProfile.getModuleSupArchs(mi); - } - catch (Exception exp) { - JOptionPane.showMessageDialog(frame, exp.getMessage()); - } - - if (vArchs == null) { - JOptionPane.showMessageDialog(frame, "No Supported Architectures specified in MSA file."); - return; - } - - String archsAdded = ""; - String mg = mi.getGuid(); - String mv = mi.getVersion(); - String pg = mi.getPackageId().getGuid(); - String pv = mi.getPackageId().getVersion(); - String mType = SurfaceAreaQuery.getModuleType(mi); - - ArrayList al = fpdMsa.get(mg + mv + pg + pv); - if (al == null) { - // - // if existing ModuleSA does not specify version info. - // - al = fpdMsa.get(mg + "null" + pg + "null"); - if (al == null) { - al = fpdMsa.get(mg + "null" + pg + pv); - if (al == null){ - al = fpdMsa.get(mg + mv + pg + "null"); - if (al == null) { - al = new ArrayList(); - fpdMsa.put(mg + mv + pg + pv, al); - } - } - } - } - // - // filter from module SupArchs what archs has been added. - // - for (int i = 0; i < al.size(); ++i) { - vArchs.remove(al.get(i)); - } - // - // check whether archs conform to SupArch of platform. - // - Vector platformSupArch = new Vector(); - ffc.getPlatformDefsSupportedArchs(platformSupArch); - vArchs.retainAll(platformSupArch); - // - // Archs this Module supported have already been added. - // - if (vArchs.size() == 0) { - JOptionPane.showMessageDialog(frame, "This Module has already been added."); - return; - } - //ToDo put Arch instead of null - boolean errorOccurred = false; - for (int i = 0; i < vArchs.size(); ++i) { - String arch = vArchs.get(i); - al.add(arch); - archsAdded += arch + " "; - String[] row = { "", "", "", "", "", "", "" }; - - if (mi != null) { - row[modNameColForFpdModTable] = mi.getName(); - row[pkgNameColForFpdModTable] = mi.getPackageId().getName(); - row[pathColForFpdModTable] = path; - row[archColForFpdModTable] = arch; - row[pkgVerColForFpdModTable] = pv; - row[modVerColForFpdModTable] = mv; - row[typeColForFpdModTable] = mType; - - } - modelFpdModules.addRow(row); - - docConsole.setSaved(false); - try { - //ToDo : specify archs need to add. - ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); - } catch (Exception exception) { - JOptionPane.showMessageDialog(frame, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch - + ": " + exception.getMessage()); - errorOccurred = true; - } - } - - String s = "This Module with Architecture " + archsAdded; - if (errorOccurred) { - s += " was added with Error. Platform may NOT Build."; - } else { - s += " was added Successfully."; - } - JOptionPane.showMessageDialog(frame, s); - TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel(); - int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1]; - jTableFpdModules.changeSelection(viewIndex, 0, false, false); + addModuleIntoPlatform (selectedRow); } }); } @@ -530,6 +548,18 @@ public class FpdFrameworkModules extends IInternalFrame { jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableFpdModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + jTableFpdModules.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent e) { + if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { + java.awt.Point p = e.getPoint(); + int rowIndex = jTableFpdModules.rowAtPoint(p); + TableSorter sorter = (TableSorter) jTableFpdModules.getModel(); + rowIndex = sorter.getModelRowIndex(rowIndex); + showSettingsDlg (rowIndex); + } + } + }); + jTableFpdModules.getModel().addTableModelListener(this); } return jTableFpdModules; @@ -550,6 +580,32 @@ public class FpdFrameworkModules extends IInternalFrame { docConsole.setSaved(false); } } + + private void showSettingsDlg (int row) { + try { + if (ffc.adjustPcd(row)) { + docConsole.setSaved(false); + } + } + catch (Exception exp) { + JOptionPane.showMessageDialog(frame, exp.getMessage()); + return; + } + + if (settingDlg == null) { + settingDlg = new FpdModuleSA(ffc); + } + + String[] sa = new String[5]; + ffc.getFrameworkModuleInfo(row, sa); + String mg = sa[ffcModGuid]; + String mv = sa[ffcModVer]; + String pg = sa[ffcPkgGuid]; + String pv = sa[ffcPkgVer]; + String arch = sa[ffcModArch]; + settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, row, docConsole); + settingDlg.setVisible(true); + } /** * This method initializes jButtonSettings * @@ -569,29 +625,7 @@ public class FpdFrameworkModules extends IInternalFrame { TableSorter sorter = (TableSorter) jTableFpdModules.getModel(); selectedRow = sorter.getModelRowIndex(selectedRow); - try { - if (ffc.adjustPcd(selectedRow)) { - docConsole.setSaved(false); - } - } - catch (Exception exp) { - JOptionPane.showMessageDialog(frame, exp.getMessage()); - return; - } - - if (settingDlg == null) { - settingDlg = new FpdModuleSA(ffc); - } - - String[] sa = new String[5]; - ffc.getFrameworkModuleInfo(selectedRow, sa); - String mg = sa[ffcModGuid]; - String mv = sa[ffcModVer]; - String pg = sa[ffcPkgGuid]; - String pv = sa[ffcPkgVer]; - String arch = sa[ffcModArch]; - settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow, docConsole); - settingDlg.setVisible(true); + showSettingsDlg (selectedRow); } }); } @@ -626,6 +660,18 @@ public class FpdFrameworkModules extends IInternalFrame { String pg = sa[ffcPkgGuid]; String pv = sa[ffcPkgVer]; String arch = sa[ffcModArch]; + // + // sync. module order list in BuildOptions-UserExtensions. + // + String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch; + String fvBindings = ffc.getFvBinding(moduleKey); + if (fvBindings != null) { + String[] fvArray = fvBindings.split(" "); + for (int i = 0; i < fvArray.length; ++i) { + ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), mg, mv, pg, pv, arch); + } + } + ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch); if (mi != null) { mv = mi.getVersion(); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index 7c1eb54ba8..dea31877f5 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -123,7 +123,6 @@ public class FpdModuleSA extends JDialog implements ActionListener { private OpeningPlatformType docConsole = null; private JPanel jPanelCustomToolChain = null; private JPanel jPanelToolchainS = null; - private JPanel jPanelToolchainC = null; private JPanel jPanelLibraryCenterN = null; private JPanel jPanelLibraryCenterC = null; // @jve:decl-index=0:visual-constraint="20,224" /** @@ -1126,7 +1125,8 @@ public class FpdModuleSA extends JDialog implements ActionListener { private JTextField getJTextFieldFvBinding() { if (jTextFieldFvBinding == null) { jTextFieldFvBinding = new JTextField(); - jTextFieldFvBinding.setPreferredSize(new java.awt.Dimension(150,20)); + jTextFieldFvBinding.setPreferredSize(new java.awt.Dimension(400,20)); + jTextFieldFvBinding.setEditable(false); jTextFieldFvBinding.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent e) { String originalFvBinding = ffc.getFvBinding(moduleKey); @@ -1603,7 +1603,7 @@ private JPanel getJPanelCustomToolChain() { jPanelCustomToolChain = new JPanel(); jPanelCustomToolChain.setLayout(new BorderLayout()); jPanelCustomToolChain.add(getJPanelToolchainS(), java.awt.BorderLayout.SOUTH); - jPanelCustomToolChain.add(getJPanelToolchainC(), java.awt.BorderLayout.CENTER); + jPanelCustomToolChain.add(getJScrollPaneModuleSaOptions(), java.awt.BorderLayout.CENTER); jPanelCustomToolChain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentShown(java.awt.event.ComponentEvent e) { initToolChainOptions(moduleKey); @@ -1625,18 +1625,7 @@ private JPanel getJPanelToolchainS() { } return jPanelToolchainS; } -/** - * This method initializes jPanelToolchainC - * - * @return javax.swing.JPanel - */ -private JPanel getJPanelToolchainC() { - if (jPanelToolchainC == null) { - jPanelToolchainC = new JPanel(); - jPanelToolchainC.add(getJScrollPaneModuleSaOptions(), null); - } - return jPanelToolchainC; -} + /** * This method initializes jPanelLibraryCenterN *