Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » [Richtext Editor] How to wait to load of browser
[Richtext Editor] How to wait to load of browser [message #1743864] Tue, 20 September 2016 09:46 Go to next message
Mickael ADAM is currently offline Mickael ADAMFriend
Messages: 31
Registered: February 2014
Member
Hi,

I use the richtext editor in a view but, at the first opening I have:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2016-09-20 11:36:58.467
!MESSAGE 
!STACK 0
org.eclipse.swt.SWTException: Impossible d'obtenir la propriété  « setReadOnly » d'une référence null ou non définie
	at org.eclipse.swt.browser.WebBrowser$EvaluateFunction.function(WebBrowser.java:192)
	at org.eclipse.swt.browser.WebSite.Invoke(WebSite.java:833)


Apparently the browser is not totally loaded and CKEditor function are not yet available.

Is there a way to wait or be sure that function are loaded before using them?

thanks a lot.

Mickaël
Re: [Richtext Editor] How to wait to load of browser [message #1743874 is a reply to message #1743864] Tue, 20 September 2016 10:39 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
How does your code look like?
Re: [Richtext Editor] How to wait to load of browser [message #1743886 is a reply to message #1743874] Tue, 20 September 2016 12:20 Go to previous messageGo to next message
Mickael ADAM is currently offline Mickael ADAMFriend
Messages: 31
Registered: February 2014
Member
The instanciation:
	toolbarConfig = new UMLToolbarConfiguration();
		toolbarConfig.toolbarCollapsible = true;
		toolbarConfig.removeFormat = false;
		toolbarConfig.toolbarInitialExpanded = Activator.getToolbarInitialExpendedPreference();

		richtextEditor = new UMLRichtextEditorWithReferences(parent, toolbarConfig);


The refrech at the selection change on a diagram element or at the opening when an element is already selected:
// Refresh rich text text editor
		richtextEditor.getDisplay().syncExec(new Runnable() {

			@Override
			public void run() {
				if (null != richtextEditor && !richtextEditor.isDisposed()) {
					richtextEditor.configureEdition(comment, null != comment ? UMLPackage.eINSTANCE.getComment_Body() : null);
					richtextEditor.setText(text);
					richtextEditor.setEditable(readOnly ? false : editable);
				}
			}
		});


NB: I passe from asyncExec to syncExec due to synchronisation issue but I have now "permission refused issue" which comme back:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2016-09-20 14:19:07.154
!MESSAGE 
!STACK 0
org.eclipse.swt.SWTException: Permission refusée
	at org.eclipse.swt.browser.WebBrowser$EvaluateFunction.function(WebBrowser.java:192)
	at org.eclipse.swt.browser.WebSite.Invoke(WebSite.java:833)
	at org.eclipse.swt.browser.WebSite$7.method6(WebSite.java:184)
	at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:119)
	at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
	at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:64)
Re: [Richtext Editor] How to wait to load of browser [message #1743898 is a reply to message #1743886] Tue, 20 September 2016 13:05 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
I don't understand why you are operating with runnables to initialize the control. And from which thread you are starting everything. But personally I would suggest to check your multi threading code and ensure you are in the UI thread. And probably don't use multi treading but operate in a single thread sequentially.

As I don't know the whole context I'm sorry, but I can't help.
Previous Topic:[RichTextPainter] IllegalArgumentException in ResetSpanStylePaintInstruction
Next Topic:Scrollbar with RichTextViewer is not working
Goto Forum:
  


Current Time: Mon Dec 09 08:39:42 GMT 2024

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

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

Back to the top