Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » FastPartitioner throwing NPEs in latest 3.3 integration build
FastPartitioner throwing NPEs in latest 3.3 integration build [message #315198] Fri, 04 May 2007 21:28 Go to next message
Eclipse UserFriend
Originally posted by: mark_melvin.amis.com

Hi There,

We are trying to port our codebase to 3.3 and I have run across an issue I
can't see how to immediately work around. I have implemented a generic
"Code Templates" preference page that applies to more than one language.
I wrote a very simply implementation to dynamically unhook the current
SourceViewerConfiguration and hook up a new one with different syntax
highlighting based on the context of the current selected code template.
It has worked in past versions of Eclipse but in 3.3 it explodes. I get
the following stack trace:

!ENTRY org.eclipse.jface 4 2 2007-05-04 17:17:50.859
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
at
org.eclipse.jface.text.rules.FastPartitioner.initialize(Fast Partitioner.java:163)
at
org.eclipse.jface.text.rules.FastPartitioner.checkInitializa tion(FastPartitioner.java:151)
at
org.eclipse.jface.text.rules.FastPartitioner.computePartitio ning(FastPartitioner.java:613)
at
org.eclipse.jface.text.AbstractDocument.computePartitioning( AbstractDocument.java:1302)
at
org.eclipse.jface.text.TextUtilities.computePartitioning(Tex tUtilities.java:428)
at
org.eclipse.jface.text.presentation.PresentationReconciler.c reatePresentation(PresentationReconciler.java:448)
at
org.eclipse.jface.text.presentation.PresentationReconciler.p rocessDamage(PresentationReconciler.java:565)
at
org.eclipse.jface.text.presentation.PresentationReconciler.a ccess$3(PresentationReconciler.java:563)
at
org.eclipse.jface.text.presentation.PresentationReconciler$I nternalListener.documentPartitioningChanged(PresentationReco nciler.java:139)
at
org.eclipse.jface.text.presentation.PresentationReconciler$I nternalListener.documentPartitioningChanged(PresentationReco nciler.java:153)
at
org.eclipse.jface.text.AbstractDocument.fireDocumentPartitio ningChanged(AbstractDocument.java:565)
at
org.eclipse.jface.text.AbstractDocument.setDocumentPartition er(AbstractDocument.java:1407)
at
com.amis.sk2x.ui.text.SK2xDocumentSetupParticipant.setup(SK2 xDocumentSetupParticipant.java:46)


Now I am using the exact same document setup participant as my editors and
they work fine. I have traced it through and it seems that in the case of
my editors, the call to <mydocumentsetupparticipant>.setup() does not fire
a partitioning changed event - but in the simplistic source viewer on my
template page it does (for some reason). This happens just before my
partitioner is even connected to the document - hence the NPE. This seems
like a regression in the platform. Can any jface gurus give me a hint as
to what is going on here and how to fix it?

Thanks,
Mark.
Re: FastPartitioner throwing NPEs in latest 3.3 integration build [message #315278 is a reply to message #315198] Mon, 07 May 2007 15:45 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Mark Melvin wrote:

> Hi There,
>
> We are trying to port our codebase to 3.3 and I have run across an
> issue I can't see how to immediately work around. I have implemented
> a generic "Code Templates" preference page that applies to more than
> one language. I wrote a very simply implementation to dynamically
> unhook the current SourceViewerConfiguration and hook up a new one
> with different syntax highlighting based on the context of the current
> selected code template. It has worked in past versions of Eclipse but
> in 3.3 it explodes. I get the following stack trace:
>
> !ENTRY org.eclipse.jface 4 2 2007-05-04 17:17:50.859
> !MESSAGE Problems occurred when invoking code from plug-in:
> "org.eclipse.jface".
> !STACK 0
> java.lang.NullPointerException
> at
> org.eclipse.jface.text.rules.FastPartitioner.initialize(Fast Partitioner.java:163)
>
> at
> org.eclipse.jface.text.rules.FastPartitioner.checkInitializa tion(FastPartitioner.java:151)
>
> at
> org.eclipse.jface.text.rules.FastPartitioner.computePartitio ning(FastPartitioner.java:613)
>
> at
> org.eclipse.jface.text.AbstractDocument.computePartitioning( AbstractDocument.java:1302)
>
> at
> org.eclipse.jface.text.TextUtilities.computePartitioning(Tex tUtilities.java:428)
>
> at
> org.eclipse.jface.text.presentation.PresentationReconciler.c reatePresentation(PresentationReconciler.java:448)
>
> at
> org.eclipse.jface.text.presentation.PresentationReconciler.p rocessDamage(PresentationReconciler.java:565)
>
> at
> org.eclipse.jface.text.presentation.PresentationReconciler.a ccess$3(PresentationReconciler.java:563)
>
> at
> org.eclipse.jface.text.presentation.PresentationReconciler$I nternalListener.documentPartitioningChanged(PresentationReco nciler.java:139)
>
> at
> org.eclipse.jface.text.presentation.PresentationReconciler$I nternalListener.documentPartitioningChanged(PresentationReco nciler.java:153)
>
> at
> org.eclipse.jface.text.AbstractDocument.fireDocumentPartitio ningChanged(AbstractDocument.java:565)
>
> at
> org.eclipse.jface.text.AbstractDocument.setDocumentPartition er(AbstractDocument.java:1407)
>
> at
> com.amis.sk2x.ui.text.SK2xDocumentSetupParticipant.setup(SK2 xDocumentSetupParticipant.java:46)
>
>
>
> Now I am using the exact same document setup participant as my editors
> and they work fine. I have traced it through and it seems that in the
> case of my editors, the call to <mydocumentsetupparticipant>.setup()
> does not fire a partitioning changed event - but in the simplistic
> source viewer on my template page it does (for some reason). This
> happens just before my partitioner is even connected to the document -
> hence the NPE. This seems like a regression in the platform. Can any
> jface gurus give me a hint as to what is going on here and how to fix it?

We didn't touch the FastPartitioner for almost a year but of course some
other change might cause what you see. If you can boil this down to
reproducible example then please file a bug report.

Dani

>
> Thanks,
> Mark.
>
Re: FastPartitioner throwing NPEs in latest 3.3 integration build [message #315280 is a reply to message #315278] Mon, 07 May 2007 16:01 Go to previous message
Eclipse UserFriend
Originally posted by: mark_melvin.amis.com

Daniel Megert wrote:

> Mark Melvin wrote:

>> Hi There,
>>
>> We are trying to port our codebase to 3.3 and I have run across an
>> issue I can't see how to immediately work around. I have implemented
>> a generic "Code Templates" preference page that applies to more than
>> one language. I wrote a very simply implementation to dynamically
>> unhook the current SourceViewerConfiguration and hook up a new one
>> with different syntax highlighting based on the context of the current
>> selected code template. It has worked in past versions of Eclipse but
>> in 3.3 it explodes. I get the following stack trace:
>>
>> !ENTRY org.eclipse.jface 4 2 2007-05-04 17:17:50.859
>> !MESSAGE Problems occurred when invoking code from plug-in:
>> "org.eclipse.jface".
>> !STACK 0
>> java.lang.NullPointerException
>> at
>>
org.eclipse.jface.text.rules.FastPartitioner.initialize(Fast Partitioner.java:163)
>>
>> at
>>
org.eclipse.jface.text.rules.FastPartitioner.checkInitializa tion(FastPartitioner.java:151)
>>
>> at
>>
org.eclipse.jface.text.rules.FastPartitioner.computePartitio ning(FastPartitioner.java:613)
>>
>> at
>>
org.eclipse.jface.text.AbstractDocument.computePartitioning( AbstractDocument.java:1302)
>>
>> at
>>
org.eclipse.jface.text.TextUtilities.computePartitioning(Tex tUtilities.java:428)
>>
>> at
>>
org.eclipse.jface.text.presentation.PresentationReconciler.c reatePresentation(PresentationReconciler.java:448)
>>
>> at
>>
org.eclipse.jface.text.presentation.PresentationReconciler.p rocessDamage(PresentationReconciler.java:565)
>>
>> at
>>
org.eclipse.jface.text.presentation.PresentationReconciler.a ccess$3(PresentationReconciler.java:563)
>>
>> at
>>
org.eclipse.jface.text.presentation.PresentationReconciler$I nternalListener.documentPartitioningChanged(PresentationReco nciler.java:139)
>>
>> at
>>
org.eclipse.jface.text.presentation.PresentationReconciler$I nternalListener.documentPartitioningChanged(PresentationReco nciler.java:153)
>>
>> at
>>
org.eclipse.jface.text.AbstractDocument.fireDocumentPartitio ningChanged(AbstractDocument.java:565)
>>
>> at
>>
org.eclipse.jface.text.AbstractDocument.setDocumentPartition er(AbstractDocument.java:1407)
>>
>> at
>>
com.amis.sk2x.ui.text.SK2xDocumentSetupParticipant.setup(SK2 xDocumentSetupParticipant.java:46)
>>
>>
>>
>> Now I am using the exact same document setup participant as my editors
>> and they work fine. I have traced it through and it seems that in the
>> case of my editors, the call to <mydocumentsetupparticipant>.setup()
>> does not fire a partitioning changed event - but in the simplistic
>> source viewer on my template page it does (for some reason). This
>> happens just before my partitioner is even connected to the document -
>> hence the NPE. This seems like a regression in the platform. Can any
>> jface gurus give me a hint as to what is going on here and how to fix it?

> We didn't touch the FastPartitioner for almost a year but of course some
> other change might cause what you see. If you can boil this down to
> reproducible example then please file a bug report.

> Dani

Thanks, Dani. I just figured out how to make it work. In my code that
configures the SourceViewer, I used to do:

public void configureViewer(SourceViewer viewer) {
MySourceViewerConfiguration configuration = new
MySourceViewerConfiguration(null);
viewer.configure(configuration);
new MyDocumentSetupParticipant().setup(viewer.getDocument());
}

Reversing the last two lines fixes the problem. So now my method looks
like:

public void configureViewer(SourceViewer viewer) {
MySourceViewerConfiguration configuration = new
MySourceViewerConfiguration(null);
new MyDocumentSetupParticipant().setup(viewer.getDocument());
viewer.configure(configuration);
}

...and all is well.

Thanks for the reply.
Mark.
Previous Topic:Detecting changes in current editor content
Next Topic:Mix of TextCellEditor and ComboBoxCellEditor
Goto Forum:
  


Current Time: Fri Jul 19 14:28:08 GMT 2024

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

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

Back to the top