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.jComboBoxExistingPackage.setEnabled(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.jLabelDestinationFile.setText("New Package Path and Filename");
}
@ -845,6 +845,33 @@ public class Clone extends IDialog {
GlobalData.vPackageList.addElement(pid);
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;
}

View File

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

View File

@ -178,7 +178,7 @@ public class GlobalData {
@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>();
try {
MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();