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.