avoid builder error on a file with name ".php" (i.e. dot and extension only)
authorbananeweizen <bananeweizen>
Tue, 20 Dec 2005 02:26:10 +0000 (02:26 +0000)
committerbananeweizen <bananeweizen>
Tue, 20 Dec 2005 02:26:10 +0000 (02:26 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java

index 261673f..61e3ce2 100644 (file)
@@ -47,13 +47,18 @@ public class PHPFileUtil {
    */
   public final static boolean isPHPFileName(String name) {
 
+       //avoid handling a file without base name, e.g. ".php", which is a valid Eclipse resource name
+       File file=new File(name);
+       if (file.getName().startsWith(".")) {
+               return false;
+       }
        IWorkbench workbench = PlatformUI.getWorkbench();
        IEditorRegistry registry = workbench.getEditorRegistry();
        IEditorDescriptor[] descriptors = registry.getEditors(name);
 
        for (int i = 0; i < descriptors.length; i++) {
                        if (descriptors[i].getId().equals(PHPeclipsePlugin.EDITOR_ID)) {
-        return true;
+                               return true;
                        }
                }
 //    String extension = getFileExtension(name);