Community
Participate
Working Groups
The interface org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager and its implementation are located in the Eclipse Sirius UI plugin while most of its code has no dependency to the user interface. It makes things a bit more complicated to manipulate Modeling projects without any dependencies to the Sirius user interface.
Moving to 6.0 to have a look at what this would imply. We'll try to do it for 6.0 if it's simple enough, but it may slip to 6.1 if it requires too much changes (we're already late in the release cycle).
- ModelingProjectManager.loadAndOpenRepresentationsFile(xxx) encapsulates the usage of OpenRepresentationsFileJob which is useful in the context of a product with UI and also needed in some particular case where the user is required an UI interaction. In the context of a non UI product, calling SessionManager.INSTANCE.getSession(URI , IProgressMonitor).open(IProgressMonitor) is sufficient. - ModelingProjectManager.createNewModelingProject(...) open automatically the session and calls ISessionFileLoadingListener.notifySessionLoadedFromModelingProject which only listener open some editors automatically. We should split that to allow simple modelingProject creation in context of non UI product. Conclusion reworking ModelingProjectManager would be usefull today only to propose a method createBasicNewModelingProject which only create the modeling projet. The code would be such a kind below: String name = newProject.getName(); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); if (project.exists()) { String message = MessageFormat.format(SiriusServerMessages.SiriusServerProjectsService_projectAlreadyExists, name); xxx } else { IProjectDescription projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(name); projectDescription.setNatureIds(new String[] { ModelingProject.NATURE_ID }); project.create(projectDescription, new NullProgressMonitor()); project.open(new NullProgressMonitor()); URI representationsURI = URI.createPlatformResourceURI(project.getFullPath().append(ModelingProject.DEFAULT_REPRESENTATIONS_FILE_NAME).toString(), true); SessionCreationOperation sessionCreationOperation = new DefaultLocalSessionCreationOperation(representationsURI, new NullProgressMonitor()); sessionCreationOperation.execute(); xxx }
New Gerrit change created: https://git.eclipse.org/r/128453