blob: 9a82653dbc9e362b5a2f0b5a60cb142363de93b8 [file] [log] [blame]
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.custom.StyledText;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
/**
* A simple page containing a single text control used for displaying warnings to
* the user.
*/
public class WarningPage extends InstallPage
{
private StyledText label;
public WarningPage(IWizardStep step, String pageName) {
super(step, pageName);
}
public WarningPage(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 StyledText(container, SWT.V_SCROLL | SWT.BORDER | SWT.WRAP );
label.setEditable(false);
label.setWordWrap(true);
label.setLayoutData(new GridData( GridData.FILL, GridData.FILL, true, true));
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 = "WarningPage: 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();
}
}