1 package net.sourceforge.phpdt.tidy.preferences;
3 import org.eclipse.jface.preference.FieldEditor;
4 import org.eclipse.swt.layout.GridData;
5 import org.eclipse.swt.widgets.Composite;
6 import org.eclipse.swt.widgets.Label;
9 * A field editor for displaying labels not associated with other widgets.
11 class LabelFieldEditor extends FieldEditor {
15 // All labels can use the same preference name since they don't
16 // store any preference.
17 public LabelFieldEditor(String value, Composite parent) {
18 super("label", value, parent);
21 // Adjusts the field editor to be displayed correctly
22 // for the given number of columns.
23 protected void adjustForNumColumns(int numColumns) {
24 ((GridData) label.getLayoutData()).horizontalSpan = numColumns;
27 // Fills the field editor's controls into the given parent.
28 protected void doFillIntoGrid(Composite parent, int numColumns) {
29 label = getLabelControl(parent);
31 GridData gridData = new GridData();
32 gridData.horizontalSpan = numColumns;
33 gridData.horizontalAlignment = GridData.FILL;
34 gridData.grabExcessHorizontalSpace = false;
35 gridData.verticalAlignment = GridData.CENTER;
36 gridData.grabExcessVerticalSpace = false;
38 label.setLayoutData(gridData);
41 // Returns the number of controls in the field editor.
42 public int getNumberOfControls() {
46 // Labels do not persist any preferences, so these methods are empty.
47 protected void doLoad() {
49 protected void doLoadDefault() {
51 protected void doStore() {