org.netbeans.modules.project.ant/1 1.42.1

org.netbeans.spi.project.support.ant
Class SourcesHelper.SourceRootConfig

java.lang.Object
  extended by org.netbeans.spi.project.support.ant.SourcesHelper.SourceRootConfig
Enclosing class:
SourcesHelper

public final class SourcesHelper.SourceRootConfig
extends Object

Helper class for configuring source roots.

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
 

Since:
org.netbeans.modules.project.ant/1 1.33

Method Summary
 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

displayName

public SourcesHelper.SourceRootConfig displayName(String value)
Configures a display name (for SourceGroup.getDisplayName())

Parameters:
value -
Returns:
this

includes

public SourcesHelper.SourceRootConfig includes(String value)
                                        throws IllegalArgumentException
Configures optional include list.

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.

Parameters:
value - Ant-style includes; may contain Ant property substitutions; Only files and folders matching the pattern (or patterns), and not specified in the excludes list, will be included. Must not be null.
Returns:
this
Throws:
IllegalArgumentException - When null is passed as parameter.

excludes

public SourcesHelper.SourceRootConfig excludes(String value)
                                        throws IllegalArgumentException
Configures optional exclude list. See includes(java.lang.String) for details.

Parameters:
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.
Returns:
this
Throws:
IllegalArgumentException - When null is passed as parameter.

type

public SourcesHelper.SourceRootConfig type(String value)
Turns a root into typed source root which will be considered only in certain contexts. When not set, root is considered to be principal source root. See class javadoc for details.

Parameters:
value - a source root type such as JavaProjectConstants.SOURCES_TYPE_JAVA
Returns:
this

hint

public SourcesHelper.SourceRootConfig hint(String value)
Configures optional hint for SourceGroupModifier allowing creation of this source root on demand.

Parameters:
value - A hint
Returns:
this
See Also:
SourcesHelper.createSourceGroupModifierImplementation()

icon

public SourcesHelper.SourceRootConfig icon(Icon value)
Configures a regular icon for the source root, optional.

Parameters:
value -
Returns:
this

openedIcon

public SourcesHelper.SourceRootConfig openedIcon(Icon value)
Configures an opened variant icon for the source root, optional.

Parameters:
value -
Returns:
this

add

public SourcesHelper.SourceRootConfig add()
                                   throws IllegalStateException
Adds configured source root to SourcesHelper.

Returns:
this
Throws:
IllegalStateException - if this method is called after either SourcesHelper.createSources() or SourcesHelper.registerExternalRoots(int) was called
See Also:
SourcesHelper.registerExternalRoots(int)

org.netbeans.modules.project.ant/1 1.42.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.