Community
Participate
Working Groups
While testing the HtmlComposer embedded in the Task Editor of the MantisBT Mylyn connector I've noticed that the editors sometimes initialise with no content. I have 4 composers rendered in a single task editor page, and sometimes some of them do not get initialised. I am unable to reproduce this behaviour on Windows or Linux. By adding debug statements I have discovered that init() is not called for the editors that remain blank. Here's some debugging output: Setting the data using 'setHtml': pre. Added integration.editor.setData('<b>description</b><br/><ol> <li> First</li> <li> Second</li> <li> Third</li> </ol> Bla bla bla<br/><ul> <li> Line</li> <li> Another line</li> <li> Yet another line</li> </ul>'); as pending Added integration.editor.setData('<b>steps_to_reproduce</b><br/>'); as pending Added integration.editor.setData('<b>additional_information</b><br/>'); as pending Added integration.editor.setData('<b>new_comment</b><br/>'); as pending First editor get initialised pre. At init got 1 pending commands Executing integration.pendingCommandIdentifier = '1307709358770676000'; Executing integration.editor.setData('<b>description</b><br/><ol> <li> First</li> <li> Second</li> <li> Third</li> </ol> Bla bla bla<br/><ul> <li> Line</li> <li> Another line</li> <li> Yet another line</li> </ul>'); Second editor getting initialised pre. At init got 1 pending commands Executing integration.pendingCommandIdentifier = '1307709358884411000'; Executing integration.editor.setData('<b>additional_information</b><br/>'); Third editor getting initialised pre. At init got 1 pending commands Executing integration.pendingCommandIdentifier = '1307709358985044000'; Executing integration.editor.setData('<b>steps_to_reproduce</b><br/>'); The fourth one does not get initialised.
Could you attach a minimalistic snippet for reproducing?
I don't do anything exotic, but here's my simplified code nonetheless . Code might look a little strange since I've eliminated some paths which end up not instantiating the HtmlComposer, but just a simple Browser widget. pre.. Control control; String value = /* get value */ null; CoolBar coolbar = new CoolBar(parent, SWT.NONE); GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false); coolbar.setLayoutData(gd); ToolBar menu = new ToolBar(coolbar, SWT.HORIZONTAL | SWT.FLAT); ToolBarManager manager = new ToolBarManager(menu); CoolItem item = new CoolItem(coolbar, SWT.NONE); item.setControl(menu); Configuration configuration = new Configuration(); configuration.addConfigurationNode(new EnterModeConfiguration(EnterMode.BR)); composer = new HtmlComposer(parent, SWT.None, configuration); manager.add(new BoldAction(composer)); manager.add(new ItalicAction(composer)); manager.add(new PreformatAction(composer)); manager.add(new UnderlineAction(composer)); manager.add(new Separator()); manager.add(new BulletlistAction(composer)); manager.add(new NumlistAction(composer)); manager.update(true); composer.setHtml(value); GridDataFactory.fillDefaults().applyTo(composer.getBrowser()); composer.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String oldValue = getAttributeMapper().getValue(getTaskAttribute()); String newValue = HtmlFormatter.convertFromDisplayHtml(composer.getHtml()); getAttributeMapper().setValue(getTaskAttribute(), newValue); if ( !newValue.equals(oldValue) ) attributeChanged(); } }); setControl(control);
You can also see the code in context at http://mylyn-mantis.git.sourceforge.net/git/gitweb.cgi?p=mylyn-mantis/mylyn-mantis;a=blob;f=com.itsolut.mantis.ui/src/com/itsolut/mantis/ui/editor/HtmlAttributeEditorFactory.java;h=4e0d1c997f8b1ac1b4c03bbd25841741983afa26;hb=HEAD#l71 .
I've tried the following snippet under Max OSX 10.6 with Eclipse 3.6.2 Cocoa and it worked so far. Could you please test the snippet on your system for a further isolation of a possible issue? public void createPartControl(Composite parent) { final Composite comp = new Composite(parent, SWT.NO_FOCUS); comp.setLayout(new GridLayout(1, false)); comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Configuration configuration = new Configuration(); configuration.addConfigurationNode(new EnterModeConfiguration( EnterMode.BR)); CoolBar coolbar = new CoolBar(comp, SWT.NONE); GridData gd_cool = new GridData(SWT.FILL, SWT.BEGINNING, true, false); coolbar.setLayoutData(gd_cool); ToolBar menu = new ToolBar(coolbar, SWT.HORIZONTAL | SWT.FLAT); ToolBarManager manager = new ToolBarManager(menu); CoolItem item = new CoolItem(coolbar, SWT.NONE); item.setControl(menu); HtmlComposer comp1 = new HtmlComposer(comp, SWT.NONE, configuration); comp1.setHtml("<b>description</b><br/><ol> <li> \n" + "First</li> <li> Second</li> <li> Third</li> </ol> Bla bla bla<br/><ul> \n" + "<li> Line</li> <li> Another line</li> <li> Yet another line</li>\n" + "</ul>"); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); manager.add(new BoldAction(comp1)); manager.add(new ItalicAction(comp1)); manager.add(new UnderlineAction(comp1)); manager.add(new Separator()); manager.add(new BulletlistAction(comp1)); manager.add(new NumlistAction(comp1)); manager.update(true); HtmlComposer comp2 = new HtmlComposer(comp, SWT.NONE, configuration); comp2.setHtml("<b>additional_information</b><br/>"); HtmlComposer comp3 = new HtmlComposer(comp, SWT.NONE, configuration); comp3.setHtml("<b>steps_to_reproduce</b><br/>"); HtmlComposer comp4 = new HtmlComposer(comp, SWT.NONE, configuration); comp4.setHtml("<b>steps_to_reproduce4</b><br/>"); comp1.setLayoutData(gd); comp2.setLayoutData(gd); comp3.setLayoutData(gd); comp4.setLayoutData(gd); }
Sorry for the delay, I don't usually run Mac OS , but I had the change to try out your code. I simply replaced the existing method in the example application attached to bug #319018 and executed it. It randomly fails for me, with some of the composers being initialised as empty. I will attach my Eclipse configuration and will try to upload a video of what goes on, perhaps it will give you some hints.
Created attachment 198174 [details] My Eclipse configuration
Please find below a link to a video of my attempts using the RPC app. The first four attempts succeeded, but the fifth ended up with one uninitialised composer. The success rate is much higher compared to using the composer in Eclipse, which makes me believe that it is somehow related to timing. http://dl.dropbox.com/u/11860058/htmlcomposer-error.mp4
I was able to reproduce this problem, although it is not real reproducable, occurs randomly. I'm afraid this is a problem of the underlying browser-bridge. I'll investigate further on the JavaScript-side but currently I have no idea what the problem could be. In addition I'll try the latest ckeditor implementation, maybe that helps..
(In reply to comment #8) > I was able to reproduce this problem, although it is not real reproducable, > occurs randomly. I'm afraid this is a problem of the underlying browser-bridge. > I'll investigate further on the JavaScript-side but currently I have no idea > what the problem could be. > In addition I'll try the latest ckeditor implementation, maybe that helps.. What would an update involve? If it's just overwriting the contents of the ckeditor with the latest version I will give it a try.
(In reply to comment #9) > (In reply to comment #8) > > I was able to reproduce this problem, although it is not real reproducable, > > occurs randomly. I'm afraid this is a problem of the underlying browser-bridge. > > I'll investigate further on the JavaScript-side but currently I have no idea > > what the problem could be. > > In addition I'll try the latest ckeditor implementation, maybe that helps.. > > What would an update involve? If it's just overwriting the contents of the > ckeditor with the latest version I will give it a try. Overwriting the contents of this folder should be enough...
After doing a quick spike with WikiText I've decided to go that route instead, as I feel that there are less 'moving parts' out of my control - the SWT Browser widget, CKEditor - and therefore won't be investigating the upgrade.
Mylyn has been restructured, and our issue tracking has moved to GitHub [1]. We are closing ~14K Bugzilla issues to give the new team a fresh start. If you feel that this issue is still relevant, please create a new one on GitHub. [1] https://github.com/orgs/eclipse-mylyn