]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java
1. Fix EDKT193 "Provide a Module tree when platform/package are open"
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Identifications / OpeningModuleList.java
index eab8d2a82465e2363d6d17c17e31db89bee75377..df52b8a34dbcf6a5c203d52f3bf13fe97204f326 100644 (file)
@@ -14,6 +14,7 @@
  **/\r
 package org.tianocore.frameworkwizard.common.Identifications;\r
 \r
+import java.util.Set;\r
 import java.util.Vector;\r
 \r
 import javax.swing.tree.TreePath;\r
@@ -27,6 +28,7 @@ public class OpeningModuleList {
     public OpeningModuleList() {\r
 \r
     }\r
+\r
     public Vector<OpeningModuleType> getVOpeningModuleList() {\r
         return vOpeningModuleList;\r
     }\r
@@ -34,18 +36,18 @@ public class OpeningModuleList {
     public void setVOpeningModuleList(Vector<OpeningModuleType> openingModuleList) {\r
         vOpeningModuleList = openingModuleList;\r
     }\r
-    \r
+\r
     public void insertToOpeningModuleList(ModuleIdentification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {\r
         vOpeningModuleList.addElement(new OpeningModuleType(id, xmlMsa));\r
     }\r
-    \r
+\r
     public OpeningModuleType getOpeningModuleByIndex(int index) {\r
         if (index > -1 && index < vOpeningModuleList.size()) {\r
             return vOpeningModuleList.elementAt(index);\r
         }\r
         return null;\r
     }\r
-    \r
+\r
     public OpeningModuleType getOpeningModuleById(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
@@ -53,7 +55,7 @@ public class OpeningModuleList {
         }\r
         return null;\r
     }\r
-    \r
+\r
     public int findIndexOfListById(ModuleIdentification id) {\r
         for (int index = 0; index < vOpeningModuleList.size(); index++) {\r
             if (vOpeningModuleList.elementAt(index).getId().equals(id)) {\r
@@ -62,24 +64,24 @@ public class OpeningModuleList {
         }\r
         return -1;\r
     }\r
-    \r
+\r
     public void removeFromOpeningModuleListByIndex(int index) {\r
         if (index > -1 && index < vOpeningModuleList.size()) {\r
             vOpeningModuleList.removeElementAt(index);\r
         }\r
     }\r
-    \r
+\r
     public void removeFromOpeningModuleListById(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             vOpeningModuleList.removeElementAt(findIndexOfListById(id));\r
         }\r
     }\r
-    \r
+\r
     public void removeAllFromOpeningModuleList() {\r
         vOpeningModuleList.removeAllElements();\r
     }\r
-    \r
+\r
     public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
@@ -87,7 +89,7 @@ public class OpeningModuleList {
         }\r
         return null;\r
     }\r
-    \r
+\r
     public boolean existsModule(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
@@ -95,71 +97,71 @@ public class OpeningModuleList {
         }\r
         return false;\r
     }\r
-    \r
+\r
     public void setModuleSaved(ModuleIdentification id, boolean isSaved) {\r
         setModuleSaved(findIndexOfListById(id), isSaved);\r
     }\r
-    \r
+\r
     public void setModuleSaved(int index, boolean isSaved) {\r
         if (index > -1) {\r
             vOpeningModuleList.elementAt(index).setSaved(isSaved);\r
         }\r
     }\r
-    \r
+\r
     public boolean getModuleSaved(ModuleIdentification id) {\r
         return getModuleSaved(findIndexOfListById(id));\r
     }\r
-    \r
+\r
     public boolean getModuleSaved(int index) {\r
         if (index > -1) {\r
             return vOpeningModuleList.elementAt(index).isSaved();\r
         }\r
         return true;\r
     }\r
-    \r
+\r
     public void setModuleOpen(ModuleIdentification id, boolean isOpen) {\r
         setModuleOpen(findIndexOfListById(id), isOpen);\r
     }\r
-    \r
+\r
     public void setModuleOpen(int index, boolean isOpen) {\r
         if (index > -1) {\r
             vOpeningModuleList.elementAt(index).setOpen(isOpen);\r
         }\r
     }\r
-    \r
+\r
     public boolean getModuleOpen(ModuleIdentification id) {\r
         return getModuleOpen(findIndexOfListById(id));\r
     }\r
-    \r
+\r
     public boolean getModuleOpen(int index) {\r
         if (index > -1) {\r
             return vOpeningModuleList.elementAt(index).isOpen();\r
         }\r
         return true;\r
     }\r
-    \r
-    public void setTreePathById(ModuleIdentification id, TreePath treePath) {\r
+\r
+    public void setTreePathById(ModuleIdentification id, Set<TreePath> treePath) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             vOpeningModuleList.elementAt(index).setTreePath(treePath);\r
         }\r
     }\r
-    \r
-    public TreePath getTreePathById(ModuleIdentification id) {\r
+\r
+    public Set<TreePath> getTreePathById(ModuleIdentification id) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             return vOpeningModuleList.elementAt(index).getTreePath();\r
         }\r
         return null;\r
     }\r
-    \r
-    public TreePath getTreePathByIndex(int index) {\r
+\r
+    public Set<TreePath> getTreePathByIndex(int index) {\r
         if (index > -1) {\r
             return vOpeningModuleList.elementAt(index).getTreePath();\r
         }\r
         return null;\r
     }\r
-    \r
+\r
     public ModuleIdentification getIdByPath(String path) {\r
         ModuleIdentification id = new ModuleIdentification(null, null, null, path);\r
         int index = findIndexOfListById(id);\r
@@ -168,24 +170,40 @@ public class OpeningModuleList {
         }\r
         return null;\r
     }\r
-    \r
+\r
+    public ModuleIdentification getIdByGuidVersion(String guid, String version) {\r
+        for (int index = 0; index < vOpeningModuleList.size(); index++) {\r
+            ModuleIdentification id = vOpeningModuleList.elementAt(index).getId();\r
+            if (version != null) {\r
+                if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {\r
+                    return id;\r
+                }\r
+            } else {\r
+                if (id.getGuid().equals(guid)) {\r
+                    return id;\r
+                }\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+\r
     public void setNew(ModuleIdentification id, boolean isNew) {\r
         int index = findIndexOfListById(id);\r
         if (index > -1) {\r
             vOpeningModuleList.elementAt(index).setNew(isNew);\r
         }\r
     }\r
-    \r
+\r
     public void closeAll() {\r
         for (int index = 0; index < this.size(); index++) {\r
-           this.setModuleOpen(index, false);\r
+            this.setModuleOpen(index, false);\r
         }\r
     }\r
-    \r
+\r
     public int size() {\r
         return vOpeningModuleList.size();\r
     }\r
-    \r
+\r
     public boolean isSaved() {\r
         for (int index = 0; index < this.size(); index++) {\r
             if (!this.getModuleSaved(index)) {\r
@@ -194,7 +212,7 @@ public class OpeningModuleList {
         }\r
         return true;\r
     }\r
-    \r
+\r
     public boolean isOpen() {\r
         for (int index = 0; index < this.size(); index++) {\r
             if (this.getModuleOpen(index)) {\r