diff options
Diffstat (limited to 'extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java')
-rw-r--r-- | extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java index e23e93e1a09..b0c1f46b6ff 100644 --- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java +++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java @@ -120,9 +120,15 @@ public class ImportTransformation { /** Execution time, in nano-seconds */ protected long executionTime = 0L; - /** Execution time of the initial model loading */ + /** Execution time of the initial model loading / ns */ protected long loadingTime = 0L; + /** Execution time for handling dangling references / ns */ + protected long danglingRefTime = 0L; + + /** Execution time for executing the UML-RT transformation / ns */ + protected long importRTTime = 0L; + /** Source URI to Target URI map (For Models/Libraries/Fragments) */ protected final Map<URI, URI> uriMappings = new HashMap<URI, URI>(); @@ -136,6 +142,7 @@ public class ImportTransformation { /** EPackages corresponding to source native profiles with specific support in the transformation */ protected static final Set<EPackage> sourceEPackages = new HashSet<EPackage>(); + protected final DependencyAnalysisHelper analysisHelper; static { sourceEPackages.add(org.eclipse.papyrus.migration.rsa.default_.DefaultPackage.eINSTANCE); @@ -144,13 +151,14 @@ public class ImportTransformation { } public ImportTransformation(URI sourceURI) { - this(sourceURI, RSAToPapyrusParametersFactory.eINSTANCE.createConfig()); + this(sourceURI, RSAToPapyrusParametersFactory.eINSTANCE.createConfig(), null); } - public ImportTransformation(URI sourceURI, Config config) { + public ImportTransformation(URI sourceURI, Config config, DependencyAnalysisHelper analysisHelper) { Assert.isNotNull(sourceURI); this.sourceURI = sourceURI; this.parameters = config; + this.analysisHelper = analysisHelper; } public void run() { @@ -239,6 +247,14 @@ public class ImportTransformation { return loadingTime; } + public long getHandleDanglingRefTime() { + return danglingRefTime; + } + + public long getImportRTTime() { + return importRTTime; + } + public Map<URI, URI> getURIMappings() { return uriMappings; } @@ -269,8 +285,6 @@ public class ImportTransformation { } catch (Exception ex) { Activator.log.error("An error occurred while loading " + getModelName(), ex); } - - monitor.subTask("Resolving all dependencies..."); } /** @@ -342,7 +356,7 @@ public class ImportTransformation { // Preloads all required transformations (Either locally or statically, depending on the cache parameter) protected IStatus loadTransformations(IProgressMonitor monitor) { for (URI transformationURI : getAllTransformationURIs()) { - IStatus status = executorsPool.preLoad(transformationURI); + executorsPool.preLoad(transformationURI); monitor.worked(1); } @@ -400,9 +414,10 @@ public class ImportTransformation { IStatus result; // Result of an individual transformation (Will be aggregated to the complete GenerationStatus) - // UML RT (First operation, because it can transform Collaborations to Classes, which has some consequences on the diagram transformation) - // TODO: Restore the UML RT transformation (Update to UML RT v3) + long startRT = System.nanoTime(); result = importRTProfile(context, monitor); + long endRT = System.nanoTime(); + this.importRTTime = endRT - startRT; generationStatus.add(result); // Diagrams @@ -535,7 +550,10 @@ public class ImportTransformation { monitor.subTask("Analyzing dangling references..."); + long startDangling = System.nanoTime(); handleDanglingURIs(resourcesToSave); + long endDangling = System.nanoTime(); + this.danglingRefTime = endDangling - startDangling; monitor.subTask("Saving models..."); @@ -562,8 +580,9 @@ public class ImportTransformation { } protected void handleDanglingURIs(Collection<Resource> resourcesToSave) { - ConfigHelper helper = new ConfigHelper(parameters); - helper.computeURIMappings(resourcesToSave); + if (analysisHelper != null) { + analysisHelper.computeURIMappings(resourcesToSave); + } } protected void unloadResourceSet(ResourceSet resourceSet) { |