Adapt ClientScripting to recent client changes in RAP master

Mostly namespace changes, one protocol related test, some code cleanup
diff --git a/bundles/org.eclipse.rap.clientscripting/.settings/com.eclipsesource.jshint.ui.prefs b/bundles/org.eclipse.rap.clientscripting/.settings/com.eclipsesource.jshint.ui.prefs
index 1d7b256..0f4e329 100644
--- a/bundles/org.eclipse.rap.clientscripting/.settings/com.eclipsesource.jshint.ui.prefs
+++ b/bundles/org.eclipse.rap.clientscripting/.settings/com.eclipsesource.jshint.ui.prefs
@@ -1,5 +1,5 @@
 eclipse.preferences.version=1
-globals=org\: true, qx\: true, qxsettings\: true, qxvariants\: true, namespace\: false
+globals=rap\: true, rwt\: true, org\: true, qx\: true, qxsettings\: true, qxvariants\: true, namespace\: false
 included=js//*.js
 options=curly\: true, immed\: true, newcap\: true, eqnull\: true, shadow\: true, funcscope\: true, undef\: true, browser\: true, laxbreak\: true, evil\:true, onecase\:true, sub\:true
 projectSpecificOptions=true
diff --git a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ClientScriptingUtil.js b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ClientScriptingUtil.js
index ff73c4a..73b1e3f 100644
--- a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ClientScriptingUtil.js
+++ b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ClientScriptingUtil.js
@@ -16,7 +16,7 @@
   _wrapperHelper : function(){},
 
   _getterMapping : {
-    "org.eclipse.rwt.widgets.Text" : {
+    "rwt.widgets.Text" : {
       "getText" : function( widget ) { return function() { return widget.getValue(); }; },
       "getSelection" : function( widget ) { return function() { return widget.getSelection(); };
       }
@@ -61,7 +61,7 @@
         result = "blur";
       break;
     }
-    if( source.classname === "org.eclipse.rwt.widgets.Text" ) {
+    if( source.classname === "rwt.widgets.Text" ) {
       switch( eventType ) {
         case SWT.Verify:
           result = "input"; // TODO [tb] : does currently not react on programatic changes
@@ -103,12 +103,12 @@
   },
 
   attachSetter : function( proxy, source ) {
-    var ObjectManager = org.eclipse.rwt.protocol.ObjectManager;
+    var ObjectManager = rwt.protocol.ObjectRegistry;
     var id = ObjectManager.getId( source );
     var properties = ObjectManager.getEntry( id ).adapter.properties;
     for( var i = 0; i < properties.length; i++ ) {
       var property = properties[ i ];
-      proxy[ "set" + qx.lang.String.toFirstUp( property ) ] =
+      proxy[ "set" + rwt.util.String.toFirstUp( property ) ] =
         this._createSetter( id, property );
     }
   },
@@ -182,7 +182,7 @@
   _setProperty : function( id, property, value ) {
     var props = {};
     props[ property ] = value;
-    org.eclipse.rwt.protocol.Processor.processOperation( {
+    rwt.protocol.MessageProcessor.processOperation( {
       "target" : id,
       "action" : "set",
       "properties" : props
@@ -299,8 +299,8 @@
       width,
       height,
       font,
-      qx.util.ColorUtil.stringToRgb( fillStyle ? fillStyle : "#000000" ),
-      qx.util.ColorUtil.stringToRgb( strokeStyle ? strokeStyle : "#000000" )
+      rwt.util.ColorUtil.stringToRgb( fillStyle ? fillStyle : "#000000" ),
+      rwt.util.ColorUtil.stringToRgb( strokeStyle ? strokeStyle : "#000000" )
     );
   },
 
@@ -317,7 +317,7 @@
 
   _initVerifyEvent : function( event, originalEvent ) {
     var text = originalEvent.getTarget();
-    if( text.classname === "org.eclipse.rwt.widgets.Text" ) {
+    if( text.classname === "rwt.widgets.Text" ) {
       var keyCode = this._getLastKeyCode();
       var newValue = text.getComputedValue();
       var oldValue = text.getValue();
diff --git a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/EventBindingAdapter.js b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/EventBindingAdapter.js
index 7530425..df4b7c3 100644
--- a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/EventBindingAdapter.js
+++ b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/EventBindingAdapter.js
@@ -9,12 +9,12 @@
  *    EclipseSource - initial API and implementation
  ******************************************************************************/
 
-org.eclipse.rwt.protocol.AdapterRegistry.add( "rwt.clientscripting.EventBinding", {
+rwt.protocol.AdapterRegistry.add( "rwt.clientscripting.EventBinding", {
 
   factory : function( properties ) {
-    var source = org.eclipse.rwt.protocol.ObjectManager.getObject( properties.targetObject );
+    var source = rwt.protocol.ObjectRegistry.getObject( properties.targetObject );
     var eventType = org.eclipse.rap.clientscripting.SWT[ properties.eventType ];
-    var targetFunction = org.eclipse.rwt.protocol.ObjectManager.getObject( properties.listener );
+    var targetFunction = rwt.protocol.ObjectRegistry.getObject( properties.listener );
     return new org.eclipse.rap.clientscripting.EventBinding( source, eventType, targetFunction );
   }
 
diff --git a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/Function.js b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/Function.js
index 1353cff..dd598d4 100644
--- a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/Function.js
+++ b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/Function.js
@@ -12,10 +12,12 @@
 qx.Class.createNamespace( "org.eclipse.rap.clientscripting", {} );
 
 // TODO [tb] : consider a name thats not a native Constructor ( "Function" )
+
 /*global handleEvent:false */
 org.eclipse.rap.clientscripting.Function = function( /* code */ ) {
   // NOTE: the eval'd code will have the same scope as this function, therefore no local
   // variables except the "imports" are used.
+  // TODO [tb] : It would be cleaner if the "import" was part of the eval'd code
   var SWT = org.eclipse.rap.clientscripting.SWT;
   try {
     eval( arguments[ 0 ] );
diff --git a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ListenerAdapter.js b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ListenerAdapter.js
index c3da8bb..4533a26 100644
--- a/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ListenerAdapter.js
+++ b/bundles/org.eclipse.rap.clientscripting/js/org/eclipse/rap/clientscripting/ListenerAdapter.js
@@ -9,7 +9,7 @@
  *    EclipseSource - initial API and implementation
  ******************************************************************************/
 
-org.eclipse.rwt.protocol.AdapterRegistry.add( "rwt.clientscripting.Listener", {
+rwt.protocol.AdapterRegistry.add( "rwt.clientscripting.Listener", {
 
   factory : function( properties ) {
     var code = properties.code;
diff --git a/tests/org.eclipse.rap.clientscripting.jstest/.settings/com.eclipsesource.jshint.ui.prefs b/tests/org.eclipse.rap.clientscripting.jstest/.settings/com.eclipsesource.jshint.ui.prefs
index 350f18e..dd2e86f 100644
--- a/tests/org.eclipse.rap.clientscripting.jstest/.settings/com.eclipsesource.jshint.ui.prefs
+++ b/tests/org.eclipse.rap.clientscripting.jstest/.settings/com.eclipsesource.jshint.ui.prefs
@@ -1,6 +1,6 @@
 eclipse.preferences.version=1
 enabled=true
-globals=org\: true, qx\: true, qxsettings\: true, qxvariants\: true, namespace\: false, \r\nassertTrue\: true, assertFalse\: true, assertNull\: true, assertNotNull\: true, assertEquals\: true, assertIdentical\: true, \r\nassertContains\: true, assertContainsNot\: true, assertLarger\: true, assertSmaller\: true, fail\: true
+globals=rwt\: true, rap\: true, org\: true, qx\: true, qxsettings\: true, qxvariants\: true, namespace\: false, \r\nassertTrue\: true, assertFalse\: true, assertNull\: true, assertNotNull\: true, assertEquals\: true, assertIdentical\: true, \r\nassertContains\: true, assertContainsNot\: true, assertLarger\: true, assertSmaller\: true, fail\: true
 included=js//*.js
 options=curly\: true, immed\: true, newcap\: true, eqnull\: true, shadow\: true, funcscope\: true, undef\: true, browser\: true, laxbreak\: true, evil\:true, onecase\:true, sub\:true, proto\:true
 projectSpecificOptions=true
diff --git a/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventBinding_Test.js b/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventBinding_Test.js
index e462a0e..a4ad59a 100644
--- a/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventBinding_Test.js
+++ b/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventBinding_Test.js
@@ -14,9 +14,8 @@
 var EventBinding = org.eclipse.rap.clientscripting.EventBinding;
 var EventProxy = org.eclipse.rap.clientscripting.EventProxy;
 var TestUtil = org.eclipse.rwt.test.fixture.TestUtil;
-var Processor = org.eclipse.rwt.protocol.Processor;
-var ObjectManager = org.eclipse.rwt.protocol.ObjectManager;
-var Function = org.eclipse.rap.clientscripting.Function;
+var Processor = rwt.protocol.MessageProcessor;
+var ObjectManager = rwt.protocol.ObjectRegistry;
 var SWT = org.eclipse.rap.clientscripting.SWT;
 var EventHandlerUtil = org.eclipse.rwt.EventHandlerUtil;
 
@@ -30,10 +29,8 @@
   members : {
 
     testCreateBindingByProtocol : function() {
-      var listener = new Function( "function handleEvent(){}" );
       var code = "var handleEvent = function(){};";
-      var processor = org.eclipse.rwt.protocol.Processor;
-      processor.processOperation( {
+      Processor.processOperation( {
         "target" : "w4",
         "action" : "create",
         "type" : "rwt.clientscripting.Listener",
@@ -42,7 +39,7 @@
         }
       } );
 
-      processor.processOperation( {
+      Processor.processOperation( {
         "target" : "w5",
         "action" : "create",
         "type" : "rwt.clientscripting.EventBinding",
@@ -53,7 +50,6 @@
         }
       } );
 
-      var ObjectManager = org.eclipse.rwt.protocol.ObjectManager;
       var result = ObjectManager.getObject( "w5" );
       assertTrue( result instanceof EventBinding );
       assertIdentical( ObjectManager.getObject( "w4" ), result.getTargetFunction() );
@@ -64,7 +60,7 @@
       TestUtil.flush();
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.KeyDown, logger );
+      new EventBinding( text, SWT.KeyDown, logger );
       TestUtil.press( text, "A" );
 
       assertEquals( 1, logger.log.length );
@@ -85,7 +81,7 @@
     testBindCreatesProxyEvent : function() {
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.KeyDown, logger );
+      new EventBinding( text, SWT.KeyDown, logger );
       TestUtil.press( text, "A" );
 
       var event = logger.log[ 0 ];
@@ -95,7 +91,7 @@
     testBindDisposesProxyEvent : function() {
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.KeyDown, logger );
+      new EventBinding( text, SWT.KeyDown, logger );
       TestUtil.press( text, "A" );
 
       var event = logger.log[ 0 ];
@@ -109,7 +105,7 @@
         }
       };
 
-      var binding = new EventBinding( text, SWT.KeyDown, listener );
+      new EventBinding( text, SWT.KeyDown, listener );
       var domEvent = TestUtil.createFakeDomKeyEvent( text.getElement(), "keypress", "a" );
       TestUtil.fireFakeDomEvent( domEvent );
 
@@ -123,7 +119,7 @@
         }
       };
 
-      var binding = new EventBinding( text, SWT.MouseDown, listener );
+      new EventBinding( text, SWT.MouseDown, listener );
       var domEvent = TestUtil.createFakeDomKeyEvent( text.getElement(), "keypress", "a" );
       TestUtil.fireFakeDomEvent( domEvent );
 
@@ -148,7 +144,7 @@
       text.blur();
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.FocusIn, logger );
+      new EventBinding( text, SWT.FocusIn, logger );
       text.focus();
 
       assertEquals( 1, logger.log.length );
@@ -158,7 +154,7 @@
       text.focus();
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.FocusOut, logger );
+      new EventBinding( text, SWT.FocusOut, logger );
       text.blur();
 
       assertEquals( 1, logger.log.length );
@@ -167,7 +163,7 @@
     testBindMouseDown : function() {
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.MouseDown, logger );
+      new EventBinding( text, SWT.MouseDown, logger );
       TestUtil.fakeMouseEventDOM( textEl, "mousedown" );
 
       assertEquals( 1, logger.log.length );
@@ -177,7 +173,7 @@
       var logger = this._createLogger();
 
       TestUtil.fakeMouseEventDOM( textEl, "mousedown" );
-      var binding = new EventBinding( text, SWT.MouseUp, logger );
+      new EventBinding( text, SWT.MouseUp, logger );
       TestUtil.fakeMouseEventDOM( textEl, "mouseup" );
 
       assertEquals( 1, logger.log.length );
@@ -187,7 +183,7 @@
       var logger = this._createLogger();
 
       TestUtil.fakeMouseEventDOM( textEl, "mouseover" );
-      var binding = new EventBinding( text, SWT.MouseMove, logger );
+      new EventBinding( text, SWT.MouseMove, logger );
       TestUtil.fakeMouseEventDOM( textEl, "mousemove" );
 
       assertEquals( 1, logger.log.length );
@@ -196,7 +192,7 @@
     testBindMouseEnter : function() {
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.MouseEnter, logger );
+      new EventBinding( text, SWT.MouseEnter, logger );
       TestUtil.fakeMouseEventDOM( textEl, "mouseover" );
 
       assertEquals( 1, logger.log.length );
@@ -206,7 +202,7 @@
       var logger = this._createLogger();
 
       TestUtil.fakeMouseEventDOM( textEl, "mouseover" );
-      var binding = new EventBinding( text, SWT.MouseExit, logger );
+      new EventBinding( text, SWT.MouseExit, logger );
       TestUtil.fakeMouseEventDOM( textEl, "mouseout" );
 
       assertEquals( 1, logger.log.length );
@@ -216,7 +212,7 @@
       TestUtil.flush();
       var logger = this._createLogger();
 
-      var binding = new EventBinding( text, SWT.Verify, logger );
+      new EventBinding( text, SWT.Verify, logger );
       this._inputText( text, "goo" );
 
       assertEquals( 1, logger.log.length );
@@ -244,7 +240,7 @@
         }
       };
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "bar" );
 
       assertEquals( "bar", text.getValue() );
@@ -260,7 +256,7 @@
         }
       };
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "bar" );
 
       assertEquals( "foo", text.getValue() );
@@ -276,7 +272,7 @@
         }
       };
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "foobarxxx", [ 3, 3 ] );
 
       assertEquals( 3, text._getSelectionStart() );
@@ -292,7 +288,7 @@
         }
       } ;
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "bar" );
 
       assertEquals( "bar", text.getValue() );
@@ -307,7 +303,7 @@
         }
       };
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "foob", [ 3, 3 ] );
 
       assertEquals( "foobar", text.getValue() );
@@ -322,7 +318,7 @@
         }
       } ;
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "foxo", [ 2, 2 ] );
 
       assertEquals( "fobaro", text.getValue() );
