1
/*******************************************************************************
2
* Copyright (c) 2001, 2008 IBM Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Rational Software - initial implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.internal.ui.wizards.dialogfields;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Control;
17
import org.eclipse.swt.widgets.Label;
19
import org.eclipse.swt.layout.GridData;
22
* Dialog field describing a separator.
24
public class Separator extends DialogField {
26
private Label fSeparator;
34
* @param style of the separator. See <code>Label</code> for possible
37
public Separator(int style) {
42
// ------- layout helpers
45
* Creates the separator and fills it in a MGridLayout.
46
* @param height The heigth of the separator
48
public Control[] doFillIntoGrid(Composite parent, int nColumns, int height) {
49
assertEnoughColumns(nColumns);
51
Control separator= getSeparator(parent);
52
separator.setLayoutData(gridDataForSeperator(nColumns, height));
54
return new Control[] { separator };
58
* @see DialogField#doFillIntoGrid
61
public Control[] doFillIntoGrid(Composite parent, int nColumns) {
62
return doFillIntoGrid(parent, nColumns, 4);
66
* @see DialogField#getNumberOfControls
69
public int getNumberOfControls() {
73
protected static GridData gridDataForSeperator(int span, int height) {
74
GridData gd= new GridData();
75
gd.horizontalAlignment= GridData.FILL;
76
gd.verticalAlignment= GridData.BEGINNING;
77
gd.heightHint= height;
78
gd.horizontalSpan= span;
82
// ------- ui creation
85
* Creates or returns the created separator.
86
* @param parent The parent composite or <code>null</code> if the widget has
87
* already been created.
89
public Control getSeparator(Composite parent) {
90
if (fSeparator == null) {
91
assertCompositeNotNull(parent);
92
fSeparator= new Label(parent, fStyle);