From 8a11d13aa30c03625afd77034603e4c9de090da5 Mon Sep 17 00:00:00 2001 From: lhauch Date: Tue, 22 Aug 2006 20:41:52 +0000 Subject: [PATCH] Updated ArchCheckBox.java and Preferences.java to support enable, disable of individual checkboxes. The Preferences will now enable the Architectures which have tools defined in tools_def.txt. If no tool is defined for an architecture, the checkbox is disabled. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1354 6f19259b-4bc3-4df7-8a09-765794883524 --- .../common/ui/ArchCheckBox.java | 83 +++++++++++++++++-- .../toolchain/Preferences.java | 29 ++++++- 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java index 76c29da157..62d4a33cb2 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java @@ -40,7 +40,7 @@ public class ArchCheckBox extends JPanel { private JCheckBox jCheckBoxArm = null; private JCheckBox jCheckBoxPpc = null; - + /** * This method initializes jCheckBoxIa32 * @@ -155,7 +155,7 @@ public class ArchCheckBox extends JPanel { this.add(getJCheckBoxPpc(), null); this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); } - + public Vector getSelectedItemsVector() { Vector v = new Vector(); if (this.jCheckBoxIa32.isSelected()) { @@ -178,7 +178,7 @@ public class ArchCheckBox extends JPanel { } return v; } - + public String getSelectedItemsString() { String s = ""; if (this.jCheckBoxIa32.isSelected()) { @@ -201,7 +201,7 @@ public class ArchCheckBox extends JPanel { } return s.trim(); } - + public void setAllItemsSelected(boolean isSelected) { this.jCheckBoxIa32.setSelected(isSelected); this.jCheckBoxX64.setSelected(isSelected); @@ -210,7 +210,7 @@ public class ArchCheckBox extends JPanel { this.jCheckBoxArm.setSelected(isSelected); this.jCheckBoxPpc.setSelected(isSelected); } - + public void setSelectedItems(Vector v) { setAllItemsSelected(false); if (v != null) { @@ -242,4 +242,77 @@ public class ArchCheckBox extends JPanel { } } } + + public void setAllItemsEnabled(boolean isEnabled) { + this.jCheckBoxIa32.setEnabled(isEnabled); + this.jCheckBoxX64.setEnabled(isEnabled); + this.jCheckBoxIpf.setEnabled(isEnabled); + this.jCheckBoxEbc.setEnabled(isEnabled); + this.jCheckBoxArm.setEnabled(isEnabled); + this.jCheckBoxPpc.setEnabled(isEnabled); + } + + public void setEnabledItems(Vector v) { + setAllItemsEnabled(false); + if (v != null) { + for (int index = 0; index < v.size(); index++) { + if (v.get(index).equals(this.jCheckBoxIa32.getText())) { + this.jCheckBoxIa32.setEnabled(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxIpf.getText())) { + this.jCheckBoxIpf.setEnabled(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxX64.getText())) { + this.jCheckBoxX64.setEnabled(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxEbc.getText())) { + this.jCheckBoxEbc.setEnabled(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxArm.getText())) { + this.jCheckBoxArm.setEnabled(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxPpc.getText())) { + this.jCheckBoxPpc.setEnabled(true); + continue; + } + } + } + } + + public void setDisabledItems(Vector v) { + setAllItemsEnabled(true); + if (v != null) { + for (int index = 0; index < v.size(); index++) { + if (v.get(index).equals(this.jCheckBoxIa32.getText())) { + this.jCheckBoxIa32.setEnabled(false); + continue; + } + if (v.get(index).equals(this.jCheckBoxIpf.getText())) { + this.jCheckBoxIpf.setEnabled(false); + continue; + } + if (v.get(index).equals(this.jCheckBoxX64.getText())) { + this.jCheckBoxX64.setEnabled(false); + continue; + } + if (v.get(index).equals(this.jCheckBoxEbc.getText())) { + this.jCheckBoxEbc.setEnabled(false); + continue; + } + if (v.get(index).equals(this.jCheckBoxArm.getText())) { + this.jCheckBoxArm.setEnabled(false); + continue; + } + if (v.get(index).equals(this.jCheckBoxPpc.getText())) { + this.jCheckBoxPpc.setEnabled(false); + continue; + } + } + } + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java index ded198d166..1082cc3d7d 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java @@ -198,6 +198,8 @@ public class Preferences extends IFrame { private Vector vArchList = null; + private Vector vDisableArchList = null; + // // Not used by UI // @@ -246,7 +248,8 @@ public class Preferences extends IFrame { jComboBoxActivePlatform.setBounds(new java.awt.Rectangle(valueColumn, activePlatformRow, valueWidth, oneRowHeight)); jComboBoxActivePlatform.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight)); - jComboBoxActivePlatform.setToolTipText("Select "Do Not Set" if you want to build a platform" + jComboBoxActivePlatform + .setToolTipText("Select "Do Not Set" if you want to build a platform" + "
from the directory where the FPD file exists," + "
otherwise scroll down to select the platform."); @@ -299,7 +302,7 @@ public class Preferences extends IFrame { private ICheckBoxList getICheckBoxListTagName() { if (iCheckBoxListTagName == null) { iCheckBoxListTagName = new ICheckBoxList(); - + if (toolsDefTagNames != null) { toolsDefTagNames.trim(); String aTagNames[] = toolsDefTagNames.trim().split(" "); @@ -312,7 +315,7 @@ public class Preferences extends IFrame { Vector defaultTags = stringToVector("MYTOOLS"); iCheckBoxListTagName.setAllItems(defaultTags); } - + iCheckBoxListTagName.setAllItemsUnchecked(); iCheckBoxListTagName.setToolTipText("" + "Specify the TagName(s) from the tool configuration file to use" @@ -358,7 +361,7 @@ public class Preferences extends IFrame { private ICheckBoxList getICheckBoxListBuildTarget() { if (iCheckBoxListBuildTarget == null) { - + String aBuildTargets[] = toolsDefTargetNames.trim().split(" "); Vector vBuildTargets = new Vector(); for (int i = 0; i < aBuildTargets.length; i++) { @@ -613,6 +616,23 @@ public class Preferences extends IFrame { lineCounter++; } reader.close(); + // Only enable Architecture selection based on tool chain installations + String turnOff = ""; + if (!toolsDefArchNames.contains("EBC")) + turnOff = "EBC "; + if (!toolsDefArchNames.contains("PPC")) + turnOff += "PPC "; + if (!toolsDefArchNames.contains("IPF")) + turnOff += "IPF "; + if (!toolsDefArchNames.contains("X64")) + turnOff += "X64 "; + if (!toolsDefArchNames.contains("IA32")) + turnOff += "X64 "; + if (!toolsDefArchNames.contains("ARM")) + turnOff += "ARM "; + turnOff = turnOff.trim(); + vDisableArchList = stringToVector(turnOff); + if (!toolsDefTargetNames.matches("[A-Z]+")) { toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim(); if (Debug) @@ -751,6 +771,7 @@ public class Preferences extends IFrame { jContentPane.add(jLabelTargetArch, null); + jArchCheckBox.setDisabledItems(vDisableArchList); jArchCheckBox.setSelectedItems(vArchList); jContentPane.add(jArchCheckBox, null); -- 2.39.2