public class SourceRoots extends Roots
FileObject
's
or URL
s.
This class is thread safe and listens to the changes
in Ant project metadata (see SourceRoots.PROP_ROOT_PROPERTIES
) as well as
in project properties (see SourceRoots.PROP_ROOTS
).Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SOURCE_LABEL
Default label for sources node used in
LogicalViewProvider . |
static String |
DEFAULT_TEST_LABEL
Default label for tests node used in
LogicalViewProvider . |
static String |
PROP_ROOT_PROPERTIES
Property name of a event that is fired when Ant project metadata change.
|
static String |
PROP_ROOTS
Property name of a event that is fired when project properties change.
|
Modifier and Type | Method and Description |
---|---|
static SourceRoots |
create(UpdateHelper helper,
PropertyEvaluator evaluator,
ReferenceHelper refHelper,
String projectConfigurationNamespace,
String elementName,
boolean isTest,
String newRootNameTemplate) |
String |
createInitialDisplayName(File sourceRoot)
Creates initial display name of source/test root.
|
String |
getRootDisplayName(String rootName,
String propName)
Translates root name into display name of source/test root.
|
String[] |
getRootDisplayNames()
Returns root's display names
|
String[] |
getRootNames()
Returns the display names of source roots.
|
String[] |
getRootProperties()
Returns names of Ant properties in the project.properties file holding the roots.
|
FileObject[] |
getRoots()
Returns the source roots in the form of absolute paths.
|
URL[] |
getRootURLs()
Returns the source roots as
URL s. |
URL[] |
getRootURLs(boolean removeInvalidRoots)
Returns the source roots as
URL s. |
boolean |
isTest()
Returns
true if the current SourceRoots instance represents source roots belonging to
the test compilation unit. |
void |
putRoots(URL[] roots,
String[] labels)
Replaces the current roots by the given ones.
|
addPropertyChangeListener, nonSourceRoots, propertyBased, removePropertyChangeListener
public static final String PROP_ROOT_PROPERTIES
public static final String PROP_ROOTS
public static final String DEFAULT_SOURCE_LABEL
LogicalViewProvider
.public static final String DEFAULT_TEST_LABEL
LogicalViewProvider
.public static SourceRoots create(UpdateHelper helper, PropertyEvaluator evaluator, ReferenceHelper refHelper, String projectConfigurationNamespace, String elementName, boolean isTest, String newRootNameTemplate)
public String[] getRootNames()
SourceRoots.getRootProperties()
.
It may contain empty String
s but not null
.public String[] getRootDisplayNames()
Roots
getRootDisplayNames
in class Roots
public String[] getRootProperties()
Roots
getRootProperties
in class Roots
public FileObject[] getRoots()
FileObject
s.public URL[] getRootURLs()
URL
s.
Calls SourceRoots.getRootURLs(boolean)
with true.URL
.public void putRoots(URL[] roots, String[] labels)
roots
- the URL
s of the new roots.labels
- the names of the new roots.public String getRootDisplayName(String rootName, String propName)
rootName
- the name of root got from SourceRoots.getRootNames()
.propName
- the name of a property the root is stored in.public String createInitialDisplayName(File sourceRoot)
sourceRoot
- the source root.public boolean isTest()
true
if the current SourceRoots
instance represents source roots belonging to
the test compilation unit.true
if the instance belongs to the test compilation unit, false otherwise.