/**
   * Generates an adapter java class for a DSL data type that has to be mapped.
   *
   * @param mappedType the DSL type that has to be mapped to the Pivot Model
   * @param genModel the genModel of the DSL model
   * @param monitor a monitor for progress status
   * @return
   */
  protected Diagnostic generateAdapter(
      GenClass genClass, GenModel genModel, String mappedType, Monitor monitor) {

    // info that a new adapter is generated
    monitor.beginTask("", 2);
    message =
        PivotAdapterGeneratorPlugin.INSTANCE.getString(
            "Generating" + mappedType + "Adapter.message",
            new Object[] {
              PivotAdapterGeneratorUtil.getAdapterClassName(genModel, genClass.getName())
            });
    monitor.subTask(message);

    // put generated code into the src folder of the new project
    String projectName = PivotAdapterGeneratorUtil.getProjectName(genModel);
    String targetPath = projectName + "/src";

    // generate the actual java class
    generateJava(
        targetPath,
        PivotAdapterGeneratorUtil.getAdapterPackage(genModel),
        PivotAdapterGeneratorUtil.getAdapterClassName(genModel, genClass),
        getJETEmitter(getJETEmitterDescriptors(), jetEmitterDescriptorIds.get(mappedType)),
        null,
        createMonitor(monitor, 1));

    return Diagnostic.OK_INSTANCE;
  }
 @Override
 public void setCanceled(boolean isCanceled) {
   if (monitor != null) {
     monitor.setCanceled(isCanceled);
   } else if (isCanceled) {
     monitor = new BasicMonitor();
     monitor.setCanceled(isCanceled);
   }
 }
 @Override
 public boolean isCanceled() {
   return (monitor != null) && monitor.isCanceled();
 }