1. Restructure module description on main UI
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 11 Jul 2006 09:03:32 +0000 (09:03 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 11 Jul 2006 09:03:32 +0000 (09:03 +0000)
2. Make alphabetized list for all module, package, platform names and guid_c_names

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

18 files changed:
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.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/DataValidation.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java [new file with mode: 0644]
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/IDefaultMutableTreeNode.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java

index c6f5b579739cdde391eb47459dbf924ae31a76f0..589a97e09bef261b13405b75dd1460055fe9c9df 100644 (file)
@@ -114,7 +114,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
     /// Define class Serial Version UID\r
     ///\r
     private static final long serialVersionUID = -7103240960573031772L;\r
-    \r
+\r
     //\r
     // To save information of all files\r
     //\r
@@ -282,20 +282,22 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
 \r
     private JMenuItem jMenuItemHelpSearch = null;\r
 \r
-    private JMenuItem jMenuItemProjectInstallPackage = null;\r
+    private JMenuItem jMenuItemProjectInstallFar = null;\r
 \r
-    private JMenuItem jMenuItemProjectUpdatePackage = null;\r
+    private JMenuItem jMenuItemProjectUpdateFar = null;\r
 \r
-    private JMenuItem jMenuItemProjectRemovePackage = null;\r
+    private JMenuItem jMenuItemProjectRemoveFar = null;\r
 \r
     //private JToolBar jToolBarFile = null;\r
 \r
     //private JToolBar jToolBarEdit = null;\r
 \r
     //private JToolBar jToolBarWindow = null;\r
-    \r
+\r
     private static FrameworkWizardUI fwui = null;\r
-    \r
+\r
+    private JMenuItem jMenuItemProjectCreateFar = null;\r
+\r
     public static FrameworkWizardUI getInstance() {\r
         if (fwui == null) {\r
             fwui = new FrameworkWizardUI();\r
@@ -1262,9 +1264,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             //jMenuProject.addSeparator();\r
             jMenuProject.add(getJMenuItemProjectChangeWorkspace());\r
             jMenuProject.addSeparator();\r
-            jMenuProject.add(getJMenuItemProjectInstallPackage());\r
-            jMenuProject.add(getJMenuItemProjectUpdatePackage());\r
-            jMenuProject.add(getJMenuItemProjectRemovePackage());\r
+            jMenuProject.add(getJMenuItemProjectCreateFar());\r
+            jMenuProject.add(getJMenuItemProjectInstallFar());\r
+            jMenuProject.add(getJMenuItemProjectUpdateFar());\r
+            jMenuProject.add(getJMenuItemProjectRemoveFar());\r
             //jMenuProject.addSeparator();\r
             jMenuProject.add(getJMenuProjectBuildTargets());\r
         }\r
@@ -1607,15 +1610,15 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
      *         \r
      * @return javax.swing.JMenuItem   \r
      */\r
-    private JMenuItem getJMenuItemProjectInstallPackage() {\r
-        if (jMenuItemProjectInstallPackage == null) {\r
-            jMenuItemProjectInstallPackage = new JMenuItem();\r
-            jMenuItemProjectInstallPackage.setText("Install Distribution Package");\r
-            jMenuItemProjectInstallPackage.setMnemonic('I');\r
-            jMenuItemProjectInstallPackage.setEnabled(false);\r
-            jMenuItemProjectInstallPackage.addActionListener(this);\r
+    private JMenuItem getJMenuItemProjectInstallFar() {\r
+        if (jMenuItemProjectInstallFar == null) {\r
+            jMenuItemProjectInstallFar = new JMenuItem();\r
+            jMenuItemProjectInstallFar.setText("Install FAR");\r
+            jMenuItemProjectInstallFar.setMnemonic('I');\r
+            jMenuItemProjectInstallFar.setEnabled(true);\r
+            jMenuItemProjectInstallFar.addActionListener(this);\r
         }\r
-        return jMenuItemProjectInstallPackage;\r
+        return jMenuItemProjectInstallFar;\r
     }\r
 \r
     /**\r
@@ -1623,15 +1626,15 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
      *         \r
      * @return javax.swing.JMenuItem   \r
      */\r
-    private JMenuItem getJMenuItemProjectUpdatePackage() {\r
-        if (jMenuItemProjectUpdatePackage == null) {\r
-            jMenuItemProjectUpdatePackage = new JMenuItem();\r
-            jMenuItemProjectUpdatePackage.setText("Update Disstribution Package");\r
-            jMenuItemProjectUpdatePackage.setMnemonic('U');\r
-            jMenuItemProjectUpdatePackage.setEnabled(false);\r
-            jMenuItemProjectUpdatePackage.addActionListener(this);\r
+    private JMenuItem getJMenuItemProjectUpdateFar() {\r
+        if (jMenuItemProjectUpdateFar == null) {\r
+            jMenuItemProjectUpdateFar = new JMenuItem();\r
+            jMenuItemProjectUpdateFar.setText("Update FAR");\r
+            jMenuItemProjectUpdateFar.setMnemonic('U');\r
+            jMenuItemProjectUpdateFar.setEnabled(true);\r
+            jMenuItemProjectUpdateFar.addActionListener(this);\r
         }\r
-        return jMenuItemProjectUpdatePackage;\r
+        return jMenuItemProjectUpdateFar;\r
     }\r
 \r
     /**\r
@@ -1639,15 +1642,30 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
      *         \r
      * @return javax.swing.JMenuItem   \r
      */\r
-    private JMenuItem getJMenuItemProjectRemovePackage() {\r
-        if (jMenuItemProjectRemovePackage == null) {\r
-            jMenuItemProjectRemovePackage = new JMenuItem();\r
-            jMenuItemProjectRemovePackage.setText("Remove Distribution Package");\r
-            jMenuItemProjectRemovePackage.setMnemonic('R');\r
-            jMenuItemProjectRemovePackage.setEnabled(false);\r
-            jMenuItemProjectRemovePackage.addActionListener(this);\r
+    private JMenuItem getJMenuItemProjectRemoveFar() {\r
+        if (jMenuItemProjectRemoveFar == null) {\r
+            jMenuItemProjectRemoveFar = new JMenuItem();\r
+            jMenuItemProjectRemoveFar.setText("Remove FAR");\r
+            jMenuItemProjectRemoveFar.setMnemonic('R');\r
+            jMenuItemProjectRemoveFar.setEnabled(true);\r
+            jMenuItemProjectRemoveFar.addActionListener(this);\r
+        }\r
+        return jMenuItemProjectRemoveFar;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jMenuItemProjectCreateFar       \r
+     *         \r
+     * @return javax.swing.JMenuItem   \r
+     */\r
+    private JMenuItem getJMenuItemProjectCreateFar() {\r
+        if (jMenuItemProjectCreateFar == null) {\r
+            jMenuItemProjectCreateFar = new JMenuItem();\r
+            jMenuItemProjectCreateFar.setText("Create FAR");\r
+            jMenuItemProjectCreateFar.setMnemonic('C');\r
+            jMenuItemProjectCreateFar.addActionListener(this);\r
         }\r
-        return jMenuItemProjectRemovePackage;\r
+        return jMenuItemProjectCreateFar;\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -1695,7 +1713,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
         this.addComponentListener(this);\r
         this.getCompontentsFromFrameworkDatabase();\r
         this.setContentPane(getJContentPane());\r
-        this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]");\r
+        this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["\r
+                      + Workspace.getCurrentWorkspace() + "]");\r
         this.setExitType(1);\r
 \r
         //\r
@@ -1766,10 +1785,26 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             changeWorkspace();\r
         }\r
 \r
+        if (arg0.getSource() == jMenuItemProjectCreateFar) {\r
+\r
+        }\r
+\r
+        if (arg0.getSource() == jMenuItemProjectInstallFar) {\r
+            this.closeAll();\r
+        }\r
+\r
+        if (arg0.getSource() == jMenuItemProjectRemoveFar) {\r
+            this.closeAll();\r
+        }\r
+\r
+        if (arg0.getSource() == jMenuItemProjectUpdateFar) {\r
+            this.closeAll();\r
+        }\r
+\r
         if (arg0.getSource() == jMenuItemToolsClone) {\r
             cloneItem();\r
         }\r
-        \r
+\r
         if (arg0.getSource() == jMenuItemToolsToolChainConfiguration) {\r
             setupToolChainConfiguration();\r
         }\r
@@ -1794,14 +1829,56 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
         // Make Module Description\r
         dmtnModuleDescription = new IDefaultMutableTreeNode("ModuleDescription", IDefaultMutableTreeNode.MODULE, -1);\r
 \r
-        if (this.vModuleList.size() > 0) {\r
-            for (int index = 0; index < this.vModuleList.size(); index++) {\r
-                dmtnModuleDescription.add(new IDefaultMutableTreeNode(this.vModuleList.elementAt(index).getName(),\r
-                                                                      IDefaultMutableTreeNode.MSA_HEADER, false,\r
-                                                                      this.vModuleList.elementAt(index)));\r
+        //\r
+        // First add package\r
+        //\r
+        if (this.vPackageList.size() > 0) {\r
+            for (int index = 0; index < this.vPackageList.size(); index++) {\r
+                IDefaultMutableTreeNode dmtnModulePackage = null;\r
+                IDefaultMutableTreeNode dmtnModulePackageLibrary = null;\r
+                IDefaultMutableTreeNode dmtnModulePackageModule = null;\r
+\r
+                dmtnModulePackage = new IDefaultMutableTreeNode(this.vPackageList.elementAt(index).getName(),\r
+                                                                IDefaultMutableTreeNode.MODULE_PACKAGE, false,\r
+                                                                this.vPackageList.elementAt(index));\r
+                dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",\r
+                                                                       IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,\r
+                                                                       false, this.vPackageList.elementAt(index));\r
+                dmtnModulePackageModule = new IDefaultMutableTreeNode("Module",\r
+                                                                      IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,\r
+                                                                      false, this.vPackageList.elementAt(index));\r
+\r
+                Vector<ModuleIdentification> vModule = wt.getAllModules(this.vPackageList.elementAt(index));\r
+                for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {\r
+                    if (vModule.get(indexJ).isLibrary()) {\r
+                        dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),\r
+                                                                                 IDefaultMutableTreeNode.MSA_HEADER,\r
+                                                                                 false, vModule.get(indexJ)));\r
+                    } else {\r
+                        dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),\r
+                                                                                IDefaultMutableTreeNode.MSA_HEADER,\r
+                                                                                false, vModule.get(indexJ)));\r
+                    }\r
+                }\r
+                if (dmtnModulePackageModule.getChildCount() > 0) {\r
+                    dmtnModulePackage.add(dmtnModulePackageModule);\r
+                }\r
+                if (dmtnModulePackageLibrary.getChildCount() > 0) {\r
+                    dmtnModulePackage.add(dmtnModulePackageLibrary);\r
+                }\r
+\r
+                dmtnModuleDescription.add(dmtnModulePackage);\r
             }\r
         }\r
 \r
+        //                if (this.vModuleList.size() > 0) {\r
+        //                    for (int index = 0; index < this.vModuleList.size(); index++) {\r
+        //                        dmtnModuleDescription.add(new IDefaultMutableTreeNode(this.vModuleList.elementAt(index).getName(),\r
+        //                                                                              IDefaultMutableTreeNode.MSA_HEADER, false,\r
+        //                                                                              this.vModuleList.elementAt(index)));\r
+        //                    }\r
+        //                }\r
+\r
         // Make Package Description\r
         dmtnPackageDescription = new IDefaultMutableTreeNode("PackageDescription", IDefaultMutableTreeNode.PACKAGE, -1);\r
         if (this.vPackageList.size() > 0) {\r
@@ -1938,6 +2015,147 @@ 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
      Open Module\r
@@ -1978,14 +2196,71 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
                 }\r
             }\r
             if (!isFind) {\r
-                vModuleList.addElement(new ModuleIdentification(id, pid));\r
+                ModuleIdentification mid = new ModuleIdentification(id, pid);\r
+                vModuleList.addElement(mid);\r
                 //\r
                 // Add new MsaHeader node to the tree\r
                 //\r
-                IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vModuleList.lastElement().getName(),\r
+                IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(),\r
                                                                            IDefaultMutableTreeNode.MSA_HEADER, true,\r
-                                                                           vModuleList.lastElement());\r
-                iTree.addNode(dmtnModuleDescription, node);\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
@@ -1994,7 +2269,8 @@ 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
         iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,\r
@@ -2311,7 +2587,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
     }\r
 \r
     private void insertPlatformTreeNode(Identification id) {\r
-        iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions", IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id));\r
+        iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions",\r
+                                                  IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id));\r
         iTree.addNode(new IDefaultMutableTreeNode("Flash", IDefaultMutableTreeNode.FPD_FLASH, true, id));\r
         iTree.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES,\r
                                                   true, id));\r
