org.eclipse.viatra.query.tooling.core.project

## Class ProjectGenerationHelper

- java.lang.Object
- - org.eclipse.viatra.query.tooling.core.project.ProjectGenerationHelper

-     public abstract class ProjectGenerationHelper
      extends java.lang.Object

  A common helper class for generating VIATRA Query-related projects.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.List<java.lang.String>` | `SINGLESOURCEFOLDER` A single source folder named src
    `static java.util.List<java.lang.String>` | `SOURCEFOLDERS` Two source folders: src to be manually written and src-gen to contain generated code

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProjectGenerationHelper()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addFileToProject(org.eclipse.core.resources.IContainer container, org.eclipse.core.runtime.Path path, java.io.InputStream contentStream, org.eclipse.core.runtime.IProgressMonitor monitor)` Adds a file to a container.
    `static boolean` | `checkBundleDependency(org.eclipse.core.resources.IProject project, java.lang.String dependency)` Checks whether the project depends on a selected bundle ID
    `static void` | `checkOpenPDEProject(org.eclipse.core.resources.IProject project)` Checks whether the given project exists, is open and has PDE plug-in nature configured.
    `static void` | `createProject(org.eclipse.core.resources.IProjectDescription description, org.eclipse.core.resources.IProject proj, java.util.List<java.lang.String> additionalDependencies, org.eclipse.core.runtime.IProgressMonitor monitor)` Creates a new VIATRA Query project: a plug-in project with src and src-gen folders and specific dependencies.
    `static void` | `ensureBundleDependencies(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies)` Updates project manifest to ensure the selected bundle dependencies are set.
    `static void` | `ensureBundleDependenciesAndPackageImports(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies, java.util.List<java.lang.String> importPackages, org.eclipse.core.runtime.IProgressMonitor monitor)` Updates project manifest to ensure the selected bundle dependencies are set.
    `static void` | `ensureExtensions(org.eclipse.core.resources.IProject project, java.lang.Iterable<ExtensionData> contributedExtensions, java.lang.Iterable<org.eclipse.xtext.xbase.lib.Pair<java.lang.String,java.lang.String>> removedExtensions)` Updates the selected project to contain the selected extension.
    `static void` | `ensureExtensions(org.eclipse.core.resources.IProject project, java.lang.Iterable<ExtensionData> contributedExtensions, java.lang.Iterable<org.eclipse.xtext.xbase.lib.Pair<java.lang.String,java.lang.String>> removedExtensions, org.eclipse.core.runtime.IProgressMonitor monitor)` Updates the selected project to contain the selected extension.
    `static void` | `ensurePackageExports(org.eclipse.core.resources.IProject project, java.util.Collection<java.lang.String> dependencies)` Updates project manifest to ensure the selected packages are exported.
    `static void` | `ensurePackageExports(org.eclipse.core.resources.IProject project, java.util.Collection<java.lang.String> exports, org.eclipse.core.runtime.IProgressMonitor monitor)` Updates project manifest to ensure the selected packages are exported.
    `static void` | `ensurePackageImports(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> packageImports)` Updates project manifest to ensure the selected package imports are set.
    `static void` | `ensureSourceFolder(org.eclipse.core.resources.IProject project, java.lang.String folder, org.eclipse.core.runtime.IProgressMonitor monitor)` Ensures that the project contains the required folder as source folder.
    `static void` | `ensureSourceFolders(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor)` Deprecated. Use `ensureSourceFolders(IProject,List,IProgressMonitor)` instead
    `static void` | `ensureSourceFolders(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> requiredSourceFolders, org.eclipse.core.runtime.IProgressMonitor monitor)` Ensures that the project contains the provided folders as source folders.
    `static void` | `fillProjectMetadata(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies, java.util.List<java.lang.String> packageImports, org.eclipse.pde.core.project.IBundleProjectService service, org.eclipse.pde.core.project.IBundleProjectDescription bundleDesc, org.eclipse.core.runtime.IPath[] additionalBinIncludes)` Initializes the plug-in metadata of a newly created project.
    `static java.lang.String` | `getBundleSymbolicName(org.eclipse.core.resources.IProject project)`
    `static void` | `initializePluginProject(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies, org.eclipse.core.runtime.IPath[] additionalBinIncludes)`
    `static void` | `initializePluginProject(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies, org.eclipse.core.runtime.IPath[] additionalBinIncludes, org.eclipse.core.runtime.IProgressMonitor monitor)`
    `static boolean` | `isOpenPDEProject(org.eclipse.core.resources.IProject project)` Return true if the given project exists, is open and has PDE plug-in nature configured
    `static void` | `removeAllExtension(org.eclipse.core.resources.IProject project, java.util.Collection<org.eclipse.xtext.xbase.lib.Pair<java.lang.String,java.lang.String>> removableExtensionIdentifiers)` Removes all extensions from the project, if the extension's pointId equals to one of the given pointId.
    `static void` | `removePackageExports(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies)` Updates project manifest to ensure the selected packages are removed.
    `static void` | `removePackageExports(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies, org.eclipse.core.runtime.IProgressMonitor monitor)` Updates project manifest to ensure the selected packages are removed.
    `static void` | `replaceBundleDependencies(org.eclipse.pde.core.project.IBundleProjectService service, org.eclipse.pde.core.project.IBundleProjectDescription bundleDesc, java.util.Map<java.lang.String,java.lang.String> replacedDependencies, java.util.Map<java.lang.String,org.eclipse.osgi.service.resolver.VersionRange> versions)` Updates plugin Manifest file to replace plug-in dependencies according to the given Map
    `static void` | `replaceBundledependencies(org.eclipse.core.resources.IProject project, java.util.Map<java.lang.String,java.lang.String> replacedDependencies, java.util.Map<java.lang.String,org.eclipse.osgi.service.resolver.VersionRange> versions, org.eclipse.core.runtime.IProgressMonitor monitor)` Deprecated. Misspelled method, call `replaceBundledependencies(IProject, Map, Map, IProgressMonitor)` instead.
    `static void` | `replaceBundleDependencies(org.eclipse.core.resources.IProject project, java.util.Map<java.lang.String,java.lang.String> replacedDependencies, java.util.Map<java.lang.String,org.eclipse.osgi.service.resolver.VersionRange> versions, org.eclipse.core.runtime.IProgressMonitor monitor)` Updates the plugin dependency settings of the given project by replacing entries according to the given map.
    `static void` | `updateNatures(org.eclipse.core.resources.IProject proj, java.util.Collection<java.lang.String> naturesToAdd, java.util.Collection<java.lang.String> naturesToRemove, org.eclipse.core.runtime.IProgressMonitor monitor)` Updates the set of project natures of a selected project

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SOURCEFOLDERS

          public static final java.util.List<java.lang.String> SOURCEFOLDERS

      Two source folders: src to be manually written and src-gen to contain generated code

    - #### SINGLESOURCEFOLDER

          public static final java.util.List<java.lang.String> SINGLESOURCEFOLDER

      A single source folder named src

  - ### Constructor Detail

    - #### ProjectGenerationHelper

          public ProjectGenerationHelper()

  - ### Method Detail

    - #### isOpenPDEProject

          public static boolean isOpenPDEProject(org.eclipse.core.resources.IProject project)

      Return true if the given project exists, is open and has PDE plug-in nature configured
      Parameters:
        `project` -

    - #### checkOpenPDEProject

          public static void checkOpenPDEProject(org.eclipse.core.resources.IProject project)

      Checks whether the given project exists, is open and has PDE plug-in nature configured. Throws an `IllegalArgumentException` otherwise.
      Parameters:
        `project` -

    - #### createProject

          public static void createProject(org.eclipse.core.resources.IProjectDescription description,
                                           org.eclipse.core.resources.IProject proj,
                                           java.util.List<java.lang.String> additionalDependencies,
                                           org.eclipse.core.runtime.IProgressMonitor monitor)
                                    throws org.eclipse.core.runtime.CoreException

      Creates a new VIATRA Query project: a plug-in project with src and src-gen folders and specific dependencies.
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### updateNatures

          public static void updateNatures(org.eclipse.core.resources.IProject proj,
                                           java.util.Collection<java.lang.String> naturesToAdd,
                                           java.util.Collection<java.lang.String> naturesToRemove,
                                           org.eclipse.core.runtime.IProgressMonitor monitor)
                                    throws org.eclipse.core.runtime.CoreException

      Updates the set of project natures of a selected project
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### addFileToProject

          public static void addFileToProject(org.eclipse.core.resources.IContainer container,
                                              org.eclipse.core.runtime.Path path,
                                              java.io.InputStream contentStream,
                                              org.eclipse.core.runtime.IProgressMonitor monitor)
                                       throws org.eclipse.core.runtime.CoreException

      Adds a file to a container.
      Parameters:
        `container` - the container to add the file to
        `path` - the path of the newly created file
        `contentStream` - the file will be filled with this stream's contents
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### initializePluginProject

          public static void initializePluginProject(org.eclipse.core.resources.IProject project,
                                                     java.util.List<java.lang.String> dependencies,
                                                     org.eclipse.core.runtime.IPath[] additionalBinIncludes)
                                              throws org.eclipse.core.runtime.CoreException

      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### initializePluginProject

          public static void initializePluginProject(org.eclipse.core.resources.IProject project,
                                                     java.util.List<java.lang.String> dependencies,
                                                     org.eclipse.core.runtime.IPath[] additionalBinIncludes,
                                                     org.eclipse.core.runtime.IProgressMonitor monitor)
                                              throws org.eclipse.core.runtime.CoreException

      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### fillProjectMetadata

          public static void fillProjectMetadata(org.eclipse.core.resources.IProject project,
                                                 java.util.List<java.lang.String> dependencies,
                                                 java.util.List<java.lang.String> packageImports,
                                                 org.eclipse.pde.core.project.IBundleProjectService service,
                                                 org.eclipse.pde.core.project.IBundleProjectDescription bundleDesc,
                                                 org.eclipse.core.runtime.IPath[] additionalBinIncludes)

      Initializes the plug-in metadata of a newly created project.
      Parameters:
        `project` - the plug-in project to create the metadata for. The plug-in id will be the same as the project name
        `dependencies` - a list of required bundles to add
        `service` -
        `bundleDesc` -

    - #### checkBundleDependency

          public static boolean checkBundleDependency(org.eclipse.core.resources.IProject project,
                                                      java.lang.String dependency)
                                               throws org.eclipse.core.runtime.CoreException

      Checks whether the project depends on a selected bundle ID
      Parameters:
        `project` - an existing, open plug-in project to check
        `dependency` - bundle identifier
      Returns:
        true, if the project depends on the given bundle
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensureBundleDependencies

          public static void ensureBundleDependencies(org.eclipse.core.resources.IProject project,
                                                      java.util.List<java.lang.String> dependencies)
                                               throws org.eclipse.core.runtime.CoreException

      Updates project manifest to ensure the selected bundle dependencies are set. Does not change existing dependencies.
      Parameters:
        `project` -
        `dependencies` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensurePackageImports

          public static void ensurePackageImports(org.eclipse.core.resources.IProject project,
                                                  java.util.List<java.lang.String> packageImports)
                                           throws org.eclipse.core.runtime.CoreException

      Updates project manifest to ensure the selected package imports are set. Does not change existing package imports or required bundle declarations.
      Parameters:
        `project` -
        `packageImports` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensureBundleDependenciesAndPackageImports

          public static void ensureBundleDependenciesAndPackageImports(org.eclipse.core.resources.IProject project,
                                                                       java.util.List<java.lang.String> dependencies,
                                                                       java.util.List<java.lang.String> importPackages,
                                                                       org.eclipse.core.runtime.IProgressMonitor monitor)
                                                                throws org.eclipse.core.runtime.CoreException

      Updates project manifest to ensure the selected bundle dependencies are set. Does not change existing dependencies.
      Parameters:
        `project` - an existing, open PDE plug-in project
        `dependencies` -
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### replaceBundledependencies

          @Deprecated
          public static void replaceBundledependencies(org.eclipse.core.resources.IProject project,
                                                                   java.util.Map<java.lang.String,java.lang.String> replacedDependencies,
                                                                   java.util.Map<java.lang.String,org.eclipse.osgi.service.resolver.VersionRange> versions,
                                                                   org.eclipse.core.runtime.IProgressMonitor monitor)
                                                            throws org.eclipse.core.runtime.CoreException

      Deprecated. Misspelled method, call `replaceBundledependencies(IProject, Map, Map, IProgressMonitor)` instead.
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### replaceBundleDependencies

          public static void replaceBundleDependencies(org.eclipse.core.resources.IProject project,
                                                       java.util.Map<java.lang.String,java.lang.String> replacedDependencies,
                                                       java.util.Map<java.lang.String,org.eclipse.osgi.service.resolver.VersionRange> versions,
                                                       org.eclipse.core.runtime.IProgressMonitor monitor)
                                                throws org.eclipse.core.runtime.CoreException

      Updates the plugin dependency settings of the given project by replacing entries according to the given map. This method preserves optional and re-export flags, and updates version settings (if was originally set)
      Parameters:
        `project` - the project to apply changes on
        `replacedDependencies` - bundle IDs to replace dependencies
        `versions` - version ranges to set for the new entries
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`
      Since:
        1.5

    - #### replaceBundleDependencies

          public static void replaceBundleDependencies(org.eclipse.pde.core.project.IBundleProjectService service,
                                                       org.eclipse.pde.core.project.IBundleProjectDescription bundleDesc,
                                                       java.util.Map<java.lang.String,java.lang.String> replacedDependencies,
                                                       java.util.Map<java.lang.String,org.eclipse.osgi.service.resolver.VersionRange> versions)

      Updates plugin Manifest file to replace plug-in dependencies according to the given Map
      Parameters:
        `service` -
        `bundleDesc` -
        `replacedDependencies` -

    - #### ensurePackageExports

          public static void ensurePackageExports(org.eclipse.core.resources.IProject project,
                                                  java.util.Collection<java.lang.String> dependencies)
                                           throws org.eclipse.core.runtime.CoreException

      Updates project manifest to ensure the selected packages are exported. Does not change existing exports.
      Parameters:
        `project` -
        `dependencies` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensurePackageExports

          public static void ensurePackageExports(org.eclipse.core.resources.IProject project,
                                                  java.util.Collection<java.lang.String> exports,
                                                  org.eclipse.core.runtime.IProgressMonitor monitor)
                                           throws org.eclipse.core.runtime.CoreException

      Updates project manifest to ensure the selected packages are exported. Does not change existing exports.
      Parameters:
        `project` - an existing, open PDE plug-in project
        `exports` - a non-empty list of package exports
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### removePackageExports

          public static void removePackageExports(org.eclipse.core.resources.IProject project,
                                                  java.util.List<java.lang.String> dependencies,
                                                  org.eclipse.core.runtime.IProgressMonitor monitor)
                                           throws org.eclipse.core.runtime.CoreException

      Updates project manifest to ensure the selected packages are removed. Does not change existing exports.
      Parameters:
        `project` - an existing, open plug-in project
        `dependencies` -
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensureExtensions

          public static void ensureExtensions(org.eclipse.core.resources.IProject project,
                                              java.lang.Iterable<ExtensionData> contributedExtensions,
                                              java.lang.Iterable<org.eclipse.xtext.xbase.lib.Pair<java.lang.String,java.lang.String>> removedExtensions)
                                       throws org.eclipse.core.runtime.CoreException

      Updates the selected project to contain the selected extension. The extensions are identified using an identifier and extension point together; old extensions are replaced with the new ones, other extensions are kept intact.
      Parameters:
        `project` -
        `contributedExtensions` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensureExtensions

          public static void ensureExtensions(org.eclipse.core.resources.IProject project,
                                              java.lang.Iterable<ExtensionData> contributedExtensions,
                                              java.lang.Iterable<org.eclipse.xtext.xbase.lib.Pair<java.lang.String,java.lang.String>> removedExtensions,
                                              org.eclipse.core.runtime.IProgressMonitor monitor)
                                       throws org.eclipse.core.runtime.CoreException

      Updates the selected project to contain the selected extension. The extensions are identified using an identifier and extension point together; old extensions are replaced with the new ones, other extensions are kept intact. An extension will be ignored, if exist in the removedExtensions list.
      Parameters:
        `project` - an existing, open PDE plug-in project
        `contributedExtensions` -
        `removedExtensions` -
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### removePackageExports

          public static void removePackageExports(org.eclipse.core.resources.IProject project,
                                                  java.util.List<java.lang.String> dependencies)
                                           throws org.eclipse.core.runtime.CoreException

      Updates project manifest to ensure the selected packages are removed. Does not change existing exports.
      Parameters:
        `project` -
        `dependencies` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### removeAllExtension

          public static void removeAllExtension(org.eclipse.core.resources.IProject project,
                                                java.util.Collection<org.eclipse.xtext.xbase.lib.Pair<java.lang.String,java.lang.String>> removableExtensionIdentifiers)
                                         throws org.eclipse.core.runtime.CoreException

      Removes all extensions from the project, if the extension's pointId equals to one of the given pointId.
      Parameters:
        `project` - an existing, open PDE project
        `removableExtensionIdentifiers` - - contains both the extension id prefix (key), and the extension point id (value)
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensureSourceFolders

          public static void ensureSourceFolders(org.eclipse.core.resources.IProject project,
                                                 org.eclipse.core.runtime.IProgressMonitor monitor)
                                          throws org.eclipse.core.runtime.CoreException

      Deprecated. Use `ensureSourceFolders(IProject,List,IProgressMonitor)` instead
      Ensures that the project contains the src and src-gen folders as source folders.
      Parameters:
        `project` - an existing, open plug-in project
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`

    - #### ensureSourceFolder

          public static void ensureSourceFolder(org.eclipse.core.resources.IProject project,
                                                java.lang.String folder,
                                                org.eclipse.core.runtime.IProgressMonitor monitor)
                                         throws org.eclipse.core.runtime.CoreException

      Ensures that the project contains the required folder as source folder.
      Parameters:
        `project` - an existing, open plug-in project
        `folder` - a project-relative path encoded as a string
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`
      Since:
        1.5

    - #### ensureSourceFolders

          public static void ensureSourceFolders(org.eclipse.core.resources.IProject project,
                                                 java.util.List<java.lang.String> requiredSourceFolders,
                                                 org.eclipse.core.runtime.IProgressMonitor monitor)
                                          throws org.eclipse.core.runtime.CoreException

      Ensures that the project contains the provided folders as source folders.
      Parameters:
        `project` - an existing, open plug-in project
        `requiredSourceFolders` - a list of strings representing project-relative paths for source folders
        `monitor` -
      Throws:
        `org.eclipse.core.runtime.CoreException`
      Since:
        1.5

    - #### getBundleSymbolicName

          public static java.lang.String getBundleSymbolicName(org.eclipse.core.resources.IProject project)