2 * $Id: NewElementWizardPage.java,v 1.1 2004-10-05 20:51:57 jsurfer 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.*;
10 import org.eclipse.swt.layout.*;
11 import org.eclipse.swt.widgets.*;
17 public class NewElementWizardPage extends EditElementWizardPage {
20 EditElementWizardPage nextPage = null;
22 public NewElementWizardPage() {
23 super("NewElementPage");
24 setTitle("Create HTML Element");
25 setDescription("Specify new HTML tag (dl,ul,ol or table) and configure that tag.");
28 protected void createChildControl(Composite base) {
29 // create foundation component
30 base.setLayout(new GridLayout(1, false));
32 // element input components
33 new Label(base, SWT.NONE).setText("&Element Name:");
35 elementName = new Text(base, SWT.BORDER | SWT.SINGLE);
36 elementName.setLayoutData( new GridData(GridData.FILL_HORIZONTAL));
37 elementName.addModifyListener( new ModifyListener() {
38 public void modifyText(ModifyEvent e) {
39 String eName = elementName.getText();
40 if( eName.indexOf(' ') != -1 ){
41 setErrorMessage("Don't contain blink in speicfied element name.");
42 } else if (eName.length() == 0){
43 setErrorMessage("Need to specify element name.");
45 setErrorMessage(null);
46 nextPage = ((EditElementWizard)getWizard()).createElementEditPage(eName);
47 nextPage.setElementName(eName);
48 if( nextPage instanceof UnknownElementWizardPage){
49 setMessage("This editor does not known element name.", WARNING);
51 setMessage(null, NONE);
55 getWizard().getContainer().updateButtons();
60 public String getPreviewText(){
61 if(nextPage instanceof EditElementWizardPage){
62 return ((EditElementWizardPage)nextPage).getPreviewText();
67 public void setErrorMessage(String newMessage) {
68 super.setErrorMessage(newMessage);
69 if( newMessage != null){
74 public IWizardPage getNextPage() {