@@ -339,7 +335,7 @@
         }
       } ;
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "fxo", [ 1, 2 ] );
 
       assertEquals( "fbaro", text.getValue() );
@@ -358,7 +354,7 @@
         }
       } ;
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       this._inputText( text, "foxo", [ 2, 2 ] );
 
       assertEquals( 5, text._getSelectionStart() );
@@ -377,7 +373,7 @@
         }
       } ;
 
-      var binding = new EventBinding( text, SWT.Verify, handler );
+      new EventBinding( text, SWT.Verify, handler );
       text._setSelectionStart( 2 );
       text._setSelectionLength( 0 );
       TestUtil.press( text, "x" );
diff --git a/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventProxy_Test.js b/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventProxy_Test.js
index 5cb03a9..d5a5b44 100644
--- a/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventProxy_Test.js
+++ b/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/EventProxy_Test.js
@@ -13,8 +13,8 @@
 var EventProxy = org.eclipse.rap.clientscripting.EventProxy;
 var EventBinding = org.eclipse.rap.clientscripting.EventBinding;
 var TestUtil = org.eclipse.rwt.test.fixture.TestUtil;
-var Processor = org.eclipse.rwt.protocol.Processor;
-var ObjectManager = org.eclipse.rwt.protocol.ObjectManager;
+var Processor = rwt.protocol.MessageProcessor;
+var ObjectManager = rwt.protocol.ObjectRegistry;
 var WidgetProxy = org.eclipse.rap.clientscripting.WidgetProxy;
 var SWT = org.eclipse.rap.clientscripting.SWT;
 
