/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * 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-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; /** * An abstract section for the dynamic tests view. * * @author Anthony Hunter */ public abstract class DynamicTestsAbstractLabelSection extends AbstractPropertySection { @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite = getWidgetFactory() .createFlatFormComposite(parent); Group group = getWidgetFactory().createGroup(composite, getGroup()); FormLayout layout = new FormLayout(); layout.marginWidth = ITabbedPropertyConstants.HSPACE + 2; layout.marginHeight = ITabbedPropertyConstants.VSPACE; layout.spacing = ITabbedPropertyConstants.VMARGIN + 1; group.setLayout(layout); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 0); data.bottom = new FormAttachment(100, 0); group.setLayoutData(data); CLabel nameLabel = getWidgetFactory().createCLabel(group, getLabel()); data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 0); nameLabel.setLayoutData(data); } public abstract String getGroup(); public abstract String getLabel(); @Override public boolean shouldUseExtraSpace() { return true; } }