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

Bug 438838

Summary: Auto-completion unavailable when SICstus Prolog IDE is installed
Product: [Modeling] Sirius Reporter: Benoit Ries <benoit.ries>
Component: CoreAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: benoit.ries, maxime.porhel, per.mildner
Version: 1.0.0Keywords: triaged
Target Milestone: 1.0.1   
Hardware: All   
OS: All   
Whiteboard:

Description Benoit Ries CLA 2014-07-03 09:33:20 EDT
Overview:

There is some kind of incompatibility between Sirius and "SICstus Prolog IDE" which causes in auto-completion unavailability. 

Steps to reproduce:

1) Install Sirius on Luna
2) Install SICstus Prolog IDE
update-site: 
http://www.sics.se/sicstus/update/
3) Create a new Viewpoint Specification Project
4) Create a new Viewpoint
5) Create a new Diagram Description Representation
6) Goto the Domain Class, hit Ctrl+Space the auto-completion is unavailable


Note that if I uninstall SCIstus Prolog IDE, the auto-completion is available.
Comment 1 Maxime Porhel CLA 2014-07-09 11:24:13 EDT
Hi Benoit, 

It tried to reproduce, and I still have the completion, but it seems slower than without the SICstus Prolog IDE. 

If I restrict the metamodels used by my representation description, I do not see differences any more. Could you try this ? 

On each RpresentationDescription (DiagramDescription, TableDescription, TreeDescription), you just have to select the Metamodels tab in the property view and to select the metamodels you will use in the current description. Then the completion and the evaluation of  interpreted expression (and domain classes) will only  look into the referenced metamodels.
Comment 2 Maxime Porhel CLA 2014-07-09 12:46:44 EDT
Do not take the previous comment into account. I had (again) an issue with my target plateform. 

I reproduce the issue, and it impact all completions in Sirius VSM editor: domain class, style customization and interpreted expression. 


