1. Fix bug in get industry std headers
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Jul 2006 08:51:27 +0000 (08:51 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Jul 2006 08:51:27 +0000 (08:51 +0000)
2. Fix bug in save msa without saving specification
3. Add tool tip text to ArchCheckBox
4. Locate to msa file location when open a file browser when edit source file in Msa
5. File filter only for text file when open/save ToolChainConfig file
6. Adjust UI for clone and add far id info when clone an item.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@971 6f19259b-4bc3-4df7-8a09-765794883524

13 files changed:
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java

index 8f1ec6c6bab4e9ab0257256769cc3a00bdb9af4a..68d8c48160ba1638205caf39561d75301aaaa860 100644 (file)
@@ -121,7 +121,7 @@ public class Clone extends IDialog {
     private JTextField getJTextFieldType() {\r
         if (jTextFieldType == null) {\r
             jTextFieldType = new JTextField();\r
-            jTextFieldType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
+            jTextFieldType.setBounds(new java.awt.Rectangle(210, 10, 320, 20));\r
             jTextFieldType.setEditable(false);\r
         }\r
         return jTextFieldType;\r
@@ -135,7 +135,7 @@ public class Clone extends IDialog {
     private JTextField getJTextFieldSource() {\r
         if (jTextFieldSource == null) {\r
             jTextFieldSource = new JTextField();\r
-            jTextFieldSource.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
+            jTextFieldSource.setBounds(new java.awt.Rectangle(210, 35, 320, 20));\r
             jTextFieldSource.setEditable(false);\r
         }\r
         return jTextFieldSource;\r
@@ -149,7 +149,7 @@ public class Clone extends IDialog {
     private JButton getJButtonBrowse() {\r
         if (jButtonBrowse == null) {\r
             jButtonBrowse = new JButton();\r
-            jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20));\r
+            jButtonBrowse.setBounds(new java.awt.Rectangle(445, 85, 85, 20));\r
             jButtonBrowse.setText("Browse");\r
             jButtonBrowse.addActionListener(this);\r
         }\r
@@ -164,7 +164,7 @@ public class Clone extends IDialog {
     private JTextField getJTextFieldFilePath() {\r
         if (jTextFieldFilePath == null) {\r
             jTextFieldFilePath = new JTextField();\r
-            jTextFieldFilePath.setBounds(new java.awt.Rectangle(160, 60, 230, 20));\r
+            jTextFieldFilePath.setBounds(new java.awt.Rectangle(210, 85, 230, 20));\r
         }\r
         return jTextFieldFilePath;\r
     }\r
@@ -177,7 +177,7 @@ public class Clone extends IDialog {
     private JTextField getJTextFieldBaseName() {\r
         if (jTextFieldBaseName == null) {\r
             jTextFieldBaseName = new JTextField();\r
-            jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
+            jTextFieldBaseName.setBounds(new java.awt.Rectangle(210, 110, 320, 20));\r
         }\r
         return jTextFieldBaseName;\r
     }\r
@@ -190,7 +190,7 @@ public class Clone extends IDialog {
     private JTextField getJTextFieldGuid() {\r
         if (jTextFieldGuid == null) {\r
             jTextFieldGuid = new JTextField();\r
-            jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 135, 230, 20));\r
+            jTextFieldGuid.setBounds(new java.awt.Rectangle(210, 135, 230, 20));\r
         }\r
         return jTextFieldGuid;\r
     }\r
@@ -203,7 +203,7 @@ public class Clone extends IDialog {
     private JTextField getJTextFieldVersion() {\r
         if (jTextFieldVersion == null) {\r
             jTextFieldVersion = new JTextField();\r
-            jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 160, 320, 20));\r
+            jTextFieldVersion.setBounds(new java.awt.Rectangle(210, 160, 320, 20));\r
         }\r
         return jTextFieldVersion;\r
     }\r
@@ -216,7 +216,7 @@ public class Clone extends IDialog {
     private JButton getJButtonOk() {\r
         if (jButtonOk == null) {\r
             jButtonOk = new JButton();\r
-            jButtonOk.setBounds(new java.awt.Rectangle(235, 200, 90, 20));\r
+            jButtonOk.setBounds(new java.awt.Rectangle(285, 200, 90, 20));\r
             jButtonOk.setText("Ok");\r
             jButtonOk.addActionListener(this);\r
         }\r
@@ -231,7 +231,7 @@ public class Clone extends IDialog {
     private JButton getJButtonCancel() {\r
         if (jButtonCancel == null) {\r
             jButtonCancel = new JButton();\r
-            jButtonCancel.setBounds(new java.awt.Rectangle(355, 200, 90, 20));\r
+            jButtonCancel.setBounds(new java.awt.Rectangle(405, 200, 90, 20));\r
             jButtonCancel.setText("Cancel");\r
             jButtonCancel.addActionListener(this);\r
         }\r
@@ -246,7 +246,7 @@ public class Clone extends IDialog {
     private JButton getJButtonGenerateGuid() {\r
         if (jButtonGenerateGuid == null) {\r
             jButtonGenerateGuid = new JButton();\r
-            jButtonGenerateGuid.setBounds(new java.awt.Rectangle(395, 135, 85, 20));\r
+            jButtonGenerateGuid.setBounds(new java.awt.Rectangle(445, 135, 85, 20));\r
             jButtonGenerateGuid.setText("Gen");\r
             jButtonGenerateGuid.addActionListener(this);\r
         }\r
@@ -261,7 +261,7 @@ public class Clone extends IDialog {
     private JComboBox getJComboBoxExistingPackage() {\r
         if (jComboBoxExistingPackage == null) {\r
             jComboBoxExistingPackage = new JComboBox();\r
-            jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
+            jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(210, 60, 320, 20));\r
         }\r
         return jComboBoxExistingPackage;\r
     }\r
@@ -316,7 +316,7 @@ public class Clone extends IDialog {
      * @return void\r
      */\r
     private void init() {\r
-        this.setSize(493, 260);\r
+        this.setSize(550, 260);\r
         this.setContentPane(getJContentPane());\r
         this.setTitle("Clone");\r
         this.centerWindow();\r
@@ -331,20 +331,26 @@ public class Clone extends IDialog {
         init();\r
         if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
             this.jTextFieldType.setText(DataType.MODULE_SURFACE_AREA);\r
-            this.jTextFieldSource.setText(oldId.getPath());\r
+            String s = oldId.getPath();\r
+            s = Tools.getRelativePath(s, Tools.getFilePathOnly(wt.getPackageIdByModuleId(oldId).getPath()));\r
+            this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));\r
             initExistingPackage();\r
-            this.jButtonBrowse.setEnabled(false);\r
+            this.jButtonBrowse.setVisible(false);\r
             this.jTextFieldFilePath.setToolTipText("Input module name here. For example, Application\\HelloWorld\\HelloWorld.msa");\r
-            this.jLabelDestinationFile.setText("Module Path\\Name");\r
+            this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);\r
+            this.jLabelDestinationFile.setText("New Module Path and Filename");\r
         }\r
         if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
             this.jTextFieldType.setText(DataType.PACKAGE_SURFACE_AREA);\r
-            this.jTextFieldSource.setText(oldId.getPath());\r
+            String s = oldId.getPath();\r
+            s = Tools.getRelativePath(oldId.getPath(), Workspace.getCurrentWorkspace());\r
+            this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));\r
             this.jLabelBelong.setEnabled(false);\r
             this.jComboBoxExistingPackage.setEnabled(false);\r
-            this.jButtonBrowse.setEnabled(false);\r
+            this.jButtonBrowse.setVisible(false);\r
             this.jTextFieldFilePath.setToolTipText("Input package name here. For example, MdePkg\\MdePkg.fpd");\r
-            this.jLabelDestinationFile.setText("Package Path\\Name");\r
+            this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);\r
+            this.jLabelDestinationFile.setText("New Package Path and Filename");\r
         }\r
         if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
             this.jTextFieldType.setText(DataType.PLATFORM_SURFACE_AREA);\r
@@ -352,7 +358,7 @@ public class Clone extends IDialog {
             this.jLabelBelong.setEnabled(false);\r
             this.jComboBoxExistingPackage.setEnabled(false);\r
             this.jTextFieldFilePath.setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd");\r
-            this.jLabelDestinationFile.setText("New Platform path");\r
+            this.jLabelDestinationFile.setText("New Platform Path and Filename");\r
         }\r
         if (mode == DataType.RETURN_TYPE_WORKSPACE) {\r
             this.jTextFieldType.setText(DataType.WORKSPACE);\r
@@ -367,7 +373,7 @@ public class Clone extends IDialog {
             this.jLabelVersion.setEnabled(false);\r
             this.jTextFieldVersion.setEnabled(false);\r
             this.jTextFieldFilePath.setToolTipText("Input workspace path here. For example, C:\\MyWorkspace");\r
-            this.jLabelDestinationFile.setText("New Workspace path");\r
+            this.jLabelDestinationFile.setText("New Workspace Path");\r
         }\r
     }\r
 \r
@@ -379,29 +385,29 @@ public class Clone extends IDialog {
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
             jLabelBelong = new JLabel();\r
-            jLabelBelong.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
+            jLabelBelong.setBounds(new java.awt.Rectangle(15, 60, 190, 20));\r
             jLabelBelong.setText("Clone to Package");\r
             jLabelVersion = new JLabel();\r
-            jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 140, 20));\r
+            jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 190, 20));\r
             jLabelVersion.setText("Version");\r
             jLabelGuid = new JLabel();\r
-            jLabelGuid.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
+            jLabelGuid.setBounds(new java.awt.Rectangle(15, 135, 190, 20));\r
             jLabelGuid.setText("Guid");\r
             jLabelBaseName = new JLabel();\r
-            jLabelBaseName.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
+            jLabelBaseName.setBounds(new java.awt.Rectangle(15, 110, 190, 20));\r
             jLabelBaseName.setText("Base Name");\r
             jLabelDestinationFile = new JLabel();\r
-            jLabelDestinationFile.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
+            jLabelDestinationFile.setBounds(new java.awt.Rectangle(15, 85, 190, 20));\r
             jLabelDestinationFile.setText("Destination File Name");\r
             jLabelSource = new JLabel();\r
-            jLabelSource.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
+            jLabelSource.setBounds(new java.awt.Rectangle(15, 35, 190, 20));\r
             jLabelSource.setText("Source");\r
             jLabelType = new JLabel();\r
-            jLabelType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
+            jLabelType.setBounds(new java.awt.Rectangle(15, 10, 190, 20));\r
             jLabelType.setText("Type");\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setSize(new java.awt.Dimension(490, 227));\r
+            jContentPane.setSize(new java.awt.Dimension(540, 227));\r
             jContentPane.add(jLabelType, null);\r
             jContentPane.add(getJTextFieldType(), null);\r
             jContentPane.add(jLabelSource, null);\r
@@ -551,7 +557,7 @@ public class Clone extends IDialog {
      \r
      **/\r
     private boolean check() {\r
-        String src = this.jTextFieldSource.getText();\r
+        String src = this.oldId.getPath();\r
         String trg = this.jTextFieldFilePath.getText();\r
         File srcFile = new File(src);\r
         File trgFile = new File(trg);\r
@@ -648,7 +654,7 @@ public class Clone extends IDialog {
     }\r
 \r
     private void save() throws IOException, XmlException, Exception {\r
-        String src = this.jTextFieldSource.getText();\r
+        String src = this.oldId.getPath();\r
         String trg = this.jTextFieldFilePath.getText();\r
         Vector<String> vFiles = new Vector<String>();\r
         \r
@@ -898,6 +904,10 @@ public class Clone extends IDialog {
         c.setPackageGuid(wt.getPackageIdByModuleId(oldId).getGuid());\r
         c.setPackageVersion(wt.getPackageIdByModuleId(oldId).getVersion());\r
         c.setId(count.add(new BigInteger("1")));\r
+        String guid = wt.getModuleFarGuid(oldId);\r
+        if (guid != null && !guid.equals("")) {\r
+            c.setFarGuid(guid);    \r
+        }\r
 \r
         cf.addNewCloned();\r
         cf.setClonedArray(cf.getClonedList().size() - 1, c);\r
@@ -950,6 +960,10 @@ public class Clone extends IDialog {
         c.setPackageGuid(id.getGuid());\r
         c.setPackageVersion(id.getVersion());\r
         c.setId(count.add(new BigInteger("1")));\r
+        String guid = wt.getModuleFarGuid(oldId);\r
+        if (guid != null && !guid.equals("")) {\r
+            c.setFarGuid(guid);    \r
+        }\r
 \r
         cf.addNewCloned();\r
         cf.setClonedArray(cf.getClonedList().size() - 1, c);\r
@@ -1002,7 +1016,11 @@ public class Clone extends IDialog {
         c.setPlatformGuid(id.getGuid());\r
         c.setPlatformVersion(id.getVersion());\r
         c.setId(count.add(new BigInteger("1")));\r
-\r
+        String guid = wt.getModuleFarGuid(oldId);\r
+        if (guid != null && !guid.equals("")) {\r
+            c.setFarGuid(guid);    \r
+        }\r
+        \r
         cf.addNewCloned();\r
         cf.setClonedArray(cf.getClonedList().size() - 1, c);\r
         pd.addNewClonedFrom();\r
index 6426f6b0e54c7d30ffa77341b83ef46dc6ccd57c..1087d85a4e232eab6c10d37b6a22b595df0868c4 100644 (file)
@@ -1793,7 +1793,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             CreateStepOne cso = new CreateStepOne(this, true);\r
             int result = cso.showDialog();\r
             if (result == DataType.RETURN_TYPE_OK) {\r
-                this.closeAll();\r
+                String strReturn = "Create Far Done!";\r
+                JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);\r
             }\r
             cso.dispose();\r
         }\r
@@ -1802,6 +1803,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             InstallStepOne iso = new InstallStepOne(this, true);\r
             int result = iso.showDialog();\r
             if (result == DataType.RETURN_TYPE_OK) {\r
+                String strReturn = "<html>Install Far Done! <br>The WORKSPACE will be refreshed!</html>";\r
+                JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);\r
                 this.closeAll();\r
             }\r
             iso.dispose();\r
@@ -1811,6 +1814,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             DeleteStepOne dso = new DeleteStepOne(this, true);\r
             int result = dso.showDialog();\r
             if (result == DataType.RETURN_TYPE_OK) {\r
+                String strReturn = "<html>Delete Far Done! <br>The WORKSPACE will be refreshed!</html>";\r
+                JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);\r
                 this.closeAll();\r
             }\r
             dso.dispose();\r
@@ -1820,6 +1825,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             UpdateStepOne uso = new UpdateStepOne(this, true);\r
             int result = uso.showDialog();\r
             if (result == DataType.RETURN_TYPE_OK) {\r
+                String strReturn = "<html>Update Far Done! <br>The WORKSPACE will be refreshed!</html>";\r
+                JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);\r
                 this.closeAll();\r
             }\r
             uso.dispose();\r
@@ -2039,147 +2046,76 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
         fc.addChoosableFileFilter(new IFileFilter(ext));\r
         return fc.showSaveDialog(new JPanel());\r
     }\r
-    \r
-    /**\r
-    Open Module\r
-\r
-    @param path input file path\r
-    \r
-    **/\r
-   private void openModule(String path, ModuleIdentification moduleId) {\r
-       ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
-       try {\r
-           msa = OpenFile.openMsaFile(path);\r
-       } catch (IOException e) {\r
-           Log.err("Open Module Surface Area " + path, e.getMessage());\r
-           return;\r
-       } catch (XmlException e) {\r
-           Log.err("Open Module Surface Area " + path, e.getMessage());\r
-           return;\r
-       } catch (Exception e) {\r
-           Log.err("Open Module Surface Area " + path, "Invalid file type");\r
-           return;\r
-       }\r
-       Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(),\r
-                                              msa.getMsaHeader().getVersion(), path);\r
-       //\r
-       // Generate module id\r
-       //\r
-       PackageIdentification pid = wt.getPackageIdByModuleId(id);\r
-       if (pid != null) {\r
-           //\r
-           // To judge if the module existed in vModuleList\r
-           // If not, add it to vModuleList\r
-           //\r
-           boolean isFind = false;\r
-           for (int index = 0; index < vModuleList.size(); index++) {\r
-               if (vModuleList.elementAt(index).equals(id)) {\r
-                   isFind = true;\r
-                   break;\r
-               }\r
-           }\r
-           if (!isFind) {\r
-               ModuleIdentification mid = new ModuleIdentification(id, pid, moduleId.isLibrary());\r
-               vModuleList.addElement(mid);\r
-               //\r
-               // Add new MsaHeader node to the tree\r
-               //\r
-               IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(),\r
-                                                                          IDefaultMutableTreeNode.MSA_HEADER, true,\r
-                                                                          mid);\r
-               //\r
-               // First find the module belongs to which package\r
-               //\r
-               IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),\r
-                                                                       IDefaultMutableTreeNode.MODULE_PACKAGE);\r
-               //\r
-               // To check if has module node or library node\r
-               //\r
-               IDefaultMutableTreeNode parentModuleNode = null;\r
-               IDefaultMutableTreeNode parentLibraryNode = null;\r
-               boolean hasModule = false;\r
-               boolean hasLibrary = false;\r
-               for (int index = 0; index < packageNode.getChildCount(); index++) {\r
-                   IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);\r
-                   if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {\r
-                       hasLibrary = true;\r
-                       parentLibraryNode = iNode;\r
-                   }\r
-                   if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {\r
-                       hasModule = true;\r
-                       parentModuleNode = iNode;\r
-                   }\r
-               }\r
-\r
-               //\r
-               // If is a module\r
-               //\r
-               if (!mid.isLibrary()) {\r
-                   //\r
-                   // Create parent node first if has no parent node\r
-                   //\r
-                   if (!hasModule) {\r
-                       parentModuleNode = new IDefaultMutableTreeNode("Module",\r
-                                                                      IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,\r
-                                                                      false, mid.getPackageId());\r
-                       iTree.addNode(packageNode, parentModuleNode);\r
-                   }\r
-\r
-                   iTree.addNode(parentModuleNode, node);\r
-               }\r
-\r
-               //\r
-               // If is a Library\r
-               //\r
-               if (mid.isLibrary()) {\r
-                   //\r
-                   // Create parent node first if has no parent node\r
-                   //\r
-                   if (!hasLibrary) {\r
-                       parentLibraryNode = new IDefaultMutableTreeNode("Library",\r
-                                                                       IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,\r
-                                                                       false, mid.getPackageId());\r
-                       iTree.addNode(packageNode, parentLibraryNode);\r
-                   }\r
-\r
-                   iTree.addNode(parentLibraryNode, node);\r
-               }\r
-           }\r
-       } else {\r
-           //\r
-           // The module is not in existing packages\r
-           //\r
-           Log.err("The module hasn't been added to any package of current workspace!");\r
-           return;\r
-       }\r
-       \r
-       //\r
-       // Make the node selected\r
-       //\r
-       iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,\r
-                                                                    IDefaultMutableTreeNode.MSA_HEADER)));\r
-       //\r
-       // Update opening Module list information\r
-       //\r
-       if (!openingModuleList.existsModule(id)) {\r
-           //\r
-           // Insert sub node of module\r
-           //\r
-           insertModuleTreeNode(id);\r
-           iTree.getSelectNode().setOpening(true);\r
-\r
-           //\r
-           // Update opening module list\r
-           //\r
-           openingModuleList.insertToOpeningModuleList(id, msa);\r
-           openingModuleList.setTreePathById(id, iTree.getSelectionPath());\r
-       }\r
-       //\r
-       // Show msa header in editor panel\r
-       //\r
-       showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id));\r
-       this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id);\r
-   }\r
+\r
+    /**\r
+     Add a module to tree\r
+     \r
+     @param mid The module node to be added\r
+     \r
+     **/\r
+    private void addModuleToTree(ModuleIdentification mid) {\r
+        //\r
+        // Add new MsaHeader node to the tree\r
+        //\r
+        IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MSA_HEADER,\r
+                                                                   true, mid);\r
+        //\r
+        // First find the module belongs to which package\r
+        //\r
+        IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),\r
+                                                                IDefaultMutableTreeNode.MODULE_PACKAGE);\r
+        //\r
+        // To check if has module node or library node\r
+        //\r
+        IDefaultMutableTreeNode parentModuleNode = null;\r
+        IDefaultMutableTreeNode parentLibraryNode = null;\r
+        boolean hasModule = false;\r
+        boolean hasLibrary = false;\r
+        for (int index = 0; index < packageNode.getChildCount(); index++) {\r
+            IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);\r
+            if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {\r
+                hasLibrary = true;\r
+                parentLibraryNode = iNode;\r
+            }\r
+            if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {\r
+                hasModule = true;\r
+                parentModuleNode = iNode;\r
+            }\r
+        }\r
+\r
+        //\r
+        // If is a module\r
+        //\r
+        if (!mid.isLibrary()) {\r
+            //\r
+            // Create parent node first if has no parent node\r
+            //\r
+            if (!hasModule) {\r
+                parentModuleNode = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,\r
+                                                               false, mid.getPackageId());\r
+                iTree.addNode(packageNode, parentModuleNode);\r
+            }\r
+\r
+            iTree.addNode(parentModuleNode, node);\r
+        }\r
+\r
+        //\r
+        // If is a Library\r
+        //\r
+        if (mid.isLibrary()) {\r
+            //\r
+            // Create parent node first if has no parent node\r
+            //\r
+            if (!hasLibrary) {\r
+                parentLibraryNode = new IDefaultMutableTreeNode("Library",\r
+                                                                IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,\r
+                                                                mid.getPackageId());\r
+                iTree.addNode(packageNode, parentLibraryNode);\r
+            }\r
+\r
+            iTree.addNode(parentLibraryNode, node);\r
+        }\r
+    }\r
 \r
     /**\r
      Open Module\r
@@ -2187,7 +2123,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
      @param path input file path\r
      \r
      **/\r
