Пример #1
0
  private void checkLibrary(Library library) {
    File libFile = new File(getDestinationFolder(), library.getName());
    TestUtil.assertPersistableAST(
        QvtOperationalStdLibrary.INSTANCE.getStdLibModule(),
        URI.createURI(libFile.toURI().toString(), true)); // $NON-NLS-1$

    assertTrue(
        "library file " + libFile + " must have been saved", libFile.exists()); // $NON-NLS-1$	
  }
Пример #2
0
  public QvtOperationalModuleEnv defineLibrary(
      Library lib, Map<String, List<EOperation>> definedOperations)
      throws LibraryCreationException {
    org.eclipse.m2m.internal.qvt.oml.expressions.Library libModule =
        QvtOperationalStdLibrary.createLibrary(lib.getId());
    // FIXME - set isBlackBox=TRUE, as soon is it gets into the AST metamodel

    QvtOperationalModuleEnv libEnv = initLibEnvironment(lib, libModule);
    URI libUri =
        URI.createHierarchicalURI(
            BlackboxUnitDescriptor.URI_QVTO_SCHEME,
            BlackboxUnitDescriptor.URI_BLACKBOX_AUTHORITY,
            null,
            new String[] {lib.getId()},
            null,
            null);
    libModule.eResource().setURI(libUri);

    org.eclipse.m2m.internal.qvt.oml.expressions.Library opModule =
        QvtOperationalStdLibrary.createLibrary(lib.getId());
    QvtOperationalModuleEnv opEnv = initLibEnvironment(lib, opModule);

    for (LibraryOperation libOp : lib.getLibraryOperations()) {
      Helper helper = defineOperation(opModule, opEnv, libOp);

      libEnv.defineImperativeOperation(helper, false, true);

      List<EOperation> listOp = definedOperations.get(helper.getName());
      if (listOp == null) {
        listOp = new LinkedList<EOperation>();
        definedOperations.put(helper.getName(), listOp);
      }
      listOp.add(helper);
    }

    // FIXME - workaround to make Environment available with the module
    ASTBindingHelper.createCST2ASTBinding(
        CSTFactory.eINSTANCE.createLibraryCS(), libEnv.getModuleContextType(), libEnv);
    return libEnv;
  }