/** * Returns the change button for this field editor. * * @param parent The control to create the button in if required. * @return the change button */ protected Button getChangeControl(Composite parent) { if (colorSelector == null) { colorSelector = new ColorSelector(parent); colorSelector.addListener( new IPropertyChangeListener() { // forward the property change of the color selector public void propertyChange(PropertyChangeEvent event) { ColorFieldEditor.this.fireValueChanged( event.getProperty(), event.getOldValue(), event.getNewValue()); setPresentsDefaultValue(false); } }); } else { checkParent(colorSelector.getButton(), parent); } return colorSelector.getButton(); }
/* * (non-Javadoc) Method declared on FieldEditor. */ @Override protected void adjustForNumColumns(int numColumns) { ((GridData) colorSelector.getButton().getLayoutData()).horizontalSpan = numColumns - 1; }