| package org.eclipse.epp.installer.internal.ui.pages; |
| |
| import org.eclipse.epp.installer.ui.IWizardStep; |
| import org.eclipse.epp.installer.ui.InstallPage; |
| import org.eclipse.jface.resource.ImageDescriptor; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.layout.FillLayout; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Label; |
| |
| |
| /** |
| * A simple page containing a single text control used for displaying a basic message to |
| * the user. |
| */ |
| public class BasicTextPage extends InstallPage |
| { |
| private Label label; |
| |
| public BasicTextPage(IWizardStep step, String pageName) { |
| super(step, pageName); |
| } |
| |
| public BasicTextPage(IWizardStep step, String pageName, String title, ImageDescriptor titleImage) { |
| super(step, pageName, title, titleImage); |
| } |
| |
| /** |
| * Create contents of the wizard |
| * |
| * @param parent |
| */ |
| public void createControl(Composite parent) { |
| Composite container = new Composite(parent, SWT.NULL); |
| final FillLayout fillLayout = new FillLayout(); |
| fillLayout.marginHeight = 10; |
| fillLayout.marginWidth = 15; |
| container.setLayout(fillLayout); |
| |
| label = new Label(container, SWT.WRAP); |
| |
| setControl(container); |
| } |
| |
| /** |
| * Set the text to be displayed. |
| * |
| * Must be called after the wizard page content has been created. |
| * |
| * @param String message |
| */ |
| public void setText(String message) { |
| if(message == null) |
| message = "BasicTextPage: setText(null), please check installer code"; |
| label.setText(message); |
| } |
| |
| public void setVisible(boolean visible) { |
| super.setVisible(visible); |
| if (visible) |
| setDefaultFocus(); |
| } |
| |
| /** |
| * Focus on default element |
| */ |
| public void setDefaultFocus() { |
| label.setFocus(); |
| } |
| } |