diff options
author | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-22 04:59:10 +0000 |
---|---|---|
committer | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-22 04:59:10 +0000 |
commit | 33f1b485454dc24cfed856aaf1d694d67c1f4fb5 (patch) | |
tree | c17c1ad4f68d1c0829737c31c7bb3550d8d3c946 /Tools | |
parent | f387591c768818960c6ab2333efea6c74e75960f (diff) | |
download | edk2-platforms-33f1b485454dc24cfed856aaf1d694d67c1f4fb5.tar.xz |
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
Diffstat (limited to 'Tools')
6 files changed, 72 insertions, 13 deletions
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java index 44b8d27d2a..4f5fb37f71 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java @@ -288,7 +288,7 @@ public class DbFileContents { p.addNewPackageName().setStringValue(name);
p.addNewGuid().setStringValue(guid);
p.addNewVersion().setStringValue(version);
- p.addNewPath().setStringValue(installDir);
+ p.addNewPath().setStringValue(installDir + "/");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Date date = new Date();
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java index 71d291548d..03e1607626 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java @@ -24,6 +24,7 @@ import java.awt.GridLayout; import java.io.File;
import javax.swing.JButton;
+import javax.swing.filechooser.FileFilter;
/**
GUI for create spd file
@@ -137,6 +138,8 @@ public class PackageAction extends JFrame { @return javax.swing.JButton
**/
private JButton getJButton() {
+ final FileFilter filter = new PkgFileFilter("spd");
+
if (jButton == null) {
jButton = new JButton();
jButton.setText("Save");
@@ -145,8 +148,9 @@ public class PackageAction extends JFrame { //
// save sfc contents to file
//
- JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
+ JFileChooser chooser = new JFileChooser(PackagingMain.dirForNewSpd);
chooser.setMultiSelectionEnabled(false);
+ chooser.setFileFilter(filter);
int retval = chooser.showSaveDialog(frame);
if (retval == JFileChooser.APPROVE_OPTION) {
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java index efd6a767b4..bf8c70b3df 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java @@ -416,7 +416,7 @@ public class PackageLibraryClass extends JFrame implements ActionListener { if (jRadioButtonSelect.isSelected()) {
strLibClass = jComboBoxSelect.getSelectedItem().toString();
}
- listItem.addElement(jTextField.getText() + this.Separator + strLibClass);
+ listItem.addElement(jTextField.getText().replace('\\', '/') + this.Separator + strLibClass);
}
//
// remove selected line
@@ -517,25 +517,40 @@ public class PackageLibraryClass extends JFrame implements ActionListener { // Select files from current workspace
//
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
+ File theFile = null;
+ String headerDest = null;
chooser.setMultiSelectionEnabled(false);
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int retval = chooser.showOpenDialog(frame);
if (retval == JFileChooser.APPROVE_OPTION) {
- File theFile = chooser.getSelectedFile();
+ theFile = chooser.getSelectedFile();
String file = theFile.getPath();
if (!file.startsWith(System.getenv("WORKSPACE"))) {
JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");
return;
}
+
+
+ }
+ else {
+ return;
+ }
+
+ if (!theFile.getPath().startsWith(PackagingMain.dirForNewSpd)) {
//
- // record relative path of selected file. Assume top level package directory lies directly in workspace
+ //ToDo: copy elsewhere header file to new pkg dir, prompt user to chooser a location
//
- int fileIndex = file.indexOf(System.getProperty("file.separator"), System.getenv("WORKSPACE").length() + 1);
- jTextField.setText(file.substring(fileIndex + 1));
-
+ 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('\\', '/'));
+
}
});
}
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java index b57a1b23d4..824c372d53 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java @@ -32,6 +32,7 @@ import javax.swing.JList; import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JFrame;
+import javax.swing.filechooser.FileFilter;
/**
GUI for create MsaFile elements of spd file
@@ -318,6 +319,8 @@ public class PackageMsaFile extends JFrame implements ActionListener { @return javax.swing.JButton
**/
private JButton getJButton() {
+ final FileFilter filter = new PkgFileFilter("msa");
+
if (jButton == null) {
jButton = new JButton();
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() {
public void mouseClicked(java.awt.event.MouseEvent e) {
JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE"));
+ File theFile = null;
+ String msaDest = null;
chooser.setMultiSelectionEnabled(false);
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- chooser.setFileFilter(new PkgFileFilter("msa"));
+ chooser.setFileFilter(filter);
int retval = chooser.showOpenDialog(frame);
if (retval == JFileChooser.APPROVE_OPTION) {
- File theFile = chooser.getSelectedFile();
+ theFile = chooser.getSelectedFile();
String file = theFile.getPath();
if (!file.startsWith(System.getenv("WORKSPACE"))) {
JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!");
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('\\', '/'));
}
});
}
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java index 982dbe224f..8d0eb7dc89 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java @@ -373,7 +373,7 @@ public class PackagePkgHeader extends JFrame implements ActionListener { strLibClass = jComboBoxSelect.getSelectedItem().toString();
}
- listItem.addElement(jTextField.getText() + Separator + strLibClass);
+ listItem.addElement(jTextField.getText().replace('\\', '/') + Separator + strLibClass);
}
if (arg0.getSource() == jButtonRemove) {
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java index bca1108045..7d4654ab00 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java @@ -37,6 +37,8 @@ public class PackagingMain extends JFrame { static JFrame frame;
+ static String dirForNewSpd = null;
+
private JPanel jContentPane = null;
private JButton jButton = null;
@@ -227,6 +229,25 @@ public class PackagingMain extends JFrame { jButton5.setText("Create Package Description File");
jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
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();
ModalFrameUtil.showAsModal(new PackageAction(sfc), pThis);
}
|