X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdFrameworkModules.java;h=e6a372a36e0b0e76e810949686928bef59efd79c;hb=a8a9de7cbbfc0146a1c6c5c9a9dc4abfe48fca6e;hp=f9eb19409bb956f9d9c1d07d1b84d4014c0ecfe0;hpb=d6d24759a0c47633e30acbda45a0d899764e4610;p=mirror_edk2.git 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 f9eb19409b..e6a372a36e 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 @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.Vector; public class FpdFrameworkModules extends IInternalFrame { @@ -34,32 +35,91 @@ public class FpdFrameworkModules extends IInternalFrame { * */ private static final long serialVersionUID = 1L; + static JFrame frame; + private JSplitPane jSplitPane = null; - private JPanel jPanel = null; - private JPanel jPanel1 = null; + + private JPanel jPanelTop = null; + + private JPanel jPanelBottom = null; + private JLabel jLabel = null; - private JScrollPane jScrollPane = null; - private JTable jTable = null; - private JPanel jPanel2 = null; - private JButton jButton = null; - private JLabel jLabel1 = null; - private JPanel jPanel3 = null; - private JScrollPane jScrollPane1 = null; - private JTable jTable1 = null; - private JButton jButton1 = null; - private JButton jButton2 = null; - private NonEditableTableModel model = null; - private NonEditableTableModel model1 = null; - + + private JScrollPane jScrollPaneAllModules = null; + + private JTable jTableAllModules = null; + + private JPanel jPanelTopSouth = null; + + private JButton jButtonAddModule = null; + + private JLabel jLabelModulesAdded = null; + + private JPanel jPanelBottomSouth = null; + + private JScrollPane jScrollPaneFpdModules = null; + + private JTable jTableFpdModules = null; + + private JButton jButtonSettings = null; + + private JButton jButtonRemoveModule = null; + + private NonEditableTableModel modelAllModules = null; + + private NonEditableTableModel modelFpdModules = null; + private FpdModuleSA settingDlg = null; - + private FpdFileContents ffc = null; + private OpeningPlatformType docConsole = null; - private Map fpdMsa = null; - + + private Map> fpdMsa = null; + private ArrayList miList = null; + private final int ModNameCol = 0; + + private final int ModVerCol = 1; + + private final int PkgNameCol = 2; + + private final int PkgVerCol = 3; + + private final int ArchCol = 4; + + private final int Path4Col = 4; + + private final int Path5Col = 5; + + private final int ModNameMinWidth = 168; + + private final int ModNamePrefWidth = 200; + + private final int PkgNameMinWidth = 100; + + private final int PkgNamePrefWidth = 110; + + private final int PkgNameMaxWidth = 150; + + private final int VerMinWidth = 50; + + private final int VerMaxWidth = 80; + + private final int VerPrefWidth = 60; + + private final int PathPrefWidth = 320; + + private final int PathMinWidth = 280; + + private final int ArchPrefWidth = 80; + + private final int ArchMinWidth = 60; + + private final int ArchMaxWidth = 100; + /** * This method initializes jSplitPane * @@ -70,8 +130,8 @@ public class FpdFrameworkModules extends IInternalFrame { jSplitPane = new JSplitPane(); jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); jSplitPane.setDividerLocation(250); - jSplitPane.setBottomComponent(getJPanel1()); - jSplitPane.setTopComponent(getJPanel()); + jSplitPane.setBottomComponent(getJPanelBottom()); + jSplitPane.setTopComponent(getJPanelTop()); } return jSplitPane; } @@ -81,17 +141,17 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JPanel */ - private JPanel getJPanel() { - if (jPanel == null) { + private JPanel getJPanelTop() { + if (jPanelTop == null) { jLabel = new JLabel(); jLabel.setText("Modules in Workspace"); - jPanel = new JPanel(); - jPanel.setLayout(new BorderLayout()); - jPanel.add(jLabel, java.awt.BorderLayout.NORTH); - jPanel.add(getJScrollPane(), java.awt.BorderLayout.CENTER); - jPanel.add(getJPanel2(), java.awt.BorderLayout.SOUTH); + jPanelTop = new JPanel(); + jPanelTop.setLayout(new BorderLayout()); + jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH); + jPanelTop.add(getJScrollPaneAllModules(), java.awt.BorderLayout.CENTER); + jPanelTop.add(getJPanelTopSouth(), java.awt.BorderLayout.SOUTH); } - return jPanel; + return jPanelTop; } /** @@ -99,17 +159,17 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JPanel */ - private JPanel getJPanel1() { - if (jPanel1 == null) { - jLabel1 = new JLabel(); - jLabel1.setText("Modules Added"); - jPanel1 = new JPanel(); - jPanel1.setLayout(new BorderLayout()); - jPanel1.add(jLabel1, java.awt.BorderLayout.NORTH); - jPanel1.add(getJPanel3(), java.awt.BorderLayout.SOUTH); - jPanel1.add(getJScrollPane1(), java.awt.BorderLayout.CENTER); + private JPanel getJPanelBottom() { + if (jPanelBottom == null) { + jLabelModulesAdded = new JLabel(); + jLabelModulesAdded.setText("Modules Added"); + jPanelBottom = new JPanel(); + jPanelBottom.setLayout(new BorderLayout()); + jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH); + jPanelBottom.add(getJPanelBottomSouth(), java.awt.BorderLayout.SOUTH); + jPanelBottom.add(getJScrollPaneFpdModules(), java.awt.BorderLayout.CENTER); } - return jPanel1; + return jPanelBottom; } /** @@ -117,13 +177,13 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JScrollPane */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setPreferredSize(new java.awt.Dimension(600,200)); - jScrollPane.setViewportView(getJTable()); + private JScrollPane getJScrollPaneAllModules() { + if (jScrollPaneAllModules == null) { + jScrollPaneAllModules = new JScrollPane(); + jScrollPaneAllModules.setPreferredSize(new java.awt.Dimension(600, 200)); + jScrollPaneAllModules.setViewportView(getJTableAllModules()); } - return jScrollPane; + return jScrollPaneAllModules; } /** @@ -131,20 +191,41 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JTable */ - private JTable getJTable() { - if (jTable == null) { - model = new NonEditableTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("ModuleName"); - model.addColumn("ModuleGUID"); - model.addColumn("ModuleVersion"); - model.addColumn("PackageGUID"); - model.addColumn("PackageVersion"); - - jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + private JTable getJTableAllModules() { + if (jTableAllModules == null) { + modelAllModules = new NonEditableTableModel(); + TableSorter sorter = new TableSorter(modelAllModules); + jTableAllModules = new JTable(sorter); + sorter.setTableHeader(jTableAllModules.getTableHeader()); + jTableAllModules.setRowHeight(20); + modelAllModules.addColumn("Module
Name"); + modelAllModules.addColumn("Module
Version"); + modelAllModules.addColumn("Package
Name"); + modelAllModules.addColumn("Package
Version"); + modelAllModules.addColumn("Path"); + javax.swing.table.TableColumn column = null; + column = jTableAllModules.getColumnModel().getColumn(ModNameCol); + column.setPreferredWidth(ModNamePrefWidth); + column.setMinWidth(ModNameMinWidth); + column = jTableAllModules.getColumnModel().getColumn(ModVerCol); + column.setPreferredWidth(VerPrefWidth); + column.setMaxWidth(VerMaxWidth); + column.setMinWidth(VerMinWidth); + column = jTableAllModules.getColumnModel().getColumn(PkgNameCol); + column.setPreferredWidth(PkgNamePrefWidth); + column.setMinWidth(PkgNameMinWidth); + column.setMaxWidth(PkgNameMaxWidth); + column = jTableAllModules.getColumnModel().getColumn(PkgVerCol); + column.setPreferredWidth(VerPrefWidth); + column.setMaxWidth(VerMaxWidth); + column.setMinWidth(VerMinWidth); + column = jTableAllModules.getColumnModel().getColumn(Path4Col); + column.setPreferredWidth(PathPrefWidth); + column.setMinWidth(PathMinWidth); + + jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } - return jTable; + return jTableAllModules; } /** @@ -152,15 +233,15 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JPanel */ - private JPanel getJPanel2() { - if (jPanel2 == null) { + private JPanel getJPanelTopSouth() { + if (jPanelTopSouth == null) { FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(java.awt.FlowLayout.RIGHT); - jPanel2 = new JPanel(); - jPanel2.setLayout(flowLayout); - jPanel2.add(getJButton(), null); + jPanelTopSouth = new JPanel(); + jPanelTopSouth.setLayout(flowLayout); + jPanelTopSouth.add(getJButtonAddModule(), null); } - return jPanel2; + return jPanelTopSouth; } /** @@ -168,43 +249,94 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JButton */ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setPreferredSize(new java.awt.Dimension(130,20)); - jButton.setText("Add a Module"); - jButton.addActionListener(new java.awt.event.ActionListener() { + private JButton getJButtonAddModule() { + if (jButtonAddModule == null) { + jButtonAddModule = new JButton(); + jButtonAddModule.setPreferredSize(new java.awt.Dimension(130, 20)); + jButtonAddModule.setText("Add a Module"); + jButtonAddModule.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTable.getSelectedRow(); - if (selectedRow < 0){ + int selectedRow = jTableAllModules.getSelectedRow(); + if (selectedRow < 0) { return; } - - String mg = (String)model.getValueAt(selectedRow, 1); - String mv = (String)model.getValueAt(selectedRow, 2); - String pg = (String)model.getValueAt(selectedRow, 3); - String pv = (String)model.getValueAt(selectedRow, 4); - if (fpdMsa.containsKey(mg + mv + pg + pv)) { - JOptionPane.showMessageDialog(frame, "This Module Already Added."); + + TableSorter sorter = (TableSorter) jTableAllModules.getModel(); + selectedRow = sorter.modelIndex(selectedRow); + String path = modelAllModules.getValueAt(selectedRow, Path4Col) + ""; + ModuleIdentification mi = miList.get(selectedRow); + Vector vArchs = null; + try { + vArchs = GlobalData.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.getPackage().getGuid(); + String pv = mi.getPackage().getVersion(); + + ArrayList al = fpdMsa.get(mg + mv + pg + pv); + if (al == null) { + al = new ArrayList(); + fpdMsa.put(mg + mv + pg + pv, al); + } + for (int i = 0; i < al.size(); ++i) { + vArchs.remove(al.get(i)); + } + // + // 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 - fpdMsa.put(mg + mv + pg + pv, null); - - String[] row = {" ", mg, mv, pg, pv}; - ModuleIdentification mi = getModuleId(mg + " " + mv + " " + pg + " " + pv); - if (mi != null) { - row[0] = mi.getName(); - row[2] = mi.getVersion(); - row[4] = mi.getPackage().getVersion(); + boolean errorOccurred = false; + for (int i = 0; i < vArchs.size(); ++i) { + String arch = vArchs.get(i); + al.add(arch); + archsAdded += arch + " "; + String[] row = { "", mv, "", pv, arch, path }; + + if (mi != null) { + row[ModNameCol] = mi.getName(); + row[PkgNameCol] = mi.getPackage().getName(); + + } + 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[ModNameCol] + " with SupArch " + arch + + ": " + exception.getMessage()); + errorOccurred = true; + } } - model1.addRow(row); - docConsole.setSaved(false); - ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null); + + 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); + jTableFpdModules.changeSelection(modelFpdModules.getRowCount() - 1, 0, false, false); } }); } - return jButton; + return jButtonAddModule; } /** @@ -212,16 +344,16 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JPanel */ - private JPanel getJPanel3() { - if (jPanel3 == null) { + private JPanel getJPanelBottomSouth() { + if (jPanelBottomSouth == null) { FlowLayout flowLayout1 = new FlowLayout(); flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT); - jPanel3 = new JPanel(); - jPanel3.setLayout(flowLayout1); - jPanel3.add(getJButton1(), null); - jPanel3.add(getJButton2(), null); + jPanelBottomSouth = new JPanel(); + jPanelBottomSouth.setLayout(flowLayout1); + jPanelBottomSouth.add(getJButtonSettings(), null); + jPanelBottomSouth.add(getJButtonRemoveModule(), null); } - return jPanel3; + return jPanelBottomSouth; } /** @@ -229,13 +361,13 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JScrollPane */ - private JScrollPane getJScrollPane1() { - if (jScrollPane1 == null) { - jScrollPane1 = new JScrollPane(); - jScrollPane1.setPreferredSize(new java.awt.Dimension(453,200)); - jScrollPane1.setViewportView(getJTable1()); + private JScrollPane getJScrollPaneFpdModules() { + if (jScrollPaneFpdModules == null) { + jScrollPaneFpdModules = new JScrollPane(); + jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200)); + jScrollPaneFpdModules.setViewportView(getJTableFpdModules()); } - return jScrollPane1; + return jScrollPaneFpdModules; } /** @@ -243,21 +375,46 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JTable */ - private JTable getJTable1() { - if (jTable1 == null) { - model1 = new NonEditableTableModel(); - jTable1 = new JTable(model1); - jTable1.setRowHeight(20); - model1.addColumn("ModuleName"); - model1.addColumn("ModuleGUID"); - model1.addColumn("ModuleVersion"); - model1.addColumn("PackageGUID"); - model1.addColumn("PackageVersion"); -// model1.addColumn("SupportedArch"); - - jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + private JTable getJTableFpdModules() { + if (jTableFpdModules == null) { + modelFpdModules = new NonEditableTableModel(); + TableSorter sorter = new TableSorter(modelFpdModules); + jTableFpdModules = new JTable(sorter); + sorter.setTableHeader(jTableFpdModules.getTableHeader()); + jTableFpdModules.setRowHeight(20); + modelFpdModules.addColumn("Module
Name"); + modelFpdModules.addColumn("Module
Version"); + modelFpdModules.addColumn("Package
Name"); + modelFpdModules.addColumn("Package
Version"); + modelFpdModules.addColumn("Supported
Architectures"); + modelFpdModules.addColumn("Path"); + javax.swing.table.TableColumn column = null; + column = jTableFpdModules.getColumnModel().getColumn(ModNameCol); + column.setPreferredWidth(ModNamePrefWidth); + column.setMinWidth(ModNameMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(ModVerCol); + column.setPreferredWidth(VerPrefWidth); + column.setMaxWidth(VerMaxWidth); + column.setMinWidth(VerMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(PkgNameCol); + column.setPreferredWidth(PkgNamePrefWidth); + column.setMinWidth(PkgNameMinWidth); + column.setMaxWidth(PkgNameMaxWidth); + column = jTableFpdModules.getColumnModel().getColumn(PkgVerCol); + column.setPreferredWidth(VerPrefWidth); + column.setMaxWidth(VerMaxWidth); + column.setMinWidth(VerMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(ArchCol); + column.setPreferredWidth(ArchPrefWidth); + column.setMaxWidth(ArchMaxWidth); + column.setMinWidth(ArchMinWidth); + column = jTableFpdModules.getColumnModel().getColumn(Path5Col); + column.setPreferredWidth(PathPrefWidth); + column.setMinWidth(PathMinWidth); + + jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } - return jTable1; + return jTableFpdModules; } /** @@ -265,31 +422,47 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JButton */ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setPreferredSize(new java.awt.Dimension(130,20)); - jButton1.setText("Settings"); - jButton1.addActionListener(new java.awt.event.ActionListener() { + private JButton getJButtonSettings() { + if (jButtonSettings == null) { + jButtonSettings = new JButton(); + jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20)); + jButtonSettings.setText("Settings"); + jButtonSettings.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTable1.getSelectedRow(); - if (selectedRow < 0){ + int selectedRow = jTableFpdModules.getSelectedRow(); + if (selectedRow < 0) { return; } + + TableSorter sorter = (TableSorter) jTableFpdModules.getModel(); + selectedRow = sorter.modelIndex(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); } - docConsole.setSaved(false); - String mg = model1.getValueAt(selectedRow, 1)+""; - String mv = model1.getValueAt(selectedRow, 2)+""; - String pg = model1.getValueAt(selectedRow, 3)+""; - String pv = model1.getValueAt(selectedRow, 4)+""; - settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv); + + String[] sa = new String[5]; + ffc.getFrameworkModuleInfo(selectedRow, sa); + String mg = sa[ModNameCol]; + String mv = sa[ModVerCol]; + String pg = sa[PkgNameCol]; + String pv = sa[PkgVerCol]; + String arch = sa[ArchCol]; + settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow, docConsole); settingDlg.setVisible(true); } }); } - return jButton1; + return jButtonSettings; } /** @@ -297,29 +470,51 @@ public class FpdFrameworkModules extends IInternalFrame { * * @return javax.swing.JButton */ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setPreferredSize(new java.awt.Dimension(130,20)); - jButton2.setText("Remove Module"); - jButton2.addActionListener(new java.awt.event.ActionListener() { + private JButton getJButtonRemoveModule() { + if (jButtonRemoveModule == null) { + jButtonRemoveModule = new JButton(); + jButtonRemoveModule.setPreferredSize(new java.awt.Dimension(130, 20)); + jButtonRemoveModule.setText("Remove Module"); + jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - int selectedRow = jTable1.getSelectedRow(); - if (selectedRow < 0){ + int selectedRow = jTableFpdModules.getSelectedRow(); + if (selectedRow < 0) { return; } - String mg = model1.getValueAt(selectedRow, 1).toString(); - String mv = model1.getValueAt(selectedRow, 2).toString(); - String pg = model1.getValueAt(selectedRow, 3).toString(); - String pv = model1.getValueAt(selectedRow, 4).toString(); - model1.removeRow(selectedRow); - fpdMsa.remove(mg+mv+pg+pv); + + TableSorter sorter = (TableSorter) jTableFpdModules.getModel(); + selectedRow = sorter.modelIndex(selectedRow); + + String[] sa = new String[5]; + ffc.getFrameworkModuleInfo(selectedRow, sa); + String mg = sa[ModNameCol]; + String mv = sa[ModVerCol]; + String pg = sa[PkgNameCol]; + String pv = sa[PkgVerCol]; + String arch = sa[ArchCol]; + ModuleIdentification mi = GlobalData.getModuleId(sa[ModNameCol] + " " + sa[ModVerCol] + " " + + sa[PkgNameCol] + " " + sa[PkgVerCol] + " " + + sa[ArchCol]); + mv = mi.getVersion(); + pv = mi.getPackage().getVersion(); + modelFpdModules.removeRow(selectedRow); + if (arch == null) { + // if no arch specified in ModuleSA + fpdMsa.remove(mg + mv + pg + pv); + } else { + ArrayList al = fpdMsa.get(mg + mv + pg + pv); + al.remove(arch); + if (al.size() == 0) { + fpdMsa.remove(mg + mv + pg + pv); + } + } + docConsole.setSaved(false); ffc.removeModuleSA(selectedRow); } }); } - return jButton2; + return jButtonRemoveModule; } /** @@ -338,78 +533,103 @@ public class FpdFrameworkModules extends IInternalFrame { initialize(); } - public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){ + public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) { this(); init(fpd); - + } - + public FpdFrameworkModules(OpeningPlatformType opt) { this(opt.getXmlFpd()); docConsole = opt; } - + private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) { try { GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE")); } catch(Exception e){ - JOptionPane.showMessageDialog(frame, "FrameworkDatabase Corrupted."); + JOptionPane.showMessageDialog(frame, "Error occurred when getting module data."); } - - if (ffc == null){ + + if (ffc == null) { ffc = new FpdFileContents(fpd); ffc.initDynPcdMap(); } - + if (fpdMsa == null) { - fpdMsa = new HashMap(); + fpdMsa = new HashMap>(); } - + if (ffc.getFrameworkModulesCount() > 0) { String[][] saa = new String[ffc.getFrameworkModulesCount()][5]; ffc.getFrameworkModulesInfo(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 = GlobalData.getModuleId(saa[i][ModNameCol] + " " + saa[i][ModVerCol] + " " + + saa[i][PkgNameCol] + " " + saa[i][PkgVerCol]); + String[] row = { "", "", "", "", "", "" }; if (mi != null) { - saa[i][0] = mi.getName(); - saa[i][2] = mi.getVersion(); - saa[i][4] = mi.getPackage().getVersion(); + row[ModNameCol] = mi.getName(); + row[ModVerCol] = mi.getVersion(); + row[PkgNameCol] = mi.getPackage().getName(); + row[PkgVerCol] = mi.getPackage().getVersion(); + row[ArchCol] = saa[i][ArchCol]; + try { + row[Path5Col] = GlobalData.getMsaFile(mi).getPath().substring( + System.getenv("WORKSPACE") + .length() + 1); + } catch (Exception e) { + JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage()); + } + } + modelFpdModules.addRow(row); + ArrayList al = fpdMsa.get(saa[i][ModNameCol] + row[ModVerCol] + saa[i][PkgNameCol] + + row[PkgVerCol]); + if (al == null) { + al = new ArrayList(); + fpdMsa.put(saa[i][ModNameCol] + row[ModVerCol] + saa[i][PkgNameCol] + row[PkgVerCol], al); } - model1.addRow(saa[i]); - fpdMsa.put(saa[i][1]+saa[i][2]+saa[i][3]+saa[i][4], saa[i][0]); + al.add(saa[i][Path4Col]); + } } - + showAllModules(); - + } - + private void showAllModules() { - + if (miList == null) { miList = new ArrayList(); } Set spi = GlobalData.getPackageList(); Iterator ispi = spi.iterator(); - - while(ispi.hasNext()) { - PackageIdentification pi = (PackageIdentification)ispi.next(); - String[] s = {"", "", "", "", ""}; - s[3] = pi.getGuid(); - s[4] = pi.getVersion(); + + while (ispi.hasNext()) { + PackageIdentification pi = (PackageIdentification) ispi.next(); + String[] s = { "", "", "", "", "" }; + Set smi = GlobalData.getModules(pi); Iterator ismi = smi.iterator(); - while(ismi.hasNext()) { - ModuleIdentification mi = (ModuleIdentification)ismi.next(); - s[0] = mi.getName(); - s[1] = mi.getGuid(); - s[2] = mi.getVersion(); - model.addRow(s); + while (ismi.hasNext()) { + ModuleIdentification mi = (ModuleIdentification) ismi.next(); + s[ModNameCol] = mi.getName(); + s[ModVerCol] = mi.getVersion(); + s[PkgNameCol] = pi.getName(); + s[PkgVerCol] = pi.getVersion(); + try { + s[Path4Col] = GlobalData.getMsaFile(mi).getPath() + .substring(System.getenv("WORKSPACE").length() + 1); + } catch (Exception e) { + JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage()); + } + modelAllModules.addRow(s); miList.add(mi); } } } + /** * This method initializes this * @@ -420,38 +640,10 @@ public class FpdFrameworkModules extends IInternalFrame { this.setTitle("Framework Modules"); this.setContentPane(getJSplitPane()); this.setVisible(true); - - } - - private ModuleIdentification getModuleId(String key){ - // - // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion 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])){ -// || !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])){ -// && mi.getVersion().equals(keyPart[1])){ - return mi; - } - } - } - return null; } -} // @jve:decl-index=0:visual-constraint="10,10" +} // @jve:decl-index=0:visual-constraint="10,10" class NonEditableTableModel extends DefaultTableModel { /**