Eclipse programming tips (4)-wizard uses progress bar indication

Source: Internet
Author: User
When using wizard, when the operation is very expensive, the use of progress bar instructions will provide a good interface vision. Fortunately, eclipse has prepared a progress bar for us, which can be displayed as long as it is used properly.
Do not directly write the completion method in the worker mfinish method of the wizard. Use the following method:
Public Boolean initialize mfinish (){
Try {
This. getcontainer (). Run (true, false, new irunnablewithprogress (){
Public void run (iprogressmonitor Monitor)
Throws invocationtargetexception, interruptedexception {
Monitor. begintask ("task. Name", 100 );
// The following Code Write the business logic. Do not forget to call monitor. Worked (...) to move the progress bar forward.
Monitor. Done ();
}
});
Return true;
} Catch (invocationtargetexception e ){
// Exception Handling
} Catch (interruptedexception e ){
;//
}
Return false;
}

In this way, when the click is complete, a progress bar is displayed at the bottom of the wizard. After the operation is complete, the entire wizard is automatically disabled.

The above code is obtained by reading wizardprojectsimportpage. java.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.