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

Bug 426134

Summary: [Sirius] Sirius break context menu of other tools
Product: [Modeling] Sirius Reporter: Ansgar Radermacher <ansgar.radermacher>
Component: DiagramAssignee: Florian Barbin <florian.barbin>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: cletavernier, esteban.dugueperoux, florian.barbin, maxime.porhel, Patrick.Tessier, pierre-charles.david
Version: unspecifiedKeywords: triaged
Target Milestone: 1.0.0M5   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 425535    
Attachments:
Description Flags
Normal context menu
none
Broken context menu (with sirius)
none
Context menu on a Papyrus class without Sirius installed
none
Papyrus project creation wizard none

Description Ansgar Radermacher CLA 2014-01-20 09:40:31 EST
Created attachment 239144 [details]
Normal context menu

Since Sirius has been installed with Luna M2, the context menus of Papyrus are broken (other tools might be affected as well): ~half of the entries are missing. I attach two screenshots of the respective menus
Comment 1 Ansgar Radermacher CLA 2014-01-20 09:41:14 EST
Created attachment 239145 [details]
Broken context menu (with sirius)
Comment 2 Esteban DUGUEPEROUX CLA 2014-01-20 12:46:11 EST
Hi Ansgar,

I tried to reproduce your issue but cannot, these are the steps followed :

1. Downloaded a Luna M4 from http://eclipse.org/downloads/packages/eclipse-standard-44-m4/lunam4 for windows 64 bits
2. Installed Papyrus from Luna p2 repo
3. Tried to create a Papyrus project or Papyrus model, but on the second wizard's page, I must select a category, but there is no choice, i.e. the "Diagram Language" group is empty. I have tried to install additional papyrus components like MARTE but there is yet no choice.

Can you provide all the steps to reproduce from a clean Luna milestone?
Comment 3 Ansgar Radermacher CLA 2014-01-22 09:24:43 EST
Dear Esteban,

I cannot reproduce this problem. Can you please retry with the papyrus nightly update-site for luna?
http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna
Comment 4 Esteban DUGUEPEROUX CLA 2014-01-22 11:23:41 EST
I have installed Papyrus UML from your nightly p2 repo and on Papyrus Project creation, I select the UML Diagram Language and click on Finish, but nothing occurs except the following exception in error log :

java.lang.LinkageError: com/google/common/base/Optional
	at org.eclipse.papyrus.uml.controlmode.profile.ControlledElementReadOnlyHandler.anyReadOnly(ControlledElementReadOnlyHandler.java:65)
	at org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager.anyReadOnly(ReadOnlyManager.java:164)
	at org.eclipse.papyrus.infra.core.resource.ModelSet.save(ModelSet.java:675)
	at org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard.saveDiagram(CreateModelWizard.java:566)
	at org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard.initDiagramModel(CreateModelWizard.java:555)
	at org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard.createAndOpenPapyrusModel(CreateModelWizard.java:254)
	at org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard.performFinish(CreateModelWizard.java:208)
	at org.eclipse.papyrus.uml.diagram.wizards.NewPapyrusProjectWizard.performFinish(NewPapyrusProjectWizard.java:105)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:851)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:437)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:633)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4351)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:827)
	at org.eclipse.jface.window.Window.open(Window.java:803)
	at org.eclipse.ui.actions.NewProjectAction.run(NewProjectAction.java:117)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:588)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:415)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4351)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1122)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1006)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:146)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:565)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:125)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:80)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:372)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:226)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

Then I cannot reproduce anymore.
Comment 5 Esteban DUGUEPEROUX CLA 2014-01-23 03:26:23 EST
I tried again this morning with your nightly p2 repo, and I can create a Papyrus project. But I can't guess on which selection there are these menu contributions from Papyrus.
Can you provide a reproduction scenario?
Comment 6 Ansgar Radermacher CLA 2014-01-23 04:00:59 EST
Steps to reproduce:
The problem affects all diagrams. Create for instance a class diagram. Now create a class within this diagram. Then make a right click on the class and see which entries are shown in the context menu.
(The attached screen shots were produced in a Papyrus version with Moka, Qompass and code generation extensions. Thus, its normal that entries related to these extensions are not visible in your version. But for instance the Papyrus "Validation" and "Filters" sub-menus must always be present).
Comment 7 Pierre-Charles David CLA 2014-01-24 03:52:17 EST
For reference, the entries visible in the first screenshot and absent from the second are:
* File >
* Code generation
* Edit >
* Tracing >
* Validation >
* Open a CDT Editor
* Test diagram creation
* Filters >
* Show properties view
* Properties
Comment 8 Pierre-Charles David CLA 2014-01-24 05:32:57 EST
Tried to reproduce, starting from eclipse-SDK-4.4M4-linux-gtk-x86_64.tar.gz and installing "Papyrus" and "Papyrus SDK" from the URL mentioned above (http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna). At this time this gets me:

* Papyrus UML (Incubation)	1.0.0.v201401240555
* Papyrus UML SDK (Incubation)	1.0.0.v201401240555

From this I could create a Papyrus project, a class diagram, and create a class on it. I'll attach a screenshot of the context menu on that class.

