1 package info.mikethomas.fahview.v6project;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import java.awt.Image;
25 import java.io.IOException;
26 import javax.swing.ImageIcon;
27 import org.netbeans.api.project.Project;
28 import org.netbeans.api.project.ProjectManager;
29 import org.netbeans.spi.project.ProjectFactory;
30 import org.netbeans.spi.project.ProjectFactory2;
31 import org.netbeans.spi.project.ProjectState;
32 import org.openide.filesystems.FileObject;
33 import org.openide.util.ImageUtilities;
34 import org.openide.util.lookup.ServiceProvider;
35
36
37
38
39
40
41
42 @ServiceProvider(service = ProjectFactory.class)
43 public class ClientProjectFactory implements ProjectFactory2 {
44
45
46 @Override
47 public final ProjectManager.Result isProject2(
48 final FileObject projectDirectory) {
49
50 if (isProject(projectDirectory)) {
51 Image image = ImageUtilities.loadImage(ClientProject.PROJECT_ICON);
52 return new ProjectManager.Result(new ImageIcon(image));
53 }
54 return null;
55 }
56
57
58 @Override
59 public final boolean isProject(final FileObject projectDirectory) {
60 return projectDirectory.getFileObject(
61 ClientProject.PROJECT_FILE) != null;
62 }
63
64
65 @Override
66 public final Project loadProject(final FileObject projectDirectory,
67 final ProjectState state) throws IOException {
68
69 if (isProject(projectDirectory)) {
70 return new ClientProject(projectDirectory, state);
71 }
72 return null;
73 }
74
75
76 @Override
77 public void saveProject(final Project project) throws IOException {
78
79 }
80 }