Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Problem with Papyrus Compare and an embedded profile?
Problem with Papyrus Compare and an embedded profile? [message #1816909] Mon, 11 November 2019 16:57 Go to next message
Oliver Gardiner is currently offline Oliver GardinerFriend
Messages: 50
Registered: May 2014
Location: Oxford, UK
Member
I have a model that we are working on collaboratively and we use Papyrus Compare to manage the merge process. We have our own plugin that extends Papyrus for our needs and it gets packaged as an RCP product.

We have recently moved to using a Profile that is registered within the plugin, rather than having it externally applied - I am now trying to use Papyrus Compare but it now fails with the error "The definition of the Profile applied on <Model> xxx has changed.". When I look at the log, the actual stack trace is as shown below. Looking at the code throwing the exception:

public EObject lookupRoot() throws NotFoundException {
if (resource == null || resource.getContents().isEmpty()) {
// The root doesn't exist.
throw new NotFoundException("No root defined in the model");
}

return resource.getContents().get(0);
}

is this because it is failing to load a resource from within the plugin?

NB: Our model is relatively complex as it is split into different domains, each within its own file that are then brought together using PackageImports - there may be issues there but I have been through by hand and the UML files are all consistent with regard to the ProfileApplication.

Thanks,

Oliver

!ENTRY org.eclipse.papyrus.uml.tools 4 0 2019-11-11 16:34:54.229
!MESSAGE Unexpected Error
!STACK 0
org.eclipse.papyrus.infra.core.resource.NotFoundException: No root defined in the model
at org.eclipse.papyrus.uml.tools.model.UmlModel.lookupRoot(UmlModel.java:114)
at org.eclipse.papyrus.uml.tools.service.ProfileDefinitionService.addRootProfileDecorationIfRequired(ProfileDefinitionService.java:140)
at org.eclipse.papyrus.uml.tools.service.ProfileDefinitionService.startService(ProfileDefinitionService.java:121)
at org.eclipse.papyrus.infra.core.services.internal.ServiceEntry.startService(ServiceEntry.java:154)
at org.eclipse.papyrus.infra.core.services.internal.StartStartupEntry.startService(StartStartupEntry.java:83)
at org.eclipse.papyrus.infra.core.services.ServicesRegistry.startServices(ServicesRegistry.java:1022)
at org.eclipse.papyrus.infra.core.services.ServicesRegistry.startRegistry(ServicesRegistry.java:490)
at org.eclipse.papyrus.compare.diagram.ide.ui.internal.ServicesRegistryInitializingHook.preLoadingHook(ServicesRegistryInitializingHook.java:37)
at org.eclipse.emf.compare.ide.internal.utils.NotLoadingResourceSet.load(NotLoadingResourceSet.java:390)
at org.eclipse.emf.compare.ide.internal.utils.NotLoadingResourceSet.create(NotLoadingResourceSet.java:155)
at org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder.createScope(ComparisonScopeBuilder.java:519)
at org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder.createMinimizedScope(ComparisonScopeBuilder.java:487)
at org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder.build(ComparisonScopeBuilder.java:182)
at org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder.create(ComparisonScopeBuilder.java:271)
at org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.EMFCompareStructureMergeViewer.compareInputChanged(EMFCompareStructureMergeViewer.java:1563)
at org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.EMFCompareStructureMergeViewer$CompareInputChangedJob.run(EMFCompareStructureMergeViewer.java:224)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Re: Problem with Papyrus Compare and an embedded profile? [message #1816927 is a reply to message #1816909] Tue, 12 November 2019 09:31 Go to previous messageGo to next message
Oliver Gardiner is currently offline Oliver GardinerFriend
Messages: 50
Registered: May 2014
Location: Oxford, UK
Member
Having gone back to earlier commits with an earlier version of the profile - but with all branches descendants of the same commit, it works as expected, i.e. not an issue with the Profile being embedded. My next guess is that this is caused by updating the profile on each branch independently after branching, e.g.:

Start point:
master uses Profile version 1.0.2
branch-a created as a new branch of master

Step 1:
Team member does some work on branch-a and commits.

At this point, branch-a and master can be compared using Papyrus Compare

Step 2:
Profile updated to 1.0.3
New profile definition applied to master when prompted.
master branch with Profile 1.0.3 committed back to repo

Step 3:
In order to merge, branch-a needs new Profile applied
branch-a with Profile 1.0.3 committed back to repo

While the models have the same Profile applied and should be comparable, comparison fails with the complaint "The definition of the Profile applied on <Model> branch-a has changed.".

My presumption is that this is caused by the fact that the new <profileApplication> declarations in each branch will be (e.g. different xmi:id values) as they have been updated independently - having said that, I have tried correcting this by hand without success!

If this analysis is correct then I guess we can have a work-around of forcing everyone to re-branch from the master as a large exercise every time we want to iterate the Profile but it would clearly be preferable to be able to just update the Profile on each branch without it breaking.

Any thoughts/correction much appreciated.

Thanks,

Oliver
Re: Problem with Papyrus Compare and an embedded profile? [message #1816929 is a reply to message #1816909] Tue, 12 November 2019 10:30 Go to previous message
Philip Langer is currently offline Philip LangerFriend
Messages: 99
Registered: March 2015
Location: Vienna, Austria
Member

Hi Oliver,

Papyrus Compare has only partial support for profile migration during the comparison (see bug 495259).

This support is mainly provided in the so-called ProfileMigrationHook, which will run through your models before the comparison and tries to migrate stereotype applications of stereotypes for which no definition can be resolved.
Profile definitions are searched based on the URI of the missing stereotypes package URI. See also class ProfileMigrationHook.

Note that this only works for static UML profiles that are registered -- it doesn't work for profiles that live in the workspace.

Anyway, diff/merge with evolving profiles is a tricky thing because you essentially change the metamodel when changing the UML profile, so within one comparison, you have to account for the change of possible attribute and reference values according to the metamodel. Sure, there are easy cases which can be supported (e.g. only additions), but it quickly becomes complex if you want to provide "full" support for that.

To be on the safe side, I would recommend to handle that issue, if possible, in a separate "organizational" process as you suggested (rebase open branches after each profile change or merge them before the profile migration).

Hope this helps!

Philip


--
Philip Langer

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:Simple SVG export
Next Topic:Map in model and code generation
Goto Forum:
  


Current Time: Fri Apr 26 12:30:12 GMT 2024

Powered by FUDForum. Page generated in 0.03774 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top