diff --git a/java.j2seproject/nbproject/project.xml b/java.j2seproject/nbproject/project.xml --- a/java.j2seproject/nbproject/project.xml +++ b/java.j2seproject/nbproject/project.xml @@ -55,7 +55,7 @@ 3 - 3.84 + 3.85 diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java --- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java +++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java @@ -798,6 +798,7 @@ true : tabName.equals(s); execenv.setTabReplaceStrategy(p, p); + execenv.setUserAction(false); return AntTargetExecutor.createTargetExecutor(execenv) .execute(apc, targetNames); } diff --git a/o.apache.tools.ant.module/apichanges.xml b/o.apache.tools.ant.module/apichanges.xml --- a/o.apache.tools.ant.module/apichanges.xml +++ b/o.apache.tools.ant.module/apichanges.xml @@ -109,6 +109,22 @@ + + + + Added a method to mark an execution as user / non-user into the AntTargetExecutor.Env + + + + + +

Added a method AntTargetExecutor.Env.setUserActionto mark an execution as user / non-user. + The executions marked as user actions are registered in the UI support + org.netbeans.spi.project.ui.support.BuildExecutionSupport. By default the execution is an user action. +

+
+ +
diff --git a/o.apache.tools.ant.module/nbproject/project.properties b/o.apache.tools.ant.module/nbproject/project.properties --- a/o.apache.tools.ant.module/nbproject/project.properties +++ b/o.apache.tools.ant.module/nbproject/project.properties @@ -42,7 +42,7 @@ javac.compilerargs=-Xlint:unchecked javac.source=1.8 -spec.version.base=3.84.0 +spec.version.base=3.85.0 compile.ant.jar=${ant.core.lib} compile.ant-launcher.jar=${ant.core.lib}/../ant-launcher.jar src-bridge.cp.extra=build/classes:${compile.ant.jar}:${compile.ant-launcher.jar} diff --git a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/api/AntTargetExecutor.java b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/api/AntTargetExecutor.java --- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/api/AntTargetExecutor.java +++ b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/api/AntTargetExecutor.java @@ -118,6 +118,7 @@ assert env.canBeReplaced != null; te.setTabReplaceStrategy(env.canReplace,env.canBeReplaced); } + te.setUserAction(env.userAction); if (env.getLogger() == null) { return te.execute(); } else { @@ -139,6 +140,7 @@ private String preferredName; private Predicate canReplace; private Predicate canBeReplaced; + private boolean userAction; /** Create instance of Env class describing environment for Ant target execution. */ @@ -147,6 +149,7 @@ properties = new Properties(); properties.putAll(AntSettings.getProperties()); concealedProperties = Collections.emptySet(); + userAction = true; } /** @@ -259,5 +262,18 @@ this.canReplace = canReplace; this.canBeReplaced = canBeReplaced; } + + /** + * Marks the execution as an user action. + * The executions marked as user actions are registered in the + * UI support {@link org.netbeans.spi.project.ui.support.BuildExecutionSupport}. + * By default the execution is an user action. + * @param userAction if true the execution is registered into + * the {@link org.netbeans.spi.project.ui.support.BuildExecutionSupport} + * @since 3.85 + */ + public void setUserAction(final boolean userAction) { + this.userAction = userAction; + } } } diff --git a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/LastTargetExecuted.java b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/LastTargetExecuted.java --- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/LastTargetExecuted.java +++ b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/LastTargetExecuted.java @@ -69,7 +69,8 @@ */ public class LastTargetExecuted implements BuildExecutionSupport.ActionItem { - private LastTargetExecuted() {} + private LastTargetExecuted() { + } private File buildScript; //private static int verbosity; @@ -81,6 +82,7 @@ private Boolean shouldSaveAllDocs; private Predicate canReplace; private Predicate canBeReplaced; + private boolean wasRegistered; /** Called from {@link TargetExecutor}. */ static LastTargetExecuted record( @@ -92,7 +94,8 @@ @NullAllowed final Boolean shouldSaveAllDocs, @NonNull final Predicate canReplace, @NonNull final Predicate canBeReplaced, - Thread thread) { + Thread thread, + final boolean shouldRegister) { LastTargetExecuted rec = new LastTargetExecuted(); rec.buildScript = buildScript; //LastTargetExecuted.verbosity = verbosity; @@ -104,14 +107,19 @@ rec.shouldSaveAllDocs = shouldSaveAllDocs; rec.canReplace = canReplace; rec.canBeReplaced = canBeReplaced; - BuildExecutionSupport.registerRunningItem(rec); + if (shouldRegister) { + BuildExecutionSupport.registerRunningItem(rec); + } + rec.wasRegistered = shouldRegister; return rec; } static void finish(LastTargetExecuted exc) { - BuildExecutionSupport.registerFinishedItem(exc); + if (exc.wasRegistered) { + BuildExecutionSupport.registerFinishedItem(exc); + } } - + /** * Get the last build script to be run. * @return the last-run build script, or null if nothing has been run yet (or the build script disappeared etc.) diff --git a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java --- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java +++ b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java @@ -134,6 +134,7 @@ private Boolean shouldSaveAllDocs; private Predicate canReplace = (s) -> true; private Predicate canBeReplaced = (s) -> true; + private boolean userAction = true; private volatile Set concealedProperties; /** targets may be null to indicate default target */ @@ -173,6 +174,10 @@ this.canBeReplaced = canBeReplaced; } + public void setUserAction(final boolean userAction) { + this.userAction = userAction; + } + private static String getProcessDisplayName(AntProjectCookie pcookie, List targetNames) { Element projel = pcookie.getProjectElement(); String projectName; @@ -527,7 +532,8 @@ shouldSaveAllDocs, canReplace, canBeReplaced, - Thread.currentThread()); + Thread.currentThread(), + userAction); sa.t = thisExec[0]; // Don't hog the CPU, the build might take a while: