コード例 #1
0
  public JavaCScriptingInterface() {
    super();

    String method =
        "def JavaC_method(name):\n"
            + "	def applyMethod(context, definition, glob):\n"
            + "		d2 = \"class __tempDef{ public void q() {\" + definition+ \"}}\";\n"
            + "		JavaC(context, d2, glob)\n"
            + "		global __tempDef\n"
            + "		globals()[name] = __tempDef().q\n"
            + "	return applyMethod\n"
            + "";

    PythonInterface.getPythonInterface().execString(method);

    MinimalTextField_blockMenu.knownTextTransforms.add(
        new Pair<String, String>(
            transformName() + "_method",
            "JavaC_method(\"somemethod\") declares a parameterless method called \"somemethod\" that's defined in Java"));
  }
コード例 #2
0
 @Override
 public void setRoot(iVisualElement root) {
   super.setRoot(root);
   root.setProperty(java, bound);
   PythonInterface.getPythonInterface().setVariable("_java", bound);
 }