Beispiel #1
0
 public synchronized void startREPLServer() {
   if (ackREPLServer == null) {
     try {
       // TODO use ClojureOSGi.withBundle instead
       Var startServer =
           BundleUtils.requireAndGetVar(
               getBundle().getSymbolicName(), "clojure.tools.nrepl.server/start-server");
       Object defaultHandler =
           BundleUtils.requireAndGetVar(
                   getBundle().getSymbolicName(), "clojure.tools.nrepl.server/default-handler")
               .invoke();
       Object handler =
           BundleUtils.requireAndGetVar(
                   getBundle().getSymbolicName(), "clojure.tools.nrepl.ack/handle-ack")
               .invoke(defaultHandler);
       ackREPLServer =
           (ServerSocket)
               ((Map) startServer.invoke(Keyword.intern("handler"), handler))
                   .get(Keyword.intern("server-socket"));
       CCWPlugin.log(
           "Started ccw nREPL server: nrepl://127.0.0.1:" + ackREPLServer.getLocalPort());
     } catch (Exception e) {
       CCWPlugin.logError("Could not start plugin-hosted REPL server", e);
       throw new RuntimeException("Could not start plugin-hosted REPL server", e);
     }
   }
 }
Beispiel #2
0
 public JoodoServlet() {
   try {
     final Var var = loadVar("joodo.kake.servlet", "initialize-joodo-servlet");
     var.invoke(this);
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException(e);
   }
 }
 /**
  * Gets default instance. Do not use directly: reserved for *.settings files only, i.e.
  * deserialization routines; otherwise you could get a non-deserialized instance. To obtain the
  * singleton instance, use {@link #findInstance}.
  */
 public static synchronized ReplTopComponent getDefault() {
   if (instance == null) {
     try {
       Var getIdeReplFn = RT.var("org.enclojure.ide.nb.editor.repl-win", "create-ide-repl");
       return (ReplTopComponent) getIdeReplFn.invoke(IDE_REPL);
     } catch (Exception ex) {
       Exceptions.printStackTrace(ex);
     }
   }
   return instance;
 }
