mirror of https://github.com/acidanthera/audk.git
Remove the assumption of package location under workspace and prompt user to specify package location.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@226 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f387591c76
commit
33f1b48545
|
@ -288,7 +288,7 @@ public class DbFileContents {
|
||||||
p.addNewPackageName().setStringValue(name);
|
p.addNewPackageName().setStringValue(name);
|
||||||
p.addNewGuid().setStringValue(guid);
|
p.addNewGuid().setStringValue(guid);
|
||||||
p.addNewVersion().setStringValue(version);
|
p.addNewVersion().setStringValue(version);
|
||||||
p.addNewPath().setStringValue(installDir);
|
p.addNewPath().setStringValue(installDir + "/");
|
||||||
|
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.awt.GridLayout;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
GUI for create spd file
|
GUI for create spd file
|
||||||
|
@ -137,6 +138,8 @@ public class PackageAction extends JFrame {
|
||||||
@return javax.swing.JButton
|
@return javax.swing.JButton
|
||||||
**/
|
**/
|
||||||
private JButton getJButton() {
|
private JButton getJButton() {
|
||||||
|
final FileFilter filter = new PkgFileFilter("spd");
|
||||||
|
|
||||||
if (jButton == null) {
|
if (jButton == null) {
|
||||||
jButton = new JButton();
|
jButton = new JButton();
|
||||||
jButton.setText("Save");
|
jButton.setText("Save");
|
||||||
|
@ -145,8 +148,9 @@ public class PackageAction extends JFrame {
|
||||||
//
|
//
|
||||||
// save sfc contents to file
|
// save sfc contents to file
|
||||||
//
|
//
|
||||||
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
|
JFileChooser chooser = new JFileChooser(PackagingMain.dirForNewSpd);
|
||||||
chooser.setMultiSelectionEnabled(false);
|
chooser.setMultiSelectionEnabled(false);
|
||||||
|
chooser.setFileFilter(filter);
|
||||||
|
|
||||||
int retval = chooser.showSaveDialog(frame);
|
int retval = chooser.showSaveDialog(frame);
|
||||||
if (retval == JFileChooser.APPROVE_OPTION) {
|
if (retval == JFileChooser.APPROVE_OPTION) {
|
||||||
|
|
|
@ -416,7 +416,7 @@ public class PackageLibraryClass extends JFrame implements ActionListener {
|
||||||
if (jRadioButtonSelect.isSelected()) {
|
if (jRadioButtonSelect.isSelected()) {
|
||||||
strLibClass = jComboBoxSelect.getSelectedItem().toString();
|
strLibClass = jComboBoxSelect.getSelectedItem().toString();
|
||||||
}
|
}
|
||||||
listItem.addElement(jTextField.getText() + this.Separator + strLibClass);
|
listItem.addElement(jTextField.getText().replace('\\', '/') + this.Separator + strLibClass);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// remove selected line
|
// remove selected line
|
||||||
|
@ -517,25 +517,40 @@ public class PackageLibraryClass extends JFrame implements ActionListener {
|
||||||
// Select files from current workspace
|
// Select files from current workspace
|
||||||
//
|
//
|
||||||
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
|
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
|
||||||
|
File theFile = null;
|
||||||
|
String headerDest = null;
|
||||||
|
|
||||||
chooser.setMultiSelectionEnabled(false);
|
chooser.setMultiSelectionEnabled(false);
|
||||||
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
|
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
|
||||||
int retval = chooser.showOpenDialog(frame);
|
int retval = chooser.showOpenDialog(frame);
|
||||||
if (retval == JFileChooser.APPROVE_OPTION) {
|
if (retval == JFileChooser.APPROVE_OPTION) {
|
||||||
|
|
||||||
File theFile = chooser.getSelectedFile();
|
theFile = chooser.getSelectedFile();
|
||||||
String file = theFile.getPath();
|
String file = theFile.getPath();
|
||||||
if (!file.startsWith(System.getenv("WORKSPACE"))) {
|
if (!file.startsWith(System.getenv("WORKSPACE"))) {
|
||||||
JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");
|
JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// record relative path of selected file. Assume top level package directory lies directly in workspace
|
|
||||||
//
|
|
||||||
int fileIndex = file.indexOf(System.getProperty("file.separator"), System.getenv("WORKSPACE").length() + 1);
|
|
||||||
jTextField.setText(file.substring(fileIndex + 1));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!theFile.getPath().startsWith(PackagingMain.dirForNewSpd)) {
|
||||||
|
//
|
||||||
|
//ToDo: copy elsewhere header file to new pkg dir, prompt user to chooser a location
|
||||||
|
//
|
||||||
|
JOptionPane.showMessageDialog(frame, "You must copy header file into current package directory!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
headerDest = theFile.getPath();
|
||||||
|
int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), PackagingMain.dirForNewSpd.length());
|
||||||
|
|
||||||
|
jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import javax.swing.JList;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
GUI for create MsaFile elements of spd file
|
GUI for create MsaFile elements of spd file
|
||||||
|
@ -318,6 +319,8 @@ public class PackageMsaFile extends JFrame implements ActionListener {
|
||||||
@return javax.swing.JButton
|
@return javax.swing.JButton
|
||||||
**/
|
**/
|
||||||
private JButton getJButton() {
|
private JButton getJButton() {
|
||||||
|
final FileFilter filter = new PkgFileFilter("msa");
|
||||||
|
|
||||||
if (jButton == null) {
|
if (jButton == null) {
|
||||||
jButton = new JButton();
|
jButton = new JButton();
|
||||||
jButton.setBounds(new java.awt.Rectangle(377,46,89,20));
|
jButton.setBounds(new java.awt.Rectangle(377,46,89,20));
|
||||||
|
@ -326,23 +329,39 @@ public class PackageMsaFile extends JFrame implements ActionListener {
|
||||||
jButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
jButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mouseClicked(java.awt.event.MouseEvent e) {
|
public void mouseClicked(java.awt.event.MouseEvent e) {
|
||||||
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
|
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
|
||||||
|
File theFile = null;
|
||||||
|
String msaDest = null;
|
||||||
|
|
||||||
chooser.setMultiSelectionEnabled(false);
|
chooser.setMultiSelectionEnabled(false);
|
||||||
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
|
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
|
||||||
chooser.setFileFilter(new PkgFileFilter("msa"));
|
chooser.setFileFilter(filter);
|
||||||
int retval = chooser.showOpenDialog(frame);
|
int retval = chooser.showOpenDialog(frame);
|
||||||
if (retval == JFileChooser.APPROVE_OPTION) {
|
if (retval == JFileChooser.APPROVE_OPTION) {
|
||||||
|
|
||||||
File theFile = chooser.getSelectedFile();
|
theFile = chooser.getSelectedFile();
|
||||||
String file = theFile.getPath();
|
String file = theFile.getPath();
|
||||||
if (!file.startsWith(System.getenv("WORKSPACE"))) {
|
if (!file.startsWith(System.getenv("WORKSPACE"))) {
|
||||||
JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");
|
JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int fileIndex = file.indexOf(System.getProperty("file.separator"), System.getenv("WORKSPACE").length() + 1);
|
|
||||||
jTextField.setText(file.substring(fileIndex + 1));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!theFile.getPath().startsWith(PackagingMain.dirForNewSpd)) {
|
||||||
|
//
|
||||||
|
//ToDo: copy elsewhere msa to new pkg dir, prompt user to chooser a location
|
||||||
|
//
|
||||||
|
JOptionPane.showMessageDialog(frame, "You must copy msa file into current package directory!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msaDest = theFile.getPath();
|
||||||
|
int fileIndex = msaDest.indexOf(System.getProperty("file.separator"), PackagingMain.dirForNewSpd.length());
|
||||||
|
|
||||||
|
jTextField.setText(msaDest.substring(fileIndex + 1).replace('\\', '/'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,7 @@ public class PackagePkgHeader extends JFrame implements ActionListener {
|
||||||
strLibClass = jComboBoxSelect.getSelectedItem().toString();
|
strLibClass = jComboBoxSelect.getSelectedItem().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
listItem.addElement(jTextField.getText() + Separator + strLibClass);
|
listItem.addElement(jTextField.getText().replace('\\', '/') + Separator + strLibClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg0.getSource() == jButtonRemove) {
|
if (arg0.getSource() == jButtonRemove) {
|
||||||
|
|
|
@ -37,6 +37,8 @@ public class PackagingMain extends JFrame {
|
||||||
|
|
||||||
static JFrame frame;
|
static JFrame frame;
|
||||||
|
|
||||||
|
static String dirForNewSpd = null;
|
||||||
|
|
||||||
private JPanel jContentPane = null;
|
private JPanel jContentPane = null;
|
||||||
|
|
||||||
private JButton jButton = null;
|
private JButton jButton = null;
|
||||||
|
@ -227,6 +229,25 @@ public class PackagingMain extends JFrame {
|
||||||
jButton5.setText("Create Package Description File");
|
jButton5.setText("Create Package Description File");
|
||||||
jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
|
jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mouseClicked(java.awt.event.MouseEvent e) {
|
public void mouseClicked(java.awt.event.MouseEvent e) {
|
||||||
|
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
|
||||||
|
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||||
|
chooser.setMultiSelectionEnabled(false);
|
||||||
|
chooser.setDialogTitle("Please specify where to save the new spd file");
|
||||||
|
|
||||||
|
int retval = chooser.showSaveDialog(frame);
|
||||||
|
if (retval == JFileChooser.APPROVE_OPTION) {
|
||||||
|
try {
|
||||||
|
File theFile = chooser.getSelectedFile();
|
||||||
|
PackagingMain.dirForNewSpd = theFile.getPath();
|
||||||
|
|
||||||
|
} catch (Exception ee) {
|
||||||
|
System.out.println(ee.toString());
|
||||||
|
}
|
||||||
|
// pThis.dispose();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
SpdFileContents sfc = new SpdFileContents();
|
SpdFileContents sfc = new SpdFileContents();
|
||||||
ModalFrameUtil.showAsModal(new PackageAction(sfc), pThis);
|
ModalFrameUtil.showAsModal(new PackageAction(sfc), pThis);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue