Class ConverterManagerImpl

java.lang.Object
com.e1c.langtool.internal.converter.ConverterManagerImpl
All Implemented Interfaces:
IConverterManager

public class ConverterManagerImpl extends Object implements 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.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConverterManagerImpl(org.eclipse.core.resources.IProject project, ProjectConverterStorage storage, AsyncConverter converter, TranslateLanguage language)
    Creates a new instance of ConverterManagerImpl with the specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.eclipse.core.runtime.IPath
    getConvertedKey(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.IProject
    Retrieves the translated project associated with this manager.
    void
    remove(org.eclipse.core.runtime.IPath path)
    Removes all conversion data associated with the specified path.
    void
    removeConvertedKey(org.eclipse.core.runtime.IPath path)
    Removes the key associated with the specified path from the conversion process.
    void
    removeConvertedValues(org.eclipse.core.runtime.IPath path)
    Removes the values associated with the specified path from the conversion process.
    void
    runConverter(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.
    void
    updateConvertedKey(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath targetPath)
    Updates the key associated with the specified path during the conversion process.
    void
    updateConvertedValues(org.eclipse.core.runtime.IPath path, FeatureKey sourceKey, FeatureKey targetKey)
    Updates the values associated with the specified path during the conversion process.
    void
    updateStringLiteralParams(org.eclipse.core.runtime.IPath path, String name, String translation)
    Updates the parameters in the string literal with their corresponding translations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConverterManagerImpl

      public ConverterManagerImpl(org.eclipse.core.resources.IProject project, ProjectConverterStorage storage, AsyncConverter converter, TranslateLanguage language)
      Creates a new instance of ConverterManagerImpl with the specified parameters.
      Parameters:
      project - the project for which to manage the conversion process, cannot be null.
      storage - the storage for managing project conversion data, cannot be null.
      converter - the asynchronous converter for coordinating language project conversion, cannot be null.
      language - the target language for the conversion process, cannot be null.
  • Method Details

    • runConverter

      public void runConverter(org.eclipse.core.resources.IProject sourceLangProject, org.eclipse.core.resources.IProject targetLangProject)
      Description copied from interface: IConverterManager
      Initiates the converter to perform the conversion between the source and target language projects.
      Specified by:
      runConverter in interface IConverterManager
      Parameters:
      sourceLangProject - the source language project, cannot be null.
      targetLangProject - the target language project, cannot be null.
    • getProject

      public org.eclipse.core.resources.IProject getProject()
      Description copied from interface: IConverterManager
      Retrieves the translated project associated with this manager.
      Specified by:
      getProject in interface IConverterManager
      Returns:
      the translated project, cannot be null.
    • getLanguage

      public TranslateLanguage getLanguage()
      Description copied from interface: IConverterManager
      Retrieves the target language for the conversion process.
      Specified by:
      getLanguage in interface IConverterManager
      Returns:
      the target language, cannot be null.
    • getConvertedValues

      public Map<String,String> getConvertedValues(org.eclipse.core.runtime.IPath path)
      Description copied from interface: IConverterManager
      Retrieves the converted values for the specified path.
      Specified by:
      getConvertedValues in interface IConverterManager
      Parameters:
      path - the path reference for which to retrieve the converted values, cannot be null.
      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: IConverterManager
      Retrieves the converted key for the specified path.
      Specified by:
      getConvertedKey in interface IConverterManager
      Parameters:
      path - the path for which to retrieve the converted key, cannot be null.
      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: IConverterManager
      Updates the values associated with the specified path during the conversion process.
      Specified by:
      updateConvertedValues in interface IConverterManager
      Parameters:
      path - the path reference for which to update the values, cannot be null.
      sourceKey - the source key to update, cannot be null.
      targetKey - the target key to set, cannot be null.
    • updateStringLiteralParams

      public void updateStringLiteralParams(org.eclipse.core.runtime.IPath path, String name, String translation)
      Description copied from interface: IConverterManager
      Updates the parameters in the string literal with their corresponding translations.
      Specified by:
      updateStringLiteralParams in interface IConverterManager
      Parameters:
      path - the path to the file containing the string literal, cannot be null.
      name - the parameter name in the original string literal, cannot be null.
      translation - the translated parameter name, cannot be null.
    • updateConvertedKey

      public void updateConvertedKey(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath targetPath)
      Description copied from interface: IConverterManager
      Updates the key associated with the specified path during the conversion process.
      Specified by:
      updateConvertedKey in interface IConverterManager
      Parameters:
      path - the source path for which to update the key, cannot be null.
      targetPath - the target path to set, cannot be null.
    • removeConvertedValues

      public void removeConvertedValues(org.eclipse.core.runtime.IPath path)
      Description copied from interface: IConverterManager
      Removes the values associated with the specified path from the conversion process.
      Specified by:
      removeConvertedValues in interface IConverterManager
      Parameters:
      path - the path reference for which to remove the values, cannot be null.
    • removeConvertedKey

      public void removeConvertedKey(org.eclipse.core.runtime.IPath path)
      Description copied from interface: IConverterManager
      Removes the key associated with the specified path from the conversion process.
      Specified by:
      removeConvertedKey in interface IConverterManager
      Parameters:
      path - the path for which to remove the key, cannot be null.
    • remove

      public void remove(org.eclipse.core.runtime.IPath path)
      Description copied from interface: IConverterManager
      Removes all conversion data associated with the specified path.
      Specified by:
      remove in interface IConverterManager
      Parameters:
      path - the path for which to remove all conversion data, cannot be null.