| /******************************************************************************* |
| * Copyright (c) 2006 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.examples.views.properties.tabbed.logic.properties; |
| |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.custom.CLabel; |
| import org.eclipse.swt.layout.FormAttachment; |
| import org.eclipse.swt.layout.FormData; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Text; |
| import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; |
| import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; |
| |
| /** |
| * The name section on the element tab. |
| * |
| * @author Anthony Hunter |
| */ |
| public class NameSection |
| extends AbstractSection { |
| |
| Text nameText; |
| |
| /** |
| * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, |
| * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) |
| */ |
| public void createControls(Composite parent, |
| TabbedPropertySheetPage tabbedPropertySheetPage) { |
| super.createControls(parent, tabbedPropertySheetPage); |
| Composite composite = getWidgetFactory() |
| .createFlatFormComposite(parent); |
| FormData data; |
| |
| nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ |
| nameText.setEditable(false); |
| data = new FormData(); |
| data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH); |
| data.right = new FormAttachment(100, 0); |
| data.top = new FormAttachment(0, 0); |
| nameText.setLayoutData(data); |
| |
| CLabel nameLabel = getWidgetFactory().createCLabel(composite, "Name:"); //$NON-NLS-1$ |
| data = new FormData(); |
| data.left = new FormAttachment(0, 0); |
| data.right = new FormAttachment(nameText, |
| -ITabbedPropertyConstants.HSPACE); |
| data.top = new FormAttachment(nameText, 0, SWT.CENTER); |
| nameLabel.setLayoutData(data); |
| } |
| |
| /* |
| * @see org.eclipse.ui.views.properties.tabbed.view.ITabbedPropertySection#refresh() |
| */ |
| public void refresh() { |
| nameText.setText((getElement()).toString()); |
| } |
| } |