Search in sources :

Example 1 with DeleteEquation

use of gov.sandia.n2a.ui.eq.undo.DeleteEquation in project n2a by frothga.

the class NodeEquation method delete.

@Override
public void delete(JTree tree, boolean canceled) {
    if (source.isFromTopDocument()) {
        PanelModel.instance.undoManager.add(new DeleteEquation(this, canceled));
    } else {
        NodeVariable parent = (NodeVariable) getParent();
        String combiner = parent.source.get();
        // strip @ from name, as required by ChangeEquation
        String name = source.key().substring(1);
        String value = source.get();
        // revoke the equation
        PanelModel.instance.undoManager.add(new ChangeEquation(parent, name, combiner, value, name, combiner, ""));
    }
}
Also used : ChangeEquation(gov.sandia.n2a.ui.eq.undo.ChangeEquation) DeleteEquation(gov.sandia.n2a.ui.eq.undo.DeleteEquation)

Example 2 with DeleteEquation

use of gov.sandia.n2a.ui.eq.undo.DeleteEquation in project n2a by frothga.

the class NodeEquation method makeDelete.

@Override
public Undoable makeDelete(boolean canceled) {
    if (source.isFromTopDocument())
        return new DeleteEquation(this, canceled);
    NodeVariable parent = (NodeVariable) getParent();
    String combiner = parent.source.get();
    // strip @ from name, as required by ChangeEquation
    String name = source.key().substring(1);
    String value = source.get();
    // revoke the equation
    return new ChangeEquation(parent, name, combiner, value, name, combiner, "$kill");
}
Also used : ChangeEquation(gov.sandia.n2a.ui.eq.undo.ChangeEquation) DeleteEquation(gov.sandia.n2a.ui.eq.undo.DeleteEquation)

Aggregations

ChangeEquation (gov.sandia.n2a.ui.eq.undo.ChangeEquation)2 DeleteEquation (gov.sandia.n2a.ui.eq.undo.DeleteEquation)2