@@ -2378,10 +2655,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
      @param elementType\r
      @param fpd\r
      \r
-    **/\r
+     **/\r
     private void showPlatformElement(int elementType, OpeningPlatformType fpd) {\r
         this.cleanDesktopPanePlatform();\r
-        \r
+\r
         switch (elementType) {\r
         case IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS:\r
             FpdPlatformDefs frmFpdPlatformDefs = new FpdPlatformDefs(fpd);\r
@@ -2596,7 +2873,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
                     e.printStackTrace();\r
                     return;\r
                 }\r
-                this.openModule(smb.getMid().getPath());\r
+                this.openModule(smb.getMid().getPath(), smb.getMid());\r
             }\r
         } else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
             //\r
@@ -2884,27 +3161,28 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             // Reinit whole window\r
             //\r
             closeAll();\r
-            this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]");\r
+            this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["\r
+                          + Workspace.getCurrentWorkspace() + "]");\r
         }\r
         sw.dispose();\r
     }\r
-    \r
+\r
     /**\r
-    Show Tool Chain Configuration Dialog to setup Tool Chain\r
-    \r
-    **/\r
+     Show Tool Chain Configuration Dialog to setup Tool Chain\r
+     \r
+     **/\r
     private void setupToolChainConfiguration() {\r
         ToolChainConfig tcc = ToolChainConfig.getInstance();\r
         tcc.showDialog();\r
     }\r
-    \r
+\r
     /**\r
      Clone selected item\r
      \r
      **/\r
     private void cloneItem() {\r
         int mode = -1;\r
-        \r
+\r
         //\r
         // Check if there is any item can be cloned\r
         //\r
@@ -2919,7 +3197,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             Log.err("Please select a target to clone!");\r
             return;\r
         }\r
