jtulach commented on a change in pull request #2232:
URL: https://github.com/apache/netbeans/pull/2232#discussion_r463406452



##########
File path: 
platform/openide.util.lookup/src/org/openide/util/lookup/ProxyLookup.java
##########
@@ -89,7 +110,96 @@ public synchronized String toString() {
         }
         return map.keySet();
     }
-    
+
+    /**
+     * A controller which allows the set of lookups being proxied to be
+     * set dynamically.
+     *
+     * @since 8.43
+     */
+    public static final class Controller {
+
+        private BiConsumer<? super Executor, ? super Lookup[]> consumer;
+
+        /**
+         * Create a controller with an initial set of lookups that will be
+         * proxied by a {@link ProxyLookup} this controller is passed to the
+         * constructor of.
+         * @param lookups An array of lookups
+         */
+        public Controller(Lookup... lookups) {
+            consumer = new InitialConsumer(lookups);
+        }
+
+        /**
+         * Create a controller with an initially empty set of lookups to
+         * proxy to.
+         */
+        public Controller() {
+            consumer = new InitialConsumer();
+        }
+
+        /**
+         * Set the lookups on the {@link ProxyLookup} this controller controls;
+         * if called before that ProxyLookup has been created, the lookup
+         * contents will be set during that ProxyLookup's constructor as if you
+         * had passed them to the constructor directly, but the executor
+         * parameter will be ignored (nothing will be listening to it while 
it's
+         * in its constructor anyway).
+         *
+         * @param exe An executor to notify in
+         * @param lookups An array of Lookups to be proxied
+         */
+        public synchronized void setLookups(Executor exe, Lookup... lookups) {
+            consumer.accept(exe, lookups);

Review comment:
       Throw whatever you prefer.




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