2 * $Id: NewElementWizardPage.java,v 1.3 2006-10-21 23:18:43 pombredanne 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;
20 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())
51 .createElementEditPage(eName);
52 nextPage.setElementName(eName);
53 if (nextPage instanceof UnknownElementWizardPage) {
54 setMessage("This editor does not known element name.",
57 setMessage(null, NONE);
61 getWizard().getContainer().updateButtons();
66 public String getPreviewText() {
67 if (nextPage instanceof EditElementWizardPage) {
68 return ((EditElementWizardPage) nextPage).getPreviewText();
73 public void setErrorMessage(String newMessage) {
74 super.setErrorMessage(newMessage);
75 if (newMessage != null) {
80 public IWizardPage getNextPage() {