/**********************************************************************
* Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. � This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ �*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+
/**
* SWT Utility class.
*/
* Returns a width hint for a button control.
*/
protected static int getButtonWidthHint(Button button) {
- int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
- return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
+ IDialogConstants.BUTTON_WIDTH);
+ return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT,
+ true).x);
}
-
+
public static Button createButton(Composite comp, String label) {
Button b = new Button(comp, SWT.PUSH);
b.setText(label);
if (fontMetrics == null)
initializeDialogUnits(comp);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.widthHint = getButtonWidthHint(b);
- data.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_HEIGHT);
+ data.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics,
+ IDialogConstants.BUTTON_HEIGHT);
b.setLayoutData(data);
return b;
}
-
- public static Button createCheckbox(Composite comp, String txt, boolean isSelected){
+
+ public static Button createCheckbox(Composite comp, String txt,
+ boolean isSelected) {
Button button = new Button(comp, SWT.CHECK);
button.setText(txt);
GridLayout layout = new GridLayout();
comp.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.horizontalIndent = 10;
button.setLayoutData(data);
button.setSelection(isSelected);
return button;
}
-
+
public static Label createLabel(Composite comp, String txt) {
Label label = new Label(comp, SWT.NONE);
label.setText(txt);
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+ | GridData.VERTICAL_ALIGN_BEGINNING));
return label;
}
}