X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdModuleSA.java;h=ef185b16f987533e221602e0788d61313c883d8f;hb=3658f95e1a73626ff1cdb9cde3676ebc1edc3523;hp=0da5a935c93a47e52c09d3b8df98b550457b8751;hpb=57d0e52a7180d3f3416388023f0edae9bb97f6ce;p=mirror_edk2.git 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 0da5a935c9..ef185b16f9 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 @@ -23,13 +23,13 @@ import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; -import org.apache.xmlbeans.XmlObject; import org.tianocore.frameworkwizard.common.DataValidation; +import org.tianocore.frameworkwizard.common.GlobalData; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; -import org.tianocore.frameworkwizard.platform.ui.global.GlobalData; +import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile; import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery; -import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification; -import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification; +import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; +import org.tianocore.frameworkwizard.packaging.PackageIdentification; import java.awt.FlowLayout; import java.awt.event.ActionEvent; @@ -38,8 +38,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.ListIterator; -import java.util.Map; -import java.util.Set; import java.util.Vector; import javax.swing.JTextField; @@ -93,6 +91,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { private DefaultTableModel optionsTableModel = null; private FpdFileContents ffc = null; private String moduleKey = null; + private int moduleSaNum = -1; private HashMap> classInstanceMap = null; private ArrayList classProduced = null; private HashMap> classConsumed = null; @@ -120,7 +119,9 @@ public class FpdModuleSA extends JDialog implements ActionListener { private JButton jButtonUpdatePcd = null; private JComboBox jComboBoxFeatureFlagValue = null; private OpeningPlatformType docConsole = null; - private JLabel jLabelPad = null; + private JPanel jPanelCustomToolChain = null; + private JPanel jPanelToolchainS = null; + private JPanel jPanelToolchainC = null; /** * This is the default constructor */ @@ -135,6 +136,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { public void setKey(String k, int i, OpeningPlatformType dc){ this.moduleKey = k; + moduleSaNum = i; this.docConsole = dc; classProduced = null; classConsumed = null; @@ -151,6 +153,10 @@ public class FpdModuleSA extends JDialog implements ActionListener { // display pcd for key. // model.setRowCount(0); + jTextAreaPcdHelp.setText(""); + jComboBoxItemType.setSelectedIndex(-1); + jTextFieldMaxDatumSize.setText(""); + jTextFieldPcdDefault.setText(""); int pcdCount = ffc.getPcdDataCount(i); if (pcdCount != 0) { String[][] saa = new String[pcdCount][7]; @@ -175,11 +181,11 @@ public class FpdModuleSA extends JDialog implements ActionListener { String[][] saa = new String[instanceCount][5]; ffc.getLibraryInstances(key, saa); for (int i = 0; i < saa.length; ++i) { - ModuleIdentification mi = getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]); + ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]); if (mi != null) { saa[i][0] = mi.getName(); saa[i][2] = mi.getVersion(); - saa[i][4] = mi.getPackage().getVersion(); + saa[i][4] = mi.getPackageId().getVersion(); // // re-evaluate lib instance usage when adding a already-selected lib instance. // @@ -192,22 +198,28 @@ public class FpdModuleSA extends JDialog implements ActionListener { } } - public void initModuleSAOptions(String key) { + public void initFvInfo (String key) { // // display module SA options // + jTextFieldFvBinding.setText(""); String fvBinding = ffc.getFvBinding(key); if (fvBinding != null) { jTextFieldFvBinding.setText(fvBinding); } + jTextFieldFileGuid.setText(""); String fileGuid = ffc.getFfsFileNameGuid(key); if (fileGuid != null) { jTextFieldFileGuid.setText(fileGuid); } + jTextFieldFfsKey.setText(""); String ffsKey = ffc.getFfsFormatKey(key); if (ffsKey != null) { jTextFieldFfsKey.setText(ffsKey); } + } + + public void initToolChainOptions(String key) { optionsTableModel.setRowCount(0); String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6]; @@ -218,51 +230,41 @@ public class FpdModuleSA extends JDialog implements ActionListener { } private void resolveLibraryInstances(String key) { - ModuleIdentification mi = getModuleId(key); + ModuleIdentification mi = WorkspaceProfile.getModuleId(key); PackageIdentification[] depPkgList = null; try{ - Map m = GlobalData.getNativeMsa(mi); - SurfaceAreaQuery.setDoc(m); // // Get dependency pkg list into which we will search lib instances. // - depPkgList = SurfaceAreaQuery.getDependencePkg(null); + depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi); // // Get the lib class consumed, produced by this module itself. // - String[] classConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED"); + Vector vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi); if (this.classConsumed == null) { this.classConsumed = new HashMap>(); } - for(int i = 0; i < classConsumed.length; ++i){ - ArrayList consumedBy = this.classConsumed.get(classConsumed[i]); + for(int i = 0; i < vClassConsumed.size(); ++i){ + ArrayList consumedBy = this.classConsumed.get(vClassConsumed.get(i)); if (consumedBy == null) { consumedBy = new ArrayList(); } consumedBy.add(key); - this.classConsumed.put(classConsumed[i], consumedBy); + this.classConsumed.put(vClassConsumed.get(i), consumedBy); } - String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED"); + Vector vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi); if (this.classProduced == null) { this.classProduced = new ArrayList(); } - for(int i = 0; i < classProduced.length; ++i){ - if (!this.classProduced.contains(classProduced[i])){ - this.classProduced.add(classProduced[i]); + for(int i = 0; i < vClassProduced.size(); ++i){ + if (!this.classProduced.contains(vClassProduced.get(i))){ + this.classProduced.add(vClassProduced.get(i)); } } - // - // Get classes unresolved - // -// Iterator lip = this.classProduced.listIterator(); -// while(lip.hasNext()){ -// String clsProduced = lip.next(); -// this.classConsumed.remove(clsProduced); -// -// } + // // find potential instances in all dependency pkgs for classes still in classConsumed. // @@ -295,11 +297,12 @@ public class FpdModuleSA extends JDialog implements ActionListener { ArrayList al = new ArrayList(); for (int i = 0; i < depPkgList.length; ++i) { - Set smi = GlobalData.getModules(depPkgList[i]); - Iterator ismi = smi.iterator(); + Iterator ismi = GlobalData.vModuleList.iterator(); while(ismi.hasNext()) { ModuleIdentification mi = (ModuleIdentification)ismi.next(); - + if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) { + continue; + } String[] clsProduced = getClassProduced(mi); boolean isPotential = false; @@ -326,7 +329,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { } private void removeInstance(String key) { - ModuleIdentification mi = getModuleId(key); + ModuleIdentification mi = WorkspaceProfile.getModuleId(key); // // remove pcd information of instance from current ModuleSA // @@ -361,50 +364,16 @@ public class FpdModuleSA extends JDialog implements ActionListener { } - private ModuleIdentification getModuleId(String key){ - // - // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array. - // - String[] keyPart = key.split(" "); - Set spi = GlobalData.getPackageList(); - Iterator ispi = spi.iterator(); - - while(ispi.hasNext()) { - PackageIdentification pi = (PackageIdentification)ispi.next(); - if ( !pi.getGuid().equals(keyPart[2])){ - - continue; - } - if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){ - if(!pi.getVersion().equals(keyPart[3])){ - continue; - } - } - Set smi = GlobalData.getModules(pi); - Iterator ismi = smi.iterator(); - while(ismi.hasNext()) { - ModuleIdentification mi = (ModuleIdentification)ismi.next(); - if (mi.getGuid().equals(keyPart[0])){ - if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){ - if(!mi.getVersion().equals(keyPart[1])){ - continue; - } - } - - return mi; - } - } - } - return null; - } private String[] getClassProduced(ModuleIdentification mi){ try{ - Map m = GlobalData.getNativeMsa(mi); - SurfaceAreaQuery.setDoc(m); - String[] clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED"); - return clsProduced; + Vector clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi); + String[] sClassProduced = new String[clsProduced.size()]; + for (int i = 0; i < clsProduced.size(); ++i) { + sClassProduced[i] = clsProduced.get(i); + } + return sClassProduced; }catch (Exception e) { e.printStackTrace(); @@ -415,16 +384,17 @@ public class FpdModuleSA extends JDialog implements ActionListener { private String[] getClassConsumed(ModuleIdentification mi){ - String[] clsConsumed = null; try{ - Map m = GlobalData.getNativeMsa(mi); - SurfaceAreaQuery.setDoc(m); - clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED"); - + Vector clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi); + String[] sClassConsumed = new String[clsConsumed.size()]; + for (int i = 0; i < clsConsumed.size(); ++i) { + sClassConsumed[i] = clsConsumed.get(i); + } + return sClassConsumed; }catch (Exception e) { e.printStackTrace(); } - return clsConsumed; + return new String[0]; } private void showClassToResolved(){ @@ -436,12 +406,12 @@ public class FpdModuleSA extends JDialog implements ActionListener { while(li.hasNext()){ String[] s = {li.next()}; - if (classConsumed.get(s[0]) == null) { - continue; - } - if (classConsumed.get(s[0]).size() == 0) { - continue; - } +// if (classConsumed.get(s[0]) == null) { +// continue; +// } +// if (classConsumed.get(s[0]).size() == 0) { +// continue; +// } if (!classProduced.contains(s[0])){ libClassTableModel.addRow(s); } @@ -485,8 +455,10 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTabbedPane == null) { jTabbedPane = new JTabbedPane(); jTabbedPane.addTab("PCD Build Definition", null, getJPanelPcd(), null); - jTabbedPane.addTab("Module SA Options", null, getJPanelModuleSaOpts(), null); jTabbedPane.addTab("Libraries", null, getJPanelLibrary(), null); + jTabbedPane.addTab("FV Info", null, getJPanelModuleSaOpts(), null); + jTabbedPane.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null); + } return jTabbedPane; } @@ -507,7 +479,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { jPanelPcd.add(getJPanelPcdSouth(), java.awt.BorderLayout.SOUTH); jPanelPcd.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentShown(java.awt.event.ComponentEvent e) { -// initPcdBuildDefinition(moduleKey); + initPcdBuildDefinition(moduleSaNum); } }); @@ -582,8 +554,9 @@ public class FpdModuleSA extends JDialog implements ActionListener { else{ int selectedRow = lsm.getMinSelectionIndex(); String cName = jTablePcd.getValueAt(selectedRow, 0)+""; + String tsGuid = jTablePcd.getValueAt(selectedRow, 1)+""; String[] pcdInfo = {"", ""}; - getPcdInfo(cName, pcdInfo); + getPcdInfo(cName, tsGuid, pcdInfo); jTextAreaPcdHelp.setText(pcdInfo[0]); initComboBox(pcdInfo[1]); jComboBoxItemType.setSelectedItem(pcdInfo[1]); @@ -663,17 +636,17 @@ public class FpdModuleSA extends JDialog implements ActionListener { } } - private void getPcdInfo(String cName, String[] sa) { + private void getPcdInfo(String cName, String tsGuid, String[] sa) { String[][] saa = new String[ffc.getLibraryInstancesCount(moduleKey)][5]; ffc.getLibraryInstances(moduleKey, saa); try{ - if (ffc.getPcdBuildDataInfo(getModuleId(moduleKey), cName, sa)) { + if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(moduleKey), cName, tsGuid, sa)) { return; } for (int j = 0; j < saa.length; ++j) { - if (ffc.getPcdBuildDataInfo(getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]), - cName, sa)) { + if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]), + cName, tsGuid, sa)) { return; } } @@ -822,7 +795,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { selectedInstancesTableModel.addColumn("PackageVersion"); jTableSelectedInstances = new JTable(selectedInstancesTableModel); jTableSelectedInstances.setRowHeight(20); - jTableSelectedInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); + jTableSelectedInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); jTableSelectedInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } @@ -880,8 +853,8 @@ public class FpdModuleSA extends JDialog implements ActionListener { while(li.hasNext()) { String instance = li.next(); String[] s = {"", "", "", "", ""}; - if (getModuleId(instance) != null) { - s[0] = getModuleId(instance).getName(); + if (WorkspaceProfile.getModuleId(instance) != null) { + s[0] = WorkspaceProfile.getModuleId(instance).getName(); } String[] instancePart = instance.split(" "); @@ -927,7 +900,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { libInstanceTableModel.addColumn("PackageVersion"); jTableLibInstances = new JTable(libInstanceTableModel); jTableLibInstances.setRowHeight(20); - jTableLibInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); + jTableLibInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); jTableLibInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } @@ -1020,7 +993,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { libInstanceTableModel.getValueAt(row, 2) + " " + libInstanceTableModel.getValueAt(row, 3) + " " + libInstanceTableModel.getValueAt(row, 4); - ModuleIdentification libMi = getModuleId(instanceValue); + ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceValue); ffc.genLibraryInstance(libMi, moduleKey); // // Add pcd information of selected instance to current moduleSA @@ -1029,7 +1002,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey)); } catch (Exception exception) { - JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); + JOptionPane.showMessageDialog(frame, "Adding Instance" + s[0] + ": "+ exception.getMessage()); } resolveLibraryInstances(instanceValue); } @@ -1113,9 +1086,6 @@ public class FpdModuleSA extends JDialog implements ActionListener { */ private JPanel getJPanelModuleSaOpts() { if (jPanelModuleSaOpts == null) { - jLabelPad = new JLabel(); - jLabelPad.setText(""); - jLabelPad.setPreferredSize(new java.awt.Dimension(250,16)); FlowLayout flowLayout4 = new FlowLayout(); flowLayout4.setAlignment(java.awt.FlowLayout.LEFT); jLabelFfsFormatKey = new JLabel(); @@ -1124,6 +1094,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { jLabelFfsFileGuid = new JLabel(); jLabelFfsFileGuid.setText("FFS File GUID"); jLabelFfsFileGuid.setPreferredSize(new java.awt.Dimension(90,16)); + jLabelFfsFileGuid.setVisible(false); jLabelFvBinding = new JLabel(); jLabelFvBinding.setText("FV Binding"); jLabelFvBinding.setPreferredSize(new java.awt.Dimension(90,16)); @@ -1135,13 +1106,9 @@ public class FpdModuleSA extends JDialog implements ActionListener { jPanelModuleSaOpts.add(getJTextFieldFileGuid(), null); jPanelModuleSaOpts.add(jLabelFfsFormatKey, null); jPanelModuleSaOpts.add(getJTextFieldFfsKey(), null); - jPanelModuleSaOpts.add(getJScrollPaneModuleSaOptions(), null); - jPanelModuleSaOpts.add(jLabelPad, null); - jPanelModuleSaOpts.add(getJButtonNew(), null); - jPanelModuleSaOpts.add(getJButtonDeleteOption(), null); jPanelModuleSaOpts.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentShown(java.awt.event.ComponentEvent e) { - initModuleSAOptions(moduleKey); + initFvInfo(moduleKey); } }); } @@ -1183,6 +1150,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTextFieldFileGuid == null) { jTextFieldFileGuid = new JTextField(); jTextFieldFileGuid.setPreferredSize(new java.awt.Dimension(300,20)); + jTextFieldFileGuid.setVisible(false); jTextFieldFileGuid.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent e) { String originalFileGuid = ffc.getFfsFileNameGuid(moduleKey); @@ -1219,7 +1187,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { private JTextField getJTextFieldFfsKey() { if (jTextFieldFfsKey == null) { jTextFieldFfsKey = new JTextField(); - jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(150,20)); + jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(250,20)); jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent e) { String originalFfsKey = ffc.getFfsFormatKey(moduleKey); @@ -1246,7 +1214,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { private JScrollPane getJScrollPaneModuleSaOptions() { if (jScrollPaneModuleSaOptions == null) { jScrollPaneModuleSaOptions = new JScrollPane(); - jScrollPaneModuleSaOptions.setPreferredSize(new java.awt.Dimension(600,200)); + jScrollPaneModuleSaOptions.setPreferredSize(new java.awt.Dimension(600,350)); jScrollPaneModuleSaOptions.setViewportView(getJTableModuleSaOptions()); } return jScrollPaneModuleSaOptions; @@ -1475,6 +1443,10 @@ private JComboBox getJComboBoxItemType() { if (jComboBoxItemType.getItemCount() == 3) { if (!jComboBoxItemType.getSelectedItem().equals("DYNAMIC")) { pcdDynamicToNonDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+""); + if (jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) { + jTextFieldPcdDefault.setText(""); + jTextFieldPcdDefault.setEnabled(true); + } } else{ pcdNonDynamicToDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+""); @@ -1592,6 +1564,50 @@ private JComboBox getJComboBoxFeatureFlagValue() { } return jComboBoxFeatureFlagValue; } +/** + * This method initializes jPanelCustomToolChain + * + * @return javax.swing.JPanel + */ +private JPanel getJPanelCustomToolChain() { + if (jPanelCustomToolChain == null) { + jPanelCustomToolChain = new JPanel(); + jPanelCustomToolChain.setLayout(new BorderLayout()); + jPanelCustomToolChain.add(getJPanelToolchainS(), java.awt.BorderLayout.SOUTH); + jPanelCustomToolChain.add(getJPanelToolchainC(), java.awt.BorderLayout.CENTER); + jPanelCustomToolChain.addComponentListener(new java.awt.event.ComponentAdapter() { + public void componentShown(java.awt.event.ComponentEvent e) { + initToolChainOptions(moduleKey); + } + }); + } + return jPanelCustomToolChain; +} +/** + * This method initializes jPanelToolchainS + * + * @return javax.swing.JPanel + */ +private JPanel getJPanelToolchainS() { + if (jPanelToolchainS == null) { + jPanelToolchainS = new JPanel(); + jPanelToolchainS.add(getJButtonNew(), null); + jPanelToolchainS.add(getJButtonDeleteOption(), null); + } + 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; +} } // @jve:decl-index=0:visual-constraint="10,10"