2 * $Id: NewElementWizardPage.java,v 1.2 2005-05-06 00:57:33 stefanbjarni Exp $
3 * Copyright Narushima Hironori. All rights reserved.
5 package net.sourceforge.phpeclipse.wizards.html;
7 import org.eclipse.jface.wizard.IWizardPage;
8 import org.eclipse.swt.SWT;
9 import org.eclipse.swt.events.ModifyEvent;
10 import org.eclipse.swt.events.ModifyListener;
11 import org.eclipse.swt.layout.GridData;
12 import org.eclipse.swt.layout.GridLayout;
13 import org.eclipse.swt.widgets.Composite;
14 import org.eclipse.swt.widgets.Label;
15 import org.eclipse.swt.widgets.Text;
21 public class NewElementWizardPage extends EditElementWizardPage {
24 EditElementWizardPage nextPage = null;
26 public NewElementWizardPage() {
27 super("NewElementPage");
28 setTitle("Create HTML Element");
29 setDescription("Specify new HTML tag (dl,ul,ol or table) and configure that tag.");
32 protected void createChildControl(Composite base) {
33 // create foundation component
34 base.setLayout(new GridLayout(1, false));
36 // element input components
37 new Label(base, SWT.NONE).setText("&Element Name:");
39 elementName = new Text(base, SWT.BORDER | SWT.SINGLE);
40 elementName.setLayoutData( new GridData(GridData.FILL_HORIZONTAL));
41 elementName.addModifyListener( new ModifyListener() {
42 public void modifyText(ModifyEvent e) {
43 String eName = elementName.getText();
44 if( eName.indexOf(' ') != -1 ){
45 setErrorMessage("Don't contain blink in speicfied element name.");
46 } else if (eName.length() == 0){
47 setErrorMessage("Need to specify element name.");
49 setErrorMessage(null);
50 nextPage = ((EditElementWizard)getWizard()).createElementEditPage(eName);
51 nextPage.setElementName(eName);
52 if( nextPage instanceof UnknownElementWizardPage){
53 setMessage("This editor does not known element name.", WARNING);
55 setMessage(null, NONE);
59 getWizard().getContainer().updateButtons();
64 public String getPreviewText(){
65 if(nextPage instanceof EditElementWizardPage){
66 return ((EditElementWizardPage)nextPage).getPreviewText();
71 public void setErrorMessage(String newMessage) {
72 super.setErrorMessage(newMessage);
73 if( newMessage != null){
78 public IWizardPage getNextPage() {