From 4917d9ddc38808bce82bc54ee690edf6bb5804a6 Mon Sep 17 00:00:00 2001 From: hche10x Date: Fri, 8 Sep 2006 01:58:04 +0000 Subject: [PATCH] 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 --- .../org/tianocore/frameworkwizard/Clone.java | 29 ++++++++++++- .../frameworkwizard/FrameworkWizardUI.java | 41 ++++++++++++++++--- .../frameworkwizard/common/GlobalData.java | 2 +- 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java index 97f16ce40c..3395434efd 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java @@ -376,7 +376,7 @@ public class Clone extends IDialog { this.jLabelBelong.setEnabled(false); this.jComboBoxExistingPackage.setEnabled(false); this.jButtonBrowse.setVisible(false); - this.jTextFieldFilePath.setToolTipText("Input the package's relative path and file name, for example:
MdePkg\\MdePkg.fpd"); + this.jTextFieldFilePath.setToolTipText("Input the package's relative path and file name, for example:
MdePkg\\MdePkg.spd"); 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 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; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index b159fe4d62..0d3ddb50ad 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -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); } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java index a50d2f104f..e83a95bbad 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java @@ -178,7 +178,7 @@ public class GlobalData { @return a Vector with all modules' path **/ - private static Vector getAllModulesOfPackage(String path) { + public static Vector getAllModulesOfPackage(String path) { Vector modulePath = new Vector(); try { MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles(); -- 2.39.5