-    private void openModule(String path) {\r
+    private void openModule(String path, ModuleIdentification moduleId) {\r
         ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
         try {\r
             msa = OpenFile.openMsaFile(path);\r
@@ -2220,72 +2156,89 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
                 }\r
             }\r
             if (!isFind) {\r
-                ModuleIdentification mid = new ModuleIdentification(id, pid);\r
+                ModuleIdentification mid = new ModuleIdentification(id, pid, moduleId.isLibrary());\r
                 vModuleList.addElement(mid);\r
-                //\r
-                // Add new MsaHeader node to the tree\r
-                //\r
-                IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(),\r
-                                                                           IDefaultMutableTreeNode.MSA_HEADER, true,\r
-                                                                           mid);\r
-                //\r
-                // First find the module belongs to which package\r
-                //\r
-                IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),\r
-                                                                        IDefaultMutableTreeNode.MODULE_PACKAGE);\r
-                //\r
-                // To check if has module node or library node\r
-                //\r
-                IDefaultMutableTreeNode parentModuleNode = null;\r
-                IDefaultMutableTreeNode parentLibraryNode = null;\r
-                boolean hasModule = false;\r
-                boolean hasLibrary = false;\r
-                for (int index = 0; index < packageNode.getChildCount(); index++) {\r
-                    IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);\r
-                    if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {\r
-                        hasLibrary = true;\r
-                        parentLibraryNode = iNode;\r
-                    }\r
-                    if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {\r
-                        hasModule = true;\r
-                        parentModuleNode = iNode;\r
-                    }\r
-                }\r
+                addModuleToTree(mid);\r
+            }\r
+        } else {\r
+            //\r
+            // The module is not in existing packages\r
+            //\r
+            Log.err("The module hasn't been added to any package of current workspace!");\r
+            return;\r
+        }\r
 \r
