sdedic commented on code in PR #7655:
URL: https://github.com/apache/netbeans/pull/7655#discussion_r1720770110


##########
java/maven/src/org/netbeans/modules/maven/problems/MavenModelProblemsProvider.java:
##########
@@ -577,6 +580,24 @@ public void invokeAction(String command, Lookup context) 
throws IllegalArgumentE
             } else {
                 LOG.log(Level.FINE, "Resolving sanity build action");
                 CompletableFuture<ProjectProblemsProvider.Result> r = 
saba.resolve(context);
+                // I didn't want to provide yet another public interface, so 
this code checks for a Consumer,
+                // whose implementation class specializes the T type to 
org.openide.Cancellable
+                // 
+                // If the context lookup can accept a Cancellable 
implementation, we provide one, that can cancel the running process.
+                Consumer<Cancellable> c = context.lookup(Consumer.class);
+                if (c != null) {
+                    int index = 0;
+                    Class[] interfaces = c.getClass().getInterfaces();
+                    for (Type t  : c.getClass().getGenericInterfaces()) {
+                        if 
(interfaces[index].getName().equals(Consumer.class.getName())) {
+                            if 
(((ParameterizedType)t).getActualTypeArguments()[0].getTypeName().equals(Cancellable.class.getName()))
 {
+                                c.accept(() -> r.cancel(true));
+                                break;
+                            }
+                        }
+                        index++;
+                    }
+                }

Review Comment:
   addressed in 4c091822130a



-- 
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.

To unsubscribe, e-mail: [email protected]

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