eclipse / nebula

Nebula Project
https://eclipse.org/nebula
Eclipse Public License 2.0
85 stars 98 forks source link

RichTextEditor cannot be set to readonly mode (in an easy way) #607

Open MaRoe opened 2 months ago

MaRoe commented 2 months ago

I am trying to disable the RichTextEditor in some cases. When doing so after initializing the Editor I get an exception (roughly translated). org.eclipse.swt.SWTException: Property "setReadOnly" of undefined or null cannot be called (org.eclipse.swt.SWTException: Die Eigenschaft "setReadOnly" eines undefinierten oder Nullverweises kann nicht abgerufen werden.) The UI isn't rendered at the time of the exception.

Nebula opens but is writeable. If I call the function via a button (UI is already rendered) there is no error.

So how to handle a readonly editor properly?

Thanks in advance :)

fipro78 commented 2 months ago

The question is at what time you are trying to set the editor readonly. It only works after the initialization is done. IIRC you need to use a ProgressListener and call setReadOnly() on completed.

MaRoe commented 2 months ago

I already tried it that way - no success unfortunately. the ProgressListener is „ready“ but the UI isn‘t drawn yet. I also tried it with a workaround directly from the ckeditor community with a check for CKEDITOR.status - it’s loaded but the error from above is the same.

fipro78 commented 2 months ago

Maybe then the readonly function needs to be implemented similar to the focus and initial value