Class ConverterManagerImpl
java.lang.Object
com.e1c.langtool.internal.converter.ConverterManagerImpl
- All Implemented Interfaces:
IConverterManager
Implementation of the
IConverterManager interface for coordinating the conversion process between language projects.
The ConverterManagerImpl class provides methods to control and monitor the conversion activities
within the context of a specific project using a specified ProjectConverterStorage, AsyncConverter,
and TranslateLanguage.
Usage example:
// Create an instance of IProject, ProjectConverterStorage, AsyncConverter, and TranslateLanguage
IProject project = ...; // Specify the project
ProjectConverterStorage storage = ...; // Implement or obtain the instance through dependency injection
AsyncConverter converter = ...; // Implement or obtain the instance through dependency injection
TranslateLanguage language = ...; // Specify the translation language
// Create an instance of ConverterManagerImpl
ConverterManagerImpl converterManager = new ConverterManagerImpl(project, storage, converter, language);
// Obtain the converted key for a specified path
IPath path = ...; // Specify the path for conversion
IPath convertedKey = converterManager.getConvertedKey(path);
// Run the converter to convert source language project to target language project
IProject sourceLangProject = ...; // Specify the source language project
IProject targetLangProject = ...; // Specify the target language project
converterManager.runConverter(sourceLangProject, targetLangProject);
Note: All projects and paths used in this class are assumed to be non-null.
-
Constructor Summary
ConstructorsConstructorDescriptionConverterManagerImpl(org.eclipse.core.resources.IProject project, ProjectConverterStorage storage, AsyncConverter converter, TranslateLanguage language) Creates a new instance ofConverterManagerImplwith the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.core.runtime.IPathgetConvertedKey(org.eclipse.core.runtime.IPath path) Retrieves the converted key for the specified path.getConvertedValues(org.eclipse.core.runtime.IPath path) Retrieves the converted values for the specified path.Retrieves the target language for the conversion process.org.eclipse.core.resources.IProjectRetrieves the translated project associated with this manager.voidremove(org.eclipse.core.runtime.IPath path) Removes all conversion data associated with the specified path.voidremoveConvertedKey(org.eclipse.core.runtime.IPath path) Removes the key associated with the specified path from the conversion process.voidremoveConvertedValues(org.eclipse.core.runtime.IPath path) Removes the values associated with the specified path from the conversion process.voidrunConverter(org.eclipse.core.resources.IProject sourceLangProject, org.eclipse.core.resources.IProject targetLangProject) Initiates the converter to perform the conversion between the source and target language projects.voidupdateConvertedKey(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath targetPath) Updates the key associated with the specified path during the conversion process.voidupdateConvertedValues(org.eclipse.core.runtime.IPath path, FeatureKey sourceKey, FeatureKey targetKey) Updates the values associated with the specified path during the conversion process.voidupdateStringLiteralParams(org.eclipse.core.runtime.IPath path, String name, String translation) Updates the parameters in the string literal with their corresponding translations.
-
Constructor Details
-
ConverterManagerImpl
public ConverterManagerImpl(org.eclipse.core.resources.IProject project, ProjectConverterStorage storage, AsyncConverter converter, TranslateLanguage language) Creates a new instance ofConverterManagerImplwith the specified parameters.- Parameters:
project- the project for which to manage the conversion process, cannot benull.storage- the storage for managing project conversion data, cannot benull.converter- the asynchronous converter for coordinating language project conversion, cannot benull.language- the target language for the conversion process, cannot benull.
-
-
Method Details
-
runConverter
public void runConverter(org.eclipse.core.resources.IProject sourceLangProject, org.eclipse.core.resources.IProject targetLangProject) Description copied from interface:IConverterManagerInitiates the converter to perform the conversion between the source and target language projects.- Specified by:
runConverterin interfaceIConverterManager- Parameters:
sourceLangProject- the source language project, cannot benull.targetLangProject- the target language project, cannot benull.
-
getProject
public org.eclipse.core.resources.IProject getProject()Description copied from interface:IConverterManagerRetrieves the translated project associated with this manager.- Specified by:
getProjectin interfaceIConverterManager- Returns:
- the translated project, cannot be
null.
-
getLanguage
Description copied from interface:IConverterManagerRetrieves the target language for the conversion process.- Specified by:
getLanguagein interfaceIConverterManager- Returns:
- the target language, cannot be
null.
-
getConvertedValues
Description copied from interface:IConverterManagerRetrieves the converted values for the specified path.- Specified by:
getConvertedValuesin interfaceIConverterManager- Parameters:
path- the path reference for which to retrieve the converted values, cannot benull.- Returns:
- a map of converted values, where the keys are original values
and the values are their converted counterparts, cannot be
null
-
getConvertedKey
public org.eclipse.core.runtime.IPath getConvertedKey(org.eclipse.core.runtime.IPath path) Description copied from interface:IConverterManagerRetrieves the converted key for the specified path.- Specified by:
getConvertedKeyin interfaceIConverterManager- Parameters:
path- the path for which to retrieve the converted key, cannot benull.- Returns:
- the converted key, cannot be
null.
-
updateConvertedValues
public void updateConvertedValues(org.eclipse.core.runtime.IPath path, FeatureKey sourceKey, FeatureKey targetKey) Description copied from interface:IConverterManagerUpdates the values associated with the specified path during the conversion process.- Specified by:
updateConvertedValuesin interfaceIConverterManager- Parameters:
path- the path reference for which to update the values, cannot benull.sourceKey- the source key to update, cannot benull.targetKey- the target key to set, cannot benull.
-
updateStringLiteralParams
public void updateStringLiteralParams(org.eclipse.core.runtime.IPath path, String name, String translation) Description copied from interface:IConverterManagerUpdates the parameters in the string literal with their corresponding translations.- Specified by:
updateStringLiteralParamsin interfaceIConverterManager- Parameters:
path- the path to the file containing the string literal, cannot benull.name- the parameter name in the original string literal, cannot benull.translation- the translated parameter name, cannot benull.
-
updateConvertedKey
public void updateConvertedKey(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath targetPath) Description copied from interface:IConverterManagerUpdates the key associated with the specified path during the conversion process.- Specified by:
updateConvertedKeyin interfaceIConverterManager- Parameters:
path- the source path for which to update the key, cannot benull.targetPath- the target path to set, cannot benull.
-
removeConvertedValues
public void removeConvertedValues(org.eclipse.core.runtime.IPath path) Description copied from interface:IConverterManagerRemoves the values associated with the specified path from the conversion process.- Specified by:
removeConvertedValuesin interfaceIConverterManager- Parameters:
path- the path reference for which to remove the values, cannot benull.
-
removeConvertedKey
public void removeConvertedKey(org.eclipse.core.runtime.IPath path) Description copied from interface:IConverterManagerRemoves the key associated with the specified path from the conversion process.- Specified by:
removeConvertedKeyin interfaceIConverterManager- Parameters:
path- the path for which to remove the key, cannot benull.
-
remove
public void remove(org.eclipse.core.runtime.IPath path) Description copied from interface:IConverterManagerRemoves all conversion data associated with the specified path.- Specified by:
removein interfaceIConverterManager- Parameters:
path- the path for which to remove all conversion data, cannot benull.
-