/*******************************************************************************
 * Copyright (c) 2014 Codenvy, S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/
package com.codenvy.ide.editor.codemirror.client.jso.event;

import com.codenvy.ide.editor.codemirror.client.jso.CMPositionOverlay;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArrayString;

/**
 * Argument of a (codemirror) native change event.
 * 
 * @author "Mickaël Leduque"
 */
public class CMBeforeChangeEventOverlay extends JavaScriptObject {

    protected CMBeforeChangeEventOverlay() {
    }

    public final native CMPositionOverlay getFrom() /*-{
        return this.from;
    }-*/;

    public final native CMPositionOverlay getTo() /*-{
        return this.to;
    }-*/;

    public final native JsArrayString getText() /*-{
        return this.text;
    }-*/;

    public final native void cancel() /*-{
        this.cancel();
    }-*/;


    public final native boolean hasUpdate() /*-{
        return (typeof this.update === "function");
    }-*/;

    public final native String update() /*-{
        return this.update();
    }-*/;

    public final native String update(CMPositionOverlay from) /*-{
        return this.update(from);
    }-*/;

    public final native String update(CMPositionOverlay from, CMPositionOverlay to) /*-{
        return this.update(from, to);
    }-*/;

    public final native String update(CMPositionOverlay from, CMPositionOverlay to, JsArrayString text) /*-{
        return this.update(from, to, text);
    }-*/;
}

@@ -785,16 +785,22 @@
  native 
+before
 change e
@@ -809,41 +809,8 @@
 nt.%0A
- * %0A * @author %22Micka%C3%ABl Leduque%22%0A
  */%0A
@@ -877,16 +877,63 @@
 ject %7B%0A%0A
+    /** JSO mandated protected constructor. */%0A
     prot
@@ -976,16 +976,95 @@
 %0A    %7D%0A%0A
+    /**%0A     * Return the from field of the event.%0A     * @return from%0A     */%0A
     publ
@@ -1141,32 +1141,107 @@
 rom;%0A    %7D-*/;%0A%0A
+    /**%0A     * Return the to field of the event.%0A     * @return to%0A     */%0A
     public final
@@ -1306,32 +1306,131 @@
 .to;%0A    %7D-*/;%0A%0A
+    /**%0A     * Return the text field of the event i.e. the added text.%0A     * @return text%0A     */%0A
     public final
@@ -1495,32 +1495,63 @@
 ext;%0A    %7D-*/;%0A%0A
+    /** Cancels the change. */%0A
     public final
@@ -1611,16 +1611,120 @@
  %7D-*/;%0A%0A
+    /**%0A     * Tells if the change is updatable.%0A     * @return true iff the change is updatable%0A     */
 %0A    pub
@@ -1820,32 +1820,71 @@
 n%22);%0A    %7D-*/;%0A%0A
+    /** Sets the change as updated. */%0A
     public final
@@ -1883,38 +1883,36 @@
 ic final native 
-String
+void
  update() /*-%7B%0A 
@@ -1943,32 +1943,95 @@
 e();%0A    %7D-*/;%0A%0A
+    /** Sets the change as updated with a new 'from' value. */%0A
     public final
@@ -2030,38 +2030,36 @@
 ic final native 
-String
+void
  update(CMPositi
@@ -2079,39 +2079,32 @@
 m) /*-%7B%0A        
-return 
 this.update(from
@@ -2109,32 +2109,105 @@
 om);%0A    %7D-*/;%0A%0A
+    /** Sets the change as updated with a new 'from' and 'to' values. */%0A
     public final
@@ -2206,38 +2206,36 @@
 ic final native 
-String
+void
  update(CMPositi
@@ -2277,39 +2277,32 @@
 o) /*-%7B%0A        
-return 
 this.update(from
@@ -2315,24 +2315,105 @@
 %0A    %7D-*/;%0A%0A
+    /** Sets the change as updated with a new 'from', 'to' and 'text' values. */%0A
     public f
@@ -2424,22 +2424,20 @@
  native 
-String
+void
  update(
@@ -2507,39 +2507,32 @@
 t) /*-%7B%0A        
-return 
 this.update(from

Fix beforechange event (no removed) and add javadoc