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

Bug 491800

Summary: codeEdit: Need a way to pass statusReporter during widget creation.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: EditorAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 12.0   
Target Milestone: 12.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2016-04-15 09:59:31 EDT
Are their any examples on how to attach a statusReporter to the codeEditor editor widget? It's possible to set it post-creation with something like:

codeEditInstance.editor._statusReporter = statusReporter; // where statusReporter is a function e.g. statusReporter(message, isError, isAccessible) 

but it's not a particularly clean way of doing so
Comment 1 libing wang CLA 2016-04-27 12:23:45 EDT
We will ask the end user to pass the statusReporter function as an option.
For example, this function can be used in two ways:
1. The codeEdit widget will feed some message for the time being, e.g. line number and col number.

2. User can also call the function to render something, e.g., the tab mode state mentioned in bug 491792.

The only concern here is that if 1 and 2 shares the same DOM node, then, for example, the tab mode could be erased by the "line number and col number" if user changes the editor caret. If that is true then 2 has to use something else.
Comment 3 libing wang CLA 2016-05-02 17:34:41 EDT
The usage of the statusReporter option would be :

	var statusReporter = function(message, type, isAccessible) {
		if (type === "progress") {
			console.log( "Progress message: " + message);
		} else if (type === "error") { //$NON-NLS-0$
			console.log( "Error message: " + message);
		} else {
			console.log( "Normal message: " + message);
		}
	};
	
	embeddedEditor.create({parent: "embeddedEditor", statusReporter: statusReporter}).then(function(editorViewer) {
Comment 4 libing wang CLA 2016-05-02 17:36:03 EDT
We assume that each editor has its own status reporter.
Note that in the multiple editor instance case if you want to share the status reporter, just pass the same function.