public abstract class DefaultGradleActionsProvider extends Object implements GradleActionsProvider
Constructor and Description |
---|
DefaultGradleActionsProvider(String... actions) |
Modifier and Type | Method and Description |
---|---|
InputStream |
defaultActionMapConfig()
Provides a declarative action description.
|
static LookupProvider |
forProjectLayer(FileObject fo)
Defines a
GradleActionsProvider for a project based on layer information. |
Set<String> |
getSupportedActions()
Returns the set of supported actions.
|
boolean |
isActionEnabled(String action,
Project project,
Lookup context)
Determines if an action should be enabled.
|
public DefaultGradleActionsProvider(String... actions)
public final Set<String> getSupportedActions()
GradleActionsProvider
GradleExecConfiguration
only,
it should still report them here.getSupportedActions
in interface GradleActionsProvider
public boolean isActionEnabled(String action, Project project, Lookup context)
GradleActionsProvider
true
for actions it does not support.isActionEnabled
in interface GradleActionsProvider
action
- action nameproject
- the target projectcontext
- context that would be used for action invocation.public final InputStream defaultActionMapConfig()
GradleActionsProvider
InputStream
must contain XML content conforming to
action-mapping.dtd
.
<!DOCTYPE actions SYSTEM "action-mapping.dtd"> <actions> <action name="clean"> <args>clean</args> </action> <action name="build"> <args>build</args> </action> <action name="rebuild"> <args>clean build</args> </action> <action name="test"> <args>--rerun-tasks test</args> </action> </actions>
Starting from version 2.13 the InputStream can contain entries for GradleExecConfiguration
s.
<actions> <profiles> <profile id="provided-config" displayName="Example Provided Config"> <property name="propA">value1</property> <args>--info</args> <actions> <apply-for plugins="java"> <action name="run.single"> <args>-PrunClassName=${selectedClass} runSingle --continuous ${javaExec.jvmArgs} ${javaExec.args} </args> </action> </apply-for> <apply-for plugins="application"> <action name="run"> <args>run --continuous ${javaExec.jvmArgs} ${javaExec.args} </args> </action> </apply-for> <action name="debug.single"> <reload rule="NEVER"/> </action> </actions> </profile> </profiles>
defaultActionMapConfig
in interface GradleActionsProvider
public static LookupProvider forProjectLayer(FileObject fo) throws IOException
GradleActionsProvider
for a project based on layer information.
It should be invoked for a FileObject
from the XML layer, that has the
following attributes:
resource
: String - URL of the resource that will be streamed from
GradleActionsProvider.defaultActionMapConfig()
<actions> <profiles> <profile id="provided-config" displayName="Example Provided Config"> <property name="propA">value1</property> <args>--info</args> <actions> <apply-for plugins="java"> <action name="run.single"> <args>-PrunClassName=${selectedClass} runSingle --continuous ${javaExec.jvmArgs} ${javaExec.args} </args> </action> </apply-for> <apply-for plugins="application"> <action name="run"> <args>run --continuous ${javaExec.jvmArgs} ${javaExec.args} </args> </action> </apply-for> <action name="debug.single"> <reload rule="NEVER"/> </action> </actions> </profile> </profiles>It can be then included in either Gradle Project's generic Lookup (folder
Projects/org-netbeans-modules-gradle/Lookup
or in a plugin-specific folder:
<filesystem> <folder name="Projects"> <folder name="org-netbeans-modules-gradle"> <folder name="Plugins"> <folder name="java-library-distribution"> <folder name="Lookup"> <file name="example-actions-provider.instance"> <attr name="instanceOf" stringvalue="org.netbeans.spi.project.LookupProvider"/> <attr name="instanceCreate" methodvalue="org.netbeans.modules.gradle.spi.actions.DefaultGradleActionsProvider.forProjectLayer"/> <attr name="service" stringvalue="org.netbeans.modules.gradle.spi.actions.GradleActionsProvider"/> <attr name="resource" stringvalue="nbres:/org/netbeans/modules/gradle/actions/declarative-actions.xml"/> </file> </folder> </folder> </folder> </folder> </folder>
fo
- the layer fileIOException
- in case of an error.