public class TransformConfigUtil
extends java.lang.Object
For an ITransformConfig
returned by any of the methods of this
class the following is true:
IInheritingTransformConfig
.
ITransformContext
returned by it's
methods can be cast to ITransformationConfigurationContext
.
Modifier and Type | Method and Description |
---|---|
static ITransformConfig |
copyConfig(ITransformConfig config)
Returns a copy of the given transformation configuration.
|
static ITransformConfig |
createConfiguration(ITransformationDescriptor forwardDescriptor,
ITransformationDescriptor reverseDescriptor,
org.eclipse.core.resources.IFile file)
This method will create a new transformation configuration based on the
transformations identified by the supplied descriptors.
|
static ITransformConfig |
createConfiguration(java.lang.String name,
ITransformationDescriptor forwardDescriptor,
ITransformationDescriptor reverseDescriptor,
org.eclipse.core.resources.IContainer container)
Deprecated.
Use createConfiguration(ITransformationDescriptor,
ITransformationDescriptor, IFile) instead.
|
static void |
deleteConfiguration(ITransformConfig configuration)
This method will delete a transformation configuration file.
|
static ITransformConfig[] |
getConfigurations(ITransformationDescriptor descriptor)
This method will return the current array of transformation configurations
that are defined against the given transformation descriptor.
|
static java.util.List<java.lang.String> |
getOverriddenProperties(ITransformConfig config)
Deprecated.
Use getOverriddenProperties(ITransformConfig, boolean)
instead.
|
static java.util.List<java.lang.String> |
getOverriddenProperties(ITransformConfig config,
boolean includeCoreIds)
Returns the list of property ids that correspond to properties with
overridden values.
|
static ITransformConfig |
loadConfiguration(org.eclipse.core.resources.IFile file)
Creates a new
ITransformConfig based on the contents of the
given XML file. |
static ITransformConfig |
loadConfiguration(org.eclipse.core.resources.IFile file,
boolean reRead)
Loads the given transformation configuration file
|
static ITransformConfig |
loadConfiguration(java.io.InputStream in,
boolean resolve)
Load configuration from input stream
|
static ITransformConfig |
loadConfiguration(java.net.URL url)
Creates a new
TransformConfig by opening a stream to the
given URL. |
static ITransformConfig |
loadConfiguration(java.net.URL url,
boolean reRead)
Creates a new
TransformConfig by opening a stream to the
given URL. |
static boolean |
openConfigurationEditor(ITransformConfig configuration)
This method will open the transformation configuration editor for the
given transformaton configuration.
|
static boolean |
saveConfiguration(ITransformConfig config)
Write the given
ITransformConfig to a file. |
static boolean |
saveConfiguration(ITransformConfig config,
boolean doValidate)
Write the given
ITransformConfig to a file. |
static void |
saveConfiguration(ITransformConfig config,
java.io.OutputStream out)
Save configuration to output stream
|
static org.eclipse.core.runtime.IStatus |
validateConfiguration(ITransformConfig config,
boolean updateMarkers)
Validates the transformation configuration.
|
public static ITransformConfig[] getConfigurations(ITransformationDescriptor descriptor)
If the given descriptor is 'null' or its ID does not match an existing registered transformation then 'null' is returned to indicate a logic error.
descriptor
- The transformation descriptor identifying the transformation to
get the configurations for.@Deprecated public static ITransformConfig createConfiguration(java.lang.String name, ITransformationDescriptor forwardDescriptor, ITransformationDescriptor reverseDescriptor, org.eclipse.core.resources.IContainer container)
name
- The name for the new configuration.forwardDescriptor
- The descriptor identifying the forward
transformation for the new transformation configuration.reverseDescriptor
- The descriptor identifying the reverse
transformation for the new transformation configuration.container
- The container to create the transformation
configuration in.
java.lang.IllegalArgumentException
- when the forward id is null or the
forward or reverse id does not match a registered transformation.java.lang.IllegalStateException
- if the forward transformation could
not be instantiated.public static ITransformConfig createConfiguration(ITransformationDescriptor forwardDescriptor, ITransformationDescriptor reverseDescriptor, org.eclipse.core.resources.IFile file)
forwardDescriptor
- The descriptor identifying the forward
transformation for the new transformation configuration. It must not be
null.reverseDescriptor
- The descriptor identifying the reverse
transformation for the new transformation configuration. It can be null
if a reverse transformation is not used.file
- The config file to create. It can be null if the client only
wants to create an in memory configuration.
java.lang.IllegalArgumentException
- when the forward descriptor is null.java.lang.IllegalStateException
- if the forward transformation could
not be instantiated.public static void deleteConfiguration(ITransformConfig configuration) throws org.eclipse.core.runtime.CoreException
configuration
- The tranformation configuration to delete.org.eclipse.core.runtime.CoreException
- When the transformation configuration cannot be
deleted.public static boolean openConfigurationEditor(ITransformConfig configuration)
configuration
- The transformation configuration to edit.public static ITransformConfig loadConfiguration(org.eclipse.core.resources.IFile file) throws java.io.FileNotFoundException, java.io.IOException
ITransformConfig
based on the contents of the
given XML file.file
- The XML file to read from.ITransformConfig
. If there were
problems parsing the information in the file null will be returned.
null will also be returned if the forward or reverse transformation
referenced in the file is not registered or if the forward
transformation cannot be instantiated.java.io.FileNotFoundException
- If the file cannot be found.java.io.IOException
- If the file cannot be read.public static ITransformConfig loadConfiguration(org.eclipse.core.resources.IFile file, boolean reRead) throws java.io.FileNotFoundException, java.io.IOException
file
- The XML file to read from.reRead
- Whether to re-read the file or use a cached config insteadITransformConfig
. If reRead is false, would
return a cached config. If reRead is true and if there were
problems parsing the information in the file null will be returned.
null will also be returned if the forward or reverse transformation
referenced in the file is not registered or if the forward
transformation cannot be instantiated.java.io.FileNotFoundException
- If the file cannot be found.java.io.IOException
- If the file cannot be read.public static ITransformConfig loadConfiguration(java.net.URL url, boolean reRead) throws java.io.FileNotFoundException, java.io.IOException
TransformConfig
by opening a stream to the
given URL.
url
- The URL to read from.reRead
- Whether to re-read the contents from the streamITransformConfig
. If reRead was false, would return
a cached config. If reRead was true and if there were
problems parsing the information from the stream, null will be
returned. null will also be returned if the forward or reverse
transformation is not registered or if the forward transformation
cannot be instantiated.java.io.FileNotFoundException
- If the file referenced by the URL cannot
be found.java.io.IOException
- if there was a problem creating or accessing the
stream to the URL.public static ITransformConfig loadConfiguration(java.net.URL url) throws java.io.FileNotFoundException, java.io.IOException
TransformConfig
by opening a stream to the
given URL.
url
- The URL to read from.ITransformConfig
. If there were
problems parsing the information from the stream, null will be
returned. null will also be returned if the forward or reverse
transformation is not registered or if the forward transformation
cannot be instantiated.java.io.FileNotFoundException
- If the file referenced by the URL cannot
be found.java.io.IOException
- if there was a problem creating or accessing the
stream to the URL.public static ITransformConfig loadConfiguration(java.io.InputStream in, boolean resolve) throws java.io.IOException
in
- java.io.IOException
public static void saveConfiguration(ITransformConfig config, java.io.OutputStream out) throws java.io.IOException
config
- out
- java.io.IOException
public static boolean saveConfiguration(ITransformConfig config)
ITransformConfig
to a file. The file must be
set in the config prior to calling this method.config
- The config to write to a file.public static boolean saveConfiguration(ITransformConfig config, boolean doValidate)
ITransformConfig
to a file. The file must be
set in the config prior to calling this method.config
- The config to write to a file.doValidate
- True if the config should be validated to update the
problem markers. False otherwise.public static org.eclipse.core.runtime.IStatus validateConfiguration(ITransformConfig config, boolean updateMarkers)
config
- The transformation configuration to validate.updateMarkers
- True if the markers of the file corresponding to
the transformation configuration should be updated based on the results
of the validation.IStatus
that contains the validation results.@Deprecated public static java.util.List<java.lang.String> getOverriddenProperties(ITransformConfig config)
ITransformConfig.PARENT_CONFIGS
.config
- The transformation configuration to find the overridden
property values in.public static java.util.List<java.lang.String> getOverriddenProperties(ITransformConfig config, boolean includeCoreIds)
ITransformConfig.PARENT_CONFIGS
.
There are some properties managed by the transformation core that are overridden in a transformation context even if the client does not explicitly set it. The client can specify if these properties should be included in the returned list by setting the includeCoreIds parameter.
config
- The transformation configuration to find the overridden
property values in.includeCoreIds
- True if ids managed by the transformation core
should be included. False otherwise.public static ITransformConfig copyConfig(ITransformConfig config)
IFile
.
The property values will be the same instances in both transformation configurations. Clients must be aware that modifying these will impact both transformation configurations.
config
- The transformation configuration to copy.