KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > piagetproject > PiagetProjectFactory


1 package org.netbeans.modules.piagetproject;
2
3 import java.io.IOException JavaDoc;
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 JavaDoc PROJECT_DIR = "piaget";
12     public static final String JavaDoc LEVEL1 = "beginner";
13     public static final String JavaDoc LEVEL2 = "frequent";
14     public static final String JavaDoc LEVEL3 = "experienced";
15     public static final String JavaDoc PARSED_DIR = "parsed";
16     public static final String JavaDoc ORIGINALS_DIR = "originals";
17     
18     
19     /** Creates a new instance of PiagetProjectFactory */
20     public PiagetProjectFactory() {
21     }
22     
23     public static String JavaDoc 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 JavaDoc {
40         return isProject(dir) ? new PiagetProject(dir, state) : null;
41     }
42
43     public void saveProject(Project project) throws IOException JavaDoc, ClassCastException JavaDoc {
44     }
45 }
46
Popular Tags