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
This commit is contained in:
lhauch 2006-08-22 20:41:52 +00:00
parent cdffd38d37
commit 8a11d13aa3
2 changed files with 103 additions and 9 deletions

View File

@ -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<String> getSelectedItemsVector() {
Vector<String> v = new Vector<String>();
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<String> 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<String> 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<String> 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;
}
}
}
}
}

View File

@ -198,6 +198,8 @@ public class Preferences extends IFrame {
private Vector<String> vArchList = null;
private Vector<String> 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("<html>Select &quot;Do Not Set&quot; if you want to build a platform"
jComboBoxActivePlatform
.setToolTipText("<html>Select &quot;Do Not Set&quot; if you want to build a platform"
+ "<br>from the directory where the FPD file exists,"
+ "<br>otherwise scroll down to select the platform.</html>");
@ -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<String> defaultTags = stringToVector("MYTOOLS");
iCheckBoxListTagName.setAllItems(defaultTags);
}
iCheckBoxListTagName.setAllItemsUnchecked();
iCheckBoxListTagName.setToolTipText("<html>"
+ "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<String> vBuildTargets = new Vector<String>();
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);