示例#1
0
  public static String[] help(String path) {
    try {
      DirectJNI.getInstance()
          .notifyRActionListeners(
              new RAction(RActionType.HELP)
                  .put(RActionConst.URL, DirectJNI.getInstance().cutRHomeFromPath(path)));

    } catch (Exception e) {
      log.error("Error!", e);
    }

    return null;
  }
示例#2
0
 public static String[] q(String save, String status, String runLast) {
   DirectJNI.getInstance()
       .notifyRActionListeners(
           new RAction(RActionType.QUIT)
               .put(RActionConst.SAVE, save)
               .put(RActionConst.STATUS, status)
               .put(RActionConst.RUNLAST, runLast));
   return null;
 }
示例#3
0
  public static String[] browse(String url) {
    try {
      DirectJNI.getInstance()
          .notifyRActionListeners(new RAction(RActionType.BROWSE).put(RActionConst.URL, url));

    } catch (Exception e) {
      log.error("Error!", e);
    }

    return null;
  }
示例#4
0
  public static String[] exec(String command, String interpret) {

    log.info("RListener - calling DirectJNI.getInstance().exec(" + command + ")");

    String[] result =
        DirectJNI.getInstance()
            .exec(command, Boolean.parseBoolean(interpret), !Boolean.parseBoolean(interpret));

    log.info("RListener - DirectJNI returned");

    return result;
  }
示例#5
0
 public static String[] forbiddenSymbols(String voidStr) {
   if (_forbiddenSymbols == null) {
     Vector<String> v = new Vector<String>();
     v.addAll(DirectJNI.getInstance().getBootStrapRObjects());
     v.add("ls");
     v.add("objects");
     v.add("q");
     v.add("win.graph");
     v.add("x11");
     v.add("X11");
     v.add("dev.off");
     v.add("graphics.off");
     v.add("dev.set");
     v.add("help");
     v.add("setwd");
     _forbiddenSymbols = (String[]) v.toArray(new String[0]);
   }
   return _forbiddenSymbols;
 }
示例#6
0
  public static void pager(String fileName, String header, String title, String deleteFile) {
    HashMap<String, Object> attributes = new HashMap<String, Object>();

    byte[] buffer = null;
    try {
      RandomAccessFile raf = new RandomAccessFile(fileName, "r");
      buffer = new byte[(int) raf.length()];
      raf.readFully(buffer);
      raf.close();
    } catch (Exception e) {
      log.error("Error!", e);
    }

    DirectJNI.getInstance()
        .notifyRActionListeners(
            new RAction(RActionType.PAGER)
                .put(RActionConst.FILENAME, new File(fileName).getName())
                .put(RActionConst.CONTENT, buffer)
                .put(RActionConst.HEADER, header)
                .put(RActionConst.TITLE, title)
                .put(RActionConst.DELETEFILE, new Boolean(deleteFile)));
  }
示例#7
0
 public static String[] edit(String function) {
   DirectJNI.getInstance()
       .notifyRActionListeners(new RAction(RActionType.EDIT).put(RActionConst.FUNCTION, function));
   return null;
 }