-        \r
+\r
         if (category == IDefaultMutableTreeNode.WORKSPACE) {\r
             mode = DataType.RETURN_TYPE_WORKSPACE;\r
             id = null;\r
@@ -2933,10 +3211,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
         if (category >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {\r
             mode = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;\r
         }\r
-        \r
+\r
         Clone c = new Clone(this, true, mode, id);\r
         int result = c.showDialog();\r
-        \r
+\r
         if (result == DataType.RETURN_TYPE_CANCEL) {\r
             c.dispose();\r
         }\r
index 7392e373eda7c391079d43742c56b8519ca92cf5..d6be739b47afa78a2344951a463d0495900e8c07 100644 (file)
  **/\r
 package org.tianocore.frameworkwizard;\r
 \r
+import java.awt.Component;\r
 import java.awt.event.ActionEvent;\r
 import java.io.File;\r
 import java.util.Vector;\r
 \r
+import javax.swing.ButtonGroup;\r
 import javax.swing.JButton;\r
 import javax.swing.JComboBox;\r
 import javax.swing.JFileChooser;\r
@@ -46,6 +48,7 @@ import org.tianocore.frameworkwizard.packaging.PackageIdentification;
 import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
 import org.tianocore.frameworkwizard.workspace.Workspace;\r
 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+import javax.swing.JRadioButton;\r
 \r
 public class SelectModuleBelong extends IDialog {\r
 \r
@@ -55,7 +58,7 @@ public class SelectModuleBelong extends IDialog {
      **/\r
     private static final long serialVersionUID = 4171355136991448972L;\r
 \r
-    private JPanel jContentPane = null;\r
+    private JPanel jContentPane = null;  //  @jve:decl-index=0:visual-constraint="10,54"\r
 \r
     private JComboBox jComboBoxExistingPackage = null;\r
 \r
@@ -96,6 +99,8 @@ public class SelectModuleBelong extends IDialog {
     private StarLabel jStarLabel4 = null;\r
 \r
     private StarLabel jStarLabel5 = null;\r
+    \r
+    private ButtonGroup bg = new ButtonGroup();\r
 \r
     private WorkspaceTools wt = new WorkspaceTools();\r
 \r
@@ -107,6 +112,12 @@ public class SelectModuleBelong extends IDialog {
 \r
     private int mode = -1;\r
 \r
+    private JLabel jLabelIsLibrary = null;\r
+\r
+    private JRadioButton jRadioButtonYes = null;\r
+\r
+    private JRadioButton jRadioButtonNo = null;\r
+\r
     /**\r
      * This method initializes jComboBoxExistingPackage        \r
      *         \r
@@ -128,7 +139,7 @@ public class SelectModuleBelong extends IDialog {
     private JButton getJButtonOk() {\r
         if (jButtonOk == null) {\r
             jButtonOk = new JButton();\r
-            jButtonOk.setBounds(new java.awt.Rectangle(310, 140, 80, 20));\r
+            jButtonOk.setBounds(new java.awt.Rectangle(310, 165, 80, 20));\r
             jButtonOk.setText("Ok");\r
             jButtonOk.addActionListener(this);\r
         }\r
@@ -143,7 +154,7 @@ public class SelectModuleBelong extends IDialog {
     private JButton getJButtonCancel() {\r
         if (jButtonCancel == null) {\r
             jButtonCancel = new JButton();\r
-            jButtonCancel.setBounds(new java.awt.Rectangle(395, 140, 80, 20));\r
+            jButtonCancel.setBounds(new java.awt.Rectangle(395, 165, 80, 20));\r
             jButtonCancel.setText("Cancel");\r
             jButtonCancel.addActionListener(this);\r
         }\r
@@ -158,7 +169,7 @@ public class SelectModuleBelong extends IDialog {
     private JTextField getJTextFieldFilePath() {\r
         if (jTextFieldFilePath == null) {\r
             jTextFieldFilePath = new JTextField();\r
-            jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 35, 250, 20));\r
+            jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 60, 250, 20));\r
         }\r
         return jTextFieldFilePath;\r
     }\r
@@ -171,7 +182,7 @@ public class SelectModuleBelong extends IDialog {
     private JButton getJButtonBrowse() {\r
         if (jButtonBrowse == null) {\r
             jButtonBrowse = new JButton();\r
-            jButtonBrowse.setBounds(new java.awt.Rectangle(395, 35, 85, 20));\r
+            jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20));\r
             jButtonBrowse.setText("Browse");\r
             jButtonBrowse.addActionListener(this);\r
         }\r
@@ -186,7 +197,7 @@ public class SelectModuleBelong extends IDialog {
     private JTextField getJTextFieldName() {\r
         if (jTextFieldName == null) {\r
             jTextFieldName = new JTextField();\r
-            jTextFieldName.setBounds(new java.awt.Rectangle(140, 60, 340, 20));\r
+            jTextFieldName.setBounds(new java.awt.Rectangle(140, 85, 340, 20));\r
         }\r
         return jTextFieldName;\r
     }\r
@@ -199,7 +210,7 @@ public class SelectModuleBelong extends IDialog {
     private JTextField getJTextFieldGuid() {\r
         if (jTextFieldGuid == null) {\r
             jTextFieldGuid = new JTextField();\r
-            jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 85, 250, 20));\r
+            jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 110, 250, 20));\r
         }\r
         return jTextFieldGuid;\r
     }\r
@@ -212,7 +223,7 @@ public class SelectModuleBelong extends IDialog {
     private JButton getJButtonGen() {\r
         if (jButtonGen == null) {\r
             jButtonGen = new JButton();\r
-            jButtonGen.setBounds(new java.awt.Rectangle(395, 85, 85, 20));\r
+            jButtonGen.setBounds(new java.awt.Rectangle(395, 110, 85, 20));\r
             jButtonGen.setText("GEN");\r
             jButtonGen.addActionListener(this);\r
         }\r
@@ -227,11 +238,41 @@ public class SelectModuleBelong extends IDialog {
     private JTextField getJTextFieldVersion() {\r
         if (jTextFieldVersion == null) {\r
             jTextFieldVersion = new JTextField();\r
-            jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 110, 340, 20));\r
+            jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 135, 340, 20));\r
         }\r
         return jTextFieldVersion;\r
     }\r
 \r
+    /**\r
+     * This method initializes jRadioButtonYes \r
+     *         \r
+     * @return javax.swing.JRadioButton        \r
+     */\r
+    private JRadioButton getJRadioButtonYes() {\r
+        if (jRadioButtonYes == null) {\r
+            jRadioButtonYes = new JRadioButton();\r
+            jRadioButtonYes.setBounds(new java.awt.Rectangle(140,35,100,20));\r
+            jRadioButtonYes.setSelected(true);\r
+            jRadioButtonYes.setText("Yes");\r
+        }\r
+        return jRadioButtonYes;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jRadioButtonNo  \r
+     *         \r
+     * @return javax.swing.JRadioButton        \r
+     */\r
+    private JRadioButton getJRadioButtonNo() {\r
+        if (jRadioButtonNo == null) {\r
+            jRadioButtonNo = new JRadioButton();\r
+            jRadioButtonNo.setBounds(new java.awt.Rectangle(300,35,110,20));\r
+            jRadioButtonNo.setSelected(false);\r
+            jRadioButtonNo.setText("No");\r
+        }\r
+        return jRadioButtonNo;\r
+    }\r
+\r
     /**\r
      * @param args\r
      */\r
@@ -260,6 +301,23 @@ public class SelectModuleBelong extends IDialog {
             this.jStarLabel1.setVisible(false);\r
             this.jLabelPackage.setVisible(false);\r
             this.jComboBoxExistingPackage.setVisible(false);\r
+            this.jLabelIsLibrary.setVisible(false);\r
+            this.jRadioButtonYes.setVisible(false);\r
+            this.jRadioButtonNo.setVisible(false);\r
+            upLocation(this.jStarLabel2, 50);\r
+            upLocation(this.jStarLabel3, 50);\r
+            upLocation(this.jStarLabel4, 50);\r
+            upLocation(this.jStarLabel5, 50);\r
+            upLocation(this.jLabelFilePath, 50);\r
+            upLocation(this.jLabelName, 50);\r
+            upLocation(this.jLabelGuid, 50);\r
+            upLocation(this.jLabelVersion, 50);\r
+            upLocation(this.jTextFieldFilePath, 50);\r
+            upLocation(this.jTextFieldName, 50);\r
+            upLocation(this.jTextFieldGuid, 50);\r
+            upLocation(this.jTextFieldVersion, 50);\r
+            upLocation(this.jButtonBrowse, 50);\r
+            upLocation(this.jButtonGen, 50);\r
         }\r
     }\r
 \r
@@ -269,7 +327,7 @@ public class SelectModuleBelong extends IDialog {
      * @return void\r
      */\r
     private void init() {\r
-        this.setSize(500, 200);\r
+        this.setSize(500, 230);\r
         this.setContentPane(getJContentPane());\r
         this.setTitle("New");\r
         this.centerWindow();\r
@@ -282,24 +340,27 @@ public class SelectModuleBelong extends IDialog {
      */\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
+            jLabelIsLibrary = new JLabel();\r
+            jLabelIsLibrary.setBounds(new java.awt.Rectangle(15,35,120,20));\r
+            jLabelIsLibrary.setText("Is a Library");\r
             jLabelVersion = new JLabel();\r
-            jLabelVersion.setBounds(new java.awt.Rectangle(15, 110, 120, 20));\r
+            jLabelVersion.setBounds(new java.awt.Rectangle(15, 135, 120, 20));\r
             jLabelVersion.setText("Version");\r
             jLabelGuid = new JLabel();\r
-            jLabelGuid.setBounds(new java.awt.Rectangle(15, 85, 120, 20));\r
+            jLabelGuid.setBounds(new java.awt.Rectangle(15, 110, 120, 20));\r
             jLabelGuid.setText("Guid");\r
             jLabelName = new JLabel();\r
-            jLabelName.setBounds(new java.awt.Rectangle(15, 60, 120, 20));\r
+            jLabelName.setBounds(new java.awt.Rectangle(15, 85, 120, 20));\r
             jLabelName.setText("Name");\r
             jLabelFilePath = new JLabel();\r
-            jLabelFilePath.setBounds(new java.awt.Rectangle(15, 35, 120, 20));\r
+            jLabelFilePath.setBounds(new java.awt.Rectangle(15, 60, 120, 20));\r
             jLabelFilePath.setText("File Path");\r
             jLabelPackage = new JLabel();\r
             jLabelPackage.setBounds(new java.awt.Rectangle(15, 10, 120, 20));\r
             jLabelPackage.setText("Choose Package");\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setSize(new java.awt.Dimension(490, 175));\r
+            jContentPane.setSize(new java.awt.Dimension(490,198));\r
             jContentPane.add(getJComboBoxExistingPackage(), null);\r
             jContentPane.add(getJButtonOk(), null);\r
             jContentPane.add(getJButtonCancel(), null);\r
@@ -318,18 +379,23 @@ public class SelectModuleBelong extends IDialog {
             jStarLabel1 = new StarLabel();\r
             jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
             jStarLabel2 = new StarLabel();\r
-            jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
+            jStarLabel2.setLocation(new java.awt.Point(0, 60));\r
             jStarLabel3 = new StarLabel();\r
-            jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
+            jStarLabel3.setLocation(new java.awt.Point(0, 85));\r
             jStarLabel4 = new StarLabel();\r
-            jStarLabel4.setLocation(new java.awt.Point(0, 85));\r
+            jStarLabel4.setLocation(new java.awt.Point(0, 110));\r
             jStarLabel5 = new StarLabel();\r
-            jStarLabel5.setLocation(new java.awt.Point(0, 110));\r
+            jStarLabel5.setLocation(new java.awt.Point(0, 135));\r
             jContentPane.add(jStarLabel1, null);\r
             jContentPane.add(jStarLabel2, null);\r
             jContentPane.add(jStarLabel3, null);\r
             jContentPane.add(jStarLabel4, null);\r
             jContentPane.add(jStarLabel5, null);\r
+            jContentPane.add(jLabelIsLibrary, null);\r
+            jContentPane.add(getJRadioButtonYes(), null);\r
+            jContentPane.add(getJRadioButtonNo(), null);\r
+            bg.add(getJRadioButtonNo());\r
+            bg.add(getJRadioButtonYes());\r
         }\r
         return jContentPane;\r
     }\r
@@ -543,7 +609,7 @@ public class SelectModuleBelong extends IDialog {
         // Save to identification\r
         //\r
         mid = new ModuleIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),\r
-                                       this.jTextFieldVersion.getText(), path);\r
+                                       this.jTextFieldVersion.getText(), path, jRadioButtonYes.isSelected());\r
         mid.setPackageId(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()));\r
     }\r
 \r
@@ -660,4 +726,8 @@ public class SelectModuleBelong extends IDialog {
     public void setPid(PackageIdentification pid) {\r
         this.pid = pid;\r
     }\r
+    \r
+    private void upLocation(Component c, int size) {\r
+        c.setLocation(c.getLocation().x, c.getLocation().y - size);\r
+    }\r
 }\r
index a859339d544a97a8de7c243539112e239d550294..ddfb479cc40ce1ae56694bf2b85d7ec275fa3058 100644 (file)
@@ -113,12 +113,7 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
      **/\r
     private JTable getJTable() {\r
         if (jTable == null) {\r
-//            Vector<String> vTableHeader = new Vector<String>();\r
-//            vTableHeader.addElement("Name");\r
-//            vTableHeader.addElement("Value");\r
-//            \r
             model = new DefaultTableModel();\r
-            //model = new DefaultTableModel(vTableHeader);\r
             jTable = new JTable(model);\r
             jTable.setRowHeight(20);\r
 \r
index ef1b6bb92289b10e55fd838b55727746121ae1d1..f32ff6ed6553996ebd4264f888f6cd8f24ce7c7d 100644 (file)
@@ -50,6 +50,8 @@ public class DataType {
     \r
     public static final int RETURN_TYPE_WORKSPACE = 15;\r
     \r
+    public static final int RETURN_TYPE_TEXT = 16;\r
+    \r
     \r
     //\r
     // Define all used final variables\r
@@ -97,6 +99,12 @@ public class DataType {
     \r
     public static final String ANT_BUILD_FILE_EXT_DESCRIPTION = ANT_BUILD_FILE + " (*." + ANT_BUILD_FILE_EXT + ")";\r
     \r
+    public static final String TEXT_FILE = "Text File";\r
+    \r
+    public static final String TEXT_FILE_EXT = "txt";\r
+    \r
+    public static final String TEXT_FILE_EXT_DESCRIPTION = TEXT_FILE + " (*." + TEXT_FILE_EXT + ")";\r
+    \r
     //\r
     // Define file separator for current OS\r
     //\r
@@ -171,4 +179,17 @@ public class DataType {
     \r
     public static final String PROJECT_VERSION = "1.0";\r
     \r
+    //\r
+    // Sort Type\r
+    //\r
+    public static final int SORT_TYPE_ASCENDING = 1;\r
+    \r
+    public static final int SORT_TYPE_DESCENDING = 2;\r
+    \r
+    //\r
+    // Module Type\r
+    //\r
+    public static final String MODULE_TYPE_LIBRARY = "Library";\r
+    \r
+    public static final String MODULE_TYPE_MODULE = "Module";\r
 }\r
index db568a6445ae32c139edbed88d3ef7d44a7973a5..402f4284d3e499f5dbabca5750677b5d7b36009e 100644 (file)
@@ -192,7 +192,7 @@ public class DataValidation {
      \r
      **/\r
     public static boolean isVersionDataType(String arg0) {\r
-        return isMatch("(\\d)+(.)?(\\d)+", arg0);\r
+        return isMatch("\\d+(\\.\\d+)*", arg0);\r
     }\r
 \r
     /**\r
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java
new file mode 100644 (file)
index 0000000..57ba11b
--- /dev/null
@@ -0,0 +1,37 @@
+/** @file\r
\r
+ The file is used to override DefaultTableModel to provides customized interfaces \r
\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
+ **/\r
+package org.tianocore.frameworkwizard.common;\r
+\r
+import javax.swing.table.DefaultTableModel;\r
+\r
+public class IDefaultTableModel extends DefaultTableModel {\r
+\r
+    ///\r
+    ///\r
+    ///\r
+    private static final long serialVersionUID = -1782544418084080185L;\r
+\r
+    public IDefaultTableModel() {\r
+        super();\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see javax.swing.table.TableModel#isCellEditable(int, int)\r
+     *\r
+     */\r
+    public boolean isCellEditable(int rowIndex, int columnIndex) {\r
+        return false;\r
+    }\r
+}\r
index d13a8c48ef25186ab1e89b49a243fa0afd0bfc8c..854155adb9b01800436bdbc60a2cc3bd416f64b9 100644 (file)
@@ -81,6 +81,8 @@ public class IFileFilter extends FileFilter {
             return DataType.PACKAGE_SURFACE_AREA_EXT_DESCRIPTION;\r
         if (strExt.equals(DataType.PLATFORM_SURFACE_AREA_EXT))\r
             return DataType.PLATFORM_SURFACE_AREA_EXT_DESCRIPTION;\r
+        if (strExt.equals(DataType.TEXT_FILE_EXT))\r
+            return DataType.TEXT_FILE_EXT_DESCRIPTION;\r
         return "";\r
     }\r
 \r
index 3623b2e3c006c1870b800f90a4924b931ea4bbe4..021c2373a04cd8c1d52a91da232238331d239839 100644 (file)
@@ -22,9 +22,15 @@ import java.util.List;
 import java.util.UUID;\r
 import java.util.Vector;\r
 \r
+import javax.swing.DefaultListModel;\r
 import javax.swing.JComboBox;\r
+import javax.swing.JList;\r
 import javax.swing.JOptionPane;\r
 \r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
+\r
 /**\r
  The class is used to provides some useful interfaces  \r
  \r
@@ -44,6 +50,25 @@ public class Tools {
      **/\r
     public static void main(String[] args) {\r
         System.out.println(getCurrentDateTime());\r
+//        Vector<String> v = new Vector<String>();\r
+//        Vector<String> v1 = new Vector<String>();\r
+//        \r
+//        v.addElement("CAC");\r
+//        v1.addElement("1111");\r
+//        v.addElement("1AC");\r
+//        v1.addElement("2222");\r
+//        v.addElement("ABC");\r
+//        v1.addElement("3333");\r
+//        v.addElement("0C");\r
+//        v1.addElement("4444");\r
+//        v.addElement("AAC");\r
+//        v1.addElement("5555");\r
+//        Vector<Integer> vs = new Vector<Integer>();\r
+//        vs = Tools.getVectorSortSequence(v, DataType.Sort_Type_Ascending);\r
+//        Tools.sortVectorString(v1, Tools.getVectorSortSequence(v, DataType.Sort_Type_Ascending));\r
+//        \r
+//        Tools.sortVectorString(v, DataType.Sort_Type_Ascending);\r
+//        Tools.sortVectorString(v, DataType.Sort_Type_Descending);\r
     }\r
 \r
     /**\r
@@ -141,6 +166,27 @@ public class Tools {
             }\r
         }\r
     }\r
+    \r
+    /**\r
+    Generate selection items for JList by input vector\r
+    \r
+    **/\r
+   public static void generateListByVector(JList jl, Vector<String> vector) {\r
+       if (jl != null) {\r
+           DefaultListModel listModel = (DefaultListModel) jl.getModel();\r
+           listModel.removeAllElements();\r
+           \r
+           if (vector != null) {\r
+               for (int index = 0; index < vector.size(); index++) {\r
+                   listModel.addElement(vector.get(index));\r
+               }\r
+           }\r
+           \r
+           if (listModel.size() > 0) {\r
+               jl.setSelectedIndex(0);\r
+           }\r
+       }\r
+   }\r
 \r
     /**\r
      Get path only from a path\r
@@ -255,6 +301,9 @@ public class Tools {
         if (type == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
             match = DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT;\r
         }\r
+        if (type == DataType.RETURN_TYPE_TEXT) {\r
+            match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT;\r
+        }\r
         if (path.length() <= match.length()) {\r
             path = path + match;\r
             return path;\r
@@ -274,18 +323,180 @@ public class Tools {
     public static void showInformationMessage(String arg0) {\r
         JOptionPane.showConfirmDialog(null, arg0, "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);\r
     }\r
+\r
+    /**\r
+     if the string doesn't end with a file separator, append it to the string\r
+     \r
+     @param arg0\r
+     @return\r
+     \r
+     **/\r
+    public static String addFileSeparator(String arg0) {\r
+        if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {\r
+            arg0 = arg0 + DataType.FILE_SEPARATOR;\r
+        }\r
+        return arg0;\r
+    }\r
+\r
+    /**\r
+     Sort all elements in the vector as the specific sort type\r
+     \r
+     @param v The vector need to be sorted\r
+     @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending\r
+\r
+     **/\r
+    public static void sortVectorString(Vector<String> v, int mode) {\r
+        if (v != null) {\r
+            for (int indexI = 0; indexI < v.size(); indexI++) {\r
+                for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {\r
+                    if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)\r
+                        || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {\r
+                        String temp = v.get(indexI);\r
+                        v.setElementAt(v.get(indexJ), indexI);\r
+                        v.setElementAt(temp, indexJ);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     Sort all elements of vector and return sorted sequence\r
+     \r
+     @param v The vector need to be sorted\r
+     @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending\r
+     @return Vector<Integer> The sorted sequence\r
+     \r
+     **/\r
+    public static Vector<Integer> getVectorSortSequence(Vector<String> v, int mode) {\r
+        Vector<Integer> vSequence = new Vector<Integer>();\r
+        //\r
+        // Init sequence\r
+        //\r
+        if (v != null) {\r
+            for (int index = 0; index < v.size(); index++) {\r
+                vSequence.addElement(index);\r
+            }\r
+        }\r
+\r
+        //\r
+        // sort and get new sequence\r
+        //\r
+        for (int indexI = 0; indexI < v.size(); indexI++) {\r
+            for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {\r
+                if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)\r
+                    || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {\r
+                    //\r
+                    // Swap strings\r
+                    //\r
+                    String tempStr = v.get(indexI);\r
+                    v.setElementAt(v.get(indexJ), indexI);\r
+                    v.setElementAt(tempStr, indexJ);\r
+                    \r
+                    //\r
+                    // Swap sequences\r
+                    //\r
+                    int tempInt = vSequence.get(indexI);\r
+                    vSequence.setElementAt(vSequence.get(indexJ), indexI);\r
+                    vSequence.setElementAt(tempInt, indexJ);\r
+                }\r
+            }\r
+        }\r
+\r
+        return vSequence;\r
+    }\r
+\r
+    /**\r
+     Sort all elements of vector as input sequence\r
+     \r
+     @param v The vector need to be sorted\r
+     @param vSequence The sort sequence should be followed\r
+     \r
+     **/\r
+    public static void sortVectorString(Vector<String> v, Vector<Integer> vSequence) {\r
+        if (v != null && vSequence != null && v.size() == vSequence.size()) {\r
+            Vector<String> tempV = new Vector<String>();\r
+            for (int index = 0; index < v.size(); index++) {\r
+                tempV.addElement(v.get(index));\r
+            }\r
+            for (int index = 0; index < v.size(); index++) {\r
+                v.setElementAt(tempV.get(vSequence.get(index)), index);\r
+            }\r
+        }\r
+    }\r
+    \r
+    /**\r
+     Sort all modules\r
+     \r
+     @param v\r
+     @param mode\r
+    \r
+    **/\r
+    public static void sortModules(Vector<ModuleIdentification> v, int mode) {\r
+        if (v != null) {\r
+            //\r
+            // sort by name\r
+            //\r
+            for (int indexI = 0; indexI < v.size(); indexI++) {\r
+                for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {\r
+                    if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)\r
+                        || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {\r
+                        ModuleIdentification temp = v.get(indexI);\r
+                        v.setElementAt(v.get(indexJ), indexI);\r
+                        v.setElementAt(temp, indexJ);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
     \r
     /**\r
-    if the string doesn't end with a file separator, append it to the string\r
+    Sort all packages\r
     \r
-    @param arg0\r
-    @return\r
+    @param v\r
+    @param mode\r
    \r
    **/\r
-   public static String addFileSeparator(String arg0) {\r
-       if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {\r
-           arg0 = arg0 + DataType.FILE_SEPARATOR;\r
+   public static void sortPackages(Vector<PackageIdentification> v, int mode) {\r
+       if (v != null) {\r
+           //\r
+           // sort by name\r
+           //\r
+           for (int indexI = 0; indexI < v.size(); indexI++) {\r
+               for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {\r
+                   if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)\r
+                       || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {\r
+                       PackageIdentification temp = v.get(indexI);\r
+                       v.setElementAt(v.get(indexJ), indexI);\r
+                       v.setElementAt(temp, indexJ);\r
+                   }\r
+               }\r
+           }\r
        }\r
-       return arg0;\r
    }\r
+   \r
+   /**\r
+   Sort all platforms\r
+   \r
+   @param v\r
+   @param mode\r
+  \r
+  **/\r
+  public static void sortPlatforms(Vector<PlatformIdentification> v, int mode) {\r
+      if (v != null) {\r
+          //\r
+          // sort by name\r
+          //\r
+          for (int indexI = 0; indexI < v.size(); indexI++) {\r
+              for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {\r
+                  if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)\r
+                      || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {\r
+                      PlatformIdentification temp = v.get(indexI);\r
+                      v.setElementAt(v.get(indexJ), indexI);\r
+                      v.setElementAt(temp, indexJ);\r
+                  }\r
+              }\r
+          }\r
+      }\r
+  }\r
 }\r
index 454f472a23e3cfa9e594089c0475443fac2c47eb..4f7b953c81cd024754953b8c7aeecb78900d4d00 100644 (file)
@@ -115,6 +115,12 @@ public class IDefaultMutableTreeNode extends DefaultMutableTreeNode {
     public static final int PACKAGE = 2;\r
 \r
     public static final int PLATFORM = 3;\r
+    \r
+    public static final int MODULE_PACKAGE = 4;\r
+    \r
+    public static final int MODULE_PACKAGE_LIBRARY = 5;\r
+    \r
+    public static final int MODULE_PACKAGE_MODULE = 6;\r
 \r
     //\r
     //Static final definitions for operation\r
index d0222e95741eb5ebe627736dd4aeea059352aeae..61d70d30438bb8a5d684af1914fde0411cb3a7d4 100644 (file)
@@ -126,7 +126,7 @@ public class IFrame extends JFrame implements ActionListener, WindowListener {
      * \r
      */\r
     public void windowClosing(WindowEvent arg0) {\r
-        this.onDisvisible();\r
+        //this.onDisvisible();\r
     }\r
 \r
     public void windowOpened(WindowEvent arg0) {\r
index 0d15a014ee894b5087a40aa1e4883263e18a36dc..b5f09da0835ceab63005e78053b0238c96445e98 100644 (file)
@@ -24,13 +24,17 @@ import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;\r
 import java.awt.event.ItemEvent;\r
 import java.awt.event.ItemListener;\r
+import java.awt.event.MouseEvent;\r
+import java.awt.event.MouseListener;\r
 \r
 import javax.swing.JDesktopPane;\r
 import javax.swing.JFrame;\r
 import javax.swing.JInternalFrame;\r
 import javax.swing.JPanel;\r
-\r
-import org.tianocore.frameworkwizard.common.DataType;\r
+import javax.swing.event.ListSelectionEvent;\r
+import javax.swing.event.ListSelectionListener;\r
+import javax.swing.event.TableModelEvent;\r
+import javax.swing.event.TableModelListener;\r
 \r
 /**\r
  * The class is used to override JInternalFrame to provides customized\r
@@ -39,7 +43,8 @@ import org.tianocore.frameworkwizard.common.DataType;
  *\r
  * \r
  */\r
-public class IInternalFrame extends JInternalFrame implements ActionListener, ComponentListener, ItemListener, FocusListener {\r
+public class IInternalFrame extends JInternalFrame implements ActionListener, ComponentListener, ItemListener,\r
+                                                  FocusListener, ListSelectionListener, TableModelListener, MouseListener {\r
 \r
     // /\r
     // / Define class Serial Version UID\r
@@ -157,8 +162,7 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
      * \r
      */\r
     public void resizeComponentWidth(Component c, int containerWidth, int preferredWidth) {\r
-        int newWidth = c.getPreferredSize().width\r
-                       + (containerWidth - preferredWidth);\r
+        int newWidth = c.getPreferredSize().width + (containerWidth - preferredWidth);\r
         if (newWidth < c.getPreferredSize().width) {\r
             newWidth = c.getPreferredSize().width;\r
         }\r
@@ -190,7 +194,8 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
      * @param containerHeight\r
      * \r
      */\r
-    public void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth, int preferredHeight) {\r
+    public void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth,\r
+                                int preferredHeight) {\r
         resizeComponentWidth(c, containerWidth, preferredWidth);\r
         resizeComponentHeight(c, containerHeight, preferredHeight);\r
     }\r
@@ -206,7 +211,7 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
     public void relocateComponentX(Component c, int containerWidth, int preferredWidth, int spaceToRight) {\r
         int intGapToRight = spaceToRight + c.getPreferredSize().width;\r
         int newLocationX = containerWidth - intGapToRight;\r
-        if (newLocationX < preferredWidth -intGapToRight) {\r
+        if (newLocationX < preferredWidth - intGapToRight) {\r
             newLocationX = preferredWidth - intGapToRight;\r
         }\r
         c.setLocation(newLocationX, c.getLocation().y);\r
@@ -221,10 +226,11 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
      * @param spaceToBottom\r
      * \r
      */\r
-    public void relocateComponentY(Component c, int containerHeight, int spaceToBottom) {\r
-        int newLocationY = containerHeight - spaceToBottom;\r
-        if (newLocationY < DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT - spaceToBottom) {\r
-            newLocationY = DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT - spaceToBottom;\r
+    public void relocateComponentY(Component c, int containerHeight, int preferredHeight, int spaceToBottom) {\r
+        int intGapToBottom = spaceToBottom + c.getPreferredSize().height;\r
+        int newLocationY = containerHeight - intGapToBottom;\r
+        if (newLocationY < preferredHeight - spaceToBottom) {\r
+            newLocationY = preferredHeight - spaceToBottom;\r
         }\r
         c.setLocation(c.getLocation().x, newLocationY);\r
         c.validate();\r
@@ -240,10 +246,10 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
      * @param spaceToRight\r
      * \r
      */\r
-    public void relocateComponent(Component c, int containerWidth, int containerHeight, int spaceToBottom,\r
-                                  int spaceToRight, int preferredWidht, int preferredHeight) {\r
-        relocateComponentX(c, containerWidth, preferredWidht, spaceToBottom);\r
-        relocateComponentY(c, containerHeight, spaceToRight);\r
+    public void relocateComponent(Component c, int containerWidth, int containerHeight, int preferredWidht,\r
+                                  int preferredHeight, int spaceToRight, int spaceToBottom) {\r
+        relocateComponentX(c, containerWidth, preferredWidht, spaceToRight);\r
+        relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);\r
     }\r
 \r
     public void showStandard() {\r
@@ -260,16 +266,51 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
 \r
     public void itemStateChanged(ItemEvent arg0) {\r
         // TODO Auto-generated method stub\r
-        \r
+\r
     }\r
 \r
     public void focusGained(FocusEvent arg0) {\r
         // TODO Auto-generated method stub\r
-        \r
+\r
     }\r
 \r
     public void focusLost(FocusEvent arg0) {\r
         // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    public void valueChanged(ListSelectionEvent arg0) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    public void tableChanged(TableModelEvent arg0) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    public void mouseClicked(MouseEvent arg0) {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+    public void mouseEntered(MouseEvent arg0) {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+    public void mouseExited(MouseEvent arg0) {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+    public void mousePressed(MouseEvent arg0) {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+    public void mouseReleased(MouseEvent arg0) {\r
+        // TODO Auto-generated method stub\r
         \r
     }\r
 }\r
index 25da85fa818f81466d808fc2fd394865191a7b95..5b7ea5900c1c13ec55db54f22d79827faf25be97 100644 (file)
@@ -238,12 +238,19 @@ public class ITree extends JTree {
             if (iNode.getId().equals(id) && iNode.getCategory() == category) {\r
                 return iNode;\r
             }\r
+            IDefaultMutableTreeNode childNode = getNodeById(iNode, id, category);\r
+            if (childNode != null) {\r
+                return childNode;\r
+            }\r
         }\r
         return null;\r
     }\r
     \r
     public TreePath getPathOfNode(IDefaultMutableTreeNode node) {\r
-        TreePath treePath = new TreePath(treeModel.getPathToRoot(node));\r
-        return treePath;\r
+        if (node != null) {\r
+            TreePath treePath = new TreePath(treeModel.getPathToRoot(node));\r
+            return treePath;    \r
+        }\r
+        return null;\r
     }\r
 }\r
index 5ad0533eec15aad9eba73865c79633cf2c79b397..2361c77e617b6fd1fa0af54a412d21d3c8e8fead 100644 (file)
@@ -86,6 +86,22 @@ public class ICheckBoxList extends JList {
         }\r
         return result;\r
     }\r
+    \r
+    /**\r
+    Get All Checked Items index of the CheckBoxList component.\r
+    \r
+    @return    All Checked Items index\r
+    **/\r
+   public Vector<Integer> getAllCheckedItemsIndex() {\r
+       Vector<Integer> result = new Vector<Integer>();\r
+\r
+       for (int i = 0; i < this.getModel().getSize(); i++) {\r
+           if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {\r
+               result.addElement(i);\r
+           }\r
+       }\r
+       return result;\r
+   }\r
 \r
     /**\r
      Get All Checked Items String of the CheckBoxList component.\r
index f7af757458b309233cad2c3be89cf71d18618338..efb146e1e7b42df6ca2071c2d9072c3eab0f137a 100644 (file)
@@ -86,4 +86,11 @@ public class LibraryClassVector {
     public int size() {\r
         return this.vLibraryClass.size();\r
     }\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getLibraryClass(index).getLibraryClassName());\r
+        v.addElement(getLibraryClass(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index cef02295f65103ee305d2def9f195d27b6f3c692..8671204b98c9370fe6a32a4765c077e81e4fb01c 100644 (file)
 package org.tianocore.frameworkwizard.module.Identifications;\r
 \r
 \r
+import java.io.IOException;\r
+\r
+import org.apache.xmlbeans.XmlException;\r
+import org.tianocore.LibraryUsage;\r
+import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
+import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
+import org.tianocore.frameworkwizard.common.Identifications.OpenFile;\r
 import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
 \r
 public class ModuleIdentification extends Identification {\r
     \r
     private PackageIdentification packageId;\r
     \r
+    private String moduleType;\r
+    \r
+    private boolean isLibrary;\r
+    \r
     public ModuleIdentification(String name, String guid, String version, String path) {\r
        super(name, guid, version, path);\r
+        setModuleType();\r
     }\r
     \r
-    public ModuleIdentification(Identification id) {\r
+    public ModuleIdentification(String name, String guid, String version, String path, boolean library) {\r
+        super(name, guid, version, path);\r
+        this.isLibrary = library;\r
+    }\r
+    \r
+    public ModuleIdentification(Identification id, boolean library) {\r
         super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
+        this.isLibrary = library;\r
     }\r
     \r
     public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId){\r
         super(name, guid, version, path);\r
         this.packageId = packageId;\r
+        setModuleType();\r
+    }\r
+    \r
+    public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId, String type){\r
+        super(name, guid, version, path);\r
+        this.packageId = packageId;\r
+        this.moduleType = type;\r
     }\r
     \r
     public ModuleIdentification(Identification id, PackageIdentification packageId) {\r
         super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
         this.packageId = packageId;\r
+        setModuleType();\r
     }\r
     \r
-//    public boolean equals(Object obj) {\r
-//        if (obj instanceof Identification) {\r
-//            Identification id = (Identification)obj;\r
-//            if ( this.getName().equalsIgnoreCase(id.getName())) {\r
-//                return true;\r
-//            }\r
-//            // and package is the same one\r
-//            return false;\r
-//        }\r
-//        else {\r
-//            return super.equals(obj);\r
-//        }\r
-//    }\r
+    public ModuleIdentification(Identification id, PackageIdentification packageId, boolean library) {\r
+        super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
+        this.packageId = packageId;\r
+        this.isLibrary = library;\r
+    }\r
+    \r
+    public ModuleIdentification(Identification id, PackageIdentification packageId, String type) {\r
+        super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
+        this.packageId = packageId;\r
+        this.moduleType = type;\r
+    }\r
     \r
     public String toString(){\r
         return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId;\r
@@ -66,4 +91,50 @@ public class ModuleIdentification extends Identification {
     public void setPackageId(PackageIdentification packageId) {\r
         this.packageId = packageId;\r
     }\r
+\r
+    public String getModuleType() {\r
+        return moduleType;\r
+    }\r
+\r
+    public void setModuleType(String moduleType) {\r
+        this.moduleType = moduleType;\r
+    }\r
+    \r
+    private void setModuleType() {\r
+        ModuleSurfaceArea msa = null;\r
+        try {\r
+            msa = OpenFile.openMsaFile(this.getPath());\r
+        } catch (IOException e) {\r
+            // TODO Auto-generated catch block\r
+            \r
+        } catch (XmlException e) {\r
+            // TODO Auto-generated catch block\r
+            \r
+        } catch (Exception e) {\r
+            // TODO Auto-generated catch block\r
+            \r
+        }\r
+        setModuleType(DataType.MODULE_TYPE_MODULE);\r
+        setLibrary(false);\r
+        if (msa != null) {\r
+            LibraryClassDefinitions lib = msa.getLibraryClassDefinitions();\r
+            if (lib != null) {\r
+                for (int index = 0; index < lib.getLibraryClassList().size(); index++) {\r
+                    if (lib.getLibraryClassList().get(index).getUsage().equals(LibraryUsage.ALWAYS_PRODUCED)) {\r
+                        setModuleType(DataType.MODULE_TYPE_LIBRARY);\r
+                        setLibrary(true);\r
+                        break;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    public boolean isLibrary() {\r
+        return isLibrary;\r
+    }\r
+\r
+    public void setLibrary(boolean isLibrary) {\r
+        this.isLibrary = isLibrary;\r
+    }\r
 }\r
index 7604a5f27a69875ce57483a513d49b74af14623f..711f9b91c0fc0a0304c1aa9845d380433e1daf20 100644 (file)
  **/\r
 \r
 package org.tianocore.frameworkwizard.packaging;\r
-import java.io.File;\r
 \r
 import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
 \r
 public class PackageIdentification extends Identification{\r
     \r
-    //\r
-    // It is optional\r
-    //\r
-    private File spdFile;\r
-    \r
     public PackageIdentification(String name, String guid, String version){\r
         super(name, guid, version);\r
     }\r
@@ -36,25 +30,4 @@ public class PackageIdentification extends Identification{
     public PackageIdentification(Identification id){\r
         super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
     }\r
-    \r
-    public PackageIdentification(String name, String guid, String version, File spdFile){\r
-        super(name, guid, version);\r
-        this.spdFile = spdFile;\r
-    }\r
-    \r
-    public File getSpdFile() {\r
-        return spdFile;\r
-    }\r
-\r
-    public String toString(){\r
-        return "Package " + this.getName() + "[" + this.getGuid() + "]";\r
-    }\r
-\r
-    public void setSpdFile(File spdFile) {\r
-        this.spdFile = spdFile;\r
-    }\r
-    \r
-    public String getPackageDir(){\r
-        return spdFile.getParent();\r
-    }\r
 }\r
index 01387223a383866e988a76521e4e35bd4263f780..0604dae95461a4640fb5e9f177f1510b308c33ad 100644 (file)
 \r
 package org.tianocore.frameworkwizard.platform;\r
 \r
-import java.io.File;\r
-\r
 import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
 \r
 public class PlatformIdentification extends Identification{\r
     \r
-    private File fpdFile;\r
-    \r
     public PlatformIdentification(String name, String guid, String version, String path){\r
         super(name, guid, version, path);\r
     }\r
     \r
-    public PlatformIdentification(String name, String guid, String version, File fpdFile){\r
-        super(name, guid, version);\r
-        this.fpdFile = fpdFile;\r
-    }\r
-    \r
     public PlatformIdentification(Identification id){\r
         super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
     }\r
-    \r
-    public String toString(){\r
-        return "Platform " + this.getName() + "[" + this.getGuid() + "]";\r
-    }\r
-\r
-    public void setFpdFile(File fpdFile) {\r
-        this.fpdFile = fpdFile;\r
-    }\r
-\r
-    public File getFpdFile() {\r
-        return fpdFile;\r
-    }\r
 }
\ No newline at end of file
index a87ab07794cfd53a3b0dbe29e7db5efad65f58f7..e4800816cb6264b9e8ab66d188addc5a4fc6c1c4 100644 (file)
@@ -89,11 +89,11 @@ public class WorkspaceTools {
                 }\r
             }\r
         } catch (IOException e) {\r
-            e.printStackTrace();\r
+\r
         } catch (XmlException e) {\r
-            e.printStackTrace();\r
+\r
         } catch (Exception e) {\r
-            e.printStackTrace();\r
+\r
         }\r
         return modulePath;\r
     }\r
@@ -117,11 +117,11 @@ public class WorkspaceTools {
                }\r
            }\r
        } catch (IOException e) {\r
-           e.printStackTrace();\r
+\r
        } catch (XmlException e) {\r
-           e.printStackTrace();\r
+\r
        } catch (Exception e) {\r
-           e.printStackTrace();\r
+\r
        }\r
        return includePath;\r
    }\r
@@ -147,22 +147,54 @@ public class WorkspaceTools {
                 vPackageList.addElement(new PackageIdentification(id));\r
             } catch (IOException e) {\r
                 Log.err("Open Package Surface Area " + path, e.getMessage());\r
-                e.printStackTrace();\r
+\r
             } catch (XmlException e) {\r
                 Log.err("Open Package Surface Area " + path, e.getMessage());\r
-                e.printStackTrace();\r
+\r
             } catch (Exception e) {\r
                 Log.err("Open Package Surface Area " + path, "Invalid file type");\r
-                e.printStackTrace();\r
+\r
             }\r
         }\r
+        Tools.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);\r
         return vPackageList;\r
     }\r
+    \r
+    /**\r
+     Get all module basic information from a package\r
+    \r
+     @param id Package id\r
+     @return A vector includes all modules' basic information\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
+        for (int index = 0; index < modulePaths.size(); index++) {\r
+            try {\r
+                modulePath = modulePaths.get(index);\r
+                id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
+            } catch (IOException e) {\r
+                Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());\r
+            } catch (XmlException e) {\r
+                Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());\r
+            } catch (Exception e) {\r
+                Log.log("Error when Open Module Surface Area " + modulePath, "Invalid file type " + e.getMessage());\r
+            }\r
+            v.addElement(new ModuleIdentification(id, pid));\r
+        }\r
+        Tools.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
+        return v;\r
+        \r
+    }\r
 \r
     /**\r
-     Get all package basic information form the FrameworkDatabase.db file\r
+     Get all module basic information form the FrameworkDatabase.db file\r
      \r
-     @return vPackageList A vector includes all packages' basic information\r
+     @return vModuleList A vector includes all modules' basic information\r
      \r
      */\r
     public Vector<ModuleIdentification> getAllModules() {\r
@@ -190,17 +222,14 @@ public class WorkspaceTools {
                     vModuleList.addElement(new ModuleIdentification(id, vPackageList.elementAt(indexI)));\r
                 } catch (IOException e) {\r
                     Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
-                    e.printStackTrace();\r
                 } catch (XmlException e) {\r
                     Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
-                    e.printStackTrace();\r
                 } catch (Exception e) {\r
                     Log.err("Open Module Surface Area " + modulePath, "Invalid file type");\r
-                    e.printStackTrace();\r
                 }\r
             }\r
         }\r
-\r
+        Tools.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);\r
         return vModuleList;\r
     }\r
 \r
@@ -225,15 +254,13 @@ public class WorkspaceTools {
                 vPlatformList.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
+        Tools.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);\r
         return vPlatformList;\r
     }\r
 \r
@@ -251,6 +278,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -268,6 +296,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -285,6 +314,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -302,6 +332,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -319,6 +350,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -340,15 +372,13 @@ public class WorkspaceTools {
                 }\r
             } catch (IOException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (XmlException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (Exception e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -368,15 +398,13 @@ public class WorkspaceTools {
                 }\r
             } catch (IOException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (XmlException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (Exception e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -396,15 +424,13 @@ public class WorkspaceTools {
                 }\r
             } catch (IOException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (XmlException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (Exception e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -424,15 +450,13 @@ public class WorkspaceTools {
                 }\r
             } catch (IOException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (XmlException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (Exception e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -452,15 +476,13 @@ public class WorkspaceTools {
                 }\r
             } catch (IOException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (XmlException e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             } catch (Exception e) {\r
                 // TODO Auto-generated catch block\r
-                e.printStackTrace();\r
             }\r
         }\r
+        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -495,11 +517,11 @@ public class WorkspaceTools {
                         return vPackageList.elementAt(indexI);\r
                     }\r
                 } catch (IOException e) {\r
-                    e.printStackTrace();\r
+\r
                 } catch (XmlException e) {\r
-                    e.printStackTrace();\r
+                \r
                 } catch (Exception e) {\r
-                    e.printStackTrace();\r
+\r
                 }\r
             }\r
         }\r