Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Encountered an NullPointException with StructuredModelManager
Encountered an NullPointException with StructuredModelManager [message #230471] Thu, 16 April 2009 18:16 Go to next message
Frank Du is currently offline Frank Du
Messages: 91
Registered: July 2009
Member
Dear, All,

Again, we are reading/writing in-memory objects. A disk file will be
parsed into model, and the SSE editor will display a small portion of the
model.

I implemented the IStorageEditorInput and IStorage for the objects. Then
added required plug-ins to the launch settings. But I kept encountering
NullPointException when trying to open a file. The debug showed that in
the following lines, model is a null value.

Do we need to register a model? If yes, how to register a model?

//org.eclipse.wst.sse.ui.internal.StorageModelProvider
//......
// first parameter must be unique
model = StructuredModelManager.getModelManager().getModelForEdit(id,
contents, null);
model.setBaseLocation(calculateBaseLocation(input));


Supplementary:
If the program starts with all the plug-ins, the problem is gone. It seems
that some plug-in contributes models for the issue. Is there a way to
figure out the plug-in?

Thank you so much!

Have a nice day!
Frank
Re: Encountered an NullPointException with StructuredModelManager [message #230494 is a reply to message #230471] Fri, 17 April 2009 21:02 Go to previous message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2228
Registered: July 2009
Senior Member
Frank Du wrote:
> Dear, All,
>
> Again, we are reading/writing in-memory objects. A disk file will be
> parsed into model, and the SSE editor will display a small portion of
> the model.
> I implemented the IStorageEditorInput and IStorage for the objects. Then
> added required plug-ins to the launch settings. But I kept encountering
> NullPointException when trying to open a file. The debug showed that in
> the following lines, model is a null value.
> Do we need to register a model? If yes, how to register a model?
> //org.eclipse.wst.sse.ui.internal.StorageModelProvider
> //......
> // first parameter must be unique
> model = StructuredModelManager.getModelManager().getModelForEdit(id,
> contents, null);
> model.setBaseLocation(calculateBaseLocation(input));
>
>
> Supplementary:
> If the program starts with all the plug-ins, the problem is gone. It
> seems that some plug-in contributes models for the issue. Is there a way
> to figure out the plug-in?
>
> Thank you so much!

It depends on what kind of input you're using, i.e. is it XML, HTML,
CSS, etc.? You'll need to have the language-specific UI and Core
plug-ins present as well as org.eclipse.wst.sse.ui and
org.eclipse.wst.sse.core. It also helps if the ID you're passing in
looks like an expected filename for your supported content type.

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Validation of XPaths in xsd?
Next Topic:Publishing static website to HTTP server fails
Goto Forum:
  


Current Time: Tue Jul 22 07:39:37 EDT 2014

Powered by FUDForum. Page generated in 0.01584 seconds