public interface ProjectFactory
Modifier and Type | Method and Description |
---|---|
boolean |
isProject(FileObject projectDirectory)
Test whether a given directory probably refers to a project recognized by this factory
without actually trying to create it.
|
Project |
loadProject(FileObject projectDirectory,
ProjectState state)
Create a project that resides on disk.
|
void |
saveProject(Project project)
Save a project to disk.
|
boolean isProject(FileObject projectDirectory)
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 ProjectFactory.loadProject(org.openide.filesystems.FileObject, org.netbeans.spi.project.ProjectState)
even when returning true
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)
or ProjectManager.isProject2(org.openide.filesystems.FileObject)
.
projectDirectory
- a directory which might refer to a projectProject loadProject(FileObject projectDirectory, ProjectState state) throws IOException
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.
projectDirectory
- some directory on diskstate
- a callback permitting the project to indicate when it is modifiedIOException
void saveProject(Project project) throws IOException, ClassCastException
Will be called inside write access, by ProjectManager.saveProject(org.netbeans.api.project.Project)
or ProjectManager.saveAllProjects()
.
project
- a project created with this factory's ProjectFactory.loadProject(org.openide.filesystems.FileObject, org.netbeans.spi.project.ProjectState)
methodIOException
- if there is a problem savingClassCastException
- if this factory did not create this project