A plug-in which uses 'execute immediately' can't get the current job from AbstractPlugin.getCurrentJob()
By looking at the code it seems like the job-id is set when the configuration wizard is started. Since this is before the job is started the id is unknown (=0). When the 'execute immediately' option is used the same plug-in instance is re-used which means that the job id is not updated. It is not a problem for jobs that are added to the job queue since everything is discarded and re-loaded from the database later when the job is about to be executed.