From: bananeweizen Date: Tue, 20 Dec 2005 02:26:10 +0000 (+0000) Subject: avoid builder error on a file with name ".php" (i.e. dot and extension only) X-Git-Url: http://git.phpeclipse.com?hp=bfa154e9da1b7c2915b8728f9e96afc8c3c1011f avoid builder error on a file with name ".php" (i.e. dot and extension only) --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java index 261673f..61e3ce2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java @@ -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);