1. Add function "Refresh" in main UI

2. Add function to add modules to GlobalData when clone a package.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1501 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-09-08 01:58:04 +00:00
parent 63e30d14b4
commit 4917d9ddc3
3 changed files with 65 additions and 7 deletions

View File

@ -376,7 +376,7 @@ public class Clone extends IDialog {
this.jLabelBelong.setEnabled(false); this.jLabelBelong.setEnabled(false);
this.jComboBoxExistingPackage.setEnabled(false); this.jComboBoxExistingPackage.setEnabled(false);
this.jButtonBrowse.setVisible(false); this.jButtonBrowse.setVisible(false);
this.jTextFieldFilePath.setToolTipText("<html>Input the package's relative path and file name, for example:<br>MdePkg\\MdePkg.fpd</html>"); this.jTextFieldFilePath.setToolTipText("<html>Input the package's relative path and file name, for example:<br>MdePkg\\MdePkg.spd</html>");
this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height); this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
this.jLabelDestinationFile.setText("New Package Path and Filename"); this.jLabelDestinationFile.setText("New Package Path and Filename");
} }
@ -845,6 +845,33 @@ public class Clone extends IDialog {
GlobalData.vPackageList.addElement(pid); GlobalData.vPackageList.addElement(pid);
GlobalData.openingPackageList.insertToOpeningPackageList(pid, spd); GlobalData.openingPackageList.insertToOpeningPackageList(pid, spd);
//
// Add all cloned modules
//
Vector<String> modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath());
String modulePath = null;
ModuleSurfaceArea msa = null;
for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
try {
modulePath = modulePaths.get(indexJ);
msa = OpenFile.openMsaFile(modulePath);
} catch (IOException e) {
Log.err("Open Module Surface Area " + modulePath, e.getMessage());
continue;
} catch (XmlException e) {
Log.err("Open Module Surface Area " + modulePath, e.getMessage());
continue;
} catch (Exception e) {
Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
continue;
}
Identification id = Tools.getId(modulePath, msa);
mid = new ModuleIdentification(id, pid);
GlobalData.vModuleList.addElement(mid);
GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);
}
this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA; this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
} }

View File

@ -149,6 +149,8 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
private JMenuItem jMenuItemFileNew = null; private JMenuItem jMenuItemFileNew = null;
private JMenuItem jMenuItemFileRefresh = null;
private JMenuItem jMenuItemFileSaveAs = null; private JMenuItem jMenuItemFileSaveAs = null;
private JMenuItem jMenuItemFileExit = null; private JMenuItem jMenuItemFileExit = null;
@ -430,6 +432,9 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
jMenuFile.add(getJMenuItemFileSaveAll()); jMenuFile.add(getJMenuItemFileSaveAll());
jMenuFile.addSeparator(); jMenuFile.addSeparator();
jMenuFile.add(getJMenuItemFileRefresh());
jMenuFile.addSeparator();
jMenuFile.add(getJMenuItemFilePageSetup()); jMenuFile.add(getJMenuItemFilePageSetup());
jMenuFile.add(getJMenuItemFilePrint()); jMenuFile.add(getJMenuItemFilePrint());
jMenuFile.add(getJMenuItemFileImport()); jMenuFile.add(getJMenuItemFileImport());
@ -458,6 +463,23 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
return jMenuItemFileSaveAs; return jMenuItemFileSaveAs;
} }
/**
This method initializes jMenuItemFileRefresh
@return javax.swing.JMenuItem jMenuItemFileRefresh
**/
private JMenuItem getJMenuItemFileRefresh() {
if (jMenuItemFileRefresh == null) {
jMenuItemFileRefresh = new JMenuItem();
jMenuItemFileRefresh.setText("Refresh");
jMenuItemFileRefresh.setMnemonic('R');
jMenuItemFileRefresh.addActionListener(this);
jMenuItemFileRefresh.setVisible(true);
}
return jMenuItemFileRefresh;
}
/** /**
This method initializes jMenuItemModuleExit This method initializes jMenuItemModuleExit
@ -633,6 +655,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
// //
jMenuHelp = new JMenu(); jMenuHelp = new JMenu();
jMenuHelp.setText("Help"); jMenuHelp.setText("Help");
jMenuHelp.setMnemonic('H');
// //
// Add sub menu items // Add sub menu items
@ -656,6 +679,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
if (jMenuItemHelpAbout == null) { if (jMenuItemHelpAbout == null) {
jMenuItemHelpAbout = new JMenuItem(); jMenuItemHelpAbout = new JMenuItem();
jMenuItemHelpAbout.setText("About..."); jMenuItemHelpAbout.setText("About...");
jMenuItemHelpAbout.setMnemonic('A');
jMenuItemHelpAbout.addActionListener(this); jMenuItemHelpAbout.addActionListener(this);
} }
return jMenuItemHelpAbout; return jMenuItemHelpAbout;
@ -882,6 +906,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
if (jMenuItemFileCloseAll == null) { if (jMenuItemFileCloseAll == null) {
jMenuItemFileCloseAll = new JMenuItem(); jMenuItemFileCloseAll = new JMenuItem();
jMenuItemFileCloseAll.setText("Close All"); jMenuItemFileCloseAll.setText("Close All");
jMenuItemFileCloseAll.setMnemonic('A');
jMenuItemFileCloseAll.setEnabled(true); jMenuItemFileCloseAll.setEnabled(true);
jMenuItemFileCloseAll.addActionListener(this); jMenuItemFileCloseAll.addActionListener(this);
} }
@ -1860,6 +1885,12 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
this.saveAll(); this.saveAll();
} }
if (arg0.getSource() == this.jMenuItemFileRefresh) {
this.closeAll();
this.refresh();
this.makeEmptyTree();
}
if (arg0.getSource() == this.jMenuItemFileExit) { if (arg0.getSource() == this.jMenuItemFileExit) {
this.exit(); this.exit();
} }
@ -3309,13 +3340,13 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
// //
// Reinit whole window // Reinit whole window
// //
closeAll(); this.closeAll();
this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
+ Workspace.getCurrentWorkspace() + "]"); + Workspace.getCurrentWorkspace() + "]");
// //
// Reinit Global Data // Refrash the tree
// //
GlobalData.init(); this.refresh();
} }
sw.dispose(); sw.dispose();
} }
@ -3467,8 +3498,8 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
// //
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode( IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(
GlobalData.vPlatformList.lastElement().getName(), GlobalData.vPlatformList.lastElement().getName(),
IDefaultMutableTreeNode.PLATFORM, IDefaultMutableTreeNode.PLATFORM, false,
false, GlobalData.vPlatformList.lastElement(), GlobalData.vPlatformList.lastElement(),
this.dmtnPlatformDescription); this.dmtnPlatformDescription);
iTree.addNode(this.dmtnPlatformDescription, node); iTree.addNode(this.dmtnPlatformDescription, node);
} }

View File

@ -178,7 +178,7 @@ public class GlobalData {
@return a Vector with all modules' path @return a Vector with all modules' path
**/ **/
private static Vector<String> getAllModulesOfPackage(String path) { public static Vector<String> getAllModulesOfPackage(String path) {
Vector<String> modulePath = new Vector<String>(); Vector<String> modulePath = new Vector<String>();
try { try {
MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles(); MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();