-                //\r
-                // If is a module\r
-                //\r
-                if (!mid.isLibrary()) {\r
-                    //\r
-                    // Create parent node first if has no parent node\r
-                    //\r
-                    if (!hasModule) {\r
-                        parentModuleNode = new IDefaultMutableTreeNode("Module",\r
-                                                                       IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,\r
-                                                                       false, mid.getPackageId());\r
-                        iTree.addNode(packageNode, parentModuleNode);\r
-                    }\r
+        //\r
+        // Make the node selected\r
+        //\r
+        iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,\r
+                                                                     IDefaultMutableTreeNode.MSA_HEADER)));\r
+        //\r
+        // Update opening Module list information\r
+        //\r
+        if (!openingModuleList.existsModule(id)) {\r
+            //\r
+            // Insert sub node of module\r
+            //\r
+            insertModuleTreeNode(id);\r
+            iTree.getSelectNode().setOpening(true);\r
 \r
-                    iTree.addNode(parentModuleNode, node);\r
-                }\r
+            //\r
+            // Update opening module list\r
+            //\r
+            openingModuleList.insertToOpeningModuleList(id, msa);\r
+            openingModuleList.setTreePathById(id, iTree.getSelectionPath());\r
+        }\r
+        //\r
+        // Show msa header in editor panel\r
+        //\r
+        showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id));\r
+        this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id);\r
+    }\r
 \r
