Exemplo n.º 1
0
  private void refreshList() {
    // If in offline mode
    if (connection == null) {
      searchWithScriptsMenu.setDisable(true);
    } else if (connection.getProperties() == null) {
      logger.warn("Connection's properties are null");
    } else if (connection.getProperties().getConfiguredProperties() == null) {
      logger.warn("Connection's configured properties are null");
    } else {
      final String directory =
          connection.getProperties().getConfiguredProperties().getSearchScripts();

      if (directory != null && !directory.isEmpty()) {
        scriptManager.addScripts(directory);
        onScriptListChange();
      }
    }
  }
Exemplo n.º 2
0
  public void onScriptListChange() {
    final Collection<Script> scripts = scriptManager.getScripts();

    final List<Script> pubScripts = new ArrayList<>();

    for (final Script script : scripts) {
      pubScripts.add(script);
    }

    NewPublicationController.updateScriptList(
        pubScripts,
        searchWithScriptsMenu,
        searchMethod,
        "Search with '%s' script",
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            onScriptSearch(((Script) searchMethod.getSelectedToggle().getUserData()).getName());
          }
        });
  }