]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
1. Provide "Find" function for Ppi/Protocol/Guid/Pcd/LibraryClass.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Tools.java
index 7a98afdb7bddb45a98bdf216a995f3b2876368d4..4b32baa7ef8247917c23d05490ef3fbedb86befb 100644 (file)
@@ -389,7 +389,7 @@ public class Tools {
 \r
         return strReturn;\r
     }\r
-    \r
+\r
     public static String convertUnicodeHexStringToString(String str) {\r
         //\r
         // Handle if str is null or empty\r
@@ -415,8 +415,8 @@ public class Tools {
             // Change hex to dec\r
             //\r
             int dec = Integer.parseInt(s, 16);\r
-            \r
-            returnString = returnString + (char)(dec);\r
+\r
+            returnString = returnString + (char) (dec);\r
         }\r
         return returnString;\r
     }\r
@@ -468,7 +468,7 @@ public class Tools {
         //\r
         return hexString.trim();\r
     }\r
-    \r
+\r
     public static ModuleIdentification getId(String path, ModuleSurfaceArea msa) {\r
         MsaHeader head = msa.getMsaHeader();\r
         String name = head.getModuleName();\r
@@ -495,7 +495,7 @@ public class Tools {
         PlatformIdentification id = new PlatformIdentification(name, guid, version, path);\r
         return id;\r
     }\r
-    \r
+\r
     /**\r
      * To reset the width of input component via container width\r
      * \r
@@ -537,7 +537,7 @@ public class Tools {
      * \r
      */\r
     public static void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth,\r
-                                int preferredHeight) {\r
+                                       int preferredHeight) {\r
         resizeComponentWidth(c, containerWidth, preferredWidth);\r
         resizeComponentHeight(c, containerHeight, preferredHeight);\r
     }\r
@@ -589,32 +589,47 @@ public class Tools {
      * \r
      */\r
     public static void relocateComponent(Component c, int containerWidth, int containerHeight, int preferredWidht,\r
-                                  int preferredHeight, int spaceToRight, int spaceToBottom) {\r
+                                         int preferredHeight, int spaceToRight, int spaceToBottom) {\r
         relocateComponentX(c, containerWidth, preferredWidht, spaceToRight);\r
         relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);\r
     }\r
-    \r
+\r
     /**\r
      Move the component to the center of screen \r
-         \r
+     \r
      @param c\r
      @param width\r
-    \r
-    **/\r
+     \r
+     **/\r
     public static void centerComponent(Component c, int width) {\r
         c.setLocation(width / 2 - c.getWidth() / 2, c.getLocation().y);\r
         c.validate();\r
     }\r
-    \r
+\r
     /**\r
-    Move the component to the center of screen and adjust the y location \r
-        \r
-    @param c\r
-    @param width\r
-   \r
-   **/\r
-   public static void centerComponent(Component c, int width, int containerHeight, int preferredHeight, int spaceToBottom) {\r
-       relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);\r
-       centerComponent(c, width);\r
-   }\r
+     Move the component to the center of screen and adjust the y location \r
+     \r
+     @param c\r
+     @param width\r
+     \r
+     **/\r
+    public static void centerComponent(Component c, int width, int containerHeight, int preferredHeight,\r
+                                       int spaceToBottom) {\r
+        relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);\r
+        centerComponent(c, width);\r
+    }\r
+\r
+    /**\r
+     Find the count of searchString in wholeString\r
+     \r
+     @param wholeString\r
+     @param searchString\r
+     @return\r
+\r
+     **/\r
+    public static int getSpecificStringCount(String wholeString, String searchString) {\r
+        int count = 0;\r
+        count = wholeString.split(searchString).length;\r
+        return count;\r
+    }\r
 }\r