Bug 533931 - Move ModelingProjectManager out of the UI plugin
Summary: Move ModelingProjectManager out of the UI plugin
Status: ASSIGNED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 5.1.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: Next   Edit
Assignee: Pierre Guilet CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2018-04-23 10:27 EDT by Stephane Begaudeau CLA
Modified: 2019-02-21 02:46 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Begaudeau CLA 2018-04-23 10:27:03 EDT
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.
Comment 1 Pierre-Charles David CLA 2018-04-24 02:19:41 EDT
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).
Comment 2 Laurent Fasani CLA 2018-04-25 03:36:39 EDT
- 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
            }
Comment 3 Eclipse Genie CLA 2018-08-31 10:57:24 EDT
New Gerrit change created: https://git.eclipse.org/r/128453