-                //\r
-                // If is a Library\r
-                //\r
-                if (mid.isLibrary()) {\r
-                    //\r
-                    // Create parent node first if has no parent node\r
-                    //\r
-                    if (!hasLibrary) {\r
-                        parentLibraryNode = new IDefaultMutableTreeNode("Library",\r
-                                                                        IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,\r
-                                                                        false, mid.getPackageId());\r
-                        iTree.addNode(packageNode, parentLibraryNode);\r
-                    }\r
+    /**\r
+     Open Module\r
 \r
-                    iTree.addNode(parentLibraryNode, node);\r
+     @param path input file path\r
+     \r
+     **/\r
+    private void openModule(String path) {\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
+        try {\r
+            msa = OpenFile.openMsaFile(path);\r
+        } catch (IOException e) {\r
+            Log.err("Open Module Surface Area " + path, e.getMessage());\r
+            return;\r
+        } catch (XmlException e) {\r
+            Log.err("Open Module Surface Area " + path, e.getMessage());\r
+            return;\r
+        } catch (Exception e) {\r
+            Log.err("Open Module Surface Area " + path, "Invalid file type");\r
+            return;\r
+        }\r
+        Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(),\r
+                                               msa.getMsaHeader().getVersion(), path);\r
+        //\r
+        // Generate module id\r
+        //\r
+        PackageIdentification pid = wt.getPackageIdByModuleId(id);\r
+        if (pid != null) {\r
+            //\r
+            // To judge if the module existed in vModuleList\r
+            // If not, add it to vModuleList\r
+            //\r
+            boolean isFind = false;\r
+            for (int index = 0; index < vModuleList.size(); index++) {\r
+                if (vModuleList.elementAt(index).equals(id)) {\r
+                    isFind = true;\r
+                    break;\r
                 }\r
             }\r
+            if (!isFind) {\r
+                ModuleIdentification mid = new ModuleIdentification(id, pid);\r
+                vModuleList.addElement(mid);\r
+                addModuleToTree(mid);\r
+            }\r
         } else {\r
             //\r
             // The module is not in existing packages\r
@@ -2293,7 +2246,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             Log.err("The module hasn't been added to any package of current workspace!");\r
             return;\r
         }\r
-        \r
+\r
         //\r
         // Make the node selected\r
         //\r
@@ -3248,13 +3201,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
         if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
             Tools.showInformationMessage("Module Surface Area Clone Finished");\r
             vModuleList.addElement(c.getMid());\r
-            //\r
-            // Add new MsaHeader node to the tree\r
-            //\r
-            IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vModuleList.lastElement().getName(),\r
-                                                                       IDefaultMutableTreeNode.MSA_HEADER, true,\r
-                                                                       vModuleList.lastElement());\r
-            iTree.addNode(dmtnModuleDescription, node);\r
+            addModuleToTree(c.getMid());\r
         }\r
         if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
             Tools.showInformationMessage("Package Surface Area Clone Finished");\r
