Interface CodeEditor.SaveCallback

Enclosing class:
CodeEditor
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface CodeEditor.SaveCallback
Functional interface for delegating save operations to the caller.

The implementation should validate/compile source and populate errors with any diagnostic messages keyed by 1-based line number. An empty errors map signals a successful save.

editor.setSaveCallback((source, errors) -> {
    try {
        MyCompiler.compile(source);
    } catch (CompileException e) {
        errors.put(e.getLine(), e.getMessage());
    }
});
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    save(String source, it.unimi.dsi.fastutil.ints.Int2ObjectMap<String> errors)
     
  • Method Details

    • save

      void save(String source, it.unimi.dsi.fastutil.ints.Int2ObjectMap<String> errors)
      Parameters:
      source - The current editor text to be saved/compiled.
      errors - Mutable map to fill with lineNumber → message pairs. Leave empty to indicate success.