Nullprogressmonitor does not display progress bars. For example, if there is a progressmonitor in the method parameter, we do not know whether it is empty, and progressmonitor isCodeSo there may be a lot of code if (processmonitor! = NULL )... wait. This is very troublesome. we can judge whether it is null at the beginning of the method. If it is null, We will assign it a nullprogressmonitor object. Even if it is called below, there will be no errors, but no progress bar appears.
For example:
Public class xxxoperation extends actoperation {@ override public istatus execute (iprogressmonitor monitor, iadaptable info) throws executionexception {monitor = (monitor! = NULL )? Monitor: (New nullprogressmonitor ());//... monitor. begintask ("taskname", iprogressmonitor. unknown );//... // monitor. setcanceled (true); monitor. done ();}}
Note: References: http://blog.csdn.net/neusoftware_20063500/article/details/5257906