/**
   * Uses the {@link ExpressionParserBuilder} to create an {@link ExpressionParser} with all modules
   * that are registered to the {@link ExpressionRegistry}.
   *
   * @param op the operator to create the {@link ExpressionParser} for. Must not be {@code null}
   * @param exampleResolver the {@link ExampleResolver} which is used to lookup example values.
   *     Might be {@code null} in case no {@link ExampleResolver} is available
   * @return the build expression parser
   */
  public static ExpressionParser createAllModulesParser(
      final Operator op, final ExampleResolver exampleResolver) {
    ExpressionParserBuilder builder = new ExpressionParserBuilder();

    // decide which functions should be available
    builder.withCompatibility(op.getCompatibilityLevel());

    if (op.getProcess() != null) {
      builder.withProcess(op.getProcess());
      builder.withScope(new MacroResolver(op.getProcess().getMacroHandler(), op));
    }
    if (exampleResolver != null) {
      builder.withDynamics(exampleResolver);
    }

    builder.withModules(ExpressionRegistry.INSTANCE.getAll());

    return builder.build();
  }
 @Override
 public void apply() {
   RepositoryLocation absLoc;
   try {
     absLoc = operator.getParameterAsRepositoryLocation(key);
     final RepositoryLocation processLoc = operator.getProcess().getRepositoryLocation().parent();
     if (processLoc == null) {
       SwingTools.showVerySimpleErrorMessage(
           "quickfix_failed", "Process is not stored in repository.");
     } else {
       String relative = absLoc.makeRelative(processLoc);
       operator.setParameter(key, relative);
     }
   } catch (UserError e) {
     // Should not happen. Parameter should be set, otherwise we would not have created this
     // prefix.
     SwingTools.showVerySimpleErrorMessage("quickfix_failed", e.toString());
   }
 }
Ejemplo n.º 3
0
 private void fill(Operator root) {
   int numTotal = root.getProcess().getRootOperator().getErrorList().size();
   errors = root.getErrorList();
   String errorString;
   switch (errors.size()) {
     case 0:
       errorString = "No problems found";
       break;
     case 1:
       errorString = "One potential problem";
       break;
     default:
       errorString = errors.size() + " potential problems";
       break;
   }
   if (errors.size() != numTotal) {
     errorString = errorString + " (" + (numTotal - errors.size()) + " Filtered)";
   }
   headerLabel.setText(errorString);
   model.fireTableDataChanged();
 }