protected void updateLeaveDelegateCheckbox(int delegateCount) { if (fLeaveDelegateCheckBox == null) { return; } final IDelegateUpdating refactoring = (IDelegateUpdating) getRefactoring().getAdapter(IDelegateUpdating.class); fLeaveDelegateCheckBox.setEnabled(delegateCount > 0); fLeaveDelegateCheckBox.setText(refactoring.getDelegateUpdatingTitle(delegateCount > 1)); if (delegateCount == 0) { fLeaveDelegateCheckBox.setSelection(false); refactoring.setDelegateUpdating(false); } }
private void addOptionalLeaveDelegateCheckbox(Composite result, RowLayouter layouter) { final IDelegateUpdating refactoring = (IDelegateUpdating) getRefactoring().getAdapter(IDelegateUpdating.class); if (refactoring == null || !refactoring.canEnableDelegateUpdating()) { return; } fLeaveDelegateCheckBox = createCheckbox( result, refactoring.getDelegateUpdatingTitle(false), DelegateUIHelper.loadLeaveDelegateSetting(refactoring), layouter); refactoring.setDelegateUpdating(fLeaveDelegateCheckBox.getSelection()); fLeaveDelegateCheckBox.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { refactoring.setDelegateUpdating(fLeaveDelegateCheckBox.getSelection()); } }); }