public abstract class ProjectGenerationHelper
extends java.lang.Object
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 and Description |
---|
ProjectGenerationHelper() |
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.
|
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
|
public static final java.util.List<java.lang.String> SOURCEFOLDERS
public static final java.util.List<java.lang.String> SINGLESOURCEFOLDER
public static boolean isOpenPDEProject(org.eclipse.core.resources.IProject project)
project
- public static void checkOpenPDEProject(org.eclipse.core.resources.IProject project)
IllegalArgumentException
otherwise.project
- 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
org.eclipse.core.runtime.CoreException
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
org.eclipse.core.runtime.CoreException
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
container
- the container to add the file topath
- the path of the newly created filecontentStream
- the file will be filled with this stream's contentsmonitor
- org.eclipse.core.runtime.CoreException
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
org.eclipse.core.runtime.CoreException
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
org.eclipse.core.runtime.CoreException
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)
project
- the plug-in project to create the metadata for. The plug-in id will be the same as the project namedependencies
- a list of required bundles to addservice
- bundleDesc
- public static boolean checkBundleDependency(org.eclipse.core.resources.IProject project, java.lang.String dependency) throws org.eclipse.core.runtime.CoreException
project
- an existing, open plug-in project to checkdependency
- bundle identifierorg.eclipse.core.runtime.CoreException
public static void ensureBundleDependencies(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies) throws org.eclipse.core.runtime.CoreException
project
- dependencies
- org.eclipse.core.runtime.CoreException
public static void ensurePackageImports(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> packageImports) throws org.eclipse.core.runtime.CoreException
project
- packageImports
- org.eclipse.core.runtime.CoreException
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
project
- an existing, open PDE plug-in projectdependencies
- monitor
- org.eclipse.core.runtime.CoreException
@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
replaceBundledependencies(IProject, Map, Map, IProgressMonitor)
instead.org.eclipse.core.runtime.CoreException
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
project
- the project to apply changes onreplacedDependencies
- bundle IDs to replace dependenciesversions
- version ranges to set for the new entriesmonitor
- org.eclipse.core.runtime.CoreException
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)
service
- bundleDesc
- replacedDependencies
- public static void ensurePackageExports(org.eclipse.core.resources.IProject project, java.util.Collection<java.lang.String> dependencies) throws org.eclipse.core.runtime.CoreException
project
- dependencies
- org.eclipse.core.runtime.CoreException
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
project
- an existing, open PDE plug-in projectexports
- a non-empty list of package exportsmonitor
- org.eclipse.core.runtime.CoreException
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
project
- an existing, open plug-in projectdependencies
- monitor
- org.eclipse.core.runtime.CoreException
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
project
- contributedExtensions
- org.eclipse.core.runtime.CoreException
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
project
- an existing, open PDE plug-in projectcontributedExtensions
- removedExtensions
- monitor
- org.eclipse.core.runtime.CoreException
public static void removePackageExports(org.eclipse.core.resources.IProject project, java.util.List<java.lang.String> dependencies) throws org.eclipse.core.runtime.CoreException
project
- dependencies
- org.eclipse.core.runtime.CoreException
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
project
- an existing, open PDE projectremovableExtensionIdentifiers
- - contains both the extension id prefix (key), and the extension point id (value)org.eclipse.core.runtime.CoreException
public static void ensureSourceFolders(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
ensureSourceFolders(IProject,List,IProgressMonitor)
insteadproject
- an existing, open plug-in projectmonitor
- org.eclipse.core.runtime.CoreException
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
project
- an existing, open plug-in projectfolder
- a project-relative path encoded as a stringmonitor
- org.eclipse.core.runtime.CoreException
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
project
- an existing, open plug-in projectrequiredSourceFolders
- a list of strings representing project-relative paths for source foldersmonitor
- org.eclipse.core.runtime.CoreException
public static java.lang.String getBundleSymbolicName(org.eclipse.core.resources.IProject project)