/** * Create a Callback from Scilab data * * @param command the instruction * @param callbackType the type of the instruction * @return the Callback */ public static CommonCallBack createCallback(String command, int callbackType) { CommonCallBack callback = null; switch (callbackType) { case CallBack.JAVA: callback = JavaCallBack.create(command); break; case CallBack.JAVA_OUT_OF_XCLICK_AND_XGETMOUSE: callback = JavaCallBack.createOutOfXclickAndXgetmouse(command); break; case CallBack.SCILAB_INSTRUCTION_WITHOUT_GCBO: callback = ScilabCallBack.create(command); break; case CallBack.SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE: callback = ScilabCallBack.createOutOfXclickAndXgetmouse(command); break; case CallBack.SCILAB_NOT_INTERRUPTIBLE_FUNCTION: case CallBack.SCILAB_NOT_INTERRUPTIBLE_INSTRUCTION: callback = ScilabCallBack.create(command, false); break; default: callback = ScilabCallBack.create(command); break; } return callback; }
/** * Create a Callback from Scilab data * * @param command the instruction * @param callbackType the type of the instruction * @param objectUID the object UID * @return the Callback */ public static CommonCallBack createCallback(String command, int callbackType, int objectUID) { CommonCallBack callback = null; switch (callbackType) { case CallBack.JAVA: callback = JavaCallBack.create(command); break; case CallBack.JAVA_OUT_OF_XCLICK_AND_XGETMOUSE: callback = JavaCallBack.createOutOfXclickAndXgetmouse(command); break; case CallBack.SCILAB_INSTRUCTION_WITHOUT_GCBO: callback = ScilabCallBack.create(command, false); break; case CallBack.SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE: callback = ScilabCallBack.createOutOfXclickAndXgetmouse(command); break; case CallBack.SCILAB_NOT_INTERRUPTIBLE_FUNCTION: case CallBack.SCILAB_NOT_INTERRUPTIBLE_INSTRUCTION: callback = ScilabCallBack.create( "if exists(\"gcbo\") then %oldgcbo = gcbo; end;" + "gcbo = getcallbackobject(" + objectUID + ");" + command + ";if exists(\"%oldgcbo\") then gcbo = %oldgcbo; else clear gcbo; end;", false); break; default: callback = ScilabCallBack.create( "if exists(\"gcbo\") then %oldgcbo = gcbo; end;" + "gcbo = getcallbackobject(" + objectUID + ");" + command + ";if exists(\"%oldgcbo\") then gcbo = %oldgcbo; else clear gcbo; end;"); break; } return callback; }