1. Fix bug in get industry std headers

2. Fix bug in save msa without saving specification
3. Add tool tip text to ArchCheckBox
4. Locate to msa file location when open a file browser when edit source file in Msa
5. File filter only for text file when open/save ToolChainConfig file
6. Adjust UI for clone and add far id info when clone an item.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@971 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-07-13 08:51:27 +00:00
parent aab6a96a70
commit 55a2762d8c
13 changed files with 426 additions and 451 deletions

View File

@ -121,7 +121,7 @@ public class Clone extends IDialog {
private JTextField getJTextFieldType() { private JTextField getJTextFieldType() {
if (jTextFieldType == null) { if (jTextFieldType == null) {
jTextFieldType = new JTextField(); jTextFieldType = new JTextField();
jTextFieldType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jTextFieldType.setBounds(new java.awt.Rectangle(210, 10, 320, 20));
jTextFieldType.setEditable(false); jTextFieldType.setEditable(false);
} }
return jTextFieldType; return jTextFieldType;
@ -135,7 +135,7 @@ public class Clone extends IDialog {
private JTextField getJTextFieldSource() { private JTextField getJTextFieldSource() {
if (jTextFieldSource == null) { if (jTextFieldSource == null) {
jTextFieldSource = new JTextField(); jTextFieldSource = new JTextField();
jTextFieldSource.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jTextFieldSource.setBounds(new java.awt.Rectangle(210, 35, 320, 20));
jTextFieldSource.setEditable(false); jTextFieldSource.setEditable(false);
} }
return jTextFieldSource; return jTextFieldSource;
@ -149,7 +149,7 @@ public class Clone extends IDialog {
private JButton getJButtonBrowse() { private JButton getJButtonBrowse() {
if (jButtonBrowse == null) { if (jButtonBrowse == null) {
jButtonBrowse = new JButton(); jButtonBrowse = new JButton();
jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20)); jButtonBrowse.setBounds(new java.awt.Rectangle(445, 85, 85, 20));
jButtonBrowse.setText("Browse"); jButtonBrowse.setText("Browse");
jButtonBrowse.addActionListener(this); jButtonBrowse.addActionListener(this);
} }
@ -164,7 +164,7 @@ public class Clone extends IDialog {
private JTextField getJTextFieldFilePath() { private JTextField getJTextFieldFilePath() {
if (jTextFieldFilePath == null) { if (jTextFieldFilePath == null) {
jTextFieldFilePath = new JTextField(); jTextFieldFilePath = new JTextField();
jTextFieldFilePath.setBounds(new java.awt.Rectangle(160, 60, 230, 20)); jTextFieldFilePath.setBounds(new java.awt.Rectangle(210, 85, 230, 20));
} }
return jTextFieldFilePath; return jTextFieldFilePath;
} }
@ -177,7 +177,7 @@ public class Clone extends IDialog {
private JTextField getJTextFieldBaseName() { private JTextField getJTextFieldBaseName() {
if (jTextFieldBaseName == null) { if (jTextFieldBaseName == null) {
jTextFieldBaseName = new JTextField(); jTextFieldBaseName = new JTextField();
jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 110, 320, 20)); jTextFieldBaseName.setBounds(new java.awt.Rectangle(210, 110, 320, 20));
} }
return jTextFieldBaseName; return jTextFieldBaseName;
} }
@ -190,7 +190,7 @@ public class Clone extends IDialog {
private JTextField getJTextFieldGuid() { private JTextField getJTextFieldGuid() {
if (jTextFieldGuid == null) { if (jTextFieldGuid == null) {
jTextFieldGuid = new JTextField(); jTextFieldGuid = new JTextField();
jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 135, 230, 20)); jTextFieldGuid.setBounds(new java.awt.Rectangle(210, 135, 230, 20));
} }
return jTextFieldGuid; return jTextFieldGuid;
} }
@ -203,7 +203,7 @@ public class Clone extends IDialog {
private JTextField getJTextFieldVersion() { private JTextField getJTextFieldVersion() {
if (jTextFieldVersion == null) { if (jTextFieldVersion == null) {
jTextFieldVersion = new JTextField(); jTextFieldVersion = new JTextField();
jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 160, 320, 20)); jTextFieldVersion.setBounds(new java.awt.Rectangle(210, 160, 320, 20));
} }
return jTextFieldVersion; return jTextFieldVersion;
} }
@ -216,7 +216,7 @@ public class Clone extends IDialog {
private JButton getJButtonOk() { private JButton getJButtonOk() {
if (jButtonOk == null) { if (jButtonOk == null) {
jButtonOk = new JButton(); jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(235, 200, 90, 20)); jButtonOk.setBounds(new java.awt.Rectangle(285, 200, 90, 20));
jButtonOk.setText("Ok"); jButtonOk.setText("Ok");
jButtonOk.addActionListener(this); jButtonOk.addActionListener(this);
} }
@ -231,7 +231,7 @@ public class Clone extends IDialog {
private JButton getJButtonCancel() { private JButton getJButtonCancel() {
if (jButtonCancel == null) { if (jButtonCancel == null) {
jButtonCancel = new JButton(); jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(355, 200, 90, 20)); jButtonCancel.setBounds(new java.awt.Rectangle(405, 200, 90, 20));
jButtonCancel.setText("Cancel"); jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this); jButtonCancel.addActionListener(this);
} }
@ -246,7 +246,7 @@ public class Clone extends IDialog {
private JButton getJButtonGenerateGuid() { private JButton getJButtonGenerateGuid() {
if (jButtonGenerateGuid == null) { if (jButtonGenerateGuid == null) {
jButtonGenerateGuid = new JButton(); jButtonGenerateGuid = new JButton();
jButtonGenerateGuid.setBounds(new java.awt.Rectangle(395, 135, 85, 20)); jButtonGenerateGuid.setBounds(new java.awt.Rectangle(445, 135, 85, 20));
jButtonGenerateGuid.setText("Gen"); jButtonGenerateGuid.setText("Gen");
jButtonGenerateGuid.addActionListener(this); jButtonGenerateGuid.addActionListener(this);
} }
@ -261,7 +261,7 @@ public class Clone extends IDialog {
private JComboBox getJComboBoxExistingPackage() { private JComboBox getJComboBoxExistingPackage() {
if (jComboBoxExistingPackage == null) { if (jComboBoxExistingPackage == null) {
jComboBoxExistingPackage = new JComboBox(); jComboBoxExistingPackage = new JComboBox();
jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(210, 60, 320, 20));
} }
return jComboBoxExistingPackage; return jComboBoxExistingPackage;
} }
@ -316,7 +316,7 @@ public class Clone extends IDialog {
* @return void * @return void
*/ */
private void init() { private void init() {
this.setSize(493, 260); this.setSize(550, 260);
this.setContentPane(getJContentPane()); this.setContentPane(getJContentPane());
this.setTitle("Clone"); this.setTitle("Clone");
this.centerWindow(); this.centerWindow();
@ -331,20 +331,26 @@ public class Clone extends IDialog {
init(); init();
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) { if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
this.jTextFieldType.setText(DataType.MODULE_SURFACE_AREA); this.jTextFieldType.setText(DataType.MODULE_SURFACE_AREA);
this.jTextFieldSource.setText(oldId.getPath()); String s = oldId.getPath();
s = Tools.getRelativePath(s, Tools.getFilePathOnly(wt.getPackageIdByModuleId(oldId).getPath()));
this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));
initExistingPackage(); initExistingPackage();
this.jButtonBrowse.setEnabled(false); this.jButtonBrowse.setVisible(false);
this.jTextFieldFilePath.setToolTipText("Input module name here. For example, Application\\HelloWorld\\HelloWorld.msa"); this.jTextFieldFilePath.setToolTipText("Input module name here. For example, Application\\HelloWorld\\HelloWorld.msa");
this.jLabelDestinationFile.setText("Module Path\\Name"); this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
this.jLabelDestinationFile.setText("New Module Path and Filename");
} }
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) { if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
this.jTextFieldType.setText(DataType.PACKAGE_SURFACE_AREA); this.jTextFieldType.setText(DataType.PACKAGE_SURFACE_AREA);
this.jTextFieldSource.setText(oldId.getPath()); String s = oldId.getPath();
s = Tools.getRelativePath(oldId.getPath(), Workspace.getCurrentWorkspace());
this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));
this.jLabelBelong.setEnabled(false); this.jLabelBelong.setEnabled(false);
this.jComboBoxExistingPackage.setEnabled(false); this.jComboBoxExistingPackage.setEnabled(false);
this.jButtonBrowse.setEnabled(false); this.jButtonBrowse.setVisible(false);
this.jTextFieldFilePath.setToolTipText("Input package name here. For example, MdePkg\\MdePkg.fpd"); this.jTextFieldFilePath.setToolTipText("Input package name here. For example, MdePkg\\MdePkg.fpd");
this.jLabelDestinationFile.setText("Package Path\\Name"); this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
this.jLabelDestinationFile.setText("New Package Path and Filename");
} }
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) { if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
this.jTextFieldType.setText(DataType.PLATFORM_SURFACE_AREA); this.jTextFieldType.setText(DataType.PLATFORM_SURFACE_AREA);
@ -352,7 +358,7 @@ public class Clone extends IDialog {
this.jLabelBelong.setEnabled(false); this.jLabelBelong.setEnabled(false);
this.jComboBoxExistingPackage.setEnabled(false); this.jComboBoxExistingPackage.setEnabled(false);
this.jTextFieldFilePath.setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd"); this.jTextFieldFilePath.setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd");
this.jLabelDestinationFile.setText("New Platform path"); this.jLabelDestinationFile.setText("New Platform Path and Filename");
} }
if (mode == DataType.RETURN_TYPE_WORKSPACE) { if (mode == DataType.RETURN_TYPE_WORKSPACE) {
this.jTextFieldType.setText(DataType.WORKSPACE); this.jTextFieldType.setText(DataType.WORKSPACE);
@ -367,7 +373,7 @@ public class Clone extends IDialog {
this.jLabelVersion.setEnabled(false); this.jLabelVersion.setEnabled(false);
this.jTextFieldVersion.setEnabled(false); this.jTextFieldVersion.setEnabled(false);
this.jTextFieldFilePath.setToolTipText("Input workspace path here. For example, C:\\MyWorkspace"); this.jTextFieldFilePath.setToolTipText("Input workspace path here. For example, C:\\MyWorkspace");
this.jLabelDestinationFile.setText("New Workspace path"); this.jLabelDestinationFile.setText("New Workspace Path");
} }
} }
@ -379,29 +385,29 @@ public class Clone extends IDialog {
private JPanel getJContentPane() { private JPanel getJContentPane() {
if (jContentPane == null) { if (jContentPane == null) {
jLabelBelong = new JLabel(); jLabelBelong = new JLabel();
jLabelBelong.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); jLabelBelong.setBounds(new java.awt.Rectangle(15, 60, 190, 20));
jLabelBelong.setText("Clone to Package"); jLabelBelong.setText("Clone to Package");
jLabelVersion = new JLabel(); jLabelVersion = new JLabel();
jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 140, 20)); jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 190, 20));
jLabelVersion.setText("Version"); jLabelVersion.setText("Version");
jLabelGuid = new JLabel(); jLabelGuid = new JLabel();
jLabelGuid.setBounds(new java.awt.Rectangle(15, 135, 140, 20)); jLabelGuid.setBounds(new java.awt.Rectangle(15, 135, 190, 20));
jLabelGuid.setText("Guid"); jLabelGuid.setText("Guid");
jLabelBaseName = new JLabel(); jLabelBaseName = new JLabel();
jLabelBaseName.setBounds(new java.awt.Rectangle(15, 110, 140, 20)); jLabelBaseName.setBounds(new java.awt.Rectangle(15, 110, 190, 20));
jLabelBaseName.setText("Base Name"); jLabelBaseName.setText("Base Name");
jLabelDestinationFile = new JLabel(); jLabelDestinationFile = new JLabel();
jLabelDestinationFile.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); jLabelDestinationFile.setBounds(new java.awt.Rectangle(15, 85, 190, 20));
jLabelDestinationFile.setText("Destination File Name"); jLabelDestinationFile.setText("Destination File Name");
jLabelSource = new JLabel(); jLabelSource = new JLabel();
jLabelSource.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); jLabelSource.setBounds(new java.awt.Rectangle(15, 35, 190, 20));
jLabelSource.setText("Source"); jLabelSource.setText("Source");
jLabelType = new JLabel(); jLabelType = new JLabel();
jLabelType.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); jLabelType.setBounds(new java.awt.Rectangle(15, 10, 190, 20));
jLabelType.setText("Type"); jLabelType.setText("Type");
jContentPane = new JPanel(); jContentPane = new JPanel();
jContentPane.setLayout(null); jContentPane.setLayout(null);
jContentPane.setSize(new java.awt.Dimension(490, 227)); jContentPane.setSize(new java.awt.Dimension(540, 227));
jContentPane.add(jLabelType, null); jContentPane.add(jLabelType, null);
jContentPane.add(getJTextFieldType(), null); jContentPane.add(getJTextFieldType(), null);
jContentPane.add(jLabelSource, null); jContentPane.add(jLabelSource, null);
@ -551,7 +557,7 @@ public class Clone extends IDialog {
**/ **/
private boolean check() { private boolean check() {
String src = this.jTextFieldSource.getText(); String src = this.oldId.getPath();
String trg = this.jTextFieldFilePath.getText(); String trg = this.jTextFieldFilePath.getText();
File srcFile = new File(src); File srcFile = new File(src);
File trgFile = new File(trg); File trgFile = new File(trg);
@ -648,7 +654,7 @@ public class Clone extends IDialog {
} }
private void save() throws IOException, XmlException, Exception { private void save() throws IOException, XmlException, Exception {
String src = this.jTextFieldSource.getText(); String src = this.oldId.getPath();
String trg = this.jTextFieldFilePath.getText(); String trg = this.jTextFieldFilePath.getText();
Vector<String> vFiles = new Vector<String>(); Vector<String> vFiles = new Vector<String>();
@ -898,6 +904,10 @@ public class Clone extends IDialog {
c.setPackageGuid(wt.getPackageIdByModuleId(oldId).getGuid()); c.setPackageGuid(wt.getPackageIdByModuleId(oldId).getGuid());
c.setPackageVersion(wt.getPackageIdByModuleId(oldId).getVersion()); c.setPackageVersion(wt.getPackageIdByModuleId(oldId).getVersion());
c.setId(count.add(new BigInteger("1"))); c.setId(count.add(new BigInteger("1")));
String guid = wt.getModuleFarGuid(oldId);
if (guid != null && !guid.equals("")) {
c.setFarGuid(guid);
}
cf.addNewCloned(); cf.addNewCloned();
cf.setClonedArray(cf.getClonedList().size() - 1, c); cf.setClonedArray(cf.getClonedList().size() - 1, c);
@ -950,6 +960,10 @@ public class Clone extends IDialog {
c.setPackageGuid(id.getGuid()); c.setPackageGuid(id.getGuid());
c.setPackageVersion(id.getVersion()); c.setPackageVersion(id.getVersion());
c.setId(count.add(new BigInteger("1"))); c.setId(count.add(new BigInteger("1")));
String guid = wt.getModuleFarGuid(oldId);
if (guid != null && !guid.equals("")) {
c.setFarGuid(guid);
}
cf.addNewCloned(); cf.addNewCloned();
cf.setClonedArray(cf.getClonedList().size() - 1, c); cf.setClonedArray(cf.getClonedList().size() - 1, c);
@ -1002,7 +1016,11 @@ public class Clone extends IDialog {
c.setPlatformGuid(id.getGuid()); c.setPlatformGuid(id.getGuid());
c.setPlatformVersion(id.getVersion()); c.setPlatformVersion(id.getVersion());
c.setId(count.add(new BigInteger("1"))); c.setId(count.add(new BigInteger("1")));
String guid = wt.getModuleFarGuid(oldId);
if (guid != null && !guid.equals("")) {
c.setFarGuid(guid);
}
cf.addNewCloned(); cf.addNewCloned();
cf.setClonedArray(cf.getClonedList().size() - 1, c); cf.setClonedArray(cf.getClonedList().size() - 1, c);
pd.addNewClonedFrom(); pd.addNewClonedFrom();

View File

@ -1793,7 +1793,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
CreateStepOne cso = new CreateStepOne(this, true); CreateStepOne cso = new CreateStepOne(this, true);
int result = cso.showDialog(); int result = cso.showDialog();
if (result == DataType.RETURN_TYPE_OK) { if (result == DataType.RETURN_TYPE_OK) {
this.closeAll(); String strReturn = "Create Far Done!";
JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
} }
cso.dispose(); cso.dispose();
} }
@ -1802,6 +1803,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
InstallStepOne iso = new InstallStepOne(this, true); InstallStepOne iso = new InstallStepOne(this, true);
int result = iso.showDialog(); int result = iso.showDialog();
if (result == DataType.RETURN_TYPE_OK) { if (result == DataType.RETURN_TYPE_OK) {
String strReturn = "<html>Install Far Done! <br>The WORKSPACE will be refreshed!</html>";
JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
this.closeAll(); this.closeAll();
} }
iso.dispose(); iso.dispose();
@ -1811,6 +1814,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
DeleteStepOne dso = new DeleteStepOne(this, true); DeleteStepOne dso = new DeleteStepOne(this, true);
int result = dso.showDialog(); int result = dso.showDialog();
if (result == DataType.RETURN_TYPE_OK) { if (result == DataType.RETURN_TYPE_OK) {
String strReturn = "<html>Delete Far Done! <br>The WORKSPACE will be refreshed!</html>";
JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
this.closeAll(); this.closeAll();
} }
dso.dispose(); dso.dispose();
@ -1820,6 +1825,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
UpdateStepOne uso = new UpdateStepOne(this, true); UpdateStepOne uso = new UpdateStepOne(this, true);
int result = uso.showDialog(); int result = uso.showDialog();
if (result == DataType.RETURN_TYPE_OK) { if (result == DataType.RETURN_TYPE_OK) {
String strReturn = "<html>Update Far Done! <br>The WORKSPACE will be refreshed!</html>";
JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
this.closeAll(); this.closeAll();
} }
uso.dispose(); uso.dispose();
@ -2039,147 +2046,155 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
fc.addChoosableFileFilter(new IFileFilter(ext)); fc.addChoosableFileFilter(new IFileFilter(ext));
return fc.showSaveDialog(new JPanel()); return fc.showSaveDialog(new JPanel());
} }
/** /**
Open Module Add a module to tree
@param mid The module node to be added
**/
private void addModuleToTree(ModuleIdentification mid) {
//
// Add new MsaHeader node to the tree
//
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MSA_HEADER,
true, mid);
//
// First find the module belongs to which package
//
IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
IDefaultMutableTreeNode.MODULE_PACKAGE);
//
// To check if has module node or library node
//
IDefaultMutableTreeNode parentModuleNode = null;
IDefaultMutableTreeNode parentLibraryNode = null;
boolean hasModule = false;
boolean hasLibrary = false;
for (int index = 0; index < packageNode.getChildCount(); index++) {
IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
hasLibrary = true;
parentLibraryNode = iNode;
}
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
hasModule = true;
parentModuleNode = iNode;
}
}
@param path input file path //
// If is a module
**/ //
private void openModule(String path, ModuleIdentification moduleId) { if (!mid.isLibrary()) {
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; //
try { // Create parent node first if has no parent node
msa = OpenFile.openMsaFile(path); //
} catch (IOException e) { if (!hasModule) {
Log.err("Open Module Surface Area " + path, e.getMessage()); parentModuleNode = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
return; false, mid.getPackageId());
} catch (XmlException e) { iTree.addNode(packageNode, parentModuleNode);
Log.err("Open Module Surface Area " + path, e.getMessage()); }
return;
} catch (Exception e) {
Log.err("Open Module Surface Area " + path, "Invalid file type");
return;
}
Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(),
msa.getMsaHeader().getVersion(), path);
//
// Generate module id
//
PackageIdentification pid = wt.getPackageIdByModuleId(id);
if (pid != null) {
//
// To judge if the module existed in vModuleList
// If not, add it to vModuleList
//
boolean isFind = false;
for (int index = 0; index < vModuleList.size(); index++) {
if (vModuleList.elementAt(index).equals(id)) {
isFind = true;
break;
}
}
if (!isFind) {
ModuleIdentification mid = new ModuleIdentification(id, pid, moduleId.isLibrary());
vModuleList.addElement(mid);
//
// Add new MsaHeader node to the tree
//
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(),
IDefaultMutableTreeNode.MSA_HEADER, true,
mid);
//
// First find the module belongs to which package
//
IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
IDefaultMutableTreeNode.MODULE_PACKAGE);
//
// To check if has module node or library node
//
IDefaultMutableTreeNode parentModuleNode = null;
IDefaultMutableTreeNode parentLibraryNode = null;
boolean hasModule = false;
boolean hasLibrary = false;
for (int index = 0; index < packageNode.getChildCount(); index++) {
IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
hasLibrary = true;
parentLibraryNode = iNode;
}
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
hasModule = true;
parentModuleNode = iNode;
}
}
// iTree.addNode(parentModuleNode, node);
// If is a module }
//
if (!mid.isLibrary()) {
//
// Create parent node first if has no parent node
//
if (!hasModule) {
parentModuleNode = new IDefaultMutableTreeNode("Module",
IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
false, mid.getPackageId());
iTree.addNode(packageNode, parentModuleNode);
}
iTree.addNode(parentModuleNode, node); //
} // If is a Library
//
if (mid.isLibrary()) {
//
// Create parent node first if has no parent node
//
if (!hasLibrary) {
parentLibraryNode = new IDefaultMutableTreeNode("Library",
IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
mid.getPackageId());
iTree.addNode(packageNode, parentLibraryNode);
}
// iTree.addNode(parentLibraryNode, node);
// If is a Library }
// }
if (mid.isLibrary()) {
//
// Create parent node first if has no parent node
//
if (!hasLibrary) {
parentLibraryNode = new IDefaultMutableTreeNode("Library",
IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
false, mid.getPackageId());
iTree.addNode(packageNode, parentLibraryNode);
}
iTree.addNode(parentLibraryNode, node); /**
} Open Module
}
} else {
//
// The module is not in existing packages
//
Log.err("The module hasn't been added to any package of current workspace!");
return;
}
//
// Make the node selected
//
iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,
IDefaultMutableTreeNode.MSA_HEADER)));
//
// Update opening Module list information
//
if (!openingModuleList.existsModule(id)) {
//
// Insert sub node of module
//
insertModuleTreeNode(id);
iTree.getSelectNode().setOpening(true);
// @param path input file path
// Update opening module list
// **/
openingModuleList.insertToOpeningModuleList(id, msa); private void openModule(String path, ModuleIdentification moduleId) {
openingModuleList.setTreePathById(id, iTree.getSelectionPath()); ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
} try {
// msa = OpenFile.openMsaFile(path);
// Show msa header in editor panel } catch (IOException e) {
// Log.err("Open Module Surface Area " + path, e.getMessage());
showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id)); return;
this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id); } catch (XmlException e) {
} Log.err("Open Module Surface Area " + path, e.getMessage());
return;
} catch (Exception e) {
Log.err("Open Module Surface Area " + path, "Invalid file type");
return;
}
Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(),
msa.getMsaHeader().getVersion(), path);
//
// Generate module id
//
PackageIdentification pid = wt.getPackageIdByModuleId(id);
if (pid != null) {
//
// To judge if the module existed in vModuleList
// If not, add it to vModuleList
//
boolean isFind = false;
for (int index = 0; index < vModuleList.size(); index++) {
if (vModuleList.elementAt(index).equals(id)) {
isFind = true;
break;
}
}
if (!isFind) {
ModuleIdentification mid = new ModuleIdentification(id, pid, moduleId.isLibrary());
vModuleList.addElement(mid);
addModuleToTree(mid);
}
} else {
//
// The module is not in existing packages
//
Log.err("The module hasn't been added to any package of current workspace!");
return;
}
//
// Make the node selected
//
iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,
IDefaultMutableTreeNode.MSA_HEADER)));
//
// Update opening Module list information
//
if (!openingModuleList.existsModule(id)) {
//
// Insert sub node of module
//
insertModuleTreeNode(id);
iTree.getSelectNode().setOpening(true);
//
// Update opening module list
//
openingModuleList.insertToOpeningModuleList(id, msa);
openingModuleList.setTreePathById(id, iTree.getSelectionPath());
}
//
// Show msa header in editor panel
//
showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id));
this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id);
}
/** /**
Open Module Open Module
@ -2222,69 +2237,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
if (!isFind) { if (!isFind) {
ModuleIdentification mid = new ModuleIdentification(id, pid); ModuleIdentification mid = new ModuleIdentification(id, pid);
vModuleList.addElement(mid); vModuleList.addElement(mid);
// addModuleToTree(mid);
// Add new MsaHeader node to the tree
//
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(),
IDefaultMutableTreeNode.MSA_HEADER, true,
mid);
//
// First find the module belongs to which package
//
IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
IDefaultMutableTreeNode.MODULE_PACKAGE);
//
// To check if has module node or library node
//
IDefaultMutableTreeNode parentModuleNode = null;
IDefaultMutableTreeNode parentLibraryNode = null;
boolean hasModule = false;
boolean hasLibrary = false;
for (int index = 0; index < packageNode.getChildCount(); index++) {
IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
hasLibrary = true;
parentLibraryNode = iNode;
}
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
hasModule = true;
parentModuleNode = iNode;
}
}
//
// If is a module
//
if (!mid.isLibrary()) {
//
// Create parent node first if has no parent node
//
if (!hasModule) {
parentModuleNode = new IDefaultMutableTreeNode("Module",
IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
false, mid.getPackageId());
iTree.addNode(packageNode, parentModuleNode);
}
iTree.addNode(parentModuleNode, node);
}
//
// If is a Library
//
if (mid.isLibrary()) {
//
// Create parent node first if has no parent node
//
if (!hasLibrary) {
parentLibraryNode = new IDefaultMutableTreeNode("Library",
IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
false, mid.getPackageId());
iTree.addNode(packageNode, parentLibraryNode);
}
iTree.addNode(parentLibraryNode, node);
}
} }
} else { } else {
// //
@ -2293,7 +2246,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
Log.err("The module hasn't been added to any package of current workspace!"); Log.err("The module hasn't been added to any package of current workspace!");
return; return;
} }
// //
// Make the node selected // Make the node selected
// //
@ -3248,13 +3201,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) { if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
Tools.showInformationMessage("Module Surface Area Clone Finished"); Tools.showInformationMessage("Module Surface Area Clone Finished");
vModuleList.addElement(c.getMid()); vModuleList.addElement(c.getMid());
// addModuleToTree(c.getMid());
// Add new MsaHeader node to the tree
//
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vModuleList.lastElement().getName(),
IDefaultMutableTreeNode.MSA_HEADER, true,
vModuleList.lastElement());
iTree.addNode(dmtnModuleDescription, node);
} }
if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) { if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
Tools.showInformationMessage("Package Surface Area Clone Finished"); Tools.showInformationMessage("Package Surface Area Clone Finished");
@ -3327,7 +3274,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
} else { } else {
int category = iTree.getSelectCategory(); int category = iTree.getSelectCategory();
if (category == IDefaultMutableTreeNode.MODULE || category == IDefaultMutableTreeNode.PACKAGE if (category == IDefaultMutableTreeNode.MODULE || category == IDefaultMutableTreeNode.PACKAGE
|| category == IDefaultMutableTreeNode.PLATFORM) { || category == IDefaultMutableTreeNode.PLATFORM
|| category == IDefaultMutableTreeNode.MODULE_PACKAGE
|| category == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY
|| category == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
jMenuItemToolsClone.setEnabled(false); jMenuItemToolsClone.setEnabled(false);
} else { } else {
jMenuItemToolsClone.setEnabled(true); jMenuItemToolsClone.setEnabled(true);

View File

@ -35,6 +35,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.IFileFilter;
import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Log;
import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigId; import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigId;
@ -348,7 +349,9 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
if (arg0.getSource() == jButtonOpen) { if (arg0.getSource() == jButtonOpen) {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setAcceptAllFileFilterUsed(true); fc.setAcceptAllFileFilterUsed(false);
IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
fc.addChoosableFileFilter(iff);
fc.setCurrentDirectory(new File(toolsDir)); fc.setCurrentDirectory(new File(toolsDir));
int result = fc.showOpenDialog(new JPanel()); int result = fc.showOpenDialog(new JPanel());
@ -369,8 +372,10 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
if (arg0.getSource() == jButtonSave) { if (arg0.getSource() == jButtonSave) {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setAcceptAllFileFilterUsed(true); fc.setAcceptAllFileFilterUsed(false);
fc.setSelectedFile(new File(currentFile)); IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
fc.addChoosableFileFilter(iff);
fc.setCurrentDirectory(new File(toolsDir));
int result = fc.showSaveDialog(new JPanel()); int result = fc.showSaveDialog(new JPanel());
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {

View File

@ -162,7 +162,7 @@ public class DataType {
public static final int SPACE_TO_RIGHT_FOR_REMOVE_BUTTON = 95; public static final int SPACE_TO_RIGHT_FOR_REMOVE_BUTTON = 95;
public static final int SPACE_TO_RIGHT_FOR_UPDATE_BUTTON = 10; public static final int SPACE_TO_RIGHT_FOR_UPDATE_BUTTON = 10;
public static final int SPACE_TO_BOTTOM_FOR_ADD_BUTTON = 30; public static final int SPACE_TO_BOTTOM_FOR_ADD_BUTTON = 30;
public static final int SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON = 30; public static final int SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON = 30;
@ -210,7 +210,7 @@ public class DataType {
// First defined here // First defined here
// Will be replaced by resource file later // Will be replaced by resource file later
// //
public static final String SUP_ARCH_LIST_HELP_TEXT = "Deselecting a checkbox will restrict this module for use with the selected architectures, based on the list of items that are checked. If all boxes are checked, then the module will support all current AND FUTURE architectures"; public static final String SUP_ARCH_LIST_HELP_TEXT = "<html>Selecting a checkbox means supporting the selected architectures;<br> None of boxes are checked means supporting all architectures<html>";
// //
// Project name and version // Project name and version

View File

@ -307,6 +307,7 @@ public class EnumerationData {
vModuleType.addElement("UEFI_DRIVER"); vModuleType.addElement("UEFI_DRIVER");
vModuleType.addElement("UEFI_APPLICATION"); vModuleType.addElement("UEFI_APPLICATION");
vModuleType.addElement("USER_DEFINED"); vModuleType.addElement("USER_DEFINED");
Tools.sortVectorString(vModuleType, DataType.SORT_TYPE_ASCENDING);
} }
// private void initComponentType() { // private void initComponentType() {
@ -362,6 +363,7 @@ public class EnumerationData {
vFrameworkModuleTypes.addElement("UEFI_DRIVER"); vFrameworkModuleTypes.addElement("UEFI_DRIVER");
vFrameworkModuleTypes.addElement("UEFI_APPLICATION"); vFrameworkModuleTypes.addElement("UEFI_APPLICATION");
vFrameworkModuleTypes.addElement("USER_DEFINED"); vFrameworkModuleTypes.addElement("USER_DEFINED");
Tools.sortVectorString(vFrameworkModuleTypes, DataType.SORT_TYPE_ASCENDING);
} }
private void initLibClassDef() { private void initLibClassDef() {

View File

@ -84,7 +84,7 @@ public class IFileFilter extends FileFilter {
if (strExt.equals(DataType.TEXT_FILE_EXT)) if (strExt.equals(DataType.TEXT_FILE_EXT))
return DataType.TEXT_FILE_EXT_DESCRIPTION; return DataType.TEXT_FILE_EXT_DESCRIPTION;
if (strExt.equals(DataType.FAR_SURFACE_AREA_EXT)) if (strExt.equals(DataType.FAR_SURFACE_AREA_EXT))
return DataType.FAR_SURFACE_AREA_EXT_DESCRIPTION; return DataType.FAR_SURFACE_AREA_EXT_DESCRIPTION;
return ""; return "";
} }

View File

@ -305,8 +305,8 @@ public class Tools {
match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT; match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT;
} }
if (type == DataType.RETURN_TYPE_FAR_SURFACE_AREA) { if (type == DataType.RETURN_TYPE_FAR_SURFACE_AREA) {
match = DataType.FILE_EXT_SEPARATOR + DataType.FAR_SURFACE_AREA_EXT; match = DataType.FILE_EXT_SEPARATOR + DataType.FAR_SURFACE_AREA_EXT;
} }
if (path.length() <= match.length()) { if (path.length() <= match.length()) {
path = path + match; path = path + match;
return path; return path;

View File

@ -20,6 +20,8 @@ import java.util.Vector;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import org.tianocore.frameworkwizard.common.DataType;
public class ArchCheckBox extends JPanel { public class ArchCheckBox extends JPanel {
/// ///
@ -49,6 +51,7 @@ public class ArchCheckBox extends JPanel {
jCheckBoxIa32 = new JCheckBox(); jCheckBoxIa32 = new JCheckBox();
jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 50, 20)); jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 50, 20));
jCheckBoxIa32.setText("IA32"); jCheckBoxIa32.setText("IA32");
jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
} }
return jCheckBoxIa32; return jCheckBoxIa32;
} }
@ -63,6 +66,7 @@ public class ArchCheckBox extends JPanel {
jCheckBoxX64 = new JCheckBox(); jCheckBoxX64 = new JCheckBox();
jCheckBoxX64.setBounds(new java.awt.Rectangle(50, 0, 50, 20)); jCheckBoxX64.setBounds(new java.awt.Rectangle(50, 0, 50, 20));
jCheckBoxX64.setText("X64"); jCheckBoxX64.setText("X64");
jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
} }
return jCheckBoxX64; return jCheckBoxX64;
} }
@ -77,6 +81,7 @@ public class ArchCheckBox extends JPanel {
jCheckBoxIpf = new JCheckBox(); jCheckBoxIpf = new JCheckBox();
jCheckBoxIpf.setBounds(new java.awt.Rectangle(100, 0, 50, 20)); jCheckBoxIpf.setBounds(new java.awt.Rectangle(100, 0, 50, 20));
jCheckBoxIpf.setText("IPF"); jCheckBoxIpf.setText("IPF");
jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
} }
return jCheckBoxIpf; return jCheckBoxIpf;
} }
@ -91,6 +96,7 @@ public class ArchCheckBox extends JPanel {
jCheckBoxEbc = new JCheckBox(); jCheckBoxEbc = new JCheckBox();
jCheckBoxEbc.setBounds(new java.awt.Rectangle(150, 0, 50, 20)); jCheckBoxEbc.setBounds(new java.awt.Rectangle(150, 0, 50, 20));
jCheckBoxEbc.setText("EBC"); jCheckBoxEbc.setText("EBC");
jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
} }
return jCheckBoxEbc; return jCheckBoxEbc;
} }
@ -105,6 +111,7 @@ public class ArchCheckBox extends JPanel {
jCheckBoxArm = new JCheckBox(); jCheckBoxArm = new JCheckBox();
jCheckBoxArm.setBounds(new java.awt.Rectangle(200, 0, 55, 20)); jCheckBoxArm.setBounds(new java.awt.Rectangle(200, 0, 55, 20));
jCheckBoxArm.setText("ARM"); jCheckBoxArm.setText("ARM");
jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
} }
return jCheckBoxArm; return jCheckBoxArm;
} }
@ -119,6 +126,7 @@ public class ArchCheckBox extends JPanel {
jCheckBoxPpc = new JCheckBox(); jCheckBoxPpc = new JCheckBox();
jCheckBoxPpc.setBounds(new java.awt.Rectangle(255, 0, 50, 20)); jCheckBoxPpc.setBounds(new java.awt.Rectangle(255, 0, 50, 20));
jCheckBoxPpc.setText("PPC"); jCheckBoxPpc.setText("PPC");
jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
} }
return jCheckBoxPpc; return jCheckBoxPpc;
} }
@ -155,6 +163,7 @@ public class ArchCheckBox extends JPanel {
this.add(getJCheckBoxEbc(), null); this.add(getJCheckBoxEbc(), null);
this.add(getJCheckBoxArm(), null); this.add(getJCheckBoxArm(), null);
this.add(getJCheckBoxPpc(), null); this.add(getJCheckBoxPpc(), null);
this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
} }
public Vector<String> getSelectedItemsVector() { public Vector<String> getSelectedItemsVector() {

View File

@ -344,7 +344,7 @@ public class ModuleSourceFiles extends IInternalFrame {
} }
private void showEdit(int index) { private void showEdit(int index) {
SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame()); SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame(), omt.getId().getPath());
int result = sfd.showDialog(); int result = sfd.showDialog();
if (result == DataType.RETURN_TYPE_OK) { if (result == DataType.RETURN_TYPE_OK) {
if (index == -1) { if (index == -1) {

View File

@ -254,12 +254,6 @@ public class MsaHeader extends IInternalFrame {
jTextFieldSpecification.setLocation(new java.awt.Point(160, 435)); jTextFieldSpecification.setLocation(new java.awt.Point(160, 435));
jTextFieldSpecification.setEditable(false); jTextFieldSpecification.setEditable(false);
jTextFieldSpecification.addFocusListener(this); jTextFieldSpecification.addFocusListener(this);
jTextFieldSpecification
.setToolTipText("Deselecting a checkbox"
+ " will restrict this module for use with the selected architectures, "
+ "based on the list of items that are checked. "
+ "If all boxes are checked, "
+ "then the module will support all current AND FUTURE architectures");
} }
return jTextFieldSpecification; return jTextFieldSpecification;
} }
@ -800,6 +794,7 @@ public class MsaHeader extends IInternalFrame {
// } // }
// this.msaHeader.setSpecification(this.jTextFieldSpecification.getText()); // this.msaHeader.setSpecification(this.jTextFieldSpecification.getText());
msaHeader.setSpecification(this.jTextFieldSpecification.getText());
msa.setMsaHeader(msaHeader); msa.setMsaHeader(msaHeader);
this.omt.setSaved(false); this.omt.setSaved(false);
} catch (Exception e) { } catch (Exception e) {

View File

@ -15,6 +15,7 @@
package org.tianocore.frameworkwizard.module.ui.dialog; package org.tianocore.frameworkwizard.module.ui.dialog;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File;
import java.util.Vector; import java.util.Vector;
import javax.swing.JButton; import javax.swing.JButton;
@ -27,12 +28,12 @@ import javax.swing.JTextField;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Log;
import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel; import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification; import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;
import org.tianocore.frameworkwizard.workspace.Workspace;
/** /**
The class is used to create, update SourceFile of MSA/MBD file The class is used to create, update SourceFile of MSA/MBD file
@ -82,15 +83,17 @@ public class SourceFilesDlg extends IDialog {
private JTextField jTextFieldFeatureFlag = null; private JTextField jTextFieldFeatureFlag = null;
private ArchCheckBox jArchCheckBox = null; private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
// //
// Not used by UI // Not used by UI
// //
private SourceFilesIdentification sfid = null; private SourceFilesIdentification sfid = null;
private JButton jButtonOk = null; private String msaFileName = "";
private JButton jButtonCancel = null;
/** /**
This method initializes jTextFieldFileName This method initializes jTextFieldFileName
@ -238,9 +241,9 @@ public class SourceFilesDlg extends IDialog {
This is the default constructor This is the default constructor
**/ **/
public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame) { public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, String fileName) {
super(iFrame, true); super(iFrame, true);
init(inSourceFilesIdentification); init(inSourceFilesIdentification, fileName);
} }
/** /**
@ -263,9 +266,10 @@ public class SourceFilesDlg extends IDialog {
@param inSourceFiles The input data of SourceFilesDocument.SourceFiles @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
**/ **/
private void init(SourceFilesIdentification inSourceFilesIdentifications) { private void init(SourceFilesIdentification inSourceFilesIdentifications, String fileName) {
init(); init();
this.sfid = inSourceFilesIdentifications; this.sfid = inSourceFilesIdentifications;
this.msaFileName = fileName;
if (this.sfid != null) { if (this.sfid != null) {
this.jTextFieldFileName.setText(sfid.getFilename()); this.jTextFieldFileName.setText(sfid.getFilename());
@ -451,8 +455,8 @@ public class SourceFilesDlg extends IDialog {
**/ **/
private void selectFile() { private void selectFile() {
JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace()); JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Tools.getFilePathOnly(msaFileName)));
int result = fc.showOpenDialog(new JPanel()); int result = fc.showOpenDialog(new JPanel());
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {
this.jTextFieldFileName.setText(fc.getSelectedFile().getName()); this.jTextFieldFileName.setText(fc.getSelectedFile().getName());

View File

@ -23,8 +23,7 @@ import org.tianocore.frameworkwizard.common.Identifications.Identification;
import org.tianocore.frameworkwizard.workspace.Workspace; import org.tianocore.frameworkwizard.workspace.Workspace;
public class PlatformIdentification extends Identification{ public class PlatformIdentification extends Identification{
public PlatformIdentification(String name, String guid, String version, String path){ public PlatformIdentification(String name, String guid, String version, String path){
super(name, guid, version, path); super(name, guid, version, path);
} }

View File

@ -77,39 +77,37 @@ public class WorkspaceTools {
} }
public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) { public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {
FrameworkDatabase fdb = openFrameworkDb(); FrameworkDatabase fdb = openFrameworkDb();
for (int i = 0; i < packageList.size(); i++) { for (int i = 0; i < packageList.size(); i++) {
DbPathAndFilename item = DbPathAndFilename.Factory.newInstance(); DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();
item.setFarGuid(far.getGuidValue()); item.setFarGuid(far.getGuidValue());
item.setStringValue(packageList.get(i)); item.setStringValue(packageList.get(i));
fdb.getPackageList().getFilenameList().add(item); fdb.getPackageList().getFilenameList().add(item);
} }
for (int i = 0; i < platformList.size(); i++) { for (int i = 0; i < platformList.size(); i++) {
DbPathAndFilename item = DbPathAndFilename.Factory.newInstance(); DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();
item.setFarGuid(far.getGuidValue()); item.setFarGuid(far.getGuidValue());
item.setStringValue(platformList.get(i)); item.setStringValue(platformList.get(i));
fdb.getPlatformList().getFilenameList().add(item); fdb.getPlatformList().getFilenameList().add(item);
} }
DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance(); DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();
farItem.setFarGuid(far.getGuidValue()); farItem.setFarGuid(far.getGuidValue());
farItem.setStringValue(far.getFarName()); farItem.setStringValue(far.getFarName());
fdb.getFarList().getFilenameList().add(farItem); fdb.getFarList().getFilenameList().add(farItem);
String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile(); String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath); strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
try { try {
SaveFile.saveDbFile(strFrameworkDbFilePath, fdb); SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);
} } catch (Exception e) {
catch (Exception e) { e.printStackTrace();
e.printStackTrace(); }
}
} }
public void removeFarFromDb(FarIdentification far) { public void removeFarFromDb(FarIdentification far) {
FrameworkDatabase fdb = openFrameworkDb(); FrameworkDatabase fdb = openFrameworkDb();
// //
@ -118,90 +116,87 @@ public class WorkspaceTools {
XmlCursor cursor = fdb.getPackageList().newCursor(); XmlCursor cursor = fdb.getPackageList().newCursor();
cursor.toFirstChild(); cursor.toFirstChild();
do { do {
DbPathAndFilename item = (DbPathAndFilename)cursor.getObject(); DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) { if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
cursor.removeXml(); cursor.removeXml();
} }
} while (cursor.toNextSibling()); } while (cursor.toNextSibling());
cursor.dispose(); cursor.dispose();
// //
// Remove Platforms // Remove Platforms
// //
cursor = fdb.getPlatformList().newCursor(); cursor = fdb.getPlatformList().newCursor();
cursor.toFirstChild(); cursor.toFirstChild();
do { do {
DbPathAndFilename item = (DbPathAndFilename)cursor.getObject(); DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) { if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
cursor.removeXml(); cursor.removeXml();
} }
} while (cursor.toNextSibling()); } while (cursor.toNextSibling());
// //
// Remove Far // Remove Far
// //
cursor = fdb.getFarList().newCursor(); cursor = fdb.getFarList().newCursor();
cursor.toFirstChild(); cursor.toFirstChild();
do { do {
DbPathAndFilename item = (DbPathAndFilename)cursor.getObject(); DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) { if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
cursor.removeXml(); cursor.removeXml();
} }
} while (cursor.toNextSibling()); } while (cursor.toNextSibling());
cursor.dispose(); cursor.dispose();
String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile(); String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath); strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
try { try {
SaveFile.saveDbFile(strFrameworkDbFilePath, fdb); SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);
} } catch (Exception e) {
catch (Exception e) { e.printStackTrace();
e.printStackTrace();
} }
} }
public String getPackageFarGuid(PackageIdentification packageId) { public String getPackageFarGuid(Identification packageId) {
openFrameworkDb(); openFrameworkDb();
for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) { for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {
DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index); DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
+ item.getStringValue(); File tempFile = new File(path);
File tempFile = new File(path); if (tempFile.getPath().equalsIgnoreCase(packageId.getPath())) {
if (tempFile.getPath().equalsIgnoreCase(packageId.getSpdFile().getPath())) { return fdb.getPackageList().getFilenameArray(index).getFarGuid();
return fdb.getPackageList().getFilenameArray(index).getFarGuid(); }
} }
}
return null;
}
public String getPlatformFarGuid(PlatformIdentification platformId) {
openFrameworkDb();
for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {
DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
+ item.getStringValue();
File tempFile = new File(path);
if (tempFile.getPath().equalsIgnoreCase(platformId.getFpdFile().getPath())) {
return fdb.getPlatformList().getFilenameArray(index).getFarGuid();
}
}
return null;
}
public String getModuleFarGuid(ModuleIdentification moduleId) {
PackageIdentification packageId = getPackageIdByModuleId(moduleId);
if (packageId != null) {
return getPackageFarGuid(packageId);
}
else {
return null; return null;
}
} }
public String getPlatformFarGuid(Identification platformId) {
openFrameworkDb();
for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {
DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
File tempFile = new File(path);
if (tempFile.getPath().equalsIgnoreCase(platformId.getPath())) {
return fdb.getPlatformList().getFilenameArray(index).getFarGuid();
}
}
return null;
}
public String getModuleFarGuid(Identification moduleId) {
PackageIdentification packageId = getPackageIdByModuleId(moduleId);
if (packageId != null) {
return getPackageFarGuid(packageId);
} else {
return null;
}
}
/** /**
Get all modules' paths from one package Get all modules' paths from one package
@ -229,34 +224,34 @@ public class WorkspaceTools {
} }
return modulePath; return modulePath;
} }
/** /**
Get all Industry Std Includes' paths from one package Get all Industry Std Includes' paths from one package
@return a Vector with all paths @return a Vector with all paths
**/ **/
public Vector<String> getAllIndustryStdIncludesOfPackage(String path) { public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {
Vector<String> includePath = new Vector<String>(); Vector<String> includePath = new Vector<String>();
try { try {
IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes(); IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes();
if (files != null) { if (files != null) {
for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) { for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {
String temp = files.getIndustryStdHeaderList().get(index).getName(); String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();
temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp; temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;
temp = Tools.convertPathToCurrentOsType(temp); temp = Tools.convertPathToCurrentOsType(temp);
includePath.addElement(temp); includePath.addElement(temp);
} }
} }
} catch (IOException e) { } catch (IOException e) {
} catch (XmlException e) { } catch (XmlException e) {
} catch (Exception e) { } catch (Exception e) {
} }
return includePath; return includePath;
} }
/** /**
Get all package basic information form the FrameworkDatabase.db file Get all package basic information form the FrameworkDatabase.db file
@ -293,90 +288,88 @@ public class WorkspaceTools {
} }
public Vector<FarIdentification> getAllFars() { public Vector<FarIdentification> getAllFars() {
openFrameworkDb(); openFrameworkDb();
Vector<FarIdentification> v = new Vector<FarIdentification>(); Vector<FarIdentification> v = new Vector<FarIdentification>();
for (int index = 0; index < fdb.getFarList().getFilenameList().size(); index++) { for (int index = 0; index < fdb.getFarList().getFilenameList().size(); index++) {
DbPathAndFilename item = fdb.getFarList().getFilenameList().get(index); DbPathAndFilename item = fdb.getFarList().getFilenameList().get(index);
FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue()); FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());
v.addElement(far); v.addElement(far);
} }
return v; return v;
} }
public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) { public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {
Identification id = null; Identification id = null;
openFrameworkDb(); openFrameworkDb();
Vector<PackageIdentification> v = new Vector<PackageIdentification>(); Vector<PackageIdentification> v = new Vector<PackageIdentification>();
for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) { for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {
DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index); DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
+ item.getStringValue(); path = Tools.convertPathToCurrentOsType(path);
path = Tools.convertPathToCurrentOsType(path);
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
try {
try { id = getId(path, OpenFile.openSpdFile(path));
id = getId(path, OpenFile.openSpdFile(path)); v.addElement(new PackageIdentification(id));
v.addElement(new PackageIdentification(id)); } catch (IOException e) {
} catch (IOException e) { Log.err("Open Package Surface Area " + path, e.getMessage());
Log.err("Open Package Surface Area " + path, e.getMessage()); e.printStackTrace();
e.printStackTrace(); } catch (XmlException e) {
} catch (XmlException e) { Log.err("Open Package Surface Area " + path, e.getMessage());
Log.err("Open Package Surface Area " + path, e.getMessage()); e.printStackTrace();
e.printStackTrace(); } catch (Exception e) {
} catch (Exception e) { Log.err("Open Package Surface Area " + path, "Invalid file type");
Log.err("Open Package Surface Area " + path, "Invalid file type"); e.printStackTrace();
e.printStackTrace(); }
} }
} }
} return v;
return v;
} }
public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) { public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) {
Identification id = null; Identification id = null;
openFrameworkDb(); openFrameworkDb();
Vector<PlatformIdentification> v = new Vector<PlatformIdentification>(); Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();
for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) { for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {
DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index); DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
+ item.getStringValue(); path = Tools.convertPathToCurrentOsType(path);
path = Tools.convertPathToCurrentOsType(path);
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) { try {
try { id = getId(path, OpenFile.openFpdFile(path));
id = getId(path, OpenFile.openFpdFile(path)); v.addElement(new PlatformIdentification(id));
v.addElement(new PlatformIdentification(id)); } catch (IOException e) {
} catch (IOException e) { Log.err("Open Platform Surface Area " + path, e.getMessage());
Log.err("Open Platform Surface Area " + path, e.getMessage()); e.printStackTrace();
e.printStackTrace(); } catch (XmlException e) {
} catch (XmlException e) { Log.err("Open Platform Surface Area " + path, e.getMessage());
Log.err("Open Platform Surface Area " + path, e.getMessage()); e.printStackTrace();
e.printStackTrace(); } catch (Exception e) {
} catch (Exception e) { Log.err("Open Platform Surface Area " + path, "Invalid file type");
Log.err("Open Platform Surface Area " + path, "Invalid file type"); e.printStackTrace();
e.printStackTrace(); }
} }
} }
} return v;
return v;
} }
/** /**
Get all module basic information from a package Get all module basic information from a package
@param id Package id @param id Package id
@return A vector includes all modules' basic information @return A vector includes all modules' basic information
**/ **/
public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) { public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {
Vector<ModuleIdentification> v = new Vector<ModuleIdentification>(); Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();
Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath()); Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());
Identification id = null; Identification id = null;
String modulePath = null; String modulePath = null;
for (int index = 0; index < modulePaths.size(); index++) { for (int index = 0; index < modulePaths.size(); index++) {
try { try {
modulePath = modulePaths.get(index); modulePath = modulePaths.get(index);
@ -392,7 +385,7 @@ public class WorkspaceTools {
} }
Tools.sortModules(v, DataType.SORT_TYPE_ASCENDING); Tools.sortModules(v, DataType.SORT_TYPE_ASCENDING);
return v; return v;
} }
/** /**
@ -418,7 +411,7 @@ public class WorkspaceTools {
for (int indexI = 0; indexI < vPackageList.size(); indexI++) { for (int indexI = 0; indexI < vPackageList.size(); indexI++) {
packagePath = vPackageList.elementAt(indexI).getPath(); packagePath = vPackageList.elementAt(indexI).getPath();
modulePaths = this.getAllModulesOfPackage(packagePath); modulePaths = this.getAllModulesOfPackage(packagePath);
for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) { for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
try { try {
modulePath = modulePaths.get(indexJ); modulePath = modulePaths.get(indexJ);
@ -723,7 +716,7 @@ public class WorkspaceTools {
} catch (IOException e) { } catch (IOException e) {
} catch (XmlException e) { } catch (XmlException e) {
} catch (Exception e) { } catch (Exception e) {
} }
@ -877,7 +870,7 @@ public class WorkspaceTools {
// First add package // First add package
// //
v.addElement(path); v.addElement(path);
// //
// Add the package's industry std includes one by one // Add the package's industry std includes one by one
// //
@ -886,7 +879,7 @@ public class WorkspaceTools {
for (int index = 0; index < f1.size(); index++) { for (int index = 0; index < f1.size(); index++) {
v.addElement(f1.get(index)); v.addElement(f1.get(index));
} }
// //
// Add module's files one by one // Add module's files one by one
// //