|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2013 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2014 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 79-84
Link Here
|
| 79 |
* @see #noDefaultAndApplyButton |
79 |
* @see #noDefaultAndApplyButton |
| 80 |
*/ |
80 |
*/ |
| 81 |
private boolean createDefaultAndApplyButton = true; |
81 |
private boolean createDefaultAndApplyButton = true; |
|
|
82 |
|
| 83 |
/** |
| 84 |
* Whether this page has the standard Apply button; <code>false</code> by |
| 85 |
* default. |
| 86 |
* |
| 87 |
* @see #noApplyButton |
| 88 |
*/ |
| 89 |
private boolean createApplyButton = false; |
| 82 |
|
90 |
|
| 83 |
/** |
91 |
/** |
| 84 |
* Standard Defaults button, or <code>null</code> if none. |
92 |
* Standard Defaults button, or <code>null</code> if none. |
|
Lines 286-292
Link Here
|
| 286 |
}); |
294 |
}); |
| 287 |
applyButton.setEnabled(isValid()); |
295 |
applyButton.setEnabled(isValid()); |
| 288 |
applyDialogFont(buttonBar); |
296 |
applyDialogFont(buttonBar); |
| 289 |
} else { |
297 |
} else if (createApplyButton) { |
|
|
298 |
layout.numColumns = layout.numColumns + 1; |
| 299 |
String label = JFaceResources.getString("apply"); //$NON-NLS-1$ |
| 300 |
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); |
| 301 |
applyButton = new Button(buttonBar, SWT.PUSH); |
| 302 |
applyButton.setText(label); |
| 303 |
Dialog.applyDialogFont(applyButton); |
| 304 |
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); |
| 305 |
Point minButtonSize = applyButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); |
| 306 |
data.widthHint = Math.max(widthHint, minButtonSize.x); |
| 307 |
applyButton.setLayoutData(data); |
| 308 |
applyButton.addSelectionListener(new SelectionAdapter() { |
| 309 |
@Override |
| 310 |
public void widgetSelected(SelectionEvent e) { |
| 311 |
performApply(); |
| 312 |
} |
| 313 |
}); |
| 314 |
applyButton.setEnabled(isValid()); |
| 315 |
applyDialogFont(buttonBar); |
| 316 |
|
| 317 |
} else { |
| 290 |
/* Check if there are any other buttons on the button bar. |
318 |
/* Check if there are any other buttons on the button bar. |
| 291 |
* If not, throw away the button bar composite. Otherwise |
319 |
* If not, throw away the button bar composite. Otherwise |
| 292 |
* there is an unusually large button bar. |
320 |
* there is an unusually large button bar. |
|
Lines 412-422
Link Here
|
| 412 |
} |
440 |
} |
| 413 |
|
441 |
|
| 414 |
/** |
442 |
/** |
| 415 |
* The <code>PreferencePage</code> implementation of this |
443 |
* Enable creation of the standard Apply button for this page. |
| 416 |
* <code>IPreferencePage</code> method returns <code>true</code> |
444 |
* <p> |
| 417 |
* if the page is valid. |
445 |
* Subclasses wishing a preference page with this button should call |
| 418 |
* @see IPreferencePage#okToLeave() |
446 |
* this framework method before the page's control has been created. |
| 419 |
*/ |
447 |
* </p> |
|
|
448 |
* |
| 449 |
* @since 3.11 |
| 450 |
*/ |
| 451 |
protected void createApplyButton() { |
| 452 |
createApplyButton = true; |
| 453 |
createDefaultAndApplyButton = false; |
| 454 |
} |
| 455 |
|
| 456 |
/** |
| 457 |
* The <code>PreferencePage</code> implementation of this |
| 458 |
* <code>IPreferencePage</code> method returns <code>true</code> if the page |
| 459 |
* is valid. |
| 460 |
* |
| 461 |
* @see IPreferencePage#okToLeave() |
| 462 |
*/ |
| 420 |
@Override |
463 |
@Override |
| 421 |
public boolean okToLeave() { |
464 |
public boolean okToLeave() { |
| 422 |
return isValid(); |
465 |
return isValid(); |