/*******************************************************************************
 * 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.hints;

import com.codenvy.ide.editor.codemirror.client.jso.CMEditorOverlay;
import com.codenvy.ide.editor.codemirror.client.jso.CodeMirrorOverlay;
import com.google.gwt.core.client.JavaScriptObject;

public class CMHintFunctionOverlay extends JavaScriptObject {

    protected CMHintFunctionOverlay() {
    }

    public final native CMHintResultsOverlay apply(CMEditorOverlay editor, CMHintOptionsOverlay options) /*-{
        return this(editor, options);
    }-*/;

    public static final native CMHintFunctionOverlay createFromName(CodeMirrorOverlay codeMirror, String funcName) /*-{
        return codemirror.hint[funcName];
    }-*/;

    public static final native CMHintFunctionOverlay createFromHintFunction(HintFunction hintFunction) /*-{
        return function(editor, options) {
            return hintFunction.@com.codenvy.ide.editor.codemirror.client.jso.hints.CMHintFunctionOverlay.HintFunction::getHints(*)(editor, options);
        };
    }-*/;

    public static final native CMHintFunctionOverlay createFromAsyncHintFunction(AsyncHintFunction hintFunction) /*-{
        var result = function(editor, callback, options) {
            return hintFunction.@com.codenvy.ide.editor.codemirror.client.jso.hints.CMHintFunctionOverlay.AsyncHintFunction::getHints(*)(editor, callback, options);
        };
        result.async=true;
        return result;
    }-*/;

    public interface HintFunction {
        CMHintResultsOverlay getHints(CMEditorOverlay editor, CMHintOptionsOverlay options);
    }

    public interface AsyncHintFunction {
        void getHints(CMEditorOverlay editor, CMHintCallback callback,
                                  CMHintOptionsOverlay options);
    }
}

@@ -1025,32 +1025,152 @@
 ns);%0A    %7D-*/;%0A%0A
+    public final native CMHintResultsOverlay apply(CMEditorOverlay editor) /*-%7B%0A        return this(editor);%0A    %7D-*/;%0A%0A
     public stati
@@ -1288,25 +1288,25 @@
  return code
-m
+M
 irror.hint%5Bf

Fix create hint function from name