@@ -3327,7 +3274,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             } else {\r
                 int category = iTree.getSelectCategory();\r
                 if (category == IDefaultMutableTreeNode.MODULE || category == IDefaultMutableTreeNode.PACKAGE\r
-                    || category == IDefaultMutableTreeNode.PLATFORM) {\r
+                    || category == IDefaultMutableTreeNode.PLATFORM\r
+                    || category == IDefaultMutableTreeNode.MODULE_PACKAGE\r
+                    || category == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY\r
+                    || category == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {\r
                     jMenuItemToolsClone.setEnabled(false);\r
                 } else {\r
                     jMenuItemToolsClone.setEnabled(true);\r
index ddfb479cc40ce1ae56694bf2b85d7ec275fa3058..ce3f96c91c64b5f1af53ae29967efa1c602c1681 100644 (file)
@@ -35,6 +35,7 @@ import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableModel;\r
 \r
 import org.tianocore.frameworkwizard.common.DataType;\r
+import org.tianocore.frameworkwizard.common.IFileFilter;\r
 import org.tianocore.frameworkwizard.common.Log;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigId;\r
@@ -348,7 +349,9 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
 \r
         if (arg0.getSource() == jButtonOpen) {\r
             JFileChooser fc = new JFileChooser();\r
-            fc.setAcceptAllFileFilterUsed(true);\r
+            fc.setAcceptAllFileFilterUsed(false);\r
+            IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);\r
+            fc.addChoosableFileFilter(iff);\r
             fc.setCurrentDirectory(new File(toolsDir));\r
 \r
             int result = fc.showOpenDialog(new JPanel());\r
@@ -369,8 +372,10 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
 \r
         if (arg0.getSource() == jButtonSave) {\r
             JFileChooser fc = new JFileChooser();\r
-            fc.setAcceptAllFileFilterUsed(true);\r
-            fc.setSelectedFile(new File(currentFile));\r
+            fc.setAcceptAllFileFilterUsed(false);\r
+            IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);\r
+            fc.addChoosableFileFilter(iff);\r
+            fc.setCurrentDirectory(new File(toolsDir));\r
 \r
             int result = fc.showSaveDialog(new JPanel());\r
             if (result == JFileChooser.APPROVE_OPTION) {\r
index cd432b1bf70fb9b5c2b87d9824708151c2b03d5e..22367795ecfe168a3982e1b6d122d8c00652d685 100644 (file)
@@ -162,7 +162,7 @@ public class DataType {
     public static final int SPACE_TO_RIGHT_FOR_REMOVE_BUTTON = 95;\r
 \r
     public static final int SPACE_TO_RIGHT_FOR_UPDATE_BUTTON = 10;\r
-    \r
+\r
     public static final int SPACE_TO_BOTTOM_FOR_ADD_BUTTON = 30;\r
 \r
     public static final int SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON = 30;\r
@@ -210,7 +210,7 @@ public class DataType {
     // First defined here\r
     // Will be replaced by resource file later\r
     //\r
-    public static final String SUP_ARCH_LIST_HELP_TEXT = "Deselecting a checkbox will restrict this module for use with the selected architectures, based on the list of items that are checked. If all boxes are checked, then the module will support all current AND FUTURE architectures";\r
+    public static final String SUP_ARCH_LIST_HELP_TEXT = "<html>Selecting a checkbox means supporting the selected architectures;<br> None of boxes are checked means supporting all architectures<html>";\r
 \r
     //\r
     // Project name and version\r
index b14c86f10a4c4ce584788b7290859c81a1a46908..a03dfac7752e1a2c0b5b35a486b7505aeabc09e4 100644 (file)
@@ -307,6 +307,7 @@ public class EnumerationData {
         vModuleType.addElement("UEFI_DRIVER");\r
         vModuleType.addElement("UEFI_APPLICATION");\r
         vModuleType.addElement("USER_DEFINED");\r
+        Tools.sortVectorString(vModuleType, DataType.SORT_TYPE_ASCENDING);\r
     }\r
     \r
 //    private void initComponentType() {\r
@@ -362,6 +363,7 @@ public class EnumerationData {
         vFrameworkModuleTypes.addElement("UEFI_DRIVER");\r
         vFrameworkModuleTypes.addElement("UEFI_APPLICATION");\r
         vFrameworkModuleTypes.addElement("USER_DEFINED");\r
+        Tools.sortVectorString(vFrameworkModuleTypes, DataType.SORT_TYPE_ASCENDING);\r
     }\r
 \r
     private void initLibClassDef() {\r
index b2d2bbe9dacfd5f2c2c4d2b6a08adb900d9b32e8..8194a316c6b9c0c0754cd9ec5ea0232c05a9cb06 100644 (file)
@@ -84,7 +84,7 @@ public class IFileFilter extends FileFilter {
         if (strExt.equals(DataType.TEXT_FILE_EXT))\r
             return DataType.TEXT_FILE_EXT_DESCRIPTION;\r
         if (strExt.equals(DataType.FAR_SURFACE_AREA_EXT))\r
-          return DataType.FAR_SURFACE_AREA_EXT_DESCRIPTION;\r
+            return DataType.FAR_SURFACE_AREA_EXT_DESCRIPTION;\r
         return "";\r
     }\r
 \r
index 517c4b1b3a8d6496d1e932c278f0bf02054866ff..8cb8dc030286f5113ab8cca65ba51be8cf21fd28 100644 (file)
@@ -305,8 +305,8 @@ public class Tools {
             match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT;\r
         }\r
         if (type == DataType.RETURN_TYPE_FAR_SURFACE_AREA) {\r
-          match = DataType.FILE_EXT_SEPARATOR + DataType.FAR_SURFACE_AREA_EXT;\r
-      }\r
+            match = DataType.FILE_EXT_SEPARATOR + DataType.FAR_SURFACE_AREA_EXT;\r
+        }\r
         if (path.length() <= match.length()) {\r
             path = path + match;\r
             return path;\r
index e564ab5effb568b2d97d9e7749e9ad3c3d38c971..901ff86634a696916040526c766c509d5d8ce247 100644 (file)
@@ -20,6 +20,8 @@ import java.util.Vector;
 import javax.swing.JPanel;\r
 import javax.swing.JCheckBox;\r
 \r
+import org.tianocore.frameworkwizard.common.DataType;\r
+\r
 public class ArchCheckBox extends JPanel {\r
 \r
     ///\r
@@ -49,6 +51,7 @@ public class ArchCheckBox extends JPanel {
             jCheckBoxIa32 = new JCheckBox();\r
             jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 50, 20));\r
             jCheckBoxIa32.setText("IA32");\r
+            jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
         }\r
         return jCheckBoxIa32;\r
     }\r
@@ -63,6 +66,7 @@ public class ArchCheckBox extends JPanel {
             jCheckBoxX64 = new JCheckBox();\r
             jCheckBoxX64.setBounds(new java.awt.Rectangle(50, 0, 50, 20));\r
             jCheckBoxX64.setText("X64");\r
+            jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
         }\r
         return jCheckBoxX64;\r
     }\r
@@ -77,6 +81,7 @@ public class ArchCheckBox extends JPanel {
             jCheckBoxIpf = new JCheckBox();\r
             jCheckBoxIpf.setBounds(new java.awt.Rectangle(100, 0, 50, 20));\r
             jCheckBoxIpf.setText("IPF");\r
+            jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
         }\r
         return jCheckBoxIpf;\r
     }\r
@@ -91,6 +96,7 @@ public class ArchCheckBox extends JPanel {
             jCheckBoxEbc = new JCheckBox();\r
             jCheckBoxEbc.setBounds(new java.awt.Rectangle(150, 0, 50, 20));\r
             jCheckBoxEbc.setText("EBC");\r
+            jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
         }\r
         return jCheckBoxEbc;\r
     }\r
@@ -105,6 +111,7 @@ public class ArchCheckBox extends JPanel {
             jCheckBoxArm = new JCheckBox();\r
             jCheckBoxArm.setBounds(new java.awt.Rectangle(200, 0, 55, 20));\r
             jCheckBoxArm.setText("ARM");\r
+            jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
         }\r
         return jCheckBoxArm;\r
     }\r
@@ -119,6 +126,7 @@ public class ArchCheckBox extends JPanel {
             jCheckBoxPpc = new JCheckBox();\r
             jCheckBoxPpc.setBounds(new java.awt.Rectangle(255, 0, 50, 20));\r
             jCheckBoxPpc.setText("PPC");\r
+            jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
         }\r
         return jCheckBoxPpc;\r
     }\r
