Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359070 - Could not evaluate javascript response when using Twistie
Summary: Could not evaluate javascript response when using Twistie
Status: RESOLVED INVALID
Alias: None
Product: RAP
Classification: RT
Component: Workbench (show other bugs)
Version: 1.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2011-09-27 09:58 EDT by Sebastian Bauer CLA
Modified: 2011-09-28 09:37 EDT (History)
2 users (show)

See Also:


Attachments
The contents of the browser window after executing TwistieBug.java (3.27 KB, text/plain)
2011-09-27 10:00 EDT, Sebastian Bauer CLA
no flags Details
Browser output of IceWeasel (1.68 KB, text/plain)
2011-09-27 11:11 EDT, Sebastian Bauer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Bauer CLA 2011-09-27 09:58:33 EDT
Build Identifier: M20110909-1335

I'm trying to use a twistie in a Form. My project uses following packages in the build path:
org.eclipse.rap.rwt_1.5.0.20110920-2112.jar
org.eclipse.rap.jface_1.5.0.20110920-2112.jar
org.eclipse.rap.ui.forms_1.5.0.20110920-2112.jar
org.eclipse.core.commands_3.6.0.I20110111-0800.jar
org.eclipse.equinox.common_3.6.0.v20110523.jar

Whenever I use the Twistie in the project, the browser shows following error messages: Could not evaluate javascript respon

(more details in the attachment)

Reproducible: Always

Steps to Reproduce:
A minimal example should be:

--<8--

import org.eclipse.rwt.lifecycle.IEntryPoint;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.widgets.Twistie;

public class TwistieBug  implements IEntryPoint
{
	@Override
	public int createUI()
	{
	    Display display = new Display();
	    Shell shell = new Shell( display, 0 );
	    shell.setLayout(new FillLayout());

	    Twistie tw = new Twistie(shell, 0);

	    shell.setMaximized(true);
	    shell.layout();
	    shell.open();
	    while( !shell.isDisposed() ) {
	      if( !display.readAndDispatch() )
	        display.sleep();
	    }
	    display.dispose();
	    return 0;
	}
}

--8>--
Comment 1 Sebastian Bauer CLA 2011-09-27 10:00:18 EDT
Created attachment 204080 [details]
The contents of the browser window after executing TwistieBug.java
Comment 2 Sebastian Bauer CLA 2011-09-27 10:20:39 EDT
Note that this also happens with the components of RAP 1.4.0. In my Form, I want to use a Section with a Twistie. I traced the problem back to the Twistie code (happens also for TreeNode) hence the minimal example.
Comment 3 Ivan Furnadjiev CLA 2011-09-27 10:40:18 EDT
Sebastian, I can't reproduce it (tested on Windows with FF 7, IE9, Chrome 14, Safari 5.1) and I can't find such a property "forms" in our code. Do you have a custom widgets or other custom javascript? Is it reproducible in all browsers - FF, IE, Chrome, Safari?
Comment 4 Sebastian Bauer CLA 2011-09-27 10:53:48 EDT
I tested it on Chrome 12 and Iceweasel 6 on Debian and the behaviour is essentially the same. I don't know so much about internals of RAP so I have no idea how to debug this to get better information :(

I create a new Java project, add the Twistie.java to it and configure the build path to contain the mentioned jar files. Then I run the Twistie.java as RWT application and I get the error message I mentioned. If I comment out the Twistie, the application runs fine.

I'll try on a Windows machine later.
Comment 5 Sebastian Bauer CLA 2011-09-27 11:11:15 EDT
Created attachment 204092 [details]
Browser output of IceWeasel

I was slightly inprecise. The output differs in the error message. In IceWeasel, it is complained that org.eclipse.ui is undefined. Did I forget to add a particular jar (apart from those I mentioned)?
Comment 6 Ivan Furnadjiev CLA 2011-09-27 11:29:14 EDT
Sebastian, if I understand correctly you create and run a RAP standalone application. As stated in this newsgroup post:
http://www.eclipse.org/forums/index.php/mv/msg/40085/130447/#msg_130447
"...forms plug-in is intended to work with RAP, but not RWT standalone, it makes use of the resource extension point. You could try to register these resources manually. Have a look at the resources extensions in the plugin.xml." I will close this bug as INVALID.
Comment 7 Sebastian Bauer CLA 2011-09-27 11:35:09 EDT
Yes, seems to be worth a FAQ if you ask me :)
Comment 8 Rüdiger Herrmann CLA 2011-09-27 13:12:02 EDT
(In reply to comment #7)
> Yes, seems to be worth a FAQ if you ask me :)
You are welcome to contribute an entry to the FAQ :)

IIRC RCP Forms can be used without OSGi and the plug-in registry running, which would mean that itis a bug in RAP Forms if it can't be used standalone.
Comment 9 Sebastian Bauer CLA 2011-09-28 03:57:00 EDT
I'd love to do this, but I did not bring the described procedure to actually do something useful. Seems that this information in the forum entry is outdated (I cannot really overload the RWTServletContextListener because most of the useful methods are private). However, I figured out that there is a org.eclipse.rwt.Configurator parameter, which I can use in web.xml to register a org.eclipse.rwt.engine.Configurator implementation, in which I can add the widgets. But this doesn't work too (same error message appears).

From the point of view what the Form UI provides, I don't see a reason why this shall depend on RAP, but then, I'm no expert of the Eclipse framework. Never used RCP forms before, but if they work without the registry I think this Bug is valid.
Comment 10 Sebastian Bauer CLA 2011-09-28 07:29:14 EDT
Got it now. The key was also to use
 context.addResource(new ToggleHyperlinkResource());
to the configure() implementation, so the corresponding javascript is "linked" in. I may provide a FAQ entry now.
Comment 11 Rüdiger Herrmann CLA 2011-09-28 09:37:54 EDT
(In reply to comment #10)
> Got it now. The key was also to use
>  context.addResource(new ToggleHyperlinkResource());
> to the configure() implementation, so the corresponding javascript is "linked"
Great!

> in. I may provide a FAQ entry now.
The FAQ is here: http://wiki.eclipse.org/RAP/FAQ, you can log in with your bugzilla account.