1 19 20 package org.netbeans.modules.scripting.php.webproject; 21 22 import java.io.IOException ; 23 import org.netbeans.api.project.Project; 24 import org.netbeans.spi.project.ProjectFactory; 25 import org.netbeans.spi.project.ProjectState; 26 import org.openide.filesystems.FileObject; 27 28 32 public class PhpProjectFactory implements ProjectFactory { 33 34 35 public PhpProjectFactory() { 36 } 37 38 public boolean isProject(FileObject fileObject) { 39 boolean ret = fileObject.isFolder() && 40 fileObject.getFileObject("index.php") != null && fileObject.getFileObject("nbproject") != null && fileObject.getFileObject("nbproject/index.php") != null; 44 System.err.println("mw PhpProjectFactory.isProject(" + fileObject + ")= " + ret); 45 46 return ret; 47 } 48 49 public Project loadProject(FileObject fileObject, ProjectState projectState) throws IOException { 50 if (!isProject(fileObject)) { 51 return null; 52 } 53 54 Project ret = new PhpProject(fileObject, projectState); 55 56 System.err.println("mw PhpProjectFactory.loadProject(" + fileObject + ", " + projectState + ")= " + ret); 57 58 return ret; 59 } 60 61 public void saveProject(Project project) throws IOException , ClassCastException { 62 if (!(project instanceof PhpProject)) { 63 throw new ClassCastException ("wrong project class: " + project); 64 } 65 66 ((PhpProject)project).save(); 67 } 68 69 } 70 | Popular Tags |