|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.netbeans.api.project.ProjectManager
Manages loaded projects.
Method Summary | |
void |
clearNonProjectCache()
Clear the cached list of folders thought not to be projects. |
Project |
findProject(FileObject projectDirectory)
Find an open project corresponding to a given project directory. |
static ProjectManager |
getDefault()
Returns the singleton project manager instance. |
Set |
getModifiedProjects()
Get a list of all projects which are modified and need to be saved. |
boolean |
isModified(Project p)
Check whether a given project is current modified. |
boolean |
isProject(FileObject projectDirectory)
Check whether a given directory is likely to contain a project without actually loading it. |
boolean |
isValid(Project p)
Check whether a given project is still valid (ie. |
static Mutex |
mutex()
Get a read/write lock to be used for all project metadata accesses. |
void |
saveAllProjects()
Save all modified projects. |
void |
saveProject(Project p)
Save one project (if it was in fact modified). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ProjectManager getDefault()
public static Mutex mutex()
public Project findProject(FileObject projectDirectory) throws IOException, IllegalArgumentException
Acquires read access.
It is not guaranteed that the returned instance will be identical
to that which is created by the appropriate ProjectFactory
. In
particular, the project manager is free to return only wrapper Project
instances which delegate to the factory's implementation. If you know your
factory created a particular project, you cannot safely cast the return value
of this method to your project type implementation class; you should instead
place an implementation of some suitable private interface into your project's
lookup, which would be safely proxied.
projectDirectory
- the project top directory
ProjectFactory
(might be null even if isProject(org.openide.filesystems.FileObject)
returns true)
IOException
- if the project was recognized but could not be loaded
IllegalArgumentException
- if the supplied file object is null or not a folderpublic boolean isProject(FileObject projectDirectory) throws IllegalArgumentException
findProject(org.openide.filesystems.FileObject)
when called
on a large number of directories.
The result is not guaranteed to be accurate; there may be false positives
(directories for which isProject
is true but findProject(org.openide.filesystems.FileObject)
will return false), for example if there is trouble loading the project.
False negatives are possible only if there are bugs in the project factory.
Acquires read access.
You do not need to call this method if you just plan to call findProject(org.openide.filesystems.FileObject)
afterwards. It is intended for only those clients which would discard the
result of findProject(org.openide.filesystems.FileObject)
other than to check for null, and which
can also tolerate false positives.
projectDirectory
- a directory which may be some project's top directory
ProjectFactory
IllegalArgumentException
- if the supplied file object is null or not a folderpublic void clearNonProjectCache()
public Set getModifiedProjects()
Acquires read access.
Project
spublic boolean isModified(Project p) throws IllegalArgumentException
Acquires read access.
p
- a project loaded by this manager
IllegalArgumentException
- if the project was not created through this managerpublic void saveProject(Project p) throws IOException, IllegalArgumentException
Acquires write access.
Although the project infrastructure permits a modified project to be saved at any time, current UI principles dictate that the "save project" concept should be internal only - i.e. a project customizer should automatically save the project when it is closed e.g. with an "OK" button. Currently there is no UI display of modified projects; this module does not ensure that modified projects are saved at system exit time the way modified files are, though the Project UI implementation module currently does this check.
p
- the project to save
IOException
- if it cannot be saved
IllegalArgumentException
- if the project was not created through this managerpublic void saveAllProjects() throws IOException
Acquires write access.
IOException
- if any of them cannot be savedpublic boolean isValid(Project p)
Acquires read access.
p
- a project loaded by this manager
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |