|
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 78-84
Link Here
|
| 78 |
* |
78 |
* |
| 79 |
* @see #noDefaultAndApplyButton |
79 |
* @see #noDefaultAndApplyButton |
| 80 |
*/ |
80 |
*/ |
| 81 |
private boolean createDefaultAndApplyButton = true; |
81 |
private boolean createApplyButton = true; |
|
|
82 |
|
| 83 |
/** |
| 84 |
* Whether this page has the standard Default button; <code>true</code> by |
| 85 |
* default. |
| 86 |
* |
| 87 |
* @see #noDefaultButton |
| 88 |
*/ |
| 89 |
private boolean createDefaultButton = true; |
| 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 250-256
Link Here
|
| 250 |
|
258 |
|
| 251 |
contributeButtons(buttonBar); |
259 |
contributeButtons(buttonBar); |
| 252 |
|
260 |
|
| 253 |
if (createDefaultAndApplyButton) { |
261 |
if (createApplyButton && createDefaultButton) { |
| 254 |
layout.numColumns = layout.numColumns + 2; |
262 |
layout.numColumns = layout.numColumns + 2; |
| 255 |
String[] labels = JFaceResources.getStrings(new String[] { |
263 |
String[] labels = JFaceResources.getStrings(new String[] { |
| 256 |
"defaults", "apply" }); //$NON-NLS-2$//$NON-NLS-1$ |
264 |
"defaults", "apply" }); //$NON-NLS-2$//$NON-NLS-1$ |
|
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 408-422
Link Here
|
| 408 |
* </p> |
436 |
* </p> |
| 409 |
*/ |
437 |
*/ |
| 410 |
protected void noDefaultAndApplyButton() { |
438 |
protected void noDefaultAndApplyButton() { |
| 411 |
createDefaultAndApplyButton = false; |
439 |
createApplyButton = false; |
|
|
440 |
createDefaultButton = false; |
| 412 |
} |
441 |
} |
| 413 |
|
442 |
|
| 414 |
/** |
443 |
/** |
| 415 |
* The <code>PreferencePage</code> implementation of this |
444 |
* Suppress creation of the standard Default button for this page. |
| 416 |
* <code>IPreferencePage</code> method returns <code>true</code> |
445 |
* <p> |
| 417 |
* if the page is valid. |
446 |
* Subclasses wishing a preference page with this button should call this |
| 418 |
* @see IPreferencePage#okToLeave() |
447 |
* framework method before the page's control has been created. |
| 419 |
*/ |
448 |
* </p> |
|
|
449 |
* |
| 450 |
* @since 3.11 |
| 451 |
*/ |
| 452 |
protected void noDefaultButton() { |
| 453 |
createDefaultButton = 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(); |