Beispiel #4
0
 public static void build_unassert(IPersistentMap term) {
   if (build_unassert_fn == null) build_unassert_fn = RT.var("csneps.core.build", "unassert");
   try {
     build_unassert_fn.invoke(term);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #5
0
 public static void csneps_core_define_type(Symbol newtype, IPersistentList parents) {
   if (csneps_define_type_fn == null) csneps_define_type_fn = RT.var("csneps.core", "define-type");
   try {
     csneps_define_type_fn.invoke(newtype, parents);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 @Override
 protected void componentDeactivated() {
   try {
     setCaretVisibilityFn.invoke(_projectName, this._replPanel.GetEditorPane(), false);
   } catch (Exception ex) {
     Exceptions.printStackTrace(ex);
   }
 }
 protected void performAction(Node[] activatedNodes) {
   try {
     RT.load("org/enclojure/ide/nb/actions/action_handler");
     loadNamespaceFn.invoke(activatedNodes);
   } catch (Exception ex) {
     Exceptions.printStackTrace(ex);
   }
 }
  public ClojureGamer() {
    super();

    try {
      // Load the Clojure script -- as a side effect this initializes the runtime.
      RT.loadResourceScript(getClojureGamerFile() + ".clj");

      // Get a reference to the gamer-generating function.
      Var gamerVar = RT.var("gamer_namespace", getClojureGamerName());

      // Call it!
      theClojureGamer = (Gamer) gamerVar.invoke();
    } catch (Exception e) {
      GamerLogger.logError("GamePlayer", "Caught exception in Clojure initialization:");
      GamerLogger.logStackTrace("GamePlayer", e);
    }
  }
Beispiel #9
0
 public static void snuser_clearkb(Boolean clearall) {
   if (snuser_clearkb_fn == null) snuser_clearkb_fn = RT.var("csneps.core.snuser", "clearkb");
   try {
     snuser_clearkb_fn.invoke(clearall);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #10
0
 public static IPersistentMap snuser_assert(PersistentList expr) {
   if (snuser_assert_fn == null) snuser_assert_fn = RT.var("csneps.core.snuser", "assert");
   try {
     return (IPersistentMap) snuser_assert_fn.invoke(expr);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #11
0
 public static void csneps_printer_print_kb_to_text_file(String fname, String header) {
   if (csneps_print_print_kb_to_text_file_fn == null)
     csneps_print_print_kb_to_text_file_fn = RT.var("csneps.core.printer", "writeKBToTextFile");
   try {
     csneps_print_print_kb_to_text_file_fn.invoke(fname, header);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #12
0
 public static ISeq build_find(ISeq pattern) {
   if (build_find_fn == null) build_find_fn = RT.var("csneps.core.build", "find");
   try {
     return (ISeq) build_find_fn.invoke(pattern);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #13
0
 public static void build_add_to_context(IPersistentMap context, IPersistentMap term) {
   if (build_add_to_context_fn == null)
     build_add_to_context_fn = RT.var("csneps.core.build", "add-to-context");
   try {
     build_add_to_context_fn.invoke(term, context);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #14
0
 public static void contexts_set_current_context(IPersistentMap context) {
   if (contexts_set_current_context_fn == null)
     contexts_set_current_context_fn = RT.var("csneps.core.contexts", "setCurrentContext");
   try {
     contexts_set_current_context_fn.invoke(context);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  private Iterator getAllJavaClasses(JTextComponent component) {
    try {
      return ((Iterable) getalljavaclassesfn.invoke(component)).iterator();

    } catch (Exception ex) {
      // Exceptions.printStackTrace(ex);
      return null;
    }
  }
Beispiel #16
0
 public static IPersistentSet contexts_hyps(IPersistentMap context) {
   if (contexts_hyps_fn == null) contexts_hyps_fn = RT.var("csneps.core.contexts", "hyps");
   try {
     return (IPersistentSet) contexts_hyps_fn.invoke(context);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
  private void connectButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_connectButtonActionPerformed
    try {
      // Connect - if failed to connet - display red error on the dalog box
      nonProjectRepl.invoke(
          this.replName.getText(), this.javaArgs.getText(), this.classPath.getText());
      this.dispose();
    } catch (Exception ex) {
      this.errorLabel.setText(ex.getMessage());
      this.errorLabel.setVisible(true);
    }

    try {
      saveSettings.invoke(this.classPath.getText());
    } catch (Exception ex) {
      Exceptions.printStackTrace(ex);
    }
  } // GEN-LAST:event_connectButtonActionPerformed
  private PersistentArrayMap addImportList(JTextComponent component, String javaList) {
    try {
      return (PersistentArrayMap) addimportlistfn.invoke(component, javaList);

    } catch (Exception ex) {
      // Exceptions.printStackTrace(ex);
      return null;
    }
  }
  private Iterator getAllClojureNamespacesWithinNSnode(JTextComponent component) {
    try {
      return ((Iterable) getallclojurenamespacesfn.invoke(component)).iterator();

    } catch (Exception ex) {
      // Exceptions.printStackTrace(ex);
      return null;
    }
  }
Beispiel #20
0
 public static String build_term_predicate(IPersistentMap term) {
   if (build_term_predicate_fn == null)
     build_term_predicate_fn = RT.var("csneps.core.build", "term-predicate");
   try {
     return build_term_predicate_fn.invoke(term).toString();
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #21
0
 public static IPersistentMap snuser_define_term(PersistentList expr, Keyword type) {
   if (snuser_define_term_fn == null)
     snuser_define_term_fn = RT.var("csneps.core.snuser", "defineTerm");
   try {
     return (IPersistentMap) snuser_define_term_fn.invoke(expr, type);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #22
0
 public static IPersistentMap snuser_define_caseframe(Keyword type, IPersistentList slots) {
   if (snuser_define_caseframe_fn == null)
     snuser_define_caseframe_fn = RT.var("csneps.core.snuser", "defineCaseframe");
   try {
     return (IPersistentMap) snuser_define_caseframe_fn.invoke(type, slots);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #23
0
 public static String caseframes_caseframe_name(IPersistentMap cf) {
   if (caseframes_caseframe_name_fn == null)
     caseframes_caseframe_name_fn = RT.var("csneps.core.caseframes", "caseframe-name");
   try {
     return caseframes_caseframe_name_fn.invoke(cf).toString();
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #24
0
 public static String csneps_core_printer_term_printer(IPersistentMap term) {
   if (csneps_core_printer_term_printer_fn == null)
     csneps_core_printer_term_printer_fn = RT.var("csneps.core.printer", "term-printer");
   try {
     return csneps_core_printer_term_printer_fn.invoke(term).toString();
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
 @Override
 public void componentClosed() {
   if (_projectName.compareTo(IDE_REPL) != 0) {
     try {
       stopProjectReplFn.invoke(_projectName, true);
     } catch (Exception ex) {
       Exceptions.printStackTrace(ex);
     }
   }
 }
Beispiel #26
0
 public static Boolean caseframes_quotedpp_qmark(IPersistentMap cf) {
   if (caseframes_quotedpp_qmark_fn == null)
     caseframes_quotedpp_qmark_fn = RT.var("csneps.core.caseframes", "quotedpp?");
   try {
     return (Boolean) caseframes_quotedpp_qmark_fn.invoke(cf);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #27
0
 public static Boolean csneps_core_variable_term_qmark(IPersistentMap term) {
   if (csneps_core_variable_term_qmark_fn == null)
     csneps_core_variable_term_qmark_fn = RT.var("csneps.core", "variableTerm?");
   try {
     return (Boolean) csneps_core_variable_term_qmark_fn.invoke(term);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Beispiel #28
0
 public static IPersistentMap contexts_asserted_qmark(
     IPersistentMap term, IPersistentMap context) {
   if (contexts_asserted_qmark_fn == null)
     contexts_asserted_qmark_fn = RT.var("csneps.core.contexts", "asserted?");
   try {
     return (IPersistentMap) contexts_asserted_qmark_fn.invoke(term, context);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
  /** Creates new form ClojureReplDialog */
  public CreateStandaloneReplDialog(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();

    try {
      this.classPath.setText((String) loadSettings.invoke(ns_settings));
    } catch (Exception ex) {
      Exceptions.printStackTrace(ex);
    }

    errorLabel.setVisible(false);
    this.setLocationRelativeTo(null);
  }
Beispiel #30
0
 public static IPersistentMap contexts_define_context(
     Symbol name, IPersistentList parents, IPersistentSet hyps) {
   if (contexts_define_context_fn == null)
     contexts_define_context_fn = RT.var("csneps.core.contexts", "defineContext");
   try {
     return (IPersistentMap)
         contexts_define_context_fn.invoke(
             name, Keyword.intern("parents"), parents, Keyword.intern("hyps"), hyps);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }