Search in sources :

Example 56 with RequestProcessor

use of org.openide.util.RequestProcessor in project netbeans-rcp-lite by outersky.

the class ConfigureToolbarPanel method paint.

@Override
public void paint(java.awt.Graphics g) {
    super.paint(g);
    if (firstTimeInit) {
        // this is not very nice but some Actions insist on being accessed
        // from the event queue only so let's wait till the dialog window is
        // painted before filtering out Actions without an icon
        firstTimeInit = false;
        new RequestProcessor("ToolbarPanelConfigWarmUp").post(new // NOI18N
        Runnable() {

            @Override
            public void run() {
                // warm up action nodes so that 'expand all' in actions tree is fast
                Node[] categories = root.getChildren().getNodes(true);
                for (int i = 0; i < categories.length; i++) {
                    final Node category = categories[i];
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            category.getChildren().getNodes(true);
                        }
                    });
                }
                // replace 'please wait' message with actions tree
                SwingUtilities.invokeLater(ConfigureToolbarPanel.this);
            }
        });
    }
}
Also used : Node(org.openide.nodes.Node) FilterNode(org.openide.nodes.FilterNode) AbstractNode(org.openide.nodes.AbstractNode) RequestProcessor(org.openide.util.RequestProcessor)

Aggregations

RequestProcessor (org.openide.util.RequestProcessor)56 CountDownLatch (java.util.concurrent.CountDownLatch)20 Task (org.openide.util.Task)13 HashSet (java.util.HashSet)12 ArrayList (java.util.ArrayList)8 Callable (java.util.concurrent.Callable)8 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)8 RandomlyFails (org.netbeans.junit.RandomlyFails)7 Future (java.util.concurrent.Future)6 ScheduledFuture (java.util.concurrent.ScheduledFuture)6 CancellationException (java.util.concurrent.CancellationException)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Logger (java.util.logging.Logger)2 TaskListener (org.openide.util.TaskListener)2 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 File (java.io.File)1 Enumeration (java.util.Enumeration)1 LinkedList (java.util.LinkedList)1