Templates were updated by pteague. Also a little change by ed_mann.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / wizards / html / NewElementWizardPage.java
index 4b39fa9..933317a 100644 (file)
@@ -1,15 +1,18 @@
 /*
- * $Id: NewElementWizardPage.java,v 1.1 2004-10-05 20:51:57 jsurfer Exp $
+ * $Id: NewElementWizardPage.java,v 1.3 2006-10-21 23:18:43 pombredanne Exp $
  * Copyright Narushima Hironori. All rights reserved.
  */
 package net.sourceforge.phpeclipse.wizards.html;
 
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
 
 /**
  * 
@@ -17,6 +20,7 @@ import org.eclipse.swt.widgets.*;
 public class NewElementWizardPage extends EditElementWizardPage {
 
        Text elementName;
+
        EditElementWizardPage nextPage = null;
 
        public NewElementWizardPage() {
@@ -24,30 +28,32 @@ public class NewElementWizardPage extends EditElementWizardPage {
                setTitle("Create HTML Element");
                setDescription("Specify new HTML tag (dl,ul,ol or table) and configure that tag.");
        }
-       
+
        protected void createChildControl(Composite base) {
                // create foundation component
                base.setLayout(new GridLayout(1, false));
-               
+
                // element input components
                new Label(base, SWT.NONE).setText("&Element Name:");
-               
+
                elementName = new Text(base, SWT.BORDER | SWT.SINGLE);
-               elementName.setLayoutData( new GridData(GridData.FILL_HORIZONTAL));
-               elementName.addModifyListener( new ModifyListener() {
+               elementName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               elementName.addModifyListener(new ModifyListener() {
                        public void modifyText(ModifyEvent e) {
                                String eName = elementName.getText();
-                               if( eName.indexOf(' ') != -1 ){
+                               if (eName.indexOf(' ') != -1) {
                                        setErrorMessage("Don't contain blink in speicfied element name.");
-                               } else if (eName.length() == 0){
+                               } else if (eName.length() == 0) {
                                        setErrorMessage("Need to specify element name.");
                                } else {
                                        setErrorMessage(null);
-                                       nextPage = ((EditElementWizard)getWizard()).createElementEditPage(eName);
+                                       nextPage = ((EditElementWizard) getWizard())
+                                                       .createElementEditPage(eName);
                                        nextPage.setElementName(eName);
-                                       if( nextPage instanceof UnknownElementWizardPage){
-                                               setMessage("This editor does not known element name.", WARNING);
-                                       }else{
+                                       if (nextPage instanceof UnknownElementWizardPage) {
+                                               setMessage("This editor does not known element name.",
+                                                               WARNING);
+                                       } else {
                                                setMessage(null, NONE);
                                        }
                                }
@@ -56,17 +62,17 @@ public class NewElementWizardPage extends EditElementWizardPage {
                        }
                });
        }
-       
-       public String getPreviewText(){
-               if(nextPage instanceof EditElementWizardPage){
-                       return ((EditElementWizardPage)nextPage).getPreviewText();
+
+       public String getPreviewText() {
+               if (nextPage instanceof EditElementWizardPage) {
+                       return ((EditElementWizardPage) nextPage).getPreviewText();
                }
                return null;
        }
-       
+
        public void setErrorMessage(String newMessage) {
                super.setErrorMessage(newMessage);
-               if( newMessage != null){
+               if (newMessage != null) {
                        nextPage = null;
                }
        }