Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Embedded Editor - Null Pointer Exception
Xtext Embedded Editor - Null Pointer Exception [message #1284532] Fri, 04 April 2014 15:34
Arunkumar Ramaswamy is currently offline Arunkumar RamaswamyFriend
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
Previous Topic:Generic Graphic View can't integrate with Xtext
Next Topic:Trouble modeling a lisp-like language
Goto Forum:
  


Current Time: Tue Apr 23 12:53:54 GMT 2024

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

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

Back to the top