/*
   * (non-Javadoc)
   * @see org.eclipse.pde.ui.launcher.AbstractPDELaunchConfiguration#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
   */
  protected void preLaunchCheck(
      ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor)
      throws CoreException {
    fModels = BundleLauncherHelper.getMergedBundleMap(configuration, true);
    fAllBundles = new HashMap(fModels.size());
    Iterator iter = fModels.keySet().iterator();
    while (iter.hasNext()) {
      IMonitorModelBase model = (IMonitorModelBase) iter.next();
      fAllBundles.put(model.getMonitorBase().getId(), model);
    }

    if (!fAllBundles.containsKey(IPDEBuildConstants.BUNDLE_OSGI)) {
      // implicitly add it
      IMonitorModelBase model = MonitorRegistry.findModel(IPDEBuildConstants.BUNDLE_OSGI);
      if (model != null) {
        fModels.put(model, "default:default"); // $NON-NLS-1$
        fAllBundles.put(IPDEBuildConstants.BUNDLE_OSGI, model);
      } else {
        String message = MDEMessages.EquinoxLaunchConfiguration_oldTarget;
        throw new CoreException(LauncherUtils.createErrorStatus(message));
      }
    }
    super.preLaunchCheck(configuration, launch, monitor);
  }