Community
Participate
Working Groups
This looks like a regression introduced after M6. Steps to reproduce, with Sirius installed: 1. Go to a non-Sirius perspective (e.g. PDE). 2. Create a new non-Modeling project (e.g. a plug-in project). 3. Inside the new project, create a sub-folder and create a new Ecore file inside of it. 4. Convert the project into a modeling project. 5. Go to the "Modeling" perspective, and expand the project. The ecore file should be loaded and "expandable", as it should have been detected as a semantic model of the session. Works with Sirius 0.9.0 and 1.0.0M6, fails with 1.0.0rc2. The regression might be related to the changes made for https://bugs.eclipse.org/bugs/show_bug.cgi?id=430263 on the way we auto-detect semantic models.
Note that an easy workaround is to explicitly add the semantic models to the session using eh "Project Dependencies", so this does not need to be fixed for 1.0.0.
In ModelingProjectManagerImpl.doAddModelingNature(), the getSession call returns null (l339): > if (optionalModelingProject.get().getSession() != null) { > // add semantic resources if already existing in the project > addSemanticResources(project, .. > } So it does not look for existing semantic resources. org.eclipse.sirius.business.api.modelingproject.ModelingProject.getMainRepresentationsFileURI(IProgressMonitor) is called in getSession() , but we do not force the computation, and mainRepresentationUri is still null as it has not been computed yet. During the add of the modeling nature, we should explicitely compute the main representationURi, it might be done in org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.manager.ModelingProjectManagerImpl.createLocalRepresentationsFile(IProject, IProgressMonitor) juste after the session creation operation. I think this previously worked because of a listener, adapter, or some asynchronous initialization of the project. But the safe way is to do it explicitely when the ModelingProjectManagerImpl creates the main aird.
I confirm my previous comment and analysis. In the current use case, when we create a new representation file, the ModelingProject is set as invalid and has no mainRepresentationURI, we known we have to compute it. Note that if an empty representation file is in the project, when use the convert action, all semantic resources are well added.
See https://git.eclipse.org/r/#/c/30021/
Corrected by commit 9bf1a1e4b917d04e2c4f2222a8b59fcaccfa0874
*** Bug 442763 has been marked as a duplicate of this bug. ***
Available in Sirius 1.0.1.