Class ViewMigrationHandler


  • public class ViewMigrationHandler
    extends java.lang.Object
    Executes a simple XPath-based transformation for migrating the namespace fragments of a given view model file.
    • Constructor Summary

      Constructors 
      Constructor Description
      ViewMigrationHandler​(java.lang.String oldNamespaceFragment, java.lang.String newNamespaceFragment)
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​Optional<org.eclipse.emf.common.util.Diagnostic>> execute​(java.util.Set<org.eclipse.core.resources.IFile> files, org.eclipse.core.runtime.SubMonitor monitor)
      Execute the migration for all given files.
      Optional<org.eclipse.emf.common.util.Diagnostic> execute​(org.eclipse.core.resources.IFile file)
      Execute the migration for a single file and validate it.
      • Methods inherited from class java.lang.Object

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

      • ViewMigrationHandler

        public ViewMigrationHandler​(java.lang.String oldNamespaceFragment,
                                    java.lang.String newNamespaceFragment)
        Default constructor.
        Parameters:
        oldNamespaceFragment - the value of the namespace fragment to be replaced
        newNamespaceFragment - the new namespace fragment to replace the old with
    • Method Detail

      • execute

        public java.util.Map<java.lang.String,​Optional<org.eclipse.emf.common.util.Diagnostic>> execute​(java.util.Set<org.eclipse.core.resources.IFile> files,
                                                                                                              org.eclipse.core.runtime.SubMonitor monitor)
                                                                                                       throws ViewMigrationException
        Execute the migration for all given files.
        Parameters:
        files - the set of files to be migrated
        monitor - a SubMonitor that allows for reporting progress
        Returns:
        a map of file names containing the view models to be migrated to the respective Diagnostics which have been produced while loading the views
        Throws:
        ViewMigrationException - in case the migration of the view fails
      • execute

        public Optional<org.eclipse.emf.common.util.Diagnostic> execute​(org.eclipse.core.resources.IFile file)
                                                                 throws ViewMigrationException
        Execute the migration for a single file and validate it.
        Parameters:
        file - the file to be migrated
        Returns:
        the validation result after the file has been migrated, or Optional.empty() if the view could not be resolved
        Throws:
        ViewMigrationException - in case the migration of the view fails