Lines 25-30
Link Here
|
25 |
import org.eclipse.swt.widgets.Widget; |
25 |
import org.eclipse.swt.widgets.Widget; |
26 |
|
26 |
|
27 |
import org.eclipse.jface.dialogs.IDialogConstants; |
27 |
import org.eclipse.jface.dialogs.IDialogConstants; |
|
|
28 |
import org.eclipse.jface.resource.JFaceResources; |
28 |
import org.eclipse.jface.util.Assert; |
29 |
import org.eclipse.jface.util.Assert; |
29 |
|
30 |
|
30 |
/** |
31 |
/** |
Lines 74-79
Link Here
|
74 |
* Returns a width hint for a button control. |
75 |
* Returns a width hint for a button control. |
75 |
*/ |
76 |
*/ |
76 |
public static int getButtonWidthHint(Button button) { |
77 |
public static int getButtonWidthHint(Button button) { |
|
|
78 |
if (button.getFont().equals(JFaceResources.getDefaultFont())) |
79 |
button.setFont(JFaceResources.getDialogFont()); |
77 |
PixelConverter converter= new PixelConverter(button); |
80 |
PixelConverter converter= new PixelConverter(button); |
78 |
int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); |
81 |
int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); |
79 |
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); |
82 |
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); |
Lines 83-88
Link Here
|
83 |
* Returns a height hint for a button control. |
86 |
* Returns a height hint for a button control. |
84 |
*/ |
87 |
*/ |
85 |
public static int getButtonHeigthHint(Button button) { |
88 |
public static int getButtonHeigthHint(Button button) { |
|
|
89 |
if (button.getFont().equals(JFaceResources.getDefaultFont())) |
90 |
button.setFont(JFaceResources.getDialogFont()); |
86 |
PixelConverter converter= new PixelConverter(button); |
91 |
PixelConverter converter= new PixelConverter(button); |
87 |
return converter.convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); |
92 |
return converter.convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); |
88 |
} |
93 |
} |