initially focus file name field, if container field contains useful value
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / wizards / PHPFileWizardPage.java
index 1b64440..4e6a174 100644 (file)
@@ -123,6 +123,7 @@ public class PHPFileWizardPage extends WizardPage {
         else
           container = ((IResource) obj).getParent();
         containerText.setText(container.getFullPath().toString());
+        fileText.setFocus();
       }
     }
     fileText.setText("*.php");
@@ -138,10 +139,13 @@ public class PHPFileWizardPage extends WizardPage {
         ResourcesPlugin.getWorkspace().getRoot(), false, PHPWizardMessages
             .getString("WizardPage.selectNewFileContainer"));
     if (dialog.open() == ContainerSelectionDialog.OK) {
-      Object[] result = dialog.getResult();
-      if (result.length == 1) {
-        IContainer container = (IContainer) result[0];
-        containerText.setText(container.getFullPath().toString());
+      Object[] results = dialog.getResult();
+      if (results.length == 1) {
+         Object result=results[0];
+         if (result instanceof IPath) {
+                 IPath ipath = (IPath) result;
+                 containerText.setText(ipath.toString());
+         }
       }
     }
   }