Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » strange behavior of XImportSection
strange behavior of XImportSection [message #1053342] Sat, 04 May 2013 06:55 Go to next message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1370
Registered: July 2009
Senior Member
Hi

I'm using the new XImportSection in my DSL like this

TJProgram:
('package' name=QualifiedName ';')?
importSection=XImportSection?
elements+=TJDeclaration*
;

now when using content assist for completing Java type references, this
works most of the time (and the import statement is automatically added).

However, especially when there is currently no import in the program,
the completion does not work and I see this exception

org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal
- Error applying completion proposal


java.lang.ClassCastException:
org.eclipse.xtext.nodemodel.impl.HiddenLeafNode cannot be cast to
org.eclipse.xtext.nodemodel.ICompositeNode
at
org.eclipse.xtext.xbase.imports.DefaultImportsConfiguration.findPreviousNode(DefaultImportsConfiguration.java:151)
at
org.eclipse.xtext.xbase.imports.DefaultImportsConfiguration.getImportSectionOffset(DefaultImportsConfiguration.java:127)
at
org.eclipse.xtext.xbase.imports.ImportSectionRegionUtil.computeRegion(ImportSectionRegionUtil.java:41)
at
org.eclipse.xtext.xbase.imports.RewritableImportSection.addSectionToAppend(RewritableImportSection.java:284)
at
org.eclipse.xtext.xbase.imports.RewritableImportSection.rewrite(RewritableImportSection.java:264)
at
org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider$FQNImporter.apply(ImportingTypesProposalProvider.java:167)
at
org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.apply(ConfigurableCompletionProposal.java:143)
at
org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.apply(ConfigurableCompletionProposal.java:335)
at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:940)
at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:891)
at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1323)
at
org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:808)
at
org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:491)
at
org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:65)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187)
at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5940)
at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5636)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1428)
at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:829)
at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3186)
at
org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:758)
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2092)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:5344)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4544)
at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8654)
at org.eclipse.swt.widgets.Display.eventProc(Display.java:1243)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2283)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3336)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1108)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:992)
at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:137)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:600)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:555)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Re: strange behavior of XImportSection [message #1053520 is a reply to message #1053342] Mon, 06 May 2013 11:14 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2908
Registered: July 2009
Senior Member
Hi Lorenzo,

this looks like a bug to me. Could you please file a ticket?

Thanks,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 04.05.13 08:55, schrieb Lorenzo Bettini:
> Hi
>
> I'm using the new XImportSection in my DSL like this
>
> TJProgram:
> ('package' name=QualifiedName ';')?
> importSection=XImportSection?
> elements+=TJDeclaration*
> ;
>
> now when using content assist for completing Java type references, this
> works most of the time (and the import statement is automatically added).
>
> However, especially when there is currently no import in the program,
> the completion does not work and I see this exception
>
> org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal
> - Error applying completion proposal
>
>
> java.lang.ClassCastException:
> org.eclipse.xtext.nodemodel.impl.HiddenLeafNode cannot be cast to
> org.eclipse.xtext.nodemodel.ICompositeNode
> at
> org.eclipse.xtext.xbase.imports.DefaultImportsConfiguration.findPreviousNode(DefaultImportsConfiguration.java:151)
> at
> org.eclipse.xtext.xbase.imports.DefaultImportsConfiguration.getImportSectionOffset(DefaultImportsConfiguration.java:127)
> at
> org.eclipse.xtext.xbase.imports.ImportSectionRegionUtil.computeRegion(ImportSectionRegionUtil.java:41)
> at
> org.eclipse.xtext.xbase.imports.RewritableImportSection.addSectionToAppend(RewritableImportSection.java:284)
> at
> org.eclipse.xtext.xbase.imports.RewritableImportSection.rewrite(RewritableImportSection.java:264)
> at
> org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider$FQNImporter.apply(ImportingTypesProposalProvider.java:167)
> at
> org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.apply(ConfigurableCompletionProposal.java:143)
> at
> org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.apply(ConfigurableCompletionProposal.java:335)
> at
> org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:940)
> at
> org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:891)
> at
> org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1323)
> at
> org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:808)
> at
> org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:491)
> at
> org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:65)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
> at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187)
> at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5940)
> at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5636)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
> at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1428)
> at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:829)
> at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3186)
> at
> org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:758)
> at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2092)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:5344)
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4544)
> at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
> at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8654)
> at org.eclipse.swt.widgets.Display.eventProc(Display.java:1243)
> at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
> at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2283)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3336)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1108)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:992)
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:137)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:600)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:555)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> 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)
>
Re: strange behavior of XImportSection [message #1053716 is a reply to message #1053520] Tue, 07 May 2013 11:22 Go to previous message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1370
Registered: July 2009
Senior Member
On 05/06/2013 01:14 PM, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> this looks like a bug to me. Could you please file a ticket?
>
> Thanks,
> Sebastian

Done https://bugs.eclipse.org/bugs/show_bug.cgi?id=407390

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Previous Topic:Mwe2 Workflow - modify variables at runtime
Next Topic:Design considerations supporting Heredoc with Xtext/antlr lexer
Goto Forum:
  


Current Time: Sat Oct 25 03:48:04 GMT 2014

Powered by FUDForum. Page generated in 0.05489 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software