private void addUpdateQualifiedNameComponent(Composite parent, int marginWidth) { final JavaMoveProcessor processor = getJavaMoveProcessor(); if (!processor.canEnableQualifiedNameUpdating() || !processor.canUpdateQualifiedNames()) return; fQualifiedNameCheckbox = new Button(parent, SWT.CHECK); int indent = marginWidth + fQualifiedNameCheckbox.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; fQualifiedNameCheckbox.setText( RefactoringMessages.RenameInputWizardPage_update_qualified_names); fQualifiedNameCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fQualifiedNameCheckbox.setSelection(processor.getUpdateQualifiedNames()); fQualifiedNameComponent = new QualifiedNameComponent(parent, SWT.NONE, processor, getRefactoringSettings()); fQualifiedNameComponent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData gd = (GridData) fQualifiedNameComponent.getLayoutData(); gd.horizontalAlignment = GridData.FILL; gd.horizontalIndent = indent; updateQualifiedNameUpdating(processor, processor.getUpdateQualifiedNames()); fQualifiedNameCheckbox.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enabled = ((Button) e.widget).getSelection(); updateQualifiedNameUpdating(processor, enabled); } }); fQualifiedNameCheckbox.setSelection( getRefactoringSettings().getBoolean(UPDATE_QUALIFIED_NAMES)); updateQualifiedNameUpdating(processor, fQualifiedNameCheckbox.getSelection()); }
private void updateUIStatus() { getRefactoringWizard().setForcePreviewReview(false); JavaMoveProcessor processor = getJavaMoveProcessor(); if (fReferenceCheckbox != null) { processor.setUpdateReferences(fReferenceCheckbox.getSelection()); } if (fQualifiedNameCheckbox != null) { boolean enabled = processor.canEnableQualifiedNameUpdating(); fQualifiedNameCheckbox.setEnabled(enabled); if (enabled) { fQualifiedNameComponent.setEnabled(processor.getUpdateQualifiedNames()); if (processor.getUpdateQualifiedNames()) getRefactoringWizard().setForcePreviewReview(true); } else { fQualifiedNameComponent.setEnabled(false); } processor.setUpdateQualifiedNames( fQualifiedNameCheckbox.getEnabled() && fQualifiedNameCheckbox.getSelection()); } }
/* * @see org.eclipse.jface.dialogs.DialogPage#dispose() */ @Override public void dispose() { super.dispose(); IDialogSettings settings = getRefactoringSettings(); if (settings == null) return; if (fQualifiedNameCheckbox != null) settings.put(ReorgMoveWizard.UPDATE_QUALIFIED_NAMES, fQualifiedNameCheckbox.getSelection()); if (fQualifiedNameComponent != null) fQualifiedNameComponent.savePatterns(settings); }
private void updateQualifiedNameUpdating(final JavaMoveProcessor processor, boolean enabled) { fQualifiedNameComponent.setEnabled(enabled); processor.setUpdateQualifiedNames(enabled); updateUIStatus(); }