Bug 459539 - Auto-completion not working for semantic candidates expression property
Summary: Auto-completion not working for semantic candidates expression property
Status: REOPENED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-02-10 06:29 EST by Elvis Dowson CLA
Modified: 2018-12-18 04:50 EST (History)
2 users (show)

See Also:


Attachments
Sirius library example test case to reproduce auto-complete error. (143.89 KB, application/zip)
2015-02-10 06:29 EST, Elvis Dowson CLA
no flags Details
Screenshot showing where to add a meta-model reference for the Author diagram (236.84 KB, image/png)
2015-03-01 12:19 EST, Elvis Dowson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elvis Dowson CLA 2015-02-10 06:29:10 EST
Created attachment 250659 [details]
Sirius library example test case to reproduce auto-complete error.

Hi,

I'm using Eclipse Luna 4.4 modelling project with all the latest updates installed.

I have updated my Sirius installation to 1.0.2 maintenance update for my Eclipse Luna installation as descriptor in

http://wiki.eclipse.org/Sirius/1.0.2

The auto-complete feature does not work, as described in the following thread and associated screenshot:

https://www.eclipse.org/forums/index.php/m/1596393/#msg_1596393

Regards,

Elvis Dowson
Comment 1 Elvis Dowson CLA 2015-02-10 06:32:00 EST
Here is the stack trace output on the main Eclipse 4.4 Luna instance. The Sirius description is being developed in a run-time instance. When I try to press ctrl+space, the following stack trace error output appears in the main eclipse instance console window. Nothing happens in the eclipse run-time instance, and it doesn't offer any auto-complete suggestions.

!ENTRY org.eclipse.ui 4 0 2015-02-10 16:48:27.571
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.sirius.common.acceleo.mtl.business.internal.interpreter.AcceleoMTLInterpreter.createCompilationContext(AcceleoMTLInterpreter.java:567)
	at org.eclipse.sirius.common.acceleo.mtl.ide.AcceleoProposalProvider.getProposals(AcceleoProposalProvider.java:125)
	at org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter.getProposals(CompoundInterpreter.java:785)
	at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getProposals(TextContentProposalProvider.java:88)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals(ContentProposalAdapter.java:2057)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter.openProposalPopup(ContentProposalAdapter.java:1903)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter.access$16(ContentProposalAdapter.java:1898)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter$1.handleEvent(ContentProposalAdapter.java:1769)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1504)
	at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1634)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1500)
	at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1600)
	at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1060)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5719)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
	at org.eclipse.swt.widgets.Widget.superKeyDown(Widget.java:1908)
	at org.eclipse.swt.widgets.Widget.keyDown(Widget.java:1085)
	at org.eclipse.swt.widgets.Control.keyDown(Control.java:2400)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5629)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2105)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2329)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5691)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5128)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5277)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Comment 2 Elvis Dowson CLA 2015-02-10 08:16:45 EST
Hi,

I have an update on this bug. The auto-completion feature works *once* if you re-start the main eclipse instance and the run-time instance. But that's it, it doesn't work a second time and any subsequent attempts to press ctrl+space will result in the stack trace error.

Regards,

Elvis Dowson
Comment 3 Maxime Porhel CLA 2015-02-16 05:32:26 EST
Hi Elvis, 

It seems that the collection of EPackage used in AcceleoMTLInterpreter.java:567 might contain a null entry. 

In your odesign on which you have the issue, do you use the metamodels property (advanced tab) on your representation descriptions ?

If this property is empty, Sirius will get the available EPackage from the EcoreRegistry, but if it is used it will get the EPackages referenced in your odesign file.
Comment 4 Elvis Dowson CLA 2015-03-01 12:18:26 EST
Hi Maxime,

I did as you asked and added a reference to the library metamodel for the Author Diagram. Auto-completion appears to be working now.

I have attached a screenshot of the workspace.

Regards,

Elvis Dowson
Comment 5 Elvis Dowson CLA 2015-03-01 12:19:49 EST
Created attachment 251203 [details]
Screenshot showing where to add a meta-model reference for the Author diagram
Comment 6 Elvis Dowson CLA 2015-03-01 12:31:39 EST
The auto-completion feature requires the metamodel property to be set. This was not mentioned in the Sirius 4min tutorial, and was hence over-looked.
Comment 7 Maxime Porhel CLA 2015-03-02 05:05:22 EST
I reopen the bug as we should not have the NPE when there is no selected metamodels. 

In Elvis's case There should be an invalid metamodel in his workspace or something causing the NPE in AcceleoMTLInterpreter.createCompilationContext(l.567). When at least one metamodel is referenced from the RepresentationDescription, the compilation context is created with the referenced metamodels and the NPE is avoided. 

We should either void the NPE in createCompilationContext or filter the null package in  context.getAvailableEPackages() or in the construction of this list : org.eclipse.sirius.business.api.dialect.description.AbstractInterpretedExpressionQuery.getPackagesToImport()