Updated ArchCheckBox.java and Preferences.java to support enable, disable of individu...
authorlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Aug 2006 20:41:52 +0000 (20:41 +0000)
committerlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Aug 2006 20:41:52 +0000 (20:41 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1354 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java

index 76c29da..62d4a33 100644 (file)
@@ -40,7 +40,7 @@ public class ArchCheckBox extends JPanel {
     private JCheckBox jCheckBoxArm = null;\r
 \r
     private JCheckBox jCheckBoxPpc = null;\r
-    \r
+\r
     /**\r
      * This method initializes jCheckBoxIa32   \r
      *         \r
@@ -155,7 +155,7 @@ public class ArchCheckBox extends JPanel {
         this.add(getJCheckBoxPpc(), null);\r
         this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
     }\r
-    \r
+\r
     public Vector<String> getSelectedItemsVector() {\r
         Vector<String> v = new Vector<String>();\r
         if (this.jCheckBoxIa32.isSelected()) {\r
@@ -178,7 +178,7 @@ public class ArchCheckBox extends JPanel {
         }\r
         return v;\r
     }\r
-    \r
+\r
     public String getSelectedItemsString() {\r
         String s = "";\r
         if (this.jCheckBoxIa32.isSelected()) {\r
@@ -201,7 +201,7 @@ public class ArchCheckBox extends JPanel {
         }\r
         return s.trim();\r
     }\r
-    \r
+\r
     public void setAllItemsSelected(boolean isSelected) {\r
         this.jCheckBoxIa32.setSelected(isSelected);\r
         this.jCheckBoxX64.setSelected(isSelected);\r
@@ -210,7 +210,7 @@ public class ArchCheckBox extends JPanel {
         this.jCheckBoxArm.setSelected(isSelected);\r
         this.jCheckBoxPpc.setSelected(isSelected);\r
     }\r
-    \r
+\r
     public void setSelectedItems(Vector<String> v) {\r
         setAllItemsSelected(false);\r
         if (v != null) {\r
@@ -242,4 +242,77 @@ public class ArchCheckBox extends JPanel {
             }\r
         }\r
     }\r
+\r
+    public void setAllItemsEnabled(boolean isEnabled) {\r
+        this.jCheckBoxIa32.setEnabled(isEnabled);\r
+        this.jCheckBoxX64.setEnabled(isEnabled);\r
+        this.jCheckBoxIpf.setEnabled(isEnabled);\r
+        this.jCheckBoxEbc.setEnabled(isEnabled);\r
+        this.jCheckBoxArm.setEnabled(isEnabled);\r
+        this.jCheckBoxPpc.setEnabled(isEnabled);\r
+    }\r
+\r
+    public void setEnabledItems(Vector<String> v) {\r
+        setAllItemsEnabled(false);\r
+        if (v != null) {\r
+            for (int index = 0; index < v.size(); index++) {\r
+                if (v.get(index).equals(this.jCheckBoxIa32.getText())) {\r
+                    this.jCheckBoxIa32.setEnabled(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxIpf.getText())) {\r
+                    this.jCheckBoxIpf.setEnabled(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxX64.getText())) {\r
+                    this.jCheckBoxX64.setEnabled(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxEbc.getText())) {\r
+                    this.jCheckBoxEbc.setEnabled(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxArm.getText())) {\r
+                    this.jCheckBoxArm.setEnabled(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxPpc.getText())) {\r
+                    this.jCheckBoxPpc.setEnabled(true);\r
+                    continue;\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    public void setDisabledItems(Vector<String> v) {\r
+        setAllItemsEnabled(true);\r
+        if (v != null) {\r
+            for (int index = 0; index < v.size(); index++) {\r
+                if (v.get(index).equals(this.jCheckBoxIa32.getText())) {\r
+                    this.jCheckBoxIa32.setEnabled(false);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxIpf.getText())) {\r
+                    this.jCheckBoxIpf.setEnabled(false);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxX64.getText())) {\r
+                    this.jCheckBoxX64.setEnabled(false);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxEbc.getText())) {\r
+                    this.jCheckBoxEbc.setEnabled(false);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxArm.getText())) {\r
+                    this.jCheckBoxArm.setEnabled(false);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxPpc.getText())) {\r
+                    this.jCheckBoxPpc.setEnabled(false);\r
+                    continue;\r
+                }\r
+            }\r
+        }\r
+    }\r
 }\r
index ded198d..1082cc3 100644 (file)
@@ -198,6 +198,8 @@ public class Preferences extends IFrame {
 \r
     private Vector<String> vArchList = null;\r
 \r
+    private Vector<String> vDisableArchList = null;\r
+\r
     //\r
     // Not used by UI\r
     //\r
@@ -246,7 +248,8 @@ public class Preferences extends IFrame {
             jComboBoxActivePlatform.setBounds(new java.awt.Rectangle(valueColumn, activePlatformRow, valueWidth,\r
                                                                      oneRowHeight));\r
             jComboBoxActivePlatform.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));\r
-            jComboBoxActivePlatform.setToolTipText("<html>Select &quot;Do Not Set&quot; if you want to build a platform"\r
+            jComboBoxActivePlatform\r
+                                   .setToolTipText("<html>Select &quot;Do Not Set&quot; if you want to build a platform"\r
                                                    + "<br>from the directory where the FPD file exists,"\r
                                                    + "<br>otherwise scroll down to select the platform.</html>");\r
 \r
@@ -299,7 +302,7 @@ public class Preferences extends IFrame {
     private ICheckBoxList getICheckBoxListTagName() {\r
         if (iCheckBoxListTagName == null) {\r
             iCheckBoxListTagName = new ICheckBoxList();\r
-            \r
+\r
             if (toolsDefTagNames != null) {\r
                 toolsDefTagNames.trim();\r
                 String aTagNames[] = toolsDefTagNames.trim().split(" ");\r
@@ -312,7 +315,7 @@ public class Preferences extends IFrame {
                 Vector<String> defaultTags = stringToVector("MYTOOLS");\r
                 iCheckBoxListTagName.setAllItems(defaultTags);\r
             }\r
-            \r
+\r
             iCheckBoxListTagName.setAllItemsUnchecked();\r
             iCheckBoxListTagName.setToolTipText("<html>"\r
                                                 + "Specify the TagName(s) from the tool configuration file to use"\r
@@ -358,7 +361,7 @@ public class Preferences extends IFrame {
 \r
     private ICheckBoxList getICheckBoxListBuildTarget() {\r
         if (iCheckBoxListBuildTarget == null) {\r
-            \r
+\r
             String aBuildTargets[] = toolsDefTargetNames.trim().split(" ");\r
             Vector<String> vBuildTargets = new Vector<String>();\r
             for (int i = 0; i < aBuildTargets.length; i++) {\r
@@ -613,6 +616,23 @@ public class Preferences extends IFrame {
                     lineCounter++;\r
                 }\r
                 reader.close();\r
+                // Only enable Architecture selection based on tool chain installations\r
+                String turnOff = "";\r
+                if (!toolsDefArchNames.contains("EBC"))\r
+                    turnOff = "EBC ";\r
+                if (!toolsDefArchNames.contains("PPC"))\r
+                    turnOff += "PPC ";\r
+                if (!toolsDefArchNames.contains("IPF"))\r
+                    turnOff += "IPF ";\r
+                if (!toolsDefArchNames.contains("X64"))\r
+                    turnOff += "X64 ";\r
+                if (!toolsDefArchNames.contains("IA32"))\r
+                    turnOff += "X64 ";\r
+                if (!toolsDefArchNames.contains("ARM"))\r
+                    turnOff += "ARM ";\r
+                turnOff = turnOff.trim();\r
+                vDisableArchList = stringToVector(turnOff);\r
+\r
                 if (!toolsDefTargetNames.matches("[A-Z]+")) {\r
                     toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim();\r
                     if (Debug)\r
@@ -751,6 +771,7 @@ public class Preferences extends IFrame {
 \r
             jContentPane.add(jLabelTargetArch, null);\r
 \r
+            jArchCheckBox.setDisabledItems(vDisableArchList);\r
             jArchCheckBox.setSelectedItems(vArchList);\r
             jContentPane.add(jArchCheckBox, null);\r
 \r