if (canSaveAutomatically
&& RefactoringSavePreferences.getSaveAllEditors()) {
// everything
return true;
}
ListDialog dialog = new ListDialog(shell) {
{
setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite result = (Composite) super.createDialogArea(parent);
if (canSaveAutomatically) {
final Button check = new Button(result, SWT.CHECK);
check
.setText(RefactoringMessages.RefactoringStarter_always_save);
check.setSelection(RefactoringSavePreferences
.getSaveAllEditors());
check.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
RefactoringSavePreferences.setSaveAllEditors(check
.getSelection());
}
});
applyDialogFont(result);
}
return result;
}
};
dialog
.setTitle(RefactoringMessages.RefactoringStarter_save_all_resources);
dialog.setAddCancelButton(true);
dialog.setLabelProvider(createDialogLabelProvider());
dialog.setMessage(RefactoringMessages.RefactoringStarter_must_save);
dialog.setContentProvider(new ArrayContentProvider());
dialog.setInput(Arrays.asList(dirtyEditors));
return dialog.open() == Window.OK;
}