Search code examples
eclipseeclipse-rcpeclipse-pde

Eclipse PDE: How to programmatically detect the auto-build process


In my plugin, I need to programmatically find out whether the IDE workbench has a build process running. If yes then the plugin has to wait for the process to complete before moving to the next step. If Auto Build is set on Eclipse IDE, is there any way to programmatically detect when such a build process starts to run? Thanks


Solution

  • You can wait for builds to finish using the Job Manager:

    IJobManager jobManager = Job.getJobManager();
    
    // Wait for manual build to finish if running
    jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, progressMonitor);
    
    // Wait for auto build to finish if running
    jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, progressMonitor);