public final class SourcesHelper.SourceRootConfig extends Object
A typical usage is to use it as "named parameters" idiom when adding source root:
sourcesHelper.sourceRoot("${src.dir}").displayName("Source Packages").type("java").add();Note also that when adding
typed
source root, principal (untyped) source
root usually needs to be added as well. You may reuse existing config object like this:
sourcesHelper.sourceRoot("${src.dir}").displayName("Source Packages") .add() // adding as principal root, continuing configuration .type("java").add(); // adding as typed root
Modifier and Type | Method and Description |
---|---|
SourcesHelper.SourceRootConfig |
add()
Adds configured source root to
SourcesHelper . |
SourcesHelper.SourceRootConfig |
displayName(String value)
Configures a display name (for
SourceGroup.getDisplayName() ) |
SourcesHelper.SourceRootConfig |
excludes(String value)
Configures optional exclude list.
|
SourcesHelper.SourceRootConfig |
hint(String value)
Configures optional hint for
SourceGroupModifier allowing creation of this
source root on demand. |
SourcesHelper.SourceRootConfig |
icon(Icon value)
Configures a regular icon for the source root, optional.
|
SourcesHelper.SourceRootConfig |
includes(String value)
Configures optional include list.
|
SourcesHelper.SourceRootConfig |
inParts(String... parts)
Declares that the source root resides in some (hierarchical) project part.
|
SourcesHelper.SourceRootConfig |
openedIcon(Icon value)
Configures an opened variant icon for the source root, optional.
|
SourcesHelper.SourceRootConfig |
type(String value)
Turns a root into typed source root which will be considered only in certain contexts.
|
public SourcesHelper.SourceRootConfig displayName(String value)
SourceGroup.getDisplayName()
)value
- this
public SourcesHelper.SourceRootConfig includes(String value) throws IllegalArgumentException
Value is evaluated and then treated as a comma- or space-separated pattern list,
as detailed in the Javadoc for PathMatcher
.
(As a special convenience, a value consisting solely of an Ant property reference
which cannot be evaluated, e.g. ${undefined}, is ignored.)
SourceGroup.contains(org.openide.filesystems.FileObject)
will then reflect the includes and excludes for files, but note that the
semantics of that method requires that a folder be "contained" in case any folder or file
beneath it is contained, and in particular the root folder is always contained.
value
- Ant-style includes; may contain Ant property substitutions;
Only files and folders matching the pattern (or patterns),
and not specified in the SourcesHelper.SourceRootConfig.excludes(String)
list,
will be included
.
Must not be null
.this
IllegalArgumentException
- When null
is passed as parameter.public SourcesHelper.SourceRootConfig excludes(String value) throws IllegalArgumentException
SourcesHelper.SourceRootConfig.includes(java.lang.String)
for details.value
- Ant-style excludes; may contain Ant property substitutions;
files and folders
matching the pattern (or patterns) will not be included
,
even if specified in the includes list.
Must not be null
.this
IllegalArgumentException
- When null
is passed as parameter.public SourcesHelper.SourceRootConfig type(String value)
value
- a source root type such as
JavaProjectConstants.SOURCES_TYPE_JAVA
this
public SourcesHelper.SourceRootConfig hint(String value)
SourceGroupModifier
allowing creation of this
source root on demand.value
- A hintthis
SourcesHelper.createSourceGroupModifierImplementation()
public SourcesHelper.SourceRootConfig icon(Icon value)
value
- this
public SourcesHelper.SourceRootConfig openedIcon(Icon value)
value
- this
public SourcesHelper.SourceRootConfig inParts(String... parts)
parts
- abstract location of this rootthis
public SourcesHelper.SourceRootConfig add() throws IllegalStateException
SourcesHelper
.this
IllegalStateException
- if this method is called after either
SourcesHelper.createSources()
or SourcesHelper.registerExternalRoots(int)
was calledSourcesHelper.registerExternalRoots(int)