Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 430263

Summary: Sirius is using CPU cycles upfront
Product: [Modeling] Sirius Reporter: Cedric Brun <cedric.brun>
Component: CoreAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact: Pierre-Charles David <pierre-charles.david>
Severity: normal    
Priority: P3 CC: florian.barbin, laurent.redor, maxime.porhel, pierre-charles.david
Version: 1.0.0M6Keywords: triaged
Target Milestone: 1.0.0M7   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Cedric Brun CLA 2014-03-13 06:18:37 EDT
I'm validating the modeling package and, through EcoreTools 2, it contains the Sirius runtime.

I noticed the Sirius plugins are getting loaded and started even if I'm not using it. It's probably linked to the usage of the org.eclipse.ui.startup extension point in the org.eclipse.sirius.ui bundle.

It's bothering me because it slow down the whole startup.

Is there something you can do to be more "lazy" ?
Comment 1 Cedric Brun CLA 2014-03-13 07:06:34 EDT
A few additionnal thoughts after having a quick look at the code.

It only makes sens if the workspace is up and any Sirius UI is loaded, right ?

Why isn't this triggered in the plugin activator ?
Comment 2 Maxime Porhel CLA 2014-03-13 07:07:09 EDT
We should check if it is possible to move this initialization to the model explorer / model explorer content provider (can be contributed to other CNF view) initalization.
Comment 3 Laurent Redor CLA 2014-04-09 08:04:20 EDT
This extension

<extension point="org.eclipse.ui.startup">
  <startup  class="org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.manager.ModelingProjectManagerStartup">
  </startup>
</extension>  

is a first candidate. We must analyze whether we can keep the same behavior (or nearly) without this extension.

But there is also :

  <extension
        point="org.eclipse.ui.decorators">
     <decorator
           adaptable="false"
           class="org.eclipse.sirius.ui.tools.internal.views.common.navigator.SessionLabelDecorator"
           id="org.eclipse.sirius.ui.session.decorator"
           label="Sirius Content Management"
           lightweight="true"
           location="TOP_RIGHT"
           state="true">
        <enablement>
           <or>
              <objectClass
                 name="org.eclipse.core.resources.IFile">
           </objectClass>
              <objectClass
                 name="org.eclipse.core.resources.IProject">
           </objectClass>
           </or>
        </enablement>
     </decorator>
  </extension>

The enablement condition should probably be more restrictive (sirius nature for project, ...)
Comment 4 Laurent Redor CLA 2014-04-11 09:52:04 EDT
Waiting for 3 reviews for this problem:
* https://git.eclipse.org/r/#/c/24790/
* https://git.eclipse.org/r/#/c/24838/ needed by https://git.eclipse.org/r/#/c/24839/

Warning: With these 2 fixes, Sirius plugins are always loaded if "Project Explorer" view is displayed. Indeed, Sirius provides content extension and filters to this view. It is possible to disable them but globally, even for "Model Explorer" view. This is not what is wanted.
Comment 6 Pierre-Charles David CLA 2014-05-05 07:36:47 EDT
To check whether or not a plug-in is started at some point, open the "Plug-in Registry" view and in the view's menu, enable "Show Active Plug-ins Only".
Comment 7 Pierre-Charles David CLA 2014-05-05 08:01:47 EDT
Verified on 1.0.0M7rc1 (1.0.0.20405030833), using the procedure above to see which plug-ins are started.

On Luna M6 with Sirius M6, right after startup on the Java perspective: 107 plug-ins started, 9 of them from Sirius.

On Luna M7 with Sirius M7rc1, same conditions: 77 plug-ins started, none from Sirius.

Note that going into the "Resources" perspective triggers Sirius initialization (and this starts most of our plug-ins) by default because we contribute filters and content providers through CNF extensions. If the user disables "Filters" and "Content" entries contributed by Sirius in the Project Explorer's Customize View dialog, then no Sirius plug-in is started anymore when going into the Resources perspective.
Comment 8 Pierre-Charles David CLA 2014-05-05 08:02:17 EDT
See previous comment.
Comment 9 Pierre-Charles David CLA 2014-05-12 03:46:16 EDT
Available in Sirius 1.0.0M7 (see https://wiki.eclipse.org/Sirius/1.0.0M7 & http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tag/?id=v1.0.0M7).