Hey Neil,
Thanks for your fast reply, it turns out that said approach is actually
what is used in the internal editors (your last link)
e.g. here:
https://github.com/apache/incubator-netbeans/blob/master/platform/o.n.core/src/org/netbeans/beaninfo/editors/ColorEditor.java#L597

I was hoping for a better solution because in my case it means
serializing/creating a class every character someone is typing, which
may introduce lag and much GC overhead,
but since it seems the way to go, I'll do it like this.

The reason I was reacting to editor.setValue() was in cases where e.g.
the underlying file is changed and thus the property, to have the editor
display those values in real-time.
But I guess that's a confusing behavior anyway and it's usual to at
least re-open the property editor there. I am not even sure if
setValue() is even called from netbeans.

Kind Regards,
Marc Streckfuß

Am 14.12.18 um 22:40 schrieb Neil C Smith:
>
> On Fri, 14 Dec 2018, 21:05 Marc Streckfuß <marc.streckf...@gmail.com
> <mailto:marc.streckf...@gmail.com> wrote:
>
>     2. I tried using editor.setValue(obj); FROM the Swing Component in the
>     Swing Thread (every time any UI Component changes it's value), but
>     this
>     fails with java.lang.IllegalStateException: Attempt to mutate in
>     notification, because my Swing Components also react to
>     editor.setValue() calls.
>
>
> That sounds along the right lines to me, except why does your custom
> editor have to respond to editor.setValue() calls? If you really need
> to, you could use a boolean updating flag.
>
> There's a range of pages on the old website around this. Maybe this is
> more useful for
> you? 
> https://platform.netbeans.org/tutorials/nbm-propertyeditors-integration.html
>
> Perhaps this also useful?
> https://github.com/apache/incubator-netbeans/tree/master/platform/o.n.core/src/org/netbeans/beaninfo/editors
> Or have a look in the form module. 
>
> Best wishes, 
>
> Neil
>

Reply via email to