| /* |
| ----------------------------------------------------------------------- |
| -- CHESS core plugin -- |
| -- -- |
| -- Copyright (C) 2011-2012 -- |
| -- University of Padova, ITALY -- |
| -- -- |
| -- All rights reserved. This program and the accompanying materials -- |
| -- are made available under the terms of the Eclipse Public License -- |
| -- v1.0 which accompanies this distribution, and is available at -- |
| -- http://www.eclipse.org/legal/epl-v20.html -- |
| ----------------------------------------------------------------------- |
| */ |
| |
| package org.polarsys.chess.core.internal.preferences; |
| |
| import org.eclipse.jface.preference.FieldEditor; |
| import org.eclipse.swt.layout.GridData; |
| import org.eclipse.swt.widgets.Composite; |
| |
| /** |
| * The Class LabelField. |
| */ |
| public final class LabelField extends FieldEditor { |
| |
| /** |
| * Instantiates a new label field. |
| * |
| * @param labelText the label text |
| * @param parent the parent |
| */ |
| public LabelField(String labelText, Composite parent) { |
| super("label", labelText, parent); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls() |
| */ |
| @Override |
| public int getNumberOfControls() { |
| return 1; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.preference.FieldEditor#doStore() |
| */ |
| @Override |
| protected void doStore() { |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault() |
| */ |
| @Override |
| protected void doLoadDefault() { |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.preference.FieldEditor#doLoad() |
| */ |
| @Override |
| protected void doLoad() { |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int) |
| */ |
| @Override |
| protected void doFillIntoGrid(Composite parent, int numColumns) { |
| getLabelControl(parent).setLayoutData(new GridData()); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int) |
| */ |
| @Override |
| protected void adjustForNumColumns(int numColumns) { |
| GridData gd = (GridData) getLabelControl().getLayoutData(); |
| gd.horizontalSpan = numColumns; |
| |
| } |
| } |