public final class SourceGroupModifier extends Object
SourceGroupModifier
provides ways of create specific folders (SourceGroup
root folders)
in case they don't exist, eg. cannot be retrieved from Sources
The project type supporting automated creation of SourceGroup
root folders needs to
provide SourceGroupModifierImplementation
in the project's lookup.Modifier and Type | Class and Description |
---|---|
static class |
SourceGroupModifier.Future
A wrapper class that is capable of lazily creating a
SourceGroup instance. |
Modifier and Type | Method and Description |
---|---|
static SourceGroup |
createAssociatedSourceGroup(Project project,
SourceGroup original,
String type,
String hint,
String... projectParts)
Creates a source group associated to an existing one.
|
static SourceGroup |
createSourceGroup(Project project,
String type,
String hint)
Creates a
SourceGroup in the given Project of the given type and hint. |
static SourceGroupModifier.Future |
createSourceGroupFuture(Project project,
String type,
String hint)
Creates a
SourceGroupModifier.Future object
that is capable of lazily creating SourceGroup in the given Project of the given type and hint. |
public static final SourceGroup createSourceGroup(Project project, String type, String hint)
SourceGroup
in the given Project
of the given type and hint.
Typically a type is a constant for java/groovy/ruby source roots and hint is a constant for main sources or test sources.
Please consult specific APIs fro the supported types/hints. Eg. JavaProjectConstants
for java related project sources.project
- type
- constant for type of sourceshint
- public static final SourceGroup createAssociatedSourceGroup(Project project, SourceGroup original, String type, String hint, String... projectParts)
SourceGroupModifier.createSourceGroup(org.netbeans.api.project.Project, java.lang.String, java.lang.String)
allows to select appropriate locations, if the newly created SourceGroup
should work in association with some existing one.
The source group will be created on location most similar to the provided original
group. If projectParts
are specified, the most matching
location will be selected.
This feature is prototypically used in J2SE modular projects, where multiple locations exists for tests and sources, yet they are related by their owning module. Other project types may also partition project sources into logical groups, similar to modules.
Some (java) examples:
relativeTo(modulesGroup, "moduleName").createSourceGroup(..)
relativeTo(modulesGroup, "moduleName", "path-to-modules").createSourceGroup(...)
relativeTo(sourceLocation).createSourceGroup(...)
relativeTo(sourceLocation, "test2").createSourceGroup(...)
.
project
- the projectoriginal
- the original SourceGroup, which the new one should be related to.type
- type of sourceshint
- additional type hintprojectParts
- optional; abstract location within the project.null
public static final SourceGroupModifier.Future createSourceGroupFuture(Project project, String type, String hint)
SourceGroupModifier.Future
object
that is capable of lazily creating SourceGroup
in the given Project
of the given type and hint.
Typically a type is a constant for java/groovy/ruby source roots and hint is a constant for main sources or test sources.
Please consult specific APIs fro the supported types/hints. Eg. JavaProjectConstants
for java related project sources.project
- type
- constant for type of sourceshint
-