1 package org.netbeans.modules.piagetproject; 2 3 import java.io.IOException ; 4 import org.netbeans.api.project.Project; 5 import org.netbeans.spi.project.ProjectFactory; 6 import org.netbeans.spi.project.ProjectState; 7 import org.openide.filesystems.FileObject; 8 9 public class PiagetProjectFactory implements ProjectFactory { 10 11 public static final String PROJECT_DIR = "piaget"; 12 public static final String LEVEL1 = "beginner"; 13 public static final String LEVEL2 = "frequent"; 14 public static final String LEVEL3 = "experienced"; 15 public static final String PARSED_DIR = "parsed"; 16 public static final String ORIGINALS_DIR = "originals"; 17 18 19 20 public PiagetProjectFactory() { 21 } 22 23 public static String getLevelName(int i){ 24 switch(i){ 25 case 1: 26 return LEVEL1; 27 case 2: 28 return LEVEL2; 29 case 3: 30 return LEVEL3; 31 } 32 return "UNKNOWN LEVEL"; 33 } 34 35 public boolean isProject(FileObject projectDirectory) { 36 return projectDirectory.getFileObject(PROJECT_DIR) != null; 37 } 38 39 public Project loadProject(FileObject dir, ProjectState state) throws IOException { 40 return isProject(dir) ? new PiagetProject(dir, state) : null; 41 } 42 43 public void saveProject(Project project) throws IOException , ClassCastException { 44 } 45 } 46 | Popular Tags |