sdedic commented on a change in pull request #2641:
URL: https://github.com/apache/netbeans/pull/2641#discussion_r552560001



##########
File path: 
platform/api.progress/src/org/netbeans/api/progress/ProgressHandle.java
##########
@@ -77,6 +86,48 @@ public static ProgressHandle createHandle(String 
displayName, Cancellable allowT
     public static ProgressHandle createSystemHandle(String displayName, 
Cancellable allowToCancel) {
         return DefaultHandleFactory.get().createHandle(displayName, 
allowToCancel, false);
     }
+    
+    /**
+     * Creates a potentially cancellable handle, which can deliver an event if 
the user 'triggers' the handle. 
+     * How the handle will be presented, and what the "trigger" gesture is 
depends on the {@link Controller} 
+     * implementation. The user may make an action on the handle (other than 
cancel), which will
+     * be reflected back. Typically used to focus or display some part of the 
UI. 
+     * If {@code triggerCallback} is provided, it should handle at least 
{@link #ACTION_VIEW} action command
+     * {@link ActionEvent#getActionCommand}.
+     * 
+     * @param viewAction callback on user's trigger.
+     * @param displayName to be shown in the progress UI
+     * @param allowToCancel either null, if the task cannot be cancelled or 
+     *          an instance of {@link org.openide.util.Cancellable} that will 
be called when user 
+     *          triggers cancel of the task.
+     * @return an instance of {@link 
org.netbeans.api.progress.ProgressHandle}, initialized but not started.
+     * @since 1.59
+     */
+    public static ProgressHandle createHandle(String displayName, Cancellable 
allowToCancel, Action viewAction) {
+        ProgressHandle h = 
DefaultHandleFactory.get().createHandle(displayName, allowToCancel, true);
+        if (viewAction != null) {
+            h.addDefaultAction(viewAction);
+        }
+        return h;
+    }
+
+    /**
+     * Creates a possibly cancellable handle, <b>not initiated</b> by the 
user, e.g. for indexing, 
+     * repository or other system-launched tasks. See documentation for {@link 
#createHandle(java.lang.String, org.openide.util.Cancellable, 
java.awt.event.ActionListener)}

Review comment:
       My bad - I prototyped some variants, one of them accepted just 
`ActionListener`; but it turned out that some Action features (display name, 
icon, ...) could be also needed in displayed implementation. So I've ended up 
with `Action` and forgot to update the javadoc.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to