Xtext Embedded Editor - Null Pointer Exception [message #1284532] |
Fri, 04 April 2014 15:34 |
Arunkumar Ramaswamy Messages: 4 Registered: April 2014 |
Junior Member |
|
|
I am trying to insert xtext embedded editor in an eclipse RCP. But I am getting null pointer exception when I type something in the editor
Here is the code that i used for creating the editor
@PostConstruct
public void createControls(Composite parent) {
IEditedResourceProvider resourceProvider = new IEditedResourceProvider() {
public XtextResource createResource() {
MyDslActivator activator = MyDslActivator.getInstance();
Injector injector = activator.getInjector(MyDslActivator.ORG_XTEXT_EXAMPLE_MYDSL_MYDSL);
XtextResourceSet rs = injector.getInstance(XtextResourceSet.class);
rs.setClasspathURIContext(getClass());
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
uri = URI.createDeviceURI("D:/software/runtime-EclipseApplication/familytest/hope.mydsl");
XtextResource resource = (XtextResource) resourceFactory.createResource(uri);
// rs.getResources().add(resource);
EcoreUtil.resolveAll(resource);
if (!resource.getErrors().isEmpty()) {
// handle error?
}
return resource;
}};
MyDslActivator activator = MyDslActivator.getInstance();
Injector injector = activator.getInjector(MyDslActivator.ORG_XTEXT_EXAMPLE_MYDSL_MYDSL);
EmbeddedEditorFactory factory = injector.getInstance(EmbeddedEditorFactory.class);
@SuppressWarnings("restriction")
EmbeddedEditor embeddedEditor = factory.newEditor(resourceProvider).withParent(parent);
EmbeddedEditorModelAccess partialEditorModelAccess = embeddedEditor.createPartialEditor();
}
}
The null pointer exception is generated from at org.eclipse.jface.text.source.projection.ProjectionViewer.handleVerifyEvent(ProjectionViewer.java:1270)
I can see that the getDocument() function in handleVerifyEvent that returns IDocument is returning null.
Can anyone help me what might me the problem.
Thanks in Advance
|
|
|
Powered by
FUDForum. Page generated in 0.03063 seconds