<commit_before>package gae.editor;

import gae.editorView.PopUpEditorView;
import gae.gameView.GenericObjectsPane;
import java.util.function.Consumer;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;

/**
 *
 * @author <NAME>
 *
 *         This ComponentEditor is used in the Editor when a @settable method takes an
 *         Engine-defined object as a parameter.
 *         It presents an "Add existing" object button and a "create new" object button.
 */
public class ObjectComponentEditor extends ComponentEditor {
    private Button myAddExistingButton;
    private Button myCreateNewButton;
    private Object myObject;
    private Class<?> clazz;

    public ObjectComponentEditor (Class<?> klass) {
        clazz = klass;
        try {
            myObject = Class.forName(klass.getName()).newInstance();
        }
        catch (ClassNotFoundException | InstantiationException | IllegalAccessException e1) {
            System.out.println("error: " + klass.getName());
            myObject = null;
            e1.printStackTrace();
        }
        myAddExistingButton = new Button("Add Existing");
        myCreateNewButton = new Button("Create New");
        myCreateNewButton.setOnMouseClicked(popNewEditor());
        // TODO: setup lambda's for these buttons
        getEditBox().getChildren().addAll(getLabel(), myAddExistingButton, myCreateNewButton);
    }

    private void setObject (Object obj) {
        myObject = obj;
    }
    
    public Class<?> getObjectClass() {
        return clazz;
    }
    
    public EventHandler<? super MouseEvent> popNewEditor() {
        return e -> {
            Consumer<Object> setObjectConsumer = o -> setObject(o);
            new PopUpEditorView(setObjectConsumer, clazz);
        };
    }

    @Override
    public Object createObject (Class<?> c) {
        return c.cast(myObject);
    }

    @Override
    void clear () {
        // TODO Auto-generated method stub

    }

    @Override
    void defaultField () {
        // TODO Auto-generated method stub

    }

}<commit_msg>checking that setImagePath on Editor still works... it doesgit add .<commit_after>package gae.editor;

import gae.editorView.PopUpEditorView;
import gae.gameView.GenericObjectsPane;
import java.util.function.Consumer;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;

/**
 *
 * @author <NAME>
 *
 *         This ComponentEditor is used in the Editor when a @settable method takes an
 *         Engine-defined object as a parameter.
 *         It presents an "Add existing" object button and a "create new" object button.
 */
public class ObjectComponentEditor extends ComponentEditor {
    private Button myAddExistingButton;
    private Button myCreateNewButton;
    private Object myObject;
    private Class<?> clazz;

    public ObjectComponentEditor (Class<?> klass) {
        clazz = klass;
        try {
            myObject = Class.forName(klass.getName()).newInstance();
        }
        catch (ClassNotFoundException | InstantiationException | IllegalAccessException e1) {
            System.out.println("error: " + klass.getName());
            myObject = null;
            e1.printStackTrace();
        }
        myAddExistingButton = new Button("Add Existing");
        myCreateNewButton = new Button("Create New");
        myCreateNewButton.setOnMouseClicked(popNewEditor());
        // TODO: setup lambda's for these buttons
        getEditBox().getChildren().addAll(getLabel(), myAddExistingButton, myCreateNewButton);
    }

    private void setObject (Object obj) {
        myObject = obj;
    }
    
    public Class<?> getObjectClass() {
        return clazz;
    }
    
    public EventHandler<? super MouseEvent> popNewEditor() {
        return e -> {
            Consumer<Object> setObjectConsumer = o -> setObject(o);
            GenericObjectsPane.newCustomObject(clazz, "yo", setObjectConsumer);
//            new PopUpEditorView(setObjectConsumer, clazz);
        };
    }

    @Override
    public Object createObject (Class<?> c) {
        return c.cast(myObject);
    }

    @Override
    void clear () {
        // TODO Auto-generated method stub

    }

    @Override
    void defaultField () {
        // TODO Auto-generated method stub

    }

}
{'fraction_non_alphanumeric': 0.09721262381939645, 'fraction_numerical': 0.0009214466712739, 'mean_word_length': 2.6334728033472805, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4030232', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1158, 'n_words': 311}