Re: SwingWorker appropriate
Martin Entlicher <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <[email protected]> |
Without seeing the actual code it's hard to say why something that works with SwingWorker does not work with RequestProcessor. SwingWorker is aware of Event Dispatch Thread, while RequestProcessor is not, that can make a difference. RequestProcessor is used in the Platform internally, therefore it can be more efficient if you use it as well. But unless you need to optimize for the number of threads, I guess it's not a big deal if you keep using SwingWorker. Regards, Martin On 28.7.2016 19:51, Mario Schroeder wrote: > Hi, > > I have the following use case: > > I want to start a long running task in a background thread when the > user clicks on an 'ok' button of my dialog. When the process finishes > succesful the result shall be populated via Lookup. > But when the user clicks on cancel the tasks should be canceled too, > and the result should not be populated, or if accidently populated > simply removed. > > My scenario works fine with a SwingWorker. > > But I'm having trouble when I use the RequestProcess of NetBeans. > > My question: Is the SwingWorker appropriate for the Plattform, or > should I continue to try my luck with the RequestProcessor? > > Regards