X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdModuleSA.java;h=14fd02499f7c0a001e9137fc57572e9eaf158931;hp=0ab921b74e4da331a3754209e96be6b6f758b78c;hb=98c207975ec9acc2a4a65fe8c5e3e4f5ab824349;hpb=f4c4325bb4b4968a18658c34b9f9c908cef9e706 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 0ab921b74e..14fd02499f 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 @@ -4,6 +4,7 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; +import javax.swing.DefaultCellEditor; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -23,13 +24,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 +39,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; @@ -121,7 +120,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 */ @@ -153,6 +154,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]; @@ -177,24 +182,23 @@ 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 = GlobalData.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. // resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]); selectedInstancesTableModel.addRow(saa[i]); } - - } } + showClassToResolved(); } - public void initModuleSAOptions(String key) { + public void initFvInfo (String key) { // // display module SA options // @@ -213,6 +217,9 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (ffsKey != null) { jTextFieldFfsKey.setText(ffsKey); } + } + + public void initToolChainOptions(String key) { optionsTableModel.setRowCount(0); String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6]; @@ -223,40 +230,38 @@ public class FpdModuleSA extends JDialog implements ActionListener { } private void resolveLibraryInstances(String key) { - ModuleIdentification mi = GlobalData.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)); } } @@ -281,7 +286,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { } - showClassToResolved(); +// showClassToResolved(); } catch(Exception e) { e.printStackTrace(); @@ -292,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; @@ -323,7 +329,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { } private void removeInstance(String key) { - ModuleIdentification mi = GlobalData.getModuleId(key); + ModuleIdentification mi = WorkspaceProfile.getModuleId(key); // // remove pcd information of instance from current ModuleSA // @@ -362,10 +368,12 @@ public class FpdModuleSA extends JDialog implements ActionListener { 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(); @@ -376,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(){ @@ -397,18 +406,33 @@ 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); } } libInstanceTableModel.setRowCount(0); } + + private void addLibInstance (ModuleIdentification libMi) { + + ffc.genLibraryInstance(libMi, moduleKey); + // + // Add pcd information of selected instance to current moduleSA + // + try{ + ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey)); + } + catch (Exception exception) { + JOptionPane.showMessageDialog(frame, "Adding Instance" + libMi.getName() + ": "+ exception.getMessage()); + } + + } /** * This method initializes this * @@ -446,8 +470,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; } @@ -630,11 +656,11 @@ public class FpdModuleSA extends JDialog implements ActionListener { ffc.getLibraryInstances(moduleKey, saa); try{ - if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(moduleKey), cName, tsGuid, sa)) { + if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(moduleKey), cName, tsGuid, sa)) { return; } for (int j = 0; j < saa.length; ++j) { - if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]), + if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]), cName, tsGuid, sa)) { return; } @@ -842,8 +868,8 @@ public class FpdModuleSA extends JDialog implements ActionListener { while(li.hasNext()) { String instance = li.next(); String[] s = {"", "", "", "", ""}; - if (GlobalData.getModuleId(instance) != null) { - s[0] = GlobalData.getModuleId(instance).getName(); + if (WorkspaceProfile.getModuleId(instance) != null) { + s[0] = WorkspaceProfile.getModuleId(instance).getName(); } String[] instancePart = instance.split(" "); @@ -982,18 +1008,10 @@ public class FpdModuleSA extends JDialog implements ActionListener { libInstanceTableModel.getValueAt(row, 2) + " " + libInstanceTableModel.getValueAt(row, 3) + " " + libInstanceTableModel.getValueAt(row, 4); - ModuleIdentification libMi = GlobalData.getModuleId(instanceValue); - ffc.genLibraryInstance(libMi, moduleKey); - // - // Add pcd information of selected instance to current moduleSA - // - try{ - ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey)); - } - catch (Exception exception) { - JOptionPane.showMessageDialog(frame, "Adding Instance" + s[0] + ": "+ exception.getMessage()); - } + ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceValue); + addLibInstance (libMi); resolveLibraryInstances(instanceValue); + showClassToResolved(); } }); } @@ -1075,9 +1093,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(); @@ -1086,6 +1101,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)); @@ -1097,13 +1113,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); } }); } @@ -1145,6 +1157,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); @@ -1208,7 +1221,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; @@ -1229,6 +1242,16 @@ public class FpdModuleSA extends JDialog implements ActionListener { optionsTableModel.addColumn("Contents"); jTableModuleSaOptions = new JTable(optionsTableModel); jTableModuleSaOptions.setRowHeight(20); + + javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1); + JComboBox cb = new JComboBox(); + cb.addItem("MSFT"); + cb.addItem("GCC"); + cb.addItem("CYGWIN"); + cb.addItem("INTEL"); + cb.addItem("USER_DEFINED"); + toolFamilyCol.setCellEditor(new DefaultCellEditor(cb)); + Vector vArch = new Vector(); vArch.add("IA32"); vArch.add("X64"); @@ -1237,6 +1260,9 @@ public class FpdModuleSA extends JDialog implements ActionListener { vArch.add("ARM"); vArch.add("PPC"); jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch)); + + jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor()); + jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() { @@ -1437,6 +1463,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)+""); @@ -1549,11 +1579,55 @@ private JComboBox getJComboBoxFeatureFlagValue() { jComboBoxFeatureFlagValue = new JComboBox(); jComboBoxFeatureFlagValue.setPreferredSize(new java.awt.Dimension(100,20)); jComboBoxFeatureFlagValue.setVisible(false); - jComboBoxFeatureFlagValue.addItem("true"); - jComboBoxFeatureFlagValue.addItem("false"); + jComboBoxFeatureFlagValue.addItem("TRUE"); + jComboBoxFeatureFlagValue.addItem("FALSE"); } 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"