addBindingButton.addSelectionListener(new SelectionAdapter() {
public final void widgetSelected(final SelectionEvent event) {
selectAddBindingButton(event);
}
});
new ControlUpdater(addBindingButton) {
protected void updateControl() {
Object selectedObject = selection.getValue();
addBindingButton
.setEnabled(selectedObject instanceof KeyBinding);
}
};
// Create the delete binding button.
final Button removeBindingButton = new Button(treeControls, SWT.PUSH);
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
removeBindingButton
.setText(NewKeysPreferenceMessages.RemoveBindingButton_Text);
gridData.widthHint = Math.max(widthHint, removeBindingButton
.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
removeBindingButton.setLayoutData(gridData);
removeBindingButton.addSelectionListener(new SelectionAdapter() {
public final void widgetSelected(final SelectionEvent event) {
selectRemoveBindingButton(event);
}
});
new ControlUpdater(removeBindingButton) {
protected void updateControl() {
Object selectedObject = selection.getValue();
removeBindingButton
.setEnabled(selectedObject instanceof KeyBinding);
}