Re: NB 8.1 ProgressBar not working

Werner Schulte <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <[email protected]>
Hi all.

After fiddling arround a bit I found out, that the Task.waitFinished() 
blocked the stuff.
But I needed to wait for the Finish of the action to open an Editor when 
finished.

Now my WorkerClass implements Observer and Observable and I use the 
notifyObservers and update() method to inform about the End of the 
Runnable process.

Et voila, the ProgressBar is shown !

So long searched for this. Might be worth a FAQ entry ...

Let me know, if u need more detailed description ...


Regards
Werner



Am 05.11.2016 um 13:26 schrieb Werner Schulte:
> Hi all.
>
> I know it might be a boaring question, but I cannot get my application 
> showing the Progress for a longer lasting action.
>
> When reading the projects content, the progress bar is shown correctly 
> and finished with ProgressHandle.finish.
>
> When the project is open next I eventually call an action which 
> iterates thru the data and executes long lasting code.
> I want  to show a progress bar for this as well, but it does not show 
> up at all.
>
> Have read a lot of comments, but cannot find any useful hints to fix 
> this.
>
> Note that the code is executed in is own module (tools) which has no 
> GUI at all.
> As far as I understand this should not have any influence on the 
> ProgressBar execution ?
>
> Any point to blog, FAQ or other hints would be most welcome.
>
> Here is the code ...
>
>         Runnable tsk = new Runnable() {
>             @Override
>             public void run() {
>                 final ProgressHandle prog = 
> ProgressHandleFactory.createHandle("Make " + ecus.size() + " ECUs 
> ServiceInfo" );
>                 prog.setInitialDelay(1);
>                 prog.start( ecus.size() );
>                 for (int i = 0; i < ecus.size(); i++) {
>                     IODXECU get = ecus.get(i);
>                     ECUInfo e = doFullECU(get);
>                     if (e == null) {
>                         LOG.error("doAllECUs(" + project.getName() + 
> ") - ECU[[" + get.getShortName() + "] Conversion NOK. Continue");
>                         continue;
>                     }
>                     leinfo.add(e);
>                     prog.progress("ECU[" + i + "][" + 
> get.getShortName() + "]", i);
>                     prog.progress( i);
>                     try {
>                         Thread.sleep(200);
>                     } catch (InterruptedException ex) {
>                     }
>                 }
>                 prog.finish();
>                 if (LOG.isInfoEnabled()) {
>                     LOG.info("doOneProject - [" + project.getName() + 
> "] - FINISHED");
>                 }
>
>
>             }
>         };
>         RequestProcessor rp = new RequestProcessor();
>         tproc = rp.post(tsk);
>         tproc.waitFinished();
>
> Best regards
>
> Werner
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.