Ejemplo n.º 1
0
 /**
  * Refreshes the list of recent query files and updates the query path.
  *
  * @param file new file
  */
 void refreshHistory(final IOFile file) {
   final StringList sl = new StringList();
   String path = null;
   if (file != null) {
     path = file.path();
     gui.gprop.set(GUIProp.WORKPATH, file.dirPath());
     sl.add(path);
     tabs.setToolTipTextAt(tabs.getSelectedIndex(), path);
   }
   final String[] qu = gui.gprop.strings(GUIProp.EDITOR);
   for (int q = 0; q < qu.length && q < 19; q++) {
     final String f = qu[q];
     if (!f.equalsIgnoreCase(path) && IO.get(f).exists()) sl.add(f);
   }
   // store sorted history
   gui.gprop.set(GUIProp.EDITOR, sl.toArray());
   hist.setEnabled(!sl.isEmpty());
 }
Ejemplo n.º 2
0
  /**
   * Starts the specified class in a separate process.
   *
   * @param clz class to start
   * @param args command-line arguments
   * @return reference to a {@link Process} instance representing the started process
   */
  public static Process start(final Class<?> clz, final String... args) {
    final String[] largs = {
      "java",
      "-Xmx" + Runtime.getRuntime().maxMemory(),
      "-cp",
      System.getProperty("java.class.path"),
      clz.getName(),
      "-D",
    };
    final StringList sl = new StringList().add(largs).add(args);

    try {
      return new ProcessBuilder(sl.toArray()).start();
    } catch (final IOException ex) {
      notexpected(ex);
      return null;
    }
  }