org.rhq.scripting.javascript
Class JavascriptCompletor

java.lang.Object
  extended by org.rhq.scripting.javascript.JavascriptCompletor
All Implemented Interfaces:
CodeCompletion

public class JavascriptCompletor
extends Object
implements CodeCompletion

A Contextual JavaScript interactive completor. Not perfect, but handles a fair number of cases.

Author:
Greg Hinkle, Lukas Krejci

Constructor Summary
JavascriptCompletor()
           
 
Method Summary
 int complete(PrintWriter output, String s, int i, List list)
           
 int completeParameters(Object baseObject, String params, int i, List<String> list, Method method)
          Split apart the parameters to a method call and complete the last parameter.
 void setMetadataProvider(MetadataProvider metadataProvider)
           
 void setScriptContext(ScriptContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavascriptCompletor

public JavascriptCompletor()
Method Detail

complete

public int complete(PrintWriter output,
                    String s,
                    int i,
                    List list)
Specified by:
complete in interface CodeCompletion

setMetadataProvider

public void setMetadataProvider(MetadataProvider metadataProvider)
Specified by:
setMetadataProvider in interface CodeCompletion

completeParameters

public int completeParameters(Object baseObject,
                              String params,
                              int i,
                              List<String> list,
                              Method method)
Split apart the parameters to a method call and complete the last parameter. If the last paramater has a valid value close that field with a "," for the next param or a ")" if is the last parameter. Does all machting according to the type of the parameters of the supplied method.

Parameters:
baseObject -
params -
i -
list -
method -
Returns:

setScriptContext

public void setScriptContext(ScriptContext context)
Specified by:
setScriptContext in interface CodeCompletion


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.