Search in sources :

Example 1 with UndoManager

use of gov.sandia.n2a.ui.UndoManager in project n2a by frothga.

the class ImportNeuroML method process.

@Override
public void process(File source) {
    if (PluginNeuroML.partMap == null)
        PluginNeuroML.partMap = new PartMap();
    ImportJob job = new ImportJob(PluginNeuroML.partMap);
    job.process(source);
    job.postprocess();
    MNode mainModel = job.models.child(job.modelName);
    job.models.clear(job.modelName);
    UndoManager um = PanelModel.instance.undoManager;
    um.addEdit(new CompoundEdit());
    while (job.models.size() > 0) addModel(job.models.iterator().next(), job.models, um);
    // after all add operations are completed.
    if (mainModel != null)
        um.add(new AddDoc(job.modelName, mainModel));
    um.endCompoundEdit();
}
Also used : UndoManager(gov.sandia.n2a.ui.UndoManager) CompoundEdit(gov.sandia.n2a.ui.CompoundEdit) MNode(gov.sandia.n2a.db.MNode) AddDoc(gov.sandia.n2a.ui.eq.undo.AddDoc)

Aggregations

MNode (gov.sandia.n2a.db.MNode)1 CompoundEdit (gov.sandia.n2a.ui.CompoundEdit)1 UndoManager (gov.sandia.n2a.ui.UndoManager)1 AddDoc (gov.sandia.n2a.ui.eq.undo.AddDoc)1