Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Exception on Open File...
Exception on Open File... [message #639870] Thu, 18 November 2010 03:44 Go to next message
Eclipse UserFriend
I have a small RCP including an xtext grammar.
Opening a file which is part of an project with the xtext nature works as expected.
However opening a grammar file via the file menu produces this exception:
java.lang.NullPointerException
    at org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.createElementInfo(XtextDocumentProvider.java:135)
    at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(AbstractDocumentProvider.java:400)
    at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4056)
    at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:217)
    at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1444)
    at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor.java:169)
    at org.eclipse.xtext.ui.editor.XtextEditor.doSetInput(XtextEditor.java:149)
    at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3043)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
    at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2600)
    at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3061)
    at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3088)
    at org.eclipse.xtext.ui.editor.XtextEditor.init(XtextEditor.java:169)
    at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:647)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
    at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
    at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
    at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
    at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
    at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1254)
    at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1207)
    at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1606)
    at org.eclipse.ui.internal.PartStack.add(PartStack.java:497)
    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
    at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
    at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
    at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
    at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
    at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778)
    at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677)
    at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2860)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768)
    at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760)
    at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2674)
    at org.eclipse.ui.ide.IDE.openEditorOnFileStore(IDE.java:1155)
    at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run(OpenLocalFileAction.java:107)
    at org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run(OpenLocalFileAction.java:76)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
    at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
    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:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    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:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


Did I forget to configure/register something?

Thank you,

Ralf
Re: Exception on Open File... [message #639890 is a reply to message #639870] Thu, 18 November 2010 04:32 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ralf,

the Xtext grammar editor (the one for *.xtext files) requires the JDT
and a workspace to be available. Are you refering to the grammar editor
or to an editor for your very own language? Which plugins do you use in
your RCP? Did you customize something in your ui module? Did you try to
debug and investigate what caused the NPE? Sorry without some more
information it's hardly possible to figure out what's going on on your side.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 18.11.10 09:44, schrieb Ralf Sieger:
> I have a small RCP including an xtext grammar.
> Opening a file which is part of an project with the xtext nature works
> as expected.
> However opening a grammar file via the file menu produces this exception:
>
> java.lang.NullPointerException
> at
> org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.crea teElementInfo(XtextDocumentProvider.java:135)
>
> at
> org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(A bstractDocumentProvider.java:400)
>
> at
> org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(Abst ractTextEditor.java:4056)
>
> at
> org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(Status TextEditor.java:217)
>
> at
> org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetI nput(AbstractDecoratedTextEditor.java:1444)
>
> at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor .java:169)
> at org.eclipse.xtext.ui.editor.XtextEditor.doSetInput(XtextEdit or.java:149)
> at
> org.eclipse.ui.texteditor.AbstractTextEditor$19.run(Abstract TextEditor.java:3043)
>
> at
> org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:464)
>
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
> at
> org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:759)
>
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
> at
> org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:756)
> at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2600)
> at
> org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(Ab stractTextEditor.java:3061)
>
> at
> org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTe xtEditor.java:3088)
>
> at org.eclipse.xtext.ui.editor.XtextEditor.init(XtextEditor.jav a:169)
> at org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:798)
> at
> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:647)
>
> at
> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:465)
>
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:595)
>
> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 3)
> at
> org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:180)
>
> at
> org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:270)
>
> at
> org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
>
> at
> org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:473)
>
> at
> org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1254)
>
> at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1207)
> at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:16 06)
> at org.eclipse.ui.internal.PartStack.add(PartStack.java:497)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103 )
> at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112 )
> at
> org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:63)
>
> at
> org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:225)
>
> at
> org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:213)
>
> at
> org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:778)
>
> at
> org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:677)
>
> at org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:638)
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2860)
>
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2768)
>
> at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag e.java:2760)
> at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j ava:2711)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2707)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2691)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2674)
> at org.eclipse.ui.ide.IDE.openEditorOnFileStore(IDE.java:1155)
> at
> org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run( OpenLocalFileAction.java:107)
>
> at
> org.eclipse.ui.internal.ide.actions.OpenLocalFileAction.run( OpenLocalFileAction.java:76)
>
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:251)
> at
> org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:229)
>
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.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(EclipseS tarter.java:369)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> 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: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
>
>
> Did I forget to configure/register something?
>
> Thank you,
>
> Ralf
Re: Exception on Open File... [message #639915 is a reply to message #639890] Thu, 18 November 2010 07:11 Go to previous messageGo to next message
Eclipse UserFriend
Hi Sebastian,

I try to open a file with my DSL (*.da files).
I have eclipse helios and the only plugins (except from the target platform) are my parser plugin and the generated ui plugin.

I did some debugging and found that
a an XtextEditor instance is created and down the chain the
call to
doSetInput()
fails.

It tries to set an input of type:
/**
 * Implements an IEditorInput instance appropriate for 
 * <code>IFileStore</code> elements that represent files
 * that are not part of the current workspace.
 */
public class FileStoreEditorInput implements IURIEditorInput, IPersistableElement;


to:

XtextDocumentProvider
    protected boolean setDocumentContent(IDocument document, IEditorInput editorInput, String encoding) throws CoreException;


In this method no one can handle this input.
-> no document set -> a NPE later on.

You should be able to reproduce this easily with an simple xtext grammar run as an RCP.
BTW I've tried to open a .java file and this is working (displayed as text file in a java editor).

Thanks.

Re: Exception on Open File... [message #640199 is a reply to message #639915] Fri, 19 November 2010 09:12 Go to previous message
Eclipse UserFriend
Hi Ralf,

Xtext cannot handle the FileStoreEditorInput transparently. You'll have
to customize the XtextDocumentProvider for your convenience.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com



Am 18.11.10 13:11, schrieb Ralf Sieger:
> Hi Sebastian,
>
> I try to open a file with my DSL (*.da files).
> I have eclipse helios and the only plugins (except from the target
> platform) are my parser plugin and the generated ui plugin.
>
> I did some debugging and found that a an XtextEditor instance is created
> and down the chain the call to doSetInput() fails.
>
> It tries to set an input of type:
>
> /**
> * Implements an IEditorInput instance appropriate for *
> <code>IFileStore</code> elements that represent files
> * that are not part of the current workspace.
> */
> public class FileStoreEditorInput implements IURIEditorInput,
> IPersistableElement;
>
>
> to:
>
>
> XtextDocumentProvider
> protected boolean setDocumentContent(IDocument document, IEditorInput
> editorInput, String encoding) throws CoreException;
>
>
> In this method no one can handle this input.
> -> no document set -> a NPE later on.
>
> You should be able to reproduce this easily with an simple xtext grammar
> run as an RCP.
> BTW I've tried to open a .java file and this is working (displayed as
> text file in a java editor).
>
> Thanks.
>
>
Previous Topic:Can't find cause of warning(200)in code generation
Next Topic:merge crossreferences
Goto Forum:
  


Current Time: Tue Jul 01 02:54:54 EDT 2025

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

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

Back to the top