if (e.button == 1) {
ColorDialog cd = new ColorDialog(panel.getShell());
cd.setRGB(blockColors[index].getRGB());
RGB rgb = cd.open();
if (rgb != null)
config.setRGBParameter(keys[index], rgb.red, rgb.green, rgb.blue);
} else {
config.removeRGBParameter(keys[index]);
}
}
});
Label lblDesc = new Label(colorSet, SWT.NULL);
Messages.setLanguageText(lblDesc, keys[i]);
data = new RowData();
data.width = 20;
data.height = lblDesc.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 3;
cColor.setLayoutData(data);
// If color changes, update our legend
config.addParameterListener(keys[i],paramListeners[i] = new ParameterListener() {
public void parameterChanged(String parameterName) {
for (int j = 0; j < keys.length; j++) {
if (keys[j].equals(parameterName)) {
final int index = j;
final int r = config.getIntParameter(keys[j] + ".red", -1);
if (r >= 0) {
final int g = config.getIntParameter(keys[j] + ".green");
final int b = config.getIntParameter(keys[j] + ".blue");
final RGB rgb = new RGB(r, g, b);
if (blockColors[j].isDisposed()
|| !rgb.equals(blockColors[j].getRGB())) {
Utils.execSWTThread(new AERunnable() {
public void runSupport() {
if (panel == null || panel.isDisposed())
return;