mirror of https://github.com/acidanthera/audk.git
a. Enhanced toolchain setting UI for ModuleSa build options and global build options.
b. Fpd editor, Flash part UI FV operations. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1440 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
6f55be9f0b
commit
98c207975e
|
@ -1802,7 +1802,11 @@ public class FpdBuildOptions extends IInternalFrame {
|
|||
vArch.add("ARM");
|
||||
vArch.add("PPC");
|
||||
jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch));
|
||||
|
||||
jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
|
||||
|
||||
jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
|
||||
jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedRow = -1;
|
||||
|
|
|
@ -988,7 +988,9 @@ public class FpdFileContents {
|
|||
|
||||
if (opt.getSupArchList() != null){
|
||||
saa[i][4] = listToString(opt.getSupArchList());
|
||||
|
||||
}
|
||||
else {
|
||||
saa[i][4] = "";
|
||||
}
|
||||
|
||||
saa[i][5] = opt.getStringValue();
|
||||
|
@ -2589,7 +2591,19 @@ public class FpdFileContents {
|
|||
}
|
||||
|
||||
public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {
|
||||
FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
|
||||
if (fis == null || fis.getFvImageList() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
|
||||
while (li.hasNext()) {
|
||||
FvImagesDocument.FvImages.FvImage fi = li.next();
|
||||
if (fi.getType().toString().equals("ImageName")) {
|
||||
vImageNames.addAll(fi.getFvImageNamesList());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddFvImageFvImageNames (String[] fvNames) {
|
||||
|
@ -2672,6 +2686,10 @@ public class FpdFileContents {
|
|||
cursor.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param oldFvName
|
||||
* @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
|
||||
*/
|
||||
public void updateFvImageNameAll (String oldFvName, String newFvName) {
|
||||
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
|
||||
return;
|
||||
|
@ -2683,6 +2701,11 @@ public class FpdFileContents {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fi
|
||||
* @param oldFvName The FV Name to be replaced.
|
||||
* @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
|
||||
*/
|
||||
public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {
|
||||
QName qFvImageNames = new QName(xmlNs, "FvImageNames");
|
||||
XmlCursor cursor = fi.newCursor();
|
||||
|
@ -2690,7 +2713,18 @@ public class FpdFileContents {
|
|||
if (cursor.toChild(qFvImageNames)) {
|
||||
do {
|
||||
if (cursor.getTextValue().equals(oldFvName)){
|
||||
cursor.setTextValue(newFvName);
|
||||
if (newFvName != null) {
|
||||
cursor.setTextValue(newFvName);
|
||||
}
|
||||
else {
|
||||
if (fi.getFvImageNamesList().size() == 1) {
|
||||
removeElement(fi);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
cursor.removeXml();
|
||||
}
|
||||
}
|
||||
}
|
||||
}while (cursor.toNextSibling(qFvImageNames));
|
||||
}
|
||||
|
@ -2738,18 +2772,50 @@ public class FpdFileContents {
|
|||
cursor.dispose();
|
||||
}
|
||||
|
||||
public int getFvImagesFvImageCount() {
|
||||
public int getFvImagesFvImageCount(String type) {
|
||||
|
||||
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
|
||||
return 0;
|
||||
}
|
||||
return getfpdFlash().getFvImages().getFvImageList().size();
|
||||
List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
|
||||
ListIterator li = l.listIterator();
|
||||
int i = 0;
|
||||
while(li.hasNext()) {
|
||||
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
|
||||
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**Only Get Fv image setting - name and type.
|
||||
public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {
|
||||
Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();
|
||||
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
|
||||
return vFvImage;
|
||||
}
|
||||
List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
|
||||
ListIterator li = l.listIterator();
|
||||
while(li.hasNext()) {
|
||||
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
|
||||
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
|
||||
continue;
|
||||
}
|
||||
if (fi.getFvImageNamesList().contains(fvName)) {
|
||||
vFvImage.add(fi);
|
||||
}
|
||||
}
|
||||
|
||||
return vFvImage;
|
||||
}
|
||||
/**
|
||||
* @param saa
|
||||
* @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.
|
||||
*/
|
||||
public void getFvImagesFvImages(String[][] saa) {
|
||||
public void getFvImagesFvImages(String[][] saa, String type) {
|
||||
|
||||
if (getfpdFlash().getFvImages() == null) {
|
||||
return;
|
||||
|
@ -2762,6 +2828,9 @@ public class FpdFileContents {
|
|||
int i = 0;
|
||||
while(li.hasNext()) {
|
||||
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
|
||||
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// get FvImageNames array, space separated
|
||||
//
|
||||
|
@ -2780,6 +2849,108 @@ public class FpdFileContents {
|
|||
}
|
||||
}
|
||||
|
||||
/**Add name-value pair to FvImage element with type.
|
||||
* @param fvName FV name to add name-value pair.
|
||||
* @param type FvImage attribute.
|
||||
* @param name
|
||||
* @param value
|
||||
*/
|
||||
public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value) {
|
||||
if (getfpdFlash().getFvImages() == null) {
|
||||
return;
|
||||
}
|
||||
List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
|
||||
if (l == null) {
|
||||
return;
|
||||
}
|
||||
ListIterator li = l.listIterator();
|
||||
while(li.hasNext()) {
|
||||
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
|
||||
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
|
||||
continue;
|
||||
}
|
||||
if (!fi.getFvImageNamesList().contains(fvName)) {
|
||||
continue;
|
||||
}
|
||||
setFvImagesFvImageNameValue (fi, name, value, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**Add to all FvImage elements with type, the name-value pair.
|
||||
* @param type
|
||||
* @param name
|
||||
* @param value
|
||||
*/
|
||||
public void setTypedFvImageNameValue (String type, String name, String value) {
|
||||
if (getfpdFlash().getFvImages() == null) {
|
||||
return;
|
||||
}
|
||||
List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
|
||||
if (l == null) {
|
||||
return;
|
||||
}
|
||||
ListIterator li = l.listIterator();
|
||||
while(li.hasNext()) {
|
||||
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
|
||||
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
|
||||
continue;
|
||||
}
|
||||
setFvImagesFvImageNameValue (fi, name, value, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.
|
||||
* @param fi
|
||||
* @param name
|
||||
* @param value
|
||||
* @param newName
|
||||
*/
|
||||
public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {
|
||||
if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
XmlCursor cursor = fi.getFvImageOptions().newCursor();
|
||||
if (cursor.toFirstChild()) {
|
||||
do {
|
||||
FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();
|
||||
if (nv.getName().equals(name)) {
|
||||
nv.setValue(value);
|
||||
if (newName != null) {
|
||||
nv.setName(newName);
|
||||
}
|
||||
cursor.dispose();
|
||||
return;
|
||||
}
|
||||
}while (cursor.toNextSibling());
|
||||
}
|
||||
|
||||
FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();
|
||||
nv.setName(name);
|
||||
nv.setValue(value);
|
||||
if (newName != null) {
|
||||
nv.setName(newName);
|
||||
}
|
||||
cursor.dispose();
|
||||
}
|
||||
|
||||
public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {
|
||||
Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");
|
||||
for (int i = 0; i < vFvImage.size(); ++i) {
|
||||
FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
|
||||
if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()
|
||||
.getNameValueList()
|
||||
.listIterator();
|
||||
while (li.hasNext()) {
|
||||
FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
|
||||
m.put(nv.getName(), nv.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
/**Get FvImage Options for FvImage i
|
||||
* @param i the ith FvImage
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.JButton;
|
|||
import javax.swing.ListSelectionModel;
|
||||
|
||||
import org.tianocore.PlatformSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.common.DataValidation;
|
||||
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
|
||||
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
|
||||
|
@ -152,13 +153,16 @@ public class FpdFlash extends IInternalFrame {
|
|||
private JButton jButtonFvInFdfOptions = null;
|
||||
private JScrollPane jScrollPaneFvAdditional = null;
|
||||
private JTable jTableFvAdditional = null;
|
||||
private DefaultTableModel fvAddtionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
|
||||
private DefaultTableModel fvAdditionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
|
||||
private JButton jButtonAddFv = null;
|
||||
private JButton jButtonDelFv = null;
|
||||
private JButton jButtonAddFvOptions = null;
|
||||
private int tabIndexForFv = -1;
|
||||
private int selectedRowInFvAdditionalTable = -1;
|
||||
private String oldFvName = null;
|
||||
private Vector<String> vBlockSize = new Vector<String>();
|
||||
private String erasePolarity = null;
|
||||
boolean memModified = false;
|
||||
|
||||
|
||||
public FpdFlash() {
|
||||
|
@ -267,12 +271,12 @@ public class FpdFlash extends IInternalFrame {
|
|||
fvImageParaTableModel.setRowCount(0);
|
||||
fvPropertyTableModel.setRowCount(0);
|
||||
|
||||
if (ffc.getFvImagesFvImageCount() == 0) {
|
||||
if (ffc.getFvImagesFvImageCount("Attributes") == 0) {
|
||||
return;
|
||||
}
|
||||
String[][] saa = new String[ffc.getFvImagesFvImageCount()][2];
|
||||
ffc.getFvImagesFvImages(saa);
|
||||
|
||||
String[][] saa = new String[ffc.getFvImagesFvImageCount("Attributes")][2];
|
||||
ffc.getFvImagesFvImages(saa, "Attributes");
|
||||
|
||||
int i = 0;
|
||||
while (i < saa.length) {
|
||||
fvImageParaTableModel.addRow(saa[i]);
|
||||
|
@ -622,10 +626,10 @@ public class FpdFlash extends IInternalFrame {
|
|||
private JComboBox getJComboBoxFvParaType() {
|
||||
if (jComboBoxFvParaType == null) {
|
||||
jComboBoxFvParaType = new JComboBox();
|
||||
jComboBoxFvParaType.addItem("ImageName");
|
||||
// jComboBoxFvParaType.addItem("ImageName");
|
||||
jComboBoxFvParaType.addItem("Attributes");
|
||||
jComboBoxFvParaType.addItem("Options");
|
||||
jComboBoxFvParaType.addItem("Components");
|
||||
// jComboBoxFvParaType.addItem("Components");
|
||||
jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20));
|
||||
jComboBoxFvParaType.setEnabled(false);
|
||||
jComboBoxFvParaType.addItemListener(new ItemListener() {
|
||||
|
@ -869,13 +873,13 @@ public class FpdFlash extends IInternalFrame {
|
|||
fvImageParaTableModel.addColumn("Type");
|
||||
|
||||
|
||||
TableColumn typeCol = jTableFvInfo.getColumnModel().getColumn(1);
|
||||
JComboBox cb = new JComboBox();
|
||||
cb.addItem("ImageName");
|
||||
cb.addItem("Attributes");
|
||||
cb.addItem("Options");
|
||||
cb.addItem("Components");
|
||||
typeCol.setCellEditor(new DefaultCellEditor(cb));
|
||||
// TableColumn typeCol = jTableFvInfo.getColumnModel().getColumn(1);
|
||||
// JComboBox cb = new JComboBox();
|
||||
// cb.addItem("ImageName");
|
||||
// cb.addItem("Attributes");
|
||||
// cb.addItem("Options");
|
||||
// cb.addItem("Components");
|
||||
// typeCol.setCellEditor(new DefaultCellEditor(cb));
|
||||
|
||||
jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
|
||||
|
@ -931,7 +935,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
if (jButtonDelFvImage == null) {
|
||||
jButtonDelFvImage = new JButton();
|
||||
jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(120,20));
|
||||
// jButton6.setEnabled(false);
|
||||
jButtonDelFvImage.setEnabled(false);
|
||||
jButtonDelFvImage.setText("Delete Row");
|
||||
jButtonDelFvImage.addActionListener(new AbstractAction() {
|
||||
/**
|
||||
|
@ -1131,23 +1135,88 @@ public class FpdFlash extends IInternalFrame {
|
|||
}
|
||||
|
||||
private void initFvAdditionalTable() {
|
||||
|
||||
Vector<String> vFvNames = new Vector<String>();
|
||||
ffc.getFvImagesFvImageFvImageNames(vFvNames);
|
||||
for (int i = 0; i < vFvNames.size(); ++i) {
|
||||
String fvName = vFvNames.get(i);
|
||||
if (fvNameExists(fvName)) {
|
||||
continue;
|
||||
}
|
||||
HashMap<String, String> mFvOpts = new HashMap<String, String>();
|
||||
ffc.getFvImagesFvImageOptions(fvName, mFvOpts);
|
||||
String bSize = "";
|
||||
String numBlks = "";
|
||||
String fvSize = "";
|
||||
String fvFile = "";
|
||||
if (mFvOpts.get("EFI_FILE_NAME") != null) {
|
||||
fvFile = mFvOpts.get("EFI_FILE_NAME");
|
||||
}
|
||||
if (mFvOpts.get("EFI_BLOCK_SIZE") != null && mFvOpts.get("EFI_NUM_BLOCKS") != null) {
|
||||
bSize = mFvOpts.get("EFI_BLOCK_SIZE");
|
||||
numBlks = mFvOpts.get("EFI_NUM_BLOCKS");
|
||||
boolean blockSizeWellFormat = true;
|
||||
boolean numOfBlockWellFormat = true;
|
||||
if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {
|
||||
blockSizeWellFormat = false;
|
||||
JOptionPane.showMessageDialog(frame, fvName + " block size bad format.");
|
||||
}
|
||||
if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {
|
||||
numOfBlockWellFormat = false;
|
||||
JOptionPane.showMessageDialog(frame, fvName + " number of blocks bad format.");
|
||||
}
|
||||
if (blockSizeWellFormat && numOfBlockWellFormat) {
|
||||
int size = Integer.decode(bSize);
|
||||
int num = Integer.decode(numBlks);
|
||||
fvSize = size*num + "";
|
||||
}
|
||||
}
|
||||
fvAdditionalTableModel.addRow(new String[]{fvName, fvSize, fvFile});
|
||||
addTabForFv(new FvInfoFromFdf(fvName, "", ""));
|
||||
}
|
||||
}
|
||||
|
||||
private void initFvInFdfTable(String fdfPath){
|
||||
Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
|
||||
getFvInfoFromFdf(fdfPath, vFvInfo);
|
||||
getFlashInfoFromFdf (fdfPath, vBlockSize, erasePolarity);
|
||||
ffc.setTypedFvImageNameValue("Attributes", "ErasePolarity", erasePolarity);
|
||||
// BugBug: assume all blocks have same size;
|
||||
String blkSize = vBlockSize.get(0);
|
||||
|
||||
getFvInFdfTableModel().setRowCount(0);
|
||||
for (int j = 0; j < vFvInfo.size(); ++j) {
|
||||
FvInfoFromFdf fvInfo = vFvInfo.get(j);
|
||||
String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
|
||||
getFvInFdfTableModel().addRow(row);
|
||||
try {
|
||||
int blockSize = Integer.decode(blkSize);
|
||||
int fvSize = Integer.decode(row[1]);
|
||||
int numBlocks = fvSize/blockSize;
|
||||
// if no options for this FV before, generate a new options entry for this FV.
|
||||
if (ffc.getFvImagesFvImageWithName(row[0], "Options") == null) {
|
||||
HashMap<String, String> mOptions = new HashMap<String, String>();
|
||||
mOptions.put("EFI_BLOCK_SIZE", blkSize);
|
||||
mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");
|
||||
mOptions.put("EFI_FILE_NAME", row[2]);
|
||||
ffc.genFvImagesFvImage(new String[]{row[0]}, "Options", mOptions);
|
||||
memModified = true;
|
||||
}
|
||||
else {
|
||||
ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize);
|
||||
ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "");
|
||||
ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2]);
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e){
|
||||
JOptionPane.showMessageDialog(frame, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < vFvInfo.size(); ++k) {
|
||||
FvInfoFromFdf fvInfo = vFvInfo.get(k);
|
||||
addTabForFv(fvInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addTabForFv (FvInfoFromFdf fvInfo) {
|
||||
|
@ -1300,6 +1369,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
jButtonUpdateFvImage = new JButton();
|
||||
jButtonUpdateFvImage.setPreferredSize(new Dimension(120, 20));
|
||||
jButtonUpdateFvImage.setActionCommand("Update");
|
||||
jButtonUpdateFvImage.setEnabled(false);
|
||||
jButtonUpdateFvImage.setText("Update FV");
|
||||
jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent e) {
|
||||
|
@ -1590,7 +1660,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
jTableFvAdditional = new JTable();
|
||||
jTableFvAdditional.setRowHeight(20);
|
||||
jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
jTableFvAdditional.setModel(getFvAddtionalTableModel());
|
||||
jTableFvAdditional.setModel(getFvAdditionalTableModel());
|
||||
|
||||
jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
|
@ -1653,14 +1723,22 @@ public class FpdFlash extends IInternalFrame {
|
|||
return jTableFvAdditional;
|
||||
}
|
||||
|
||||
private boolean fvNameExists (String fvName) {
|
||||
private boolean fvNameExistsInFvInFdfTable (String fvName) {
|
||||
for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) {
|
||||
if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean fvNameExists (String fvName) {
|
||||
if (fvNameExistsInFvInFdfTable(fvName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) {
|
||||
if (fvAddtionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {
|
||||
if (fvAdditionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1668,18 +1746,18 @@ public class FpdFlash extends IInternalFrame {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method initializes fvAddtionalTableModel
|
||||
* This method initializes fvAdditionalTableModel
|
||||
*
|
||||
* @return javax.swing.table.DefaultTableModel
|
||||
*/
|
||||
private DefaultTableModel getFvAddtionalTableModel() {
|
||||
if (fvAddtionalTableModel == null) {
|
||||
fvAddtionalTableModel = new DefaultTableModel();
|
||||
fvAddtionalTableModel.addColumn("FV Name");
|
||||
fvAddtionalTableModel.addColumn("Size");
|
||||
fvAddtionalTableModel.addColumn("Corresponding File Name");
|
||||
private DefaultTableModel getFvAdditionalTableModel() {
|
||||
if (fvAdditionalTableModel == null) {
|
||||
fvAdditionalTableModel = new DefaultTableModel();
|
||||
fvAdditionalTableModel.addColumn("FV Name");
|
||||
fvAdditionalTableModel.addColumn("Size");
|
||||
fvAdditionalTableModel.addColumn("Corresponding File Name");
|
||||
}
|
||||
return fvAddtionalTableModel;
|
||||
return fvAdditionalTableModel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1699,7 +1777,7 @@ public class FpdFlash extends IInternalFrame {
|
|||
jTableFvAdditional.getCellEditor().stopCellEditing();
|
||||
}
|
||||
String[] row = {"", "", ""};
|
||||
fvAddtionalTableModel.addRow(row);
|
||||
fvAdditionalTableModel.addRow(row);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1715,11 +1793,26 @@ public class FpdFlash extends IInternalFrame {
|
|||
if (jButtonDelFv == null) {
|
||||
jButtonDelFv = new JButton();
|
||||
jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));
|
||||
jButtonDelFv.setEnabled(false);
|
||||
jButtonDelFv.setEnabled(true);
|
||||
jButtonDelFv.setText("Delete");
|
||||
jButtonDelFv.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent e) {
|
||||
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
|
||||
//delete row in FvAdditional table.
|
||||
int selectedRow = jTableFvAdditional.getSelectedRow();
|
||||
if (selectedRow < 0) {
|
||||
return;
|
||||
}
|
||||
String fvName = fvAdditionalTableModel.getValueAt(selectedRow, 0) + "";
|
||||
fvAdditionalTableModel.removeRow(selectedRow);
|
||||
//
|
||||
//delete tab with selected FV name.
|
||||
//
|
||||
jTabbedPane.removeTabAt(jTabbedPane.indexOfTab(fvName));
|
||||
//delete FV Name from FvImages element.
|
||||
ffc.updateFvImageNameAll(fvName, null);
|
||||
//delete FvBinding from ModuleSA.
|
||||
ffc.removeFvBindingAll(fvName);
|
||||
docConsole.setSaved(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1775,6 +1868,9 @@ public class FpdFlash extends IInternalFrame {
|
|||
if (jTableFvInfo.isEditing()) {
|
||||
jTableFvInfo.getCellEditor().stopCellEditing();
|
||||
}
|
||||
if (jTableFvAdditional.isEditing()) {
|
||||
jTableFvAdditional.getCellEditor().stopCellEditing();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1815,6 +1911,53 @@ public class FpdFlash extends IInternalFrame {
|
|||
return jContentPane;
|
||||
}
|
||||
|
||||
private void getFlashInfoFromFdf (String fdfPath, Vector<String> vBlockSize, String erasePolarity) {
|
||||
File fdf = new File(fdfPath);
|
||||
if (!fdf.exists()) {
|
||||
return;
|
||||
}
|
||||
int lines = 0;
|
||||
|
||||
try {
|
||||
FileReader reader = new FileReader(fdf);
|
||||
BufferedReader in = new BufferedReader(reader);
|
||||
String str;
|
||||
|
||||
while ((str = in.readLine()) != null) {
|
||||
++lines;
|
||||
str = str.trim();
|
||||
//
|
||||
// skip empty line, comment (start with //)
|
||||
//
|
||||
if (str.length() == 0 || str.startsWith("//")) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// ErasePolarity
|
||||
//
|
||||
if (str.startsWith("ErasePolarity")) {
|
||||
erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(","));
|
||||
}
|
||||
//
|
||||
// dig into Block section.
|
||||
//
|
||||
if (str.startsWith("Block") && str.endsWith("}")) {
|
||||
String[] blockSec = str.split(",");
|
||||
String nv = blockSec[1].trim();
|
||||
String[] sizeSec = nv.split("=");
|
||||
vBlockSize.add(sizeSec[1].trim());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
reader.close();
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {
|
||||
File fdf = new File(fdfPath);
|
||||
if (!fdf.exists()) {
|
||||
|
@ -2374,10 +2517,11 @@ class ImageParaTableModel extends DefaultTableModel {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public boolean isCellEditable(int row, int col) {
|
||||
if (getValueAt(row, 1).equals("ImageName") && col >=1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
// if (getValueAt(row, 1).equals("ImageName") && col >=1) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -1241,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<String> vArch = new Vector<String>();
|
||||
vArch.add("IA32");
|
||||
vArch.add("X64");
|
||||
|
@ -1249,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() {
|
||||
|
|
Loading…
Reference in New Issue