Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356434

Summary: Callback method in generated javascript should be wrapped with Delegate
Product: z_Archived Reporter: Yun Feng Ma <mayunf>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: greer, jvincens
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch lasher: iplog+

Description Yun Feng Ma CLA 2011-09-01 01:51:59 EDT
Build Identifier: 

The callback methods in below cases need to be wrapped with Delegate:
1) widget Event handler, such as onClick event handler in Button.
2) Service call returning to method.

Here is a test case for above two cases:
handler demo9 type RUIhandler {initialUI = [ ui ],onConstructionFunction = start, cssFile="css/MyRUI9.css", title="demo9"}
	
	TextField TextField{};

	Button Button{ text = "Click", onClick ::= Button_onClick }; //here the Button_onClick should be wrapped with Delegate in generated javascript
	ui Box{  children = [ Button, TextField ] };
	
	function start()
	end
	
	function Button_onClick(event Event in)
		EchoService9 EchoService9{@bindservice {}};
		call EchoService9.echo() returning to echo1; //here the echo1 should be wrapped with Delegate in generated javascript
	end	
	
	function echo1( retResult string in)
		TextField.text = retResult;
	end
end

If Button_onClick is not wrapped with Delegate in generated javascript, when the Button is clicked, the "this" in method Button_onClick is not demo9, then method "echo1" can not be accessed in Button_onClick.

If echo1 is not wrapped with Delegate in generated javascript, when the Service call returns and the callback method is invoked, the "this" in method echo1 is not demo9, then TextField can not be accessed.

Reproducible: Always
Comment 1 Yun Feng Ma CLA 2011-09-01 02:17:18 EDT
Created attachment 202583 [details]
Patch

Hi Scott and Joe,

Please review the patch. Thanks a lot.
Comment 2 Scott Greer CLA 2011-09-08 22:00:29 EDT
Yun Feng,

I've reviewed the code (but not tested it) and it looks good;  can you test and commit the change, or do you need me to do that?
Comment 3 Yun Feng Ma CLA 2011-09-08 22:43:42 EDT
Hi Scott,

Thanks a lot for the review. The change has been in the stream now. Thanks.

(In reply to comment #2)
> Yun Feng,
> 
> I've reviewed the code (but not tested it) and it looks good;  can you test and
> commit the change, or do you need me to do that?
Comment 4 Scott Greer CLA 2011-09-09 09:28:27 EDT
Yun Feng,

Thanks...I didn't realize it was already committed....I'm going to mark this bug resolved -- please re-open if necessary...thanks.
Comment 5 Yun Feng Ma CLA 2011-10-21 04:22:57 EDT
Verified with build 20111020. close it.