diff --git a/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/WidgetProxy_Test.js b/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/WidgetProxy_Test.js
index 16dc0f0..06016f4 100644
--- a/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/WidgetProxy_Test.js
+++ b/tests/org.eclipse.rap.clientscripting.jstest/js/org/eclipse/rap/clientscripting/WidgetProxy_Test.js
@@ -11,10 +11,9 @@
 
 (function() {
 
-var EventProxy = org.eclipse.rap.clientscripting.EventProxy;
 var TestUtil = org.eclipse.rwt.test.fixture.TestUtil;
-var Processor = org.eclipse.rwt.protocol.Processor;
-var ObjectManager = org.eclipse.rwt.protocol.ObjectManager;
+var Processor = rwt.protocol.MessageProcessor;
+var ObjectManager = rwt.protocol.ObjectRegistry;
 var WidgetProxy = org.eclipse.rap.clientscripting.WidgetProxy;
 var EventBinding = org.eclipse.rap.clientscripting.EventBinding;
 var SWT = org.eclipse.rap.clientscripting.SWT;
@@ -133,9 +132,9 @@
       var widgetProxy = WidgetProxy.getInstance( text );
 
       widgetProxy.setText( "foo" );
-      var req = org.eclipse.swt.Request.getInstance().send();
-      var msg = TestUtil.getMessage();
-      assertTrue( msg.indexOf( "w3.text=foo" ) != -1 );
+      rwt.remote.Server.getInstance().send();
+      var msg = TestUtil.getMessageObject();
+      assertEquals( "foo", msg.findSetProperty( "w3", "text" ) );
     },
 
     testTextGetText : function() {