org.eclipse.viatra.query.tooling.core.generator.genmodel

## Interface IVQGenmodelProvider

- All Known Implementing Classes:
    GenModelMetamodelProviderService

      public interface IVQGenmodelProvider

  Helper interface for accessing vql genmodels

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.eclipse.emf.codegen.ecore.genmodel.GenPackage` | `findGenPackage(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EPackage ePackage)` Tries to find the EMF `GenPackage` for a selected `EPackage`.
    `org.eclipse.emf.codegen.ecore.genmodel.GenPackage` | `findGenPackage(org.eclipse.emf.ecore.EObject ctx, java.lang.String packageNsUri)` Tries to find the EMF `GenPackage` for a selected `EPackage`.
    `org.eclipse.emf.codegen.ecore.genmodel.GenPackage` | `findGenPackage(org.eclipse.emf.ecore.resource.ResourceSet set, org.eclipse.emf.ecore.EPackage ePackage)` Tries to find the EMF `GenPackage` for a selected `EPackage`.
    `org.eclipse.emf.codegen.ecore.genmodel.GenPackage` | `findGenPackage(org.eclipse.emf.ecore.resource.ResourceSet set, java.lang.String packageNsUri)` Tries to find the EMF `GenPackage` for a selected `EPackage`.
    `java.util.Collection<org.eclipse.emf.ecore.EPackage>` | `getAllMetamodelObjects(org.eclipse.core.resources.IProject project)` Collects all EPackage objects available from a selected project, including the ones from the EPackage Registry.
    `ViatraQueryGeneratorModel` | `getGeneratorModel(org.eclipse.emf.ecore.EObject context)` Gets the generator model for a selected VIATRA query-related context object (e.g.
    `ViatraQueryGeneratorModel` | `getGeneratorModel(org.eclipse.core.resources.IProject project, org.eclipse.emf.ecore.resource.ResourceSet set)` Gets the generator model for a selected Viatra Query project.
    `org.eclipse.core.runtime.IPath` | `getGeneratorModelPath(org.eclipse.core.resources.IProject project)` Calculates the path of the generator model from a selected project.
    `void` | `saveGeneratorModel(org.eclipse.core.resources.IProject project, ViatraQueryGeneratorModel generatorModel)` Saves the changes to the generator model instance in the selected project.

- - ### Method Detail

    - #### getGeneratorModel

          ViatraQueryGeneratorModel getGeneratorModel(org.eclipse.emf.ecore.EObject context)

      Gets the generator model for a selected VIATRA query-related context object (e.g. a `Pattern`). If the project of the pattern has no generator model specified, this method returns an empty generator model. The genmodel will be placed into the `ResourceSet` of the Pattern object.
      Parameters:
        `pattern` -
      Returns:
        the loaded generator model
      Throws:
        `java.lang.IllegalArgumentException` - if the parameter pattern is not serialized into a `ResourceSet` that is not linked to an VIATRA Query project

    - #### getGeneratorModel

          ViatraQueryGeneratorModel getGeneratorModel(org.eclipse.core.resources.IProject project,
                                                      org.eclipse.emf.ecore.resource.ResourceSet set)

      Gets the generator model for a selected Viatra Query project. If the project has no generator model specified, this method returns an empty generator model. The genmodel will be placed into the specified resource set
      Parameters:
        `project` -
        `set` -
      Returns:
        the loaded generator model

    - #### saveGeneratorModel

          void saveGeneratorModel(org.eclipse.core.resources.IProject project,
                                  ViatraQueryGeneratorModel generatorModel)
                           throws java.io.IOException

      Saves the changes to the generator model instance in the selected project. The provider assumes that the genmodel was instantiated by using the `getGeneratorModel(EObject)` or the `getGeneratorModel(IProject, ResourceSet)` methods.
      Throws:
        `java.io.IOException`

    - #### getAllMetamodelObjects

          java.util.Collection<org.eclipse.emf.ecore.EPackage> getAllMetamodelObjects(org.eclipse.core.resources.IProject project)
                                                                               throws org.eclipse.core.runtime.CoreException

      Collects all EPackage objects available from a selected project, including the ones from the EPackage Registry. If the project features an vqgen files, the packages referenced there are also included.
      Parameters:
        `project` -
      Returns:
        a non-null collection of packages
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### findGenPackage

          org.eclipse.emf.codegen.ecore.genmodel.GenPackage findGenPackage(org.eclipse.emf.ecore.EObject context,
                                                                           org.eclipse.emf.ecore.EPackage ePackage)

      Tries to find the EMF `GenPackage` for a selected `EPackage`. The context object is used for determining the actual project.
      Parameters:
        `ePackage` -
      Returns:
        the corresponding `GenPackage` for the selected `EPackage`

    - #### findGenPackage

          org.eclipse.emf.codegen.ecore.genmodel.GenPackage findGenPackage(org.eclipse.emf.ecore.resource.ResourceSet set,
                                                                           java.lang.String packageNsUri)

      Tries to find the EMF `GenPackage` for a selected `EPackage`. The resource set is expected to be the one Xtext assigns for a Java project.
      Parameters:
        `packageNsUri` -
      Returns:
        the corresponding `GenPackage` for the selected `EPackage`

    - #### findGenPackage

          org.eclipse.emf.codegen.ecore.genmodel.GenPackage findGenPackage(org.eclipse.emf.ecore.resource.ResourceSet set,
                                                                           org.eclipse.emf.ecore.EPackage ePackage)

      Tries to find the EMF `GenPackage` for a selected `EPackage`. The resource set is expected to be the one Xtext assigns for a Java project.
      Parameters:
        `packageNsUri` -
      Returns:
        the corresponding `GenPackage` for the selected `EPackage`

    - #### findGenPackage

          org.eclipse.emf.codegen.ecore.genmodel.GenPackage findGenPackage(org.eclipse.emf.ecore.EObject ctx,
                                                                           java.lang.String packageNsUri)

      Tries to find the EMF `GenPackage` for a selected `EPackage`. The context object is used for determining the actual project.
      Parameters:
        `packageNsUri` -
      Returns:
        the corresponding `GenPackage` for the selected `EPackage`

    - #### getGeneratorModelPath

          org.eclipse.core.runtime.IPath getGeneratorModelPath(org.eclipse.core.resources.IProject project)

      Calculates the path of the generator model from a selected project. If the project has no generator model defined, the method still returns the path where to look for the generator model.
      Parameters:
        `project` -
      Returns:
        a non-empty path for the generator model. It is possible that no resource exists at this path.