Label label;
GridLayout layout;
GridData gridData;
Composite cSection = new Composite(parent, SWT.NULL);
cSection.setLayoutData(new GridData(GridData.FILL_BOTH));
layout = new GridLayout();
layout.numColumns = 1;
cSection.setLayout(layout);
Composite cArea = new Composite(cSection, SWT.NULL);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
cArea.setLayout(layout);
cArea.setLayoutData(new GridData());
label = new Label(cArea, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.color");
ColorParameter colorScheme = new ColorParameter(cArea, "Color Scheme", 0,
128, 255);
gridData = new GridData();
gridData.widthHint = 50;
colorScheme.setLayoutData(gridData);
Group cColorOverride = new Group(cArea, SWT.NULL);
Messages.setLanguageText(cColorOverride,
"ConfigView.section.style.colorOverrides");
layout = new GridLayout();
layout.numColumns = 3;
cColorOverride.setLayout(layout);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 2;
cColorOverride.setLayoutData(gridData);
for (int i = 0; i < sColorsToOverride.length; i++) {
String sConfigID = "Colors." + sColorsToOverride[i];
label = new Label(cColorOverride, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.style.colorOverride."
+ sColorsToOverride[i]);
ColorParameter colorParm = new ColorParameter(cColorOverride, sConfigID,
colorsToOverride[i].getRed(), colorsToOverride[i].getGreen(),
colorsToOverride[i].getBlue()) {
public void newColorChosen() {
COConfigurationManager.setParameter(sParamName + ".override", true);
for (int i = 0; i < sColorsToOverride.length; i++) {
if (sParamName.equals("Colors." + sColorsToOverride[i])) {
btnColorReset[i].setEnabled(true);
break;
}
}
}
};
gridData = new GridData();
gridData.widthHint = 50;
colorParm.setLayoutData(gridData);
btnColorReset[i] = new Button(cColorOverride, SWT.PUSH);
Messages.setLanguageText(btnColorReset[i],
"ConfigView.section.style.colorOverrides.reset");
btnColorReset[i].setEnabled(COConfigurationManager.getBooleanParameter(
sConfigID + ".override", false));
btnColorReset[i].setData("ColorName", sConfigID);
btnColorReset[i].addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
Button btn = (Button) event.widget;
String sName = (String) btn.getData("ColorName");
if (sName != null) {
COConfigurationManager.setParameter(sName + ".override", false);
btn.setEnabled(false);
}
}
});
}
return cSection;