NPE opening external files [message #894553] |
Mon, 09 July 2012 11:07  |
Eclipse User |
|
|
|
Hello,
I'm using xtext to develop an editor and during a test, I notice that if I try to open a file located outside eclipse workspace I get a NullPointer Exception:
java.lang.NullPointerException
at org.eclipse.xtext.ui.editor.folding.DefaultFoldingStructureProvider.handleProjectionEnabled(DefaultFoldingStructureProvider.java:100)
at org.eclipse.xtext.ui.editor.folding.DefaultFoldingStructureProvider$ProjectionChangeListener.projectionEnabled(DefaultFoldingStructureProvider.java:186)
at org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled(ProjectionViewer.java:487)
at org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection(ProjectionViewer.java:535)
at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1414)
at org.eclipse.xtext.ui.editor.XtextEditor.installFoldingSupport(XtextEditor.java:471)
at org.eclipse.xtext.ui.editor.XtextEditor.createPartControl(XtextEditor.java:453)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:129)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:95)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:300)
....
This happens both if I use "File/open.." menu or if I "drag&drop" the file in the editor area.
I'm using eclipse 4.2 and I do not know if the problem is related to eclipse components or to xtext ones:
I tried to debug the problem and I saw that XtextDocumentProvider.setDocumentContent(IDocument document, IEditorInput editorInput, String encoding) asks super classes to set the content but both do not handle the provided FileStoreEditorInput (both super-classes come from eclipse.ui.editors)
thanks in advance for any hint/suggestion about how solve it
Nicola
ps. note, esternal files of "standard types" (like java, c and txt) are opened without any problem
|
|
|
|
Re: NPE opening external files [message #894560 is a reply to message #894559] |
Mon, 09 July 2012 11:22   |
Eclipse User |
|
|
|
This geppetto issue: https://github.com/cloudsmith/geppetto/issues/19
has links to more information, and shows what was changed in Geppetto to
allow editing of external files (i.e. the commit delta).
Regards
- henrik
On 2012-09-07 17:20, Henrik Lindberg wrote:
> This is a known problem (don't have the bugzilla issue # for it).
> Workarounds exist - I have one in cloudsmith/geppetto @ github where I
> create a hidden "auto linked" project that automatically links to the
> external files that are being opened. The problem is that resources
> being edited must be Eclipse Resources as there is otherwise nothing to
> tie things like markers and other meta data to.
>
> The solution in Geppetto is not 100% generic, but should be easily
> adapted to your dsl.
>
> Regards
> - henrik
>
> The topic has been discussed in the forum a number of times.
>
> On 2012-09-07 17:07, Nicola Serreli wrote:
>> Hello,
>>
>> I'm using xtext to develop an editor and during a test, I notice that if
>> I try to open a file located outside eclipse workspace I get a
>> NullPointer Exception:
>>
>> java.lang.NullPointerException
>> at
>> org.eclipse.xtext.ui.editor.folding.DefaultFoldingStructureProvider.handleProjectionEnabled(DefaultFoldingStructureProvider.java:100)
>>
>>
>> at
>> org.eclipse.xtext.ui.editor.folding.DefaultFoldingStructureProvider$ProjectionChangeListener.projectionEnabled(DefaultFoldingStructureProvider.java:186)
>>
>>
>> at
>> org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled(ProjectionViewer.java:487)
>>
>>
>> at
>> org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection(ProjectionViewer.java:535)
>>
>>
>> at
>> org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1414)
>>
>>
>> at
>> org.eclipse.xtext.ui.editor.XtextEditor.installFoldingSupport(XtextEditor.java:471)
>>
>>
>> at
>> org.eclipse.xtext.ui.editor.XtextEditor.createPartControl(XtextEditor.java:453)
>>
>>
>> at
>> org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:129)
>>
>>
>> at
>> org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:95)
>>
>>
>> at
>> org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:300)
>>
>>
>> ....
>>
>> This happens both if I use "File/open.." menu or if I "drag&drop" the
>> file in the editor area.
>>
>> I'm using eclipse 4.2 and I do not know if the problem is related to
>> eclipse components or to xtext ones:
>> I tried to debug the problem and I saw that
>> XtextDocumentProvider.setDocumentContent(IDocument document,
>> IEditorInput editorInput, String encoding) asks super classes to set the
>> content but both do not handle the provided FileStoreEditorInput (both
>> super-classes come from eclipse.ui.editors)
>>
>> thanks in advance for any hint/suggestion about how solve it
>> Nicola
>>
>>
>> ps. note, esternal files of "standard types" (like java, c and txt) are
>> opened without any problem
>
>
|
|
|
|
|
|
Re: NPE opening external files [message #895898 is a reply to message #894964] |
Mon, 16 July 2012 09:05   |
Eclipse User |
|
|
|
Sebastian Zarnekow wrote on Wed, 11 July 2012 05:02Which version of Xtext do you use? This should be fixed in 2.3
Regards,
Sebastian
Hi Sebastian,
you are right, with Xtext 2.3 I'm able to open external file, even in an empty workspace (no projects).
I just do a quick check and a lot of things are working:
- color and text format
- content assist
- the pop-up with the element documentation (with both mouse hover and content assist)
But there are (at least?) two problems:
- if I press "crtl-left click" on a reference, nothing happens, even if the referenced object is in the same file. Please note that the editor shows correctly the documentation associated to referenced object
- there is no validation while typing. If I ask (through pop-up menu) to force validation, I get NullPointerException:
java.lang.NullPointerException
at org.eclipse.xtext.ui.editor.validation.AddMarkersOperation.execute(AddMarkersOperation.java:94)
at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
at org.eclipse.xtext.ui.editor.validation.MarkerIssueProcessor.processIssues(MarkerIssueProcessor.java:58)
at org.eclipse.xtext.ui.editor.validation.ValidationJob.run(ValidationJob.java:67)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
clearly, I was not able to check if quick fix is working or not
Regards,
Nicola
|
|
|
Re: NPE opening external files [message #896428 is a reply to message #895898] |
Wed, 18 July 2012 07:37  |
Eclipse User |
|
|
|
Hi Nicola,
could you please file some tickets for your findings? That would be very
helpful.
Thanks,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 16.07.12 15:05, schrieb Nicola Serreli:
> Sebastian Zarnekow wrote on Wed, 11 July 2012 05:02
>> Which version of Xtext do you use? This should be fixed in 2.3
>>
>> Regards,
>> Sebastian
>
>
> Hi Sebastian,
>
> you are right, with Xtext 2.3 I'm able to open external file, even in an
> empty workspace (no projects).
>
> I just do a quick check and a lot of things are working:
> - color and text format
> - content assist
> - the pop-up with the element documentation (with both mouse hover and
> content assist)
>
> But there are (at least?) two problems:
> - if I press "crtl-left click" on a reference, nothing happens, even if
> the referenced object is in the same file. Please note that the editor
> shows correctly the documentation associated to referenced object
> - there is no validation while typing. If I ask (through pop-up menu) to
> force validation, I get NullPointerException:
>
> java.lang.NullPointerException
> at
> org.eclipse.xtext.ui.editor.validation.AddMarkersOperation.execute(AddMarkersOperation.java:94)
>
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
>
> at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
>
> at
> org.eclipse.xtext.ui.editor.validation.MarkerIssueProcessor.processIssues(MarkerIssueProcessor.java:58)
>
> at
> org.eclipse.xtext.ui.editor.validation.ValidationJob.run(ValidationJob.java:67)
>
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
>
>
> clearly, I was not able to check if quick fix is working or not
>
>
> Regards,
> Nicola
>
|
|
|
Powered by
FUDForum. Page generated in 0.06273 seconds