@@ -155,6 +163,7 @@ public class ArchCheckBox extends JPanel {
         this.add(getJCheckBoxEbc(), null);\r
         this.add(getJCheckBoxArm(), null);\r
         this.add(getJCheckBoxPpc(), null);\r
+        this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
     }\r
     \r
     public Vector<String> getSelectedItemsVector() {\r
index 515017349b30a6bcec19ee4666e68bf52c451409..7dd7d32e3a727fb7015152d0d87231e994d20449 100644 (file)
@@ -344,7 +344,7 @@ public class ModuleSourceFiles extends IInternalFrame {
     }\r
 \r
     private void showEdit(int index) {\r
-        SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame());\r
+        SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame(), omt.getId().getPath());\r
         int result = sfd.showDialog();\r
         if (result == DataType.RETURN_TYPE_OK) {\r
             if (index == -1) {\r
index 5e65afbea84b89de678f24225ba6ee87d1dbf440..250eb9da2d40cded39cc54f671c364f8b35c8f73 100644 (file)
@@ -254,12 +254,6 @@ public class MsaHeader extends IInternalFrame {
             jTextFieldSpecification.setLocation(new java.awt.Point(160, 435));\r
             jTextFieldSpecification.setEditable(false);\r
             jTextFieldSpecification.addFocusListener(this);\r
-            jTextFieldSpecification\r
-                                   .setToolTipText("Deselecting a checkbox"\r
-                                                   + " will restrict this module for use with the selected architectures, "\r
-                                                   + "based on the list of items that are checked. "\r
-                                                   + "If all boxes are checked, "\r
-                                                   + "then the module will support all current AND FUTURE architectures");\r
         }\r
         return jTextFieldSpecification;\r
     }\r
@@ -800,6 +794,7 @@ public class MsaHeader extends IInternalFrame {
             //            }\r
             //            this.msaHeader.setSpecification(this.jTextFieldSpecification.getText());\r
 \r
+            msaHeader.setSpecification(this.jTextFieldSpecification.getText());\r
             msa.setMsaHeader(msaHeader);\r
             this.omt.setSaved(false);\r
         } catch (Exception e) {\r
index 3c868494ef468381338d5624682722ef4ee8886e..53ac9a591cebdbcd9aa1824db298acb86d87dcda 100644 (file)
@@ -15,6 +15,7 @@
 package org.tianocore.frameworkwizard.module.ui.dialog;\r
 \r
 import java.awt.event.ActionEvent;\r
+import java.io.File;\r
 import java.util.Vector;\r
 \r
 import javax.swing.JButton;\r
@@ -27,12 +28,12 @@ import javax.swing.JTextField;
 import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
 import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r
 import org.tianocore.frameworkwizard.common.ui.IDialog;\r
 import org.tianocore.frameworkwizard.common.ui.IFrame;\r
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
 import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;\r
-import org.tianocore.frameworkwizard.workspace.Workspace;\r
 \r
 /**\r
  The class is used to create, update SourceFile of MSA/MBD file\r
@@ -82,15 +83,17 @@ public class SourceFilesDlg extends IDialog {
     private JTextField jTextFieldFeatureFlag = null;\r
 \r
     private ArchCheckBox jArchCheckBox = null;\r
+    \r
+    private JButton jButtonOk = null;\r
+\r
+    private JButton jButtonCancel = null;\r
 \r
     //\r
     // Not used by UI\r
     //\r
     private SourceFilesIdentification sfid = null;\r
 \r
-    private JButton jButtonOk = null;\r
-\r
-    private JButton jButtonCancel = null;\r
+    private String msaFileName = "";\r
 \r
     /**\r
      This method initializes jTextFieldFileName \r
@@ -238,9 +241,9 @@ public class SourceFilesDlg extends IDialog {
      This is the default constructor\r
      \r
      **/\r
-    public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame) {\r
+    public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, String fileName) {\r
         super(iFrame, true);\r
-        init(inSourceFilesIdentification);\r
+        init(inSourceFilesIdentification, fileName);\r
     }\r
 \r
     /**\r
@@ -263,9 +266,10 @@ public class SourceFilesDlg extends IDialog {
      @param inSourceFiles The input data of SourceFilesDocument.SourceFiles\r
      \r
      **/\r
-    private void init(SourceFilesIdentification inSourceFilesIdentifications) {\r
+    private void init(SourceFilesIdentification inSourceFilesIdentifications, String fileName) {\r
         init();\r
         this.sfid = inSourceFilesIdentifications;\r
+        this.msaFileName = fileName;\r
 \r
         if (this.sfid != null) {\r
             this.jTextFieldFileName.setText(sfid.getFilename());\r
@@ -451,8 +455,8 @@ public class SourceFilesDlg extends IDialog {
      \r
      **/\r
     private void selectFile() {\r
-        JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());\r
-\r
+        JFileChooser fc = new JFileChooser();\r
+        fc.setCurrentDirectory(new File(Tools.getFilePathOnly(msaFileName)));\r
         int result = fc.showOpenDialog(new JPanel());\r
         if (result == JFileChooser.APPROVE_OPTION) {\r
             this.jTextFieldFileName.setText(fc.getSelectedFile().getName());\r
index ced7c921521bdfc792f3e29e37b59eacb2f239b6..2fdbdd6d737c17e3cb87cd4591a1f5a9888c5de0 100644 (file)
@@ -23,8 +23,7 @@ import org.tianocore.frameworkwizard.common.Identifications.Identification;
 import org.tianocore.frameworkwizard.workspace.Workspace;\r
 \r
 public class PlatformIdentification extends Identification{\r
-    \r
-    \r
+\r
     public PlatformIdentification(String name, String guid, String version, String path){\r
         super(name, guid, version, path);\r
     }\r
index dda8844495e07b054947554a0aac52a34e713343..46c325e3b3b8d004debbb006baaf2d18d9d40e93 100644 (file)
@@ -77,39 +77,37 @@ public class WorkspaceTools {
     }\r
 \r
     public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {\r
-      FrameworkDatabase fdb = openFrameworkDb();\r
-      \r
-      for (int i = 0; i < packageList.size(); i++) {\r
-        DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
-        item.setFarGuid(far.getGuidValue());\r
-        item.setStringValue(packageList.get(i));\r
-        fdb.getPackageList().getFilenameList().add(item);\r
-      }\r
-      \r
-      for (int i = 0; i < platformList.size(); i++) {\r
-        DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
-        item.setFarGuid(far.getGuidValue());\r
-        item.setStringValue(platformList.get(i));\r
-        fdb.getPlatformList().getFilenameList().add(item);\r
-      }\r
-      \r
-      DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();\r
-      farItem.setFarGuid(far.getGuidValue());\r
-      farItem.setStringValue(far.getFarName());\r
-      fdb.getFarList().getFilenameList().add(farItem);\r
-      \r
-      String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
-      strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
-      \r
-      try {\r
-        SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
-      }\r
-      catch (Exception e) {\r
-        e.printStackTrace();\r
-      }\r
+        FrameworkDatabase fdb = openFrameworkDb();\r
+\r
+        for (int i = 0; i < packageList.size(); i++) {\r
+            DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
+            item.setFarGuid(far.getGuidValue());\r
+            item.setStringValue(packageList.get(i));\r
+            fdb.getPackageList().getFilenameList().add(item);\r
+        }\r
+\r
+        for (int i = 0; i < platformList.size(); i++) {\r
+            DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
+            item.setFarGuid(far.getGuidValue());\r
+            item.setStringValue(platformList.get(i));\r
+            fdb.getPlatformList().getFilenameList().add(item);\r
+        }\r
+\r
+        DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();\r
+        farItem.setFarGuid(far.getGuidValue());\r
+        farItem.setStringValue(far.getFarName());\r
+        fdb.getFarList().getFilenameList().add(farItem);\r
+\r
+        String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
+        strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
+\r
+        try {\r
+            SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-    \r
-    \r
+\r
     public void removeFarFromDb(FarIdentification far) {\r
         FrameworkDatabase fdb = openFrameworkDb();\r
         //\r
@@ -118,90 +116,87 @@ public class WorkspaceTools {
         XmlCursor cursor = fdb.getPackageList().newCursor();\r
         cursor.toFirstChild();\r
         do {\r
-          DbPathAndFilename item = (DbPathAndFilename)cursor.getObject();\r
-          \r
-          if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-            cursor.removeXml();\r
-          }\r
+            DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
+\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                cursor.removeXml();\r
+            }\r
         } while (cursor.toNextSibling());\r
         cursor.dispose();\r
-        \r
+\r
         //\r
         // Remove Platforms\r
         //\r
         cursor = fdb.getPlatformList().newCursor();\r
         cursor.toFirstChild();\r
         do {\r
-          DbPathAndFilename item = (DbPathAndFilename)cursor.getObject();\r
-          if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-            cursor.removeXml();\r
-          }\r
+            DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                cursor.removeXml();\r
+            }\r
         } while (cursor.toNextSibling());\r
-        \r
+\r
         //\r
         // Remove Far\r
         //\r
         cursor = fdb.getFarList().newCursor();\r
         cursor.toFirstChild();\r
         do {\r
-          DbPathAndFilename item = (DbPathAndFilename)cursor.getObject();\r
-          if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-            cursor.removeXml();\r
-          }\r
+            DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                cursor.removeXml();\r
+            }\r
         } while (cursor.toNextSibling());\r
         cursor.dispose();\r
-        \r
+\r
         String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
         strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
         try {\r
-          SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
-        }\r
-        catch (Exception e) {\r
-          e.printStackTrace();\r
-        }\r
-    }\r
-    \r
-    public String getPackageFarGuid(PackageIdentification packageId) {\r
-      openFrameworkDb();\r
-      \r
-      for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        File tempFile = new File(path);\r
-        if (tempFile.getPath().equalsIgnoreCase(packageId.getSpdFile().getPath())) {\r
-          return fdb.getPackageList().getFilenameArray(index).getFarGuid();\r
-        }\r
-      }\r
-      \r
-      return null;\r
-    }\r
-    \r
-    public String getPlatformFarGuid(PlatformIdentification platformId) {\r
-      openFrameworkDb();\r
-      \r
-      for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        File tempFile = new File(path);\r
-        if (tempFile.getPath().equalsIgnoreCase(platformId.getFpdFile().getPath())) {\r
-          return fdb.getPlatformList().getFilenameArray(index).getFarGuid();\r
-        }\r
-      }\r
-      \r
-      return null;\r
-    }\r
-    \r
-    public String getModuleFarGuid(ModuleIdentification moduleId) {\r
-      PackageIdentification packageId = getPackageIdByModuleId(moduleId);\r
-      if (packageId != null) {\r
-          return getPackageFarGuid(packageId);\r
-      }\r
-      else {\r
+            SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    public String getPackageFarGuid(Identification packageId) {\r
+        openFrameworkDb();\r
+\r
+        for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
+            File tempFile = new File(path);\r
+            if (tempFile.getPath().equalsIgnoreCase(packageId.getPath())) {\r
+                return fdb.getPackageList().getFilenameArray(index).getFarGuid();\r
+            }\r
+        }\r
+\r
         return null;\r
-      }\r
     }\r
+\r
+    public String getPlatformFarGuid(Identification platformId) {\r
+        openFrameworkDb();\r
+\r
+        for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
+            File tempFile = new File(path);\r
+            if (tempFile.getPath().equalsIgnoreCase(platformId.getPath())) {\r
+                return fdb.getPlatformList().getFilenameArray(index).getFarGuid();\r
+            }\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    public String getModuleFarGuid(Identification moduleId) {\r
+        PackageIdentification packageId = getPackageIdByModuleId(moduleId);\r
+        if (packageId != null) {\r
+            return getPackageFarGuid(packageId);\r
+        } else {\r
+            return null;\r
+        }\r
+    }\r
+\r
     /**\r
      Get all modules' paths from one package\r
      \r
@@ -229,34 +224,34 @@ public class WorkspaceTools {
         }\r
         return modulePath;\r
     }\r
-    \r
+\r
     /**\r
-    Get all Industry Std Includes' paths from one package\r
-    \r
-    @return a Vector with all paths\r
-    \r
-    **/\r
-   public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {\r
-       Vector<String> includePath = new Vector<String>();\r
-       try {\r
-           IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes();\r
-           if (files != null) {\r
-               for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r
-                   String temp = files.getIndustryStdHeaderList().get(index).getName();\r
-                   temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
-                   temp = Tools.convertPathToCurrentOsType(temp);\r
-                   includePath.addElement(temp);\r
-               }\r
-           }\r
-       } catch (IOException e) {\r
-\r
-       } catch (XmlException e) {\r
-\r
-       } catch (Exception e) {\r
-\r
-       }\r
-       return includePath;\r
-   }\r
+     Get all Industry Std Includes' paths from one package\r
+     \r
+     @return a Vector with all paths\r
+     \r
+     **/\r
+    public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {\r
+        Vector<String> includePath = new Vector<String>();\r
+        try {\r
+            IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes();\r
+            if (files != null) {\r
+                for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r
+                    String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();\r
+                    temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
+                    temp = Tools.convertPathToCurrentOsType(temp);\r
+                    includePath.addElement(temp);\r
+                }\r
+            }\r
+        } catch (IOException e) {\r
+\r
+        } catch (XmlException e) {\r
+\r
+        } catch (Exception e) {\r
+\r
+        }\r
+        return includePath;\r
+    }\r
 \r
     /**\r
      Get all package basic information form the FrameworkDatabase.db file\r
@@ -293,90 +288,88 @@ public class WorkspaceTools {
     }\r
 \r
     public Vector<FarIdentification> getAllFars() {\r
-      openFrameworkDb();\r
-      Vector<FarIdentification> v = new Vector<FarIdentification>();\r
-      for (int index = 0; index < fdb.getFarList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getFarList().getFilenameList().get(index);\r
-        FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());\r
-        v.addElement(far);\r
-      }\r
-      return v;\r
-    }\r
-    \r
+        openFrameworkDb();\r
+        Vector<FarIdentification> v = new Vector<FarIdentification>();\r
+        for (int index = 0; index < fdb.getFarList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = fdb.getFarList().getFilenameList().get(index);\r
+            FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());\r
+            v.addElement(far);\r
+        }\r
+        return v;\r
+    }\r
+\r
     public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {\r
-      Identification id = null;\r
-      openFrameworkDb();\r
-      Vector<PackageIdentification> v = new Vector<PackageIdentification>();\r
-      \r
-      for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        path = Tools.convertPathToCurrentOsType(path);\r
-        \r
-        if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-        \r
-          try {\r
-            id = getId(path, OpenFile.openSpdFile(path));\r
-            v.addElement(new PackageIdentification(id));\r
-          } catch (IOException e) {\r
-            Log.err("Open Package Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (XmlException e) {\r
-            Log.err("Open Package Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (Exception e) {\r
-            Log.err("Open Package Surface Area " + path, "Invalid file type");\r
-            e.printStackTrace();\r
-          }\r
+        Identification id = null;\r
+        openFrameworkDb();\r
+        Vector<PackageIdentification> v = new Vector<PackageIdentification>();\r
+\r
+        for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
+            path = Tools.convertPathToCurrentOsType(path);\r
+\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+\r
+                try {\r
+                    id = getId(path, OpenFile.openSpdFile(path));\r
+                    v.addElement(new PackageIdentification(id));\r
+                } catch (IOException e) {\r
+                    Log.err("Open Package Surface Area " + path, e.getMessage());\r
+                    e.printStackTrace();\r
+                } catch (XmlException e) {\r
+                    Log.err("Open Package Surface Area " + path, e.getMessage());\r
+                    e.printStackTrace();\r
+                } catch (Exception e) {\r
+                    Log.err("Open Package Surface Area " + path, "Invalid file type");\r
+                    e.printStackTrace();\r
+                }\r
+            }\r
         }\r
-      }\r
-      return v;\r
+        return v;\r
     }\r
-    \r
+\r
     public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) {\r
-      Identification id = null;\r
-      openFrameworkDb();\r
-      Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();\r
-      \r
-      for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        path = Tools.convertPathToCurrentOsType(path);\r
-        \r
-        if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-          try {\r
-            id = getId(path, OpenFile.openFpdFile(path));\r
-            v.addElement(new PlatformIdentification(id));\r
-          } catch (IOException e) {\r
-            Log.err("Open Platform Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (XmlException e) {\r
-            Log.err("Open Platform Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (Exception e) {\r
-            Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
-            e.printStackTrace();\r
-          }\r
+        Identification id = null;\r
+        openFrameworkDb();\r
+        Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();\r
+\r
+        for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
+            path = Tools.convertPathToCurrentOsType(path);\r
+\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                try {\r
+                    id = getId(path, OpenFile.openFpdFile(path));\r
+                    v.addElement(new PlatformIdentification(id));\r
+                } catch (IOException e) {\r
+                    Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+                    e.printStackTrace();\r
+                } catch (XmlException e) {\r
+                    Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+                    e.printStackTrace();\r
+                } catch (Exception e) {\r
+                    Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
+                    e.printStackTrace();\r
+                }\r
+            }\r
         }\r
-    }\r
-      return v;\r
+        return v;\r
     }\r
 \r
     /**\r
      Get all module basic information from a package\r
-    \r
+     \r
      @param id Package id\r
      @return A vector includes all modules' basic information\r
-    \r
-    **/\r
+     \r
+     **/\r
     public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {\r
         Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r
         Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());\r
         Identification id = null;\r
         String modulePath = null;\r
-        \r
+\r
         for (int index = 0; index < modulePaths.size(); index++) {\r
             try {\r
                 modulePath = modulePaths.get(index);\r
@@ -392,7 +385,7 @@ public class WorkspaceTools {
         }\r
         Tools.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
         return v;\r
-        \r
+\r
     }\r
 \r
     /**\r
@@ -418,7 +411,7 @@ public class WorkspaceTools {
         for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
             packagePath = vPackageList.elementAt(indexI).getPath();\r
             modulePaths = this.getAllModulesOfPackage(packagePath);\r
-            \r
+\r
             for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
                 try {\r
                     modulePath = modulePaths.get(indexJ);\r
@@ -723,7 +716,7 @@ public class WorkspaceTools {
                 } catch (IOException e) {\r
 \r
                 } catch (XmlException e) {\r
-                \r
+\r
                 } catch (Exception e) {\r
 \r
                 }\r
@@ -877,7 +870,7 @@ public class WorkspaceTools {
         // First add package\r
         //\r
         v.addElement(path);\r
-        \r
+\r
         //\r
         // Add the package's industry std includes one by one\r
         //\r
@@ -886,7 +879,7 @@ public class WorkspaceTools {
         for (int index = 0; index < f1.size(); index++) {\r
             v.addElement(f1.get(index));\r
         }\r
-        \r
+\r
         //\r
         // Add module's files one by one\r
         //\r