|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.netbeans.api.project.FileOwnerQuery
Find the project which owns a file.
There is a default implementation of FileOwnerQueryImplementation
which considers a file owned by the project corresponding to the nearest enclosing
project directory or marked external owner, if such a directory exists. But
other implementations can be registered to lookup as well.
Field Summary | |
static int |
EXTERNAL_ALGORITHM_TRANSIENT
Simplest algorithm for marking external file owners, which just keeps a transient memory cache of this information. |
Method Summary | |
static Project |
getOwner(FileObject file)
Find the project, if any, which "owns" the given file. |
static Project |
getOwner(URI uri)
Find the project, if any, which "owns" the given URI. |
static void |
markExternalOwner(FileObject root,
Project owner,
int algorithm)
Mark an external folder or file as being owned by a particular project. |
static void |
markExternalOwner(URI root,
Project owner,
int algorithm)
Mark an external URI (folder or file) as being owned by a particular project. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int EXTERNAL_ALGORITHM_TRANSIENT
FileObject
. For this reason, a project which makes such a
marking when it is created is obliged to hold a reference to the external
file root for as long as the project itself is in memory, to ensure that
it continues to work.
Method Detail |
public static Project getOwner(FileObject file)
file
- the file (generally on disk)
public static Project getOwner(URI uri)
uri
- the uri to the file (generally on disk); must be absolute and not opaque
IllegalArgumentException
- if the URI is relative or opaquepublic static void markExternalOwner(FileObject root, Project owner, int algorithm) throws IllegalArgumentException
Typical usage would be to call this method for each external source root of a project (if any) as soon as the project is loaded, if a transient algorithm is selected, or only when the project is created, if a reliable persistent algorithm is selected.
root
- a folder or a file which should be considered part of a projectowner
- a project which should be considered to own that folder tree
(any prior marked external owner is overridden),
or null to cancel external ownership for this folder rootalgorithm
- an algorithm to use for retaining this information;
currently may only be EXTERNAL_ALGORITHM_TRANSIENT
IllegalArgumentException
- if the root or owner is null, if an unsupported
algorithm is requested,
if the root is already a project directory,
or if the root is already equal to or inside the owner's
project directory (it may however be an ancestor)SourcesHelper
public static void markExternalOwner(URI root, Project owner, int algorithm) throws IllegalArgumentException
Typical usage would be to call this method for each external source root of a project (if any) as soon as the project is loaded, if a transient algorithm is selected, or only when the project is created, if a reliable persistent algorithm is selected.
root
- an URI of a folder or a file which should be considered part of a projectowner
- a project which should be considered to own that folder tree
(any prior marked external owner is overridden),
or null to cancel external ownership for this folder rootalgorithm
- an algorithm to use for retaining this information;
currently may only be EXTERNAL_ALGORITHM_TRANSIENT
IllegalArgumentException
- if the root or owner is null, if an unsupported
algorithm is requested,
if the root is already a project directory,
or if the root is already equal to or inside the owner's
project directory (it may however be an ancestor)SourcesHelper
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |