mirror of https://github.com/acidanthera/audk.git
Provide UI for generating Apriori file of PEI or DXE phase. The module order information are put into BuildOptions->UserExtensions with UserId as "APRIORI" and Identifier as "0" for PEI phase and "1" for DXE phase. Build tools will use these UserExtensions information to produce the Apriori files that will be placed into each FV image.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1912 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
15d449ba23
commit
99125b466d
|
@ -1800,15 +1800,15 @@ public class FpdFileContents {
|
|||
return fpdBuildOpts;
|
||||
}
|
||||
|
||||
public void genBuildOptionsUserExtensions(String fvName, String outputFileName, Vector<String[]> includeModules) {
|
||||
public void genBuildOptionsUserExtensions(String fvName, String userId, String id, String outputFileName, Vector<String[]> includeModules) {
|
||||
QName elementFvName = new QName (xmlNs, "FvName");
|
||||
QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
|
||||
QName elementInfFileName = new QName(xmlNs, "InfFileName");
|
||||
QName elementModule = new QName(xmlNs, "Module");
|
||||
|
||||
UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions();
|
||||
userExts.setUserID("IMAGES");
|
||||
userExts.setIdentifier(new BigInteger("1"));
|
||||
userExts.setUserID(userId);
|
||||
userExts.setIdentifier(new BigInteger(id));
|
||||
XmlCursor cursor = userExts.newCursor();
|
||||
cursor.toEndToken();
|
||||
|
||||
|
@ -1817,7 +1817,7 @@ public class FpdFileContents {
|
|||
cursor.toNextToken();
|
||||
|
||||
cursor.beginElement(elementInfFileName);
|
||||
cursor.insertChars(fvName + ".inf");
|
||||
cursor.insertChars(outputFileName);
|
||||
cursor.toNextToken();
|
||||
|
||||
cursor.beginElement(elementIncludeModules);
|
||||
|
@ -1839,15 +1839,19 @@ public class FpdFileContents {
|
|||
cursor.dispose();
|
||||
}
|
||||
|
||||
public int getUserExtsIncModCount (String fvName) {
|
||||
public int getUserExtsIncModCount (String fvName, String userId, int id) {
|
||||
if (getfpdBuildOpts().getUserExtensionsList() == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
|
||||
QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
|
||||
while (li.hasNext()) {
|
||||
UserExtensionsDocument.UserExtensions ues = li.next();
|
||||
if (!ues.getUserID().equals("IMAGES")) {
|
||||
if (!ues.getUserID().equals(userId)) {
|
||||
continue;
|
||||
}
|
||||
if (ues.getIdentifier() == null || ues.getIdentifier().intValue() != id) {
|
||||
continue;
|
||||
}
|
||||
XmlCursor cursor = ues.newCursor();
|
||||
|
@ -1869,7 +1873,7 @@ public class FpdFileContents {
|
|||
return -1;
|
||||
}
|
||||
|
||||
public void getUserExtsIncMods(String fvName, String[][] saa) {
|
||||
public void getUserExtsIncMods(String fvName, String userId, int id, String[][] saa) {
|
||||
if (getfpdBuildOpts().getUserExtensionsList() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1877,6 +1881,7 @@ public class FpdFileContents {
|
|||
XmlCursor cursor = getfpdBuildOpts().newCursor();
|
||||
QName elementUserExts = new QName (xmlNs, "UserExtensions");
|
||||
QName attribUserId = new QName ("UserID");
|
||||
QName attribId = new QName ("Identifier");
|
||||
QName elementFvName = new QName (xmlNs, "FvName");
|
||||
QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
|
||||
QName attribModuleGuid = new QName("ModuleGuid");
|
||||
|
@ -1888,7 +1893,7 @@ public class FpdFileContents {
|
|||
if (cursor.toChild(elementUserExts)) {
|
||||
do {
|
||||
cursor.push();
|
||||
if (cursor.getAttributeText(attribUserId).equals("IMAGES")) {
|
||||
if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id+"")) {
|
||||
cursor.toChild(elementFvName);
|
||||
String elementName = cursor.getTextValue();
|
||||
if (elementName.equals(fvName)) {
|
||||
|
@ -1935,7 +1940,7 @@ public class FpdFileContents {
|
|||
|
||||
}
|
||||
|
||||
public void removeBuildOptionsUserExtensions (String fvName) {
|
||||
public void removeBuildOptionsUserExtensions (String fvName, String userId, int id) {
|
||||
if (getfpdBuildOpts().getUserExtensionsList() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1943,7 +1948,10 @@ public class FpdFileContents {
|
|||
ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
|
||||
while (li.hasNext()) {
|
||||
UserExtensionsDocument.UserExtensions ues = li.next();
|
||||
if (!ues.getUserID().equals("IMAGES")) {
|
||||
if (!ues.getUserID().equals(userId)) {
|
||||
continue;
|
||||
}
|
||||
if (ues.getIdentifier()== null || ues.getIdentifier().intValue() != id) {
|
||||
continue;
|
||||
}
|
||||
XmlCursor cursor = ues.newCursor();
|
||||
|
@ -1974,13 +1982,13 @@ public class FpdFileContents {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean moduleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
|
||||
public boolean moduleInBuildOptionsUserExtensions (String fvName, String userId, int id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
|
||||
boolean inList = false;
|
||||
if (getUserExtsIncModCount(fvName) > 0) {
|
||||
|
||||
if (getUserExtsIncModCount(fvName, userId, id) > 0) {
|
||||
XmlCursor cursor = getfpdBuildOpts().newCursor();
|
||||
QName elementUserExts = new QName (xmlNs, "UserExtensions");
|
||||
QName attribUserId = new QName ("UserID");
|
||||
QName attribId = new QName ("Identifier");
|
||||
QName elementFvName = new QName (xmlNs, "FvName");
|
||||
QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
|
||||
QName attribModuleGuid = new QName("ModuleGuid");
|
||||
|
@ -1992,7 +2000,7 @@ public class FpdFileContents {
|
|||
if (cursor.toChild(elementUserExts)) {
|
||||
do {
|
||||
cursor.push();
|
||||
if (cursor.getAttributeText(attribUserId).equals("IMAGES")) {
|
||||
if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id+"")) {
|
||||
cursor.toChild(elementFvName);
|
||||
String elementName = cursor.getTextValue();
|
||||
if (elementName.equals(fvName)) {
|
||||
|
@ -2035,21 +2043,21 @@ public class FpdFileContents {
|
|||
return inList;
|
||||
}
|
||||
|
||||
public void removeModuleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
|
||||
public void removeModuleInBuildOptionsUserExtensions (String fvName, String userId, int id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
|
||||
//
|
||||
// if there is only one module before remove operation, the whole user extension should be removed.
|
||||
//
|
||||
int moduleAmount = getUserExtsIncModCount(fvName);
|
||||
int moduleAmount = getUserExtsIncModCount(fvName, userId, id);
|
||||
if (moduleAmount == 1) {
|
||||
removeBuildOptionsUserExtensions(fvName);
|
||||
removeBuildOptionsUserExtensions(fvName, userId, id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (moduleAmount > 1) {
|
||||
|
||||
XmlCursor cursor = getfpdBuildOpts().newCursor();
|
||||
QName elementUserExts = new QName (xmlNs, "UserExtensions");
|
||||
QName attribUserId = new QName ("UserID");
|
||||
QName attribId = new QName ("Identifier");
|
||||
QName elementFvName = new QName (xmlNs, "FvName");
|
||||
QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
|
||||
QName attribModuleGuid = new QName("ModuleGuid");
|
||||
|
@ -2061,7 +2069,7 @@ public class FpdFileContents {
|
|||
if (cursor.toChild(elementUserExts)) {
|
||||
do {
|
||||
cursor.push();
|
||||
if (cursor.getAttributeText(attribUserId).equals("IMAGES")) {
|
||||
if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id+"")) {
|
||||
cursor.toChild(elementFvName);
|
||||
String elementName = cursor.getTextValue();
|
||||
if (elementName.equals(fvName)) {
|
||||
|
@ -2102,16 +2110,20 @@ public class FpdFileContents {
|
|||
}
|
||||
}
|
||||
|
||||
public void addModuleIntoBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
|
||||
if (moduleInBuildOptionsUserExtensions (fvName, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) {
|
||||
public void addModuleIntoBuildOptionsUserExtensions (String fvName, String userId, int id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
|
||||
if (moduleInBuildOptionsUserExtensions (fvName, userId, id, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
|
||||
QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
|
||||
QName elementModule = new QName(xmlNs, "Module");
|
||||
while (li.hasNext()) {
|
||||
UserExtensionsDocument.UserExtensions ues = li.next();
|
||||
if (!ues.getUserID().equals("IMAGES")) {
|
||||
if (!ues.getUserID().equals(userId)) {
|
||||
continue;
|
||||
}
|
||||
if (ues.getIdentifier() == null || ues.getIdentifier().intValue() != id) {
|
||||
continue;
|
||||
}
|
||||
XmlCursor cursor = ues.newCursor();
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
|||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ItemEvent;
|
||||
|
@ -1268,7 +1269,10 @@ public class FpdFlash extends IInternalFrame {
|
|||
if (index >= startIndexOfDynamicTab) {
|
||||
return;
|
||||
}
|
||||
jTabbedPane.addTab(fvName, null, new ModuleOrderPane(fvName, outputFile), null);
|
||||
ModuleOrderPane pane = new ModuleOrderPane(fvName, outputFile, ffc, this);
|
||||
pane.showModulesInFv(fvName);
|
||||
pane.showAllModulesInPlatform();
|
||||
jTabbedPane.addTab(fvName, null, pane, null);
|
||||
}
|
||||
/**
|
||||
* This method initializes jTextField4
|
||||
|
@ -1799,7 +1803,10 @@ public class FpdFlash extends IInternalFrame {
|
|||
ffc.updateFvImageNameAll(oldFvName, newFvName);
|
||||
|
||||
} else {
|
||||
jTabbedPane.addTab(newFvName, new ModuleOrderPane(newFvName, ""));
|
||||
ModuleOrderPane pane = new ModuleOrderPane(newFvName, "", ffc, FpdFlash.this);
|
||||
pane.showModulesInFv(newFvName);
|
||||
pane.showAllModulesInPlatform();
|
||||
jTabbedPane.addTab(newFvName, pane);
|
||||
// Add FvImageNames in Flash
|
||||
String[] fvNames = {newFvName};
|
||||
ffc.addFvImageFvImageNames(fvNames);
|
||||
|
@ -2476,108 +2483,26 @@ public class FpdFlash extends IInternalFrame {
|
|||
|
||||
}
|
||||
|
||||
// class ModuleSAInfo {
|
||||
// private int rowNumber = -1;
|
||||
// private String moduleGuid = null;
|
||||
// private String moduleVersion = null;
|
||||
// private String packageGuid = null;
|
||||
// private String packageVersion = null;
|
||||
// private String arch = null;
|
||||
//
|
||||
// public ModuleSAInfo (String mg, String mv, String pg, String pv, String a) {
|
||||
// moduleGuid = mg;
|
||||
// moduleVersion = mv;
|
||||
// packageGuid = pg;
|
||||
// packageVersion = pv;
|
||||
// arch = a;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the arch.
|
||||
// */
|
||||
// public String getArch() {
|
||||
// return arch;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param arch The arch to set.
|
||||
// */
|
||||
// public void setArch(String arch) {
|
||||
// this.arch = arch;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the moduleGuid.
|
||||
// */
|
||||
// public String getModuleGuid() {
|
||||
// return moduleGuid;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param moduleGuid The moduleGuid to set.
|
||||
// */
|
||||
// public void setModuleGuid(String moduleGuid) {
|
||||
// this.moduleGuid = moduleGuid;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the moduleVersion.
|
||||
// */
|
||||
// public String getModuleVersion() {
|
||||
// return moduleVersion;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param moduleVersion The moduleVersion to set.
|
||||
// */
|
||||
// public void setModuleVersion(String moduleVersion) {
|
||||
// this.moduleVersion = moduleVersion;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the packageGuid.
|
||||
// */
|
||||
// public String getPackageGuid() {
|
||||
// return packageGuid;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param packageGuid The packageGuid to set.
|
||||
// */
|
||||
// public void setPackageGuid(String packageGuid) {
|
||||
// this.packageGuid = packageGuid;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the packageVersion.
|
||||
// */
|
||||
// public String getPackageVersion() {
|
||||
// return packageVersion;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param packageVersion The packageVersion to set.
|
||||
// */
|
||||
// public void setPackageVersion(String packageVersion) {
|
||||
// this.packageVersion = packageVersion;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the rowNumber.
|
||||
// */
|
||||
// public int getRowNumber() {
|
||||
// return rowNumber;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param rowNumber The rowNumber to set.
|
||||
// */
|
||||
// public void setRowNumber(int rowNumber) {
|
||||
// this.rowNumber = rowNumber;
|
||||
// }
|
||||
// }
|
||||
/* (non-Javadoc)
|
||||
* @see org.tianocore.frameworkwizard.common.ui.IInternalFrame#actionPerformed(java.awt.event.ActionEvent)
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
|
||||
docConsole.setSaved(false);
|
||||
jTabbedPane.setSelectedIndex(0);
|
||||
}
|
||||
else if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
|
||||
jTabbedPane.setSelectedIndex(0);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private class ModuleOrderPane extends JPanel {
|
||||
} // @jve:decl-index=0:visual-constraint="10,10"
|
||||
|
||||
class ModuleOrderPane extends JPanel implements ActionListener{
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -2599,30 +2524,33 @@ public class FpdFlash extends IInternalFrame {
|
|||
private JButton jButtonCancel = null;
|
||||
private IDefaultTableModel modInFvTableModel = null;
|
||||
private IDefaultTableModel fpdModTableModel = null;
|
||||
// private ArrayList<ModuleSAInfo> listTableModInFvModuleSAInfo = null;
|
||||
// private ArrayList<ModuleSAInfo> listTableFpdModulesModuleSAInfo = null;
|
||||
private FpdFileContents ffc = null;
|
||||
private String title = null;
|
||||
private String outputFileName = null;
|
||||
|
||||
public ModuleOrderPane(String tabTitle, String file) {
|
||||
public ModuleOrderPane(String tabTitle, String file, FpdFileContents inputFfc, ActionListener action) {
|
||||
super(new BorderLayout());
|
||||
title = tabTitle;
|
||||
outputFileName = file;
|
||||
// listTableModInFvModuleSAInfo = new ArrayList<ModuleSAInfo>();
|
||||
// listTableFpdModulesModuleSAInfo = new ArrayList<ModuleSAInfo>();
|
||||
ffc = inputFfc;
|
||||
add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH);
|
||||
add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH);
|
||||
add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER);
|
||||
showModulesInFv(title);
|
||||
showAllModulesInPlatform();
|
||||
jButtonOk.addActionListener(action);
|
||||
jButtonCancel.addActionListener(action);
|
||||
|
||||
}
|
||||
|
||||
private void showModulesInFv(String fvName) {
|
||||
int size = ffc.getUserExtsIncModCount(fvName);
|
||||
public void showModulesInFv(String fvName) {
|
||||
|
||||
if (modInFvTableModel == null) {
|
||||
return;
|
||||
}
|
||||
int size = ffc.getUserExtsIncModCount(fvName, "IMAGES", 1);
|
||||
|
||||
if (size != -1) {
|
||||
String[][] saa = new String[size][5];
|
||||
ffc.getUserExtsIncMods(fvName, saa);
|
||||
ffc.getUserExtsIncMods(fvName, "IMAGES", 1, saa);
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
|
||||
|
@ -2662,7 +2590,11 @@ public class FpdFlash extends IInternalFrame {
|
|||
|
||||
}
|
||||
|
||||
private void showAllModulesInPlatform() {
|
||||
public void showAllModulesInPlatform() {
|
||||
|
||||
if (modInFvTableModel == null || fpdModTableModel == null) {
|
||||
return;
|
||||
}
|
||||
int size = ffc.getFrameworkModulesCount();
|
||||
String[][] saa = new String[size][5];
|
||||
ffc.getFrameworkModulesInfo(saa);
|
||||
|
@ -2686,7 +2618,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
}
|
||||
|
||||
|
||||
private boolean moduleInfoInTable (String[] moduleInfo, DefaultTableModel model) {
|
||||
protected boolean moduleInfoInTable (String[] moduleInfo, DefaultTableModel model) {
|
||||
boolean matched = false;
|
||||
int size = model.getDataVector().size();
|
||||
for (int i = 0; i < size; ++i) {
|
||||
|
@ -2783,7 +2715,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
*
|
||||
* @return javax.swing.JTable
|
||||
*/
|
||||
private JTable getJTableModInFv() {
|
||||
protected JTable getJTableModInFv() {
|
||||
if (jTableModInFv == null) {
|
||||
modInFvTableModel = new IDefaultTableModel();
|
||||
|
||||
|
@ -2852,7 +2784,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
if (mi != null) {
|
||||
details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
|
||||
}
|
||||
JOptionPane.showMessageDialog(frame, details);
|
||||
JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2970,7 +2902,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
if (mi != null) {
|
||||
details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
|
||||
}
|
||||
JOptionPane.showMessageDialog(frame, details);
|
||||
JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3076,7 +3008,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
String[] row = {name, mg, mv, pg, pv, arch};
|
||||
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 );
|
||||
JOptionPane.showMessageDialog(ModuleOrderPane.this, "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;
|
||||
}
|
||||
|
@ -3122,13 +3054,36 @@ public class FpdFlash extends IInternalFrame {
|
|||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonOk() {
|
||||
protected JButton getJButtonOk() {
|
||||
if (jButtonOk == null) {
|
||||
jButtonOk = new JButton();
|
||||
jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonOk.setText("Ok");
|
||||
jButtonOk.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent e) {
|
||||
jButtonOk.setActionCommand("ModuleOrderPaneOk");
|
||||
jButtonOk.addActionListener(this);
|
||||
|
||||
}
|
||||
return jButtonOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonCancel
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
protected JButton getJButtonCancel() {
|
||||
if (jButtonCancel == null) {
|
||||
jButtonCancel = new JButton();
|
||||
jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonCancel.setText("Cancel");
|
||||
jButtonCancel.setActionCommand("ModuleOrderPaneCancel");
|
||||
|
||||
}
|
||||
return jButtonCancel;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == jButtonOk) {
|
||||
// need reset FvBindings in ModuleSA.
|
||||
ffc.removeFvBindingAll(title);
|
||||
//
|
||||
|
@ -3155,38 +3110,27 @@ public class FpdFlash extends IInternalFrame {
|
|||
ffc.updateFvBindingInModuleSA(moduleInfo, title);
|
||||
|
||||
}
|
||||
ffc.removeBuildOptionsUserExtensions(title);
|
||||
ffc.genBuildOptionsUserExtensions(title, outputFileName, vModInFv);
|
||||
ffc.removeBuildOptionsUserExtensions(title, "IMAGES", 1);
|
||||
ffc.genBuildOptionsUserExtensions(title, "IMAGES", "1", outputFileName, vModInFv);
|
||||
|
||||
docConsole.setSaved(false);
|
||||
jTabbedPane.setSelectedIndex(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
return jButtonOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonCancel
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
* @return Returns the fpdModTableModel.
|
||||
*/
|
||||
private JButton getJButtonCancel() {
|
||||
if (jButtonCancel == null) {
|
||||
jButtonCancel = new JButton();
|
||||
jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonCancel.setText("Cancel");
|
||||
jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent e) {
|
||||
jTabbedPane.setSelectedIndex(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
return jButtonCancel;
|
||||
}
|
||||
protected IDefaultTableModel getFpdModTableModel() {
|
||||
return fpdModTableModel;
|
||||
}
|
||||
|
||||
} // @jve:decl-index=0:visual-constraint="10,10"
|
||||
/**
|
||||
* @return Returns the modInFvTableModel.
|
||||
*/
|
||||
protected IDefaultTableModel getModInFvTableModel() {
|
||||
return modInFvTableModel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class FvOptsTableModel extends DefaultTableModel {
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
|||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
|
@ -189,6 +190,8 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
|
||||
private final int typeMaxWidth = 155;
|
||||
|
||||
private JButton jButtonApriori = null;
|
||||
|
||||
/**
|
||||
* This method initializes jSplitPane
|
||||
*
|
||||
|
@ -526,6 +529,7 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
jPanelBottomSouth.setLayout(flowLayout1);
|
||||
jPanelBottomSouth.add(getJButtonSettings(), null);
|
||||
jPanelBottomSouth.add(getJButtonRemoveModule(), null);
|
||||
jPanelBottomSouth.add(getJButtonApriori(), null);
|
||||
}
|
||||
return jPanelBottomSouth;
|
||||
}
|
||||
|
@ -751,7 +755,7 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
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);
|
||||
ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", 1, mg, mv, pg, pv, arch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -795,6 +799,29 @@ public class FpdFrameworkModules extends IInternalFrame {
|
|||
return jButtonRemoveModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonApriori
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonApriori() {
|
||||
if (jButtonApriori == null) {
|
||||
jButtonApriori = new JButton();
|
||||
jButtonApriori.setText("Apriori Files");
|
||||
FontMetrics fm = jButtonApriori.getFontMetrics(jButtonApriori.getFont());
|
||||
int buttonWidth = fm.stringWidth(jButtonApriori.getText()) + 40;
|
||||
if (jButtonRemoveModule.getWidth() > buttonWidth) {
|
||||
buttonWidth = jButtonRemoveModule.getWidth();
|
||||
}
|
||||
jButtonApriori.setPreferredSize(new Dimension (buttonWidth, 20));
|
||||
jButtonApriori.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
new GenAprioriFileDialog(ffc, docConsole).setVisible(true);
|
||||
}});
|
||||
}
|
||||
return jButtonApriori;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param args
|
||||
|
|
|
@ -1331,7 +1331,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||
//
|
||||
oldFvList.removeAll(newFvList);
|
||||
for (int j = 0; j < oldFvList.size(); ++j) {
|
||||
ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
|
||||
ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), "IMAGES", 1, moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
|
||||
}
|
||||
//
|
||||
// add module to Fvs that were not in oldFvList.
|
||||
|
@ -1339,7 +1339,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||
oldFvList = getVectorFromString (originalFvBinding);
|
||||
newFvList.removeAll(oldFvList);
|
||||
for (int i = 0; i < newFvList.size(); ++i) {
|
||||
ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
|
||||
ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), "IMAGES", 1, moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
|
||||
}
|
||||
docConsole.setSaved(false);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,265 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.tianocore.frameworkwizard.platform.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
|
||||
|
||||
/**
|
||||
* @author jlin16
|
||||
*
|
||||
*/
|
||||
public class GenAprioriFileDialog extends JDialog implements ActionListener {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3627991301208644354L;
|
||||
private JPanel jContentPane = null;
|
||||
private JPanel jPanelN = null;
|
||||
private JLabel jLabelFvName = null;
|
||||
private JComboBox jComboBoxFvNames = null;
|
||||
private JTabbedPane jTabbedPane = null;
|
||||
private FpdFileContents ffc = null;
|
||||
private OpeningPlatformType docConsole = null;
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public GenAprioriFileDialog(FpdFileContents inputFfc, OpeningPlatformType dc) {
|
||||
super();
|
||||
ffc = inputFfc;
|
||||
docConsole = dc;
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void initialize() {
|
||||
this.setSize(670, 670);
|
||||
this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
this.setTitle("Apriori Files");
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setResizable(false);
|
||||
this.setModal(true);
|
||||
|
||||
String fvName = jComboBoxFvNames.getSelectedItem()+"";
|
||||
if (fvName.length() > 0) {
|
||||
jTabbedPane.removeAll();
|
||||
AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
|
||||
peiPane.showModulesInFv(fvName);
|
||||
peiPane.showAllModulesInPlatform();
|
||||
jTabbedPane.addTab("PEIMs", peiPane);
|
||||
AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
|
||||
dxePane.showModulesInFv(fvName);
|
||||
dxePane.showAllModulesInPlatform();
|
||||
jTabbedPane.addTab("DXE Drivers", dxePane);
|
||||
}
|
||||
this.centerWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(new BorderLayout());
|
||||
jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH);
|
||||
jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
|
||||
docConsole.setSaved(false);
|
||||
return;
|
||||
}
|
||||
if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Start the window at the center of screen
|
||||
|
||||
**/
|
||||
protected void centerWindow(int intWidth, int intHeight) {
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
Start the window at the center of screen
|
||||
|
||||
**/
|
||||
protected void centerWindow() {
|
||||
centerWindow(this.getSize().width, this.getSize().height);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jPanelN
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelN() {
|
||||
if (jPanelN == null) {
|
||||
jLabelFvName = new JLabel();
|
||||
jLabelFvName.setText("FV Name");
|
||||
jPanelN = new JPanel();
|
||||
jPanelN.add(jLabelFvName, null);
|
||||
jPanelN.add(getJComboBoxFvNames(), null);
|
||||
}
|
||||
return jPanelN;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jComboBoxFvNames
|
||||
*
|
||||
* @return javax.swing.JComboBox
|
||||
*/
|
||||
private JComboBox getJComboBoxFvNames() {
|
||||
if (jComboBoxFvNames == null) {
|
||||
jComboBoxFvNames = new JComboBox();
|
||||
jComboBoxFvNames.setPreferredSize(new java.awt.Dimension(200,20));
|
||||
Vector<String> vFvNames = new Vector<String>();
|
||||
ffc.getFvImagesFvImageFvImageNames(vFvNames);
|
||||
for (int i = 0; i < vFvNames.size(); ++i) {
|
||||
jComboBoxFvNames.addItem(vFvNames.get(i));
|
||||
}
|
||||
// if (jComboBoxFvNames.getItemCount() > 0) {
|
||||
// jComboBoxFvNames.setSelectedIndex(0);
|
||||
//
|
||||
// }
|
||||
jComboBoxFvNames.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent e) {
|
||||
String fvName = jComboBoxFvNames.getSelectedItem()+"";
|
||||
if (fvName.length() > 0) {
|
||||
jTabbedPane.removeAll();
|
||||
AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
|
||||
peiPane.showModulesInFv(fvName);
|
||||
peiPane.showAllModulesInPlatform();
|
||||
jTabbedPane.addTab("PEIMs", peiPane);
|
||||
AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
|
||||
dxePane.showModulesInFv(fvName);
|
||||
dxePane.showAllModulesInPlatform();
|
||||
jTabbedPane.addTab("DXE Drivers", dxePane);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
return jComboBoxFvNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTabbedPane
|
||||
*
|
||||
* @return javax.swing.JTabbedPane
|
||||
*/
|
||||
private JTabbedPane getJTabbedPane() {
|
||||
if (jTabbedPane == null) {
|
||||
jTabbedPane = new JTabbedPane();
|
||||
}
|
||||
return jTabbedPane;
|
||||
}
|
||||
|
||||
private class AprioriModuleOrderPane extends ModuleOrderPane {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7952853414833230546L;
|
||||
private boolean forPEI = false;
|
||||
private String fvName = null;
|
||||
|
||||
AprioriModuleOrderPane (String fvName, String file, ActionListener action, boolean b) {
|
||||
|
||||
super(fvName, file, ffc, action);
|
||||
this.fvName = fvName;
|
||||
forPEI = b;
|
||||
getJTableModInFv().getColumnModel().getColumn(0).setHeaderValue("Modules in Apriori File");
|
||||
getJButtonOk().setText("Save");
|
||||
getJButtonCancel().setText("Close");
|
||||
}
|
||||
|
||||
public void showModulesInFv (String fvName) {
|
||||
int id = 1;
|
||||
if (forPEI) {
|
||||
id = 0;
|
||||
}
|
||||
int size = ffc.getUserExtsIncModCount(fvName, "APRIORI", id);
|
||||
|
||||
if (size != -1) {
|
||||
String[][] saa = new String[size][5];
|
||||
ffc.getUserExtsIncMods(fvName, "APRIORI", id, saa);
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
|
||||
ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
|
||||
String name = "N/A";
|
||||
if (mi != null) {
|
||||
name = mi.getName();
|
||||
}
|
||||
|
||||
String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
|
||||
getModInFvTableModel().addRow(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
|
||||
int id = 1;
|
||||
if (forPEI) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
Vector<String[]> vModInFv = new Vector<String[]>();
|
||||
for (int i = 0; i < getJTableModInFv().getRowCount(); ++i) {
|
||||
String moduleName = getModInFvTableModel().getValueAt(i, 0)+"";
|
||||
if (moduleName.length() == 0 || moduleName.equals("N/A")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String mg = getModInFvTableModel().getValueAt(i, 1)+"";
|
||||
String mv = getModInFvTableModel().getValueAt(i, 2)+"";
|
||||
String pg = getModInFvTableModel().getValueAt(i, 3)+"";
|
||||
String pv = getModInFvTableModel().getValueAt(i, 4)+"";
|
||||
String arch = getModInFvTableModel().getValueAt(i, 5)+"";
|
||||
|
||||
String[] sa = { mg, mv, pg, pv, arch};
|
||||
vModInFv.add(sa);
|
||||
|
||||
}
|
||||
|
||||
ffc.removeBuildOptionsUserExtensions(fvName, "APRIORI", id);
|
||||
ffc.genBuildOptionsUserExtensions(fvName, "APRIORI", id+"", "", vModInFv);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} // @jve:decl-index=0:visual-constraint="10,10"
|
Loading…
Reference in New Issue