(In reply to Maxime Porhel from comment #1)
> Hi Benoit, 
> 
> It tried to reproduce, and I still have the completion, but it seems slower
> than without the SICstus Prolog IDE. 
> 
> If I restrict the metamodels used by my representation description, I do not
> see differences any more. Could you try this ? 
> 
> On each RpresentationDescription (DiagramDescription, TableDescription,
> TreeDescription), you just have to select the Metamodels tab in the property
> view and to select the metamodels you will use in the current description.
> Then the completion and the evaluation of  interpreted expression (and
> domain classes) will only  look into the referenced metamodels.
Comment 3 Maxime Porhel CLA 2014-07-09 12:49:53 EDT
Issue seen on Mac, reproduced on Win8
Comment 4 Maxime Porhel CLA 2014-07-10 03:07:32 EDT
The call stack when the completion activates:

Thread [main] (Suspended (breakpoint at line 98 in TypeContentProposalProvider$1))
	TypeContentProposalProvider$1.proposalPopupOpened(ContentProposalAdapter) line: 98	
	ContentProposalAdapter.notifyPopupOpened() line: 2131	
	ContentProposalAdapter.openProposalPopup(boolean) line: 1918	
	ContentProposalAdapter.access$16(ContentProposalAdapter, boolean) line: 1898	
	ContentProposalAdapter$1.handleEvent(Event) line: 1769	
	EventTable.sendEvent(Event) line: 84	
	Display.sendEvent(EventTable, Event) line: 4353	
	Text(Widget).sendEvent(Event) line: 1061	
	Text(Widget).sendEvent(int, Event, boolean) line: 1085	
	Text(Widget).sendEvent(int, Event) line: 1070	
	Text(Widget).sendKeyEvent(int, int, int, int, Event) line: 1112	
	Text.sendKeyEvent(int, int, int, int, Event) line: 1731	
	Text(Widget).sendKeyEvent(int, int, int, int) line: 1108	
	Text(Widget).wmChar(int, int, int) line: 1529	
	Text(Control).WM_CHAR(int, int) line: 4722	
	Text.WM_CHAR(int, int) line: 2616	
	Text(Control).windowProc(int, int, int, int) line: 4610	
	Text.windowProc(int, int, int, int) line: 2602	
	Display.windowProc(int, int, int, int) line: 5023	
	OS.DispatchMessageW(MSG) line: not available [native method]	
	OS.DispatchMessage(MSG) line: 2549	
	Display.readAndDispatch() line: 3759	
	PartRenderingEngine$9.run() line: 1151	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 1032	
	E4Workbench.createAndRunUI(MApplicationElement) line: 148	
	Workbench$5.run() line: 636	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 579	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 150	
	IDEApplication.start(IApplicationContext) line: 135
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 134	
	EclipseAppLauncher.start(Object) line: 104	
	EclipseStarter.run(Object) line: 382	
	EclipseStarter.run(String[], Runnable) line: 236	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 648	
	Main.basicRun(String[]) line: 603	
	Main.run(String[]) line: 1465	
	Main.main(String[]) line: 1438
Comment 5 Maxime Porhel CLA 2014-07-10 03:53:20 EDT
I have detected one difference (for the received event with keyCode =32, which triggers the completion when SICStus is not there):

  with SICStus installed, Display.sendEvent(EventTable, Event) line: 4353:
     event -> Event {type=0 Text {} time=1686953 data=null x=0 y=0 width=0 height=0 detail=0}
     event -> Event {type=2 Text {} time=1687046 data=null x=0 y=0 width=0 height=0 detail=0}

  without SICStuc:
     event -> Event {type=1 Text {} time=1570531 data=null x=0 y=0 width=0 height=0 detail=0}
     Event {type=2 Text {} time=1570687 data=null x=0 y=0 width=0 height=0 detail=0}


With SICStus installed, we receive Event {type=0 .. , it triggers an early return in EventTable.sendEvent: if (event.type == SWT.None) return; (l81). The eventType is set to 1 in org.eclipse.swt.widgets.Widget.sendEvent(int, Event, boolean) l1078 and then reset to 0 in l1059 during call to org.eclipse.swt.widgets.Display.filterEvent(Event). 

This is done by org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(List<KeyStroke>, Event). eatKey (l561) is set to true when SICStus is here and false when it is not here.  A match is detected, then eclipse try to execute a command with se.sics.sicstus.ui.toplevel.TopLevelContentAssistHandler@16eb551 which "eats" the completion. 

This is due to the following extension in the se.sics.sicstus.ide plugin
<command id="org.eclipse.ui.edit.text.contentAssist.proposals"
    categoryId="se.sics.sicstus.editor.command.category.id.cat1"
    defaultHandler="se.sics.sicstus.ui.toplevel.TopLevelContentAssistHandler"
    description="Content Assist"
    name="Content Assist">
</command>

The handler seems to be always active and not only in the SICStus context. 

This bug s not loacted in Sirius
Comment 6 Maxime Porhel CLA 2014-07-10 04:12:12 EDT
I close this issue as NOT_ECLIPSE. 

The handler of SICStus declares that it can handle the content assist.
But it does not fail for the current Sirius context nor let Sirius display its completion. 

See org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(ParameterizedCommand, Event) l 287..289 that if this handler has returned a CommandException (or if the handler is not defined for a non SICStus context), the eatKey (see previous comment) would be false and Sirius would display its completion.
Comment 7 Benoit Ries CLA 2014-07-10 04:24:11 EDT
(In reply to Maxime Porhel from comment #1)
> Hi Benoit, 
> 
> It tried to reproduce, and I still have the completion, but it seems slower
> than without the SICstus Prolog IDE. 
> 
> If I restrict the metamodels used by my representation description, I do not
> see differences any more. Could you try this ? 
> 
> On each RpresentationDescription (DiagramDescription, TableDescription,
> TreeDescription), you just have to select the Metamodels tab in the property
> view and to select the metamodels you will use in the current description.
> Then the completion and the evaluation of  interpreted expression (and
> domain classes) will only  look into the referenced metamodels.

Hi Maxime,
I tried to add manually the metamodels, and it didn't impact this issue, still no auto-completion available.
Comment 8 Benoit Ries CLA 2014-07-10 04:29:26 EDT
don't take into account my last comment indeed. I answered without having read all your comments.

thanks for locating the problem !
Comment 9 Per Mildner CLA 2014-07-10 15:39:29 EDT
I am the author of SICStus Prolog IDE. I need to be able to reproduce this but I do not know what the final step means "6) Goto the Domain Class". Could someone please describe this in more detail (I know nothing about Sirius).
Comment 10 Maxime Porhel CLA 2014-07-11 03:29:04 EDT
6) Goto the Domain Class, hit Ctrl+Space the auto-completion is unavailable

6.1 -> Open the properties view In the editor
6.2 -> Select the created Diagram Description
6.3 -> In the properties view, select the General Tab
6.4 -> In the Domain Class green field, hit CTRL+SPACE : KO, no completion popup displayed 
6.5 -> In the Precondition yellow field, hit CTRL+SPACE : KO, no completion popup displayed
Comment 11 Per Mildner CLA 2014-08-07 08:37:24 EDT
Thank you for the detailed reproducer.
This bug has been fixed in SPIDER 0.0.52 that was released today.