Interface ProjectFactory
- All Known Subinterfaces:
ProjectFactory2
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isProject
(org.openide.filesystems.FileObject projectDirectory) Test whether a given directory probably refers to a project recognized by this factory without actually trying to create it.loadProject
(org.openide.filesystems.FileObject projectDirectory, ProjectState state) Create a project that resides on disk.void
saveProject
(Project project) Save a project to disk.
-
Method Details
-
isProject
boolean isProject(org.openide.filesystems.FileObject projectDirectory) Test whether a given directory probably refers to a project recognized by this factory without actually trying to create it.Should be as fast as possible as it might be called sequentially on a lot of directories.
Need not be definite; it is permitted to return null or throw an exception from
loadProject(org.openide.filesystems.FileObject, org.netbeans.spi.project.ProjectState)
even when returningtrue
from this method, in case the directory looked like a project directory but in fact had something wrong with it.Will be called inside read access by
ProjectManager.isProject(org.openide.filesystems.FileObject)
orProjectManager.isProject2(org.openide.filesystems.FileObject)
.- Parameters:
projectDirectory
- a directory which might refer to a project- Returns:
- true if this factory recognizes it
-
loadProject
Project loadProject(org.openide.filesystems.FileObject projectDirectory, ProjectState state) throws IOException Create a project that resides on disk. If this factory does not in fact recognize the directory, it should just return null.Will be called inside read access by
ProjectManager.findProject(org.openide.filesystems.FileObject)
.Do not do your own caching! The project manager caches projects for you, properly.
Do not attempt to recognize subdirectories of your project directory (just return null), unless they are distinct nested projects.
- Parameters:
projectDirectory
- some directory on diskstate
- a callback permitting the project to indicate when it is modified- Returns:
- a matching project implementation, or null if this factory does not recognize it
- Throws:
IOException
-
saveProject
Save a project to disk.Will be called inside write access, by
ProjectManager.saveProject(org.netbeans.api.project.Project)
orProjectManager.saveAllProjects()
.- Parameters:
project
- a project created with this factory'sloadProject(org.openide.filesystems.FileObject, org.netbeans.spi.project.ProjectState)
method- Throws:
IOException
- if there is a problem savingClassCastException
- if this factory did not create this project
-