I then installed the latest Sirius from http://download.eclipse.org/sirius/updates/nightly/latest/luna and tried to get the equivalent screenshot, but could not yet. I tried 4 or 5 times, and each time the whole Eclipse freezes at some point (usually when I right click somewhere). I have to kill the Eclipse process and restart.

I successfully uninstalled Sirius to get back to the previous state, and tried again, and I still get the freeze (this time when I right-click on the Papyrus class in the opened diagram). This is under Linux with

java.runtime.version=1.7.0_51-b00

which was upgraded this morning (I'm on Ubuntu 13.10). I'm not sure this is relevant but one of the freezes I saw was when opening the "Install New Software..." dialog, so it doesn't seem to be related to Sirius (which was not always installed when I had the freeze) or Papyrus (I don't see how it would freeze the installation dialog).
Comment 9 Pierre-Charles David CLA 2014-01-24 05:33:44 EST
Created attachment 239300 [details]
Context menu on a Papyrus class without Sirius installed
Comment 10 Florian Barbin CLA 2014-01-24 05:44:02 EST
Created attachment 239301 [details]
Papyrus project creation wizard

I was able to reproduce this issue on a windows 7 but not on my Ubuntu 13.10 environment. When I try to create a new Papyrus Project, the diagrams list is empty (see the attached screenshot)
Comment 11 Ansgar Radermacher CLA 2014-01-24 05:48:25 EST
First thanks for the feedback and investigation of the bug. I think, my original bug report was not clear enough: I never made a full installation of Sirius. I'm talking about the Sirius plugins that get installed automatically since M4 as part of the ecore dependencies. When I explicitly disable these (i.e. all plugins starting with org.eclipse.sirius) in my debug instance, I get the complete context menu, when all plugins are enabled I get the reduced one.

Besides the menu, there seems to be a severe "freezing" issue, if Sirius is fully installed.
Comment 12 Pierre-Charles David CLA 2014-01-24 06:07:59 EST
(In reply to Ansgar Radermacher from comment #11)
> Besides the menu, there seems to be a severe "freezing" issue, if Sirius is
> fully installed.

Note that I experienced the freeze even when Sirius is not installed. I just checked again to be sure: I installed "Papyrus" and "Papyrus SDK" nightly on top of Eclipse SDK 4.4M4, which does not contain any Sirius plug-in. Right after creating a Papyrus Class diagram, I tried to use the "Class" tool in the palette and got the freeze.

I'm not saying the freeze is caused by Papyrus. Maybe it is something on my system, maybe on the Eclipse platform, or maybe in some component (like GMF Runtime) that both Sirius and Papyrus use. 

Did you yourself experience the freeze? It was not mentioned in your initial report.
Comment 13 Ansgar Radermacher CLA 2014-01-24 07:04:17 EST
If you are experiencing the freeze on Linux only, it might very well be related to a GTK3 issue, see my comment7 in bug 423420, i.e. neither related to Sirius nor Papyrus.
Workaound set SWT_GTK3 to 0

However, the missing menu items are independent of this issue, as they occur also on Windows.
Comment 14 Pierre-Charles David CLA 2014-01-24 08:05:28 EST
(In reply to Ansgar Radermacher from comment #13)
> If you are experiencing the freeze on Linux only, it might very well be
> related to a GTK3 issue, see my comment7 in bug 423420, i.e. neither related
> to Sirius nor Papyrus.
> Workaound set SWT_GTK3 to 0

That seems to fix it. Thanks for the tip!

> However, the missing menu items are independent of this issue, as they occur
> also on Windows.

Yes, I agree, but the freeze prevented me to actually reproduce, and thus investigate, the menu items issue.
Comment 15 Pierre-Charles David CLA 2014-01-24 08:17:37 EST
We have identified the root cause and have a hint about a solutions. Will try to fix this for M5.
Comment 16 Florian Barbin CLA 2014-01-24 08:17:59 EST
Ok I found the cause of this issue. We remove in the org.eclipse.sirius.diagram/plugin.xml file some GMF contributions via the popupPredefinedItem extension mechanism. We are not restrictive enough on this and we should check the current editor ID for instance.
Comment 17 Florian Barbin CLA 2014-01-27 05:43:32 EST
Fixed by commit 21d92e1ae679fe9febfe0f271ca413503692e1d4. Can you validate on your side (to be sure) with the latest nightly here http://download.eclipse.org/sirius/updates/nightly/1.0.x/luna ?
Comment 18 Ansgar Radermacher CLA 2014-01-27 10:30:16 EST
I tested with the last version. Problem is solved for me.
Comment 19 Pierre-Charles David CLA 2014-01-27 10:41:37 EST
Validated using:
* Luna M4
* Sirius 1.0M5 (1.0.0-N20140127-060036)
* Papyrus UML 1.0.0.v201401271126 (from the nightly update-site mentioned above)

With both Sirius and Papyrus installed:
* Sirius gets its customized menus with several standard entries removed
* Papyrus get its full context menus

Tested on the diagrams' background and on an element (a class in Class Diagram in the case of Papyrus).

I don't see any Sirius menu item leaking on Papyrus menus or the inverse.
Comment 20 Pierre-Charles David CLA 2014-01-31 05:38:13 EST
Available in Sirius 1.0.0M5, see https://wiki.eclipse.org/Sirius/1.0.0M5 for availability details.