Bug 176873 [Preferences] ColorFieldEditor should not set button size to IDialogConstants.BUTTON_WIDTH
The ColorFieldEditor shouldn't adjust the size of the button that is created by ColorSelector. ColorFieldEditor#doFillIntoGrid(...) creates a ColorSelector and then increases the size of the button using IDialogConstants.BUTTON_WIDTH. This creates buttons that are oversized and unattractive. Worse, this means that Eclipse preference pages don't present a color selector with a consistent size. Pages which use the JFace API to create a ColorSelector directly get a button that's one size, while pages which use the ColorFieldEditor get something else. The current workaround allows us to use ColorFieldEditor without the undesirable missizing: new ColorFieldEditor(preference, label, parent) { protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillInfoGrid(parent, numColumns); getChangeControl(parent).setLayoutData(new GridData()); } }
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorFieldEditor.java
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.preference;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/**
 * A field editor for a color type preference.
 */
public class ColorFieldEditor extends FieldEditor {