Search in sources :

Example 1 with ModifyMeasurementOrdering

use of de.neemann.digital.gui.components.modification.ModifyMeasurementOrdering in project Digital by hneemann.

the class Main method orderMeasurements.

private void orderMeasurements() {
    try {
        Model m = new ModelCreator(circuitComponent.getCircuit(), library).createModel(false);
        try {
            ensureModelIsStopped();
            ArrayList<String> names = new ArrayList<>();
            for (Signal s : m.getSignals()) names.add(s.getName());
            new OrderMerger<String, String>(circuitComponent.getCircuit().getMeasurementOrdering()).order(names);
            ElementOrderer.ListOrder<String> o = new ElementOrderer.ListOrder<>(names);
            if (new ElementOrderer<>(Main.this, Lang.get("menu_orderMeasurements"), o).addOkButton().showDialog()) {
                circuitComponent.modify(new ModifyMeasurementOrdering(names));
            }
        } finally {
            m.close();
        }
    } catch (NodeException | PinException | ElementNotFoundException | RuntimeException e) {
        showErrorWithoutARunningModel(Lang.get("msg_errorCreatingModel"), e);
    }
}
Also used : ArrayList(java.util.ArrayList) ElementNotFoundException(de.neemann.digital.draw.library.ElementNotFoundException) ModelCreator(de.neemann.digital.draw.model.ModelCreator) ModifyMeasurementOrdering(de.neemann.digital.gui.components.modification.ModifyMeasurementOrdering) LibraryTreeModel(de.neemann.digital.gui.components.tree.LibraryTreeModel)

Aggregations

ElementNotFoundException (de.neemann.digital.draw.library.ElementNotFoundException)1 ModelCreator (de.neemann.digital.draw.model.ModelCreator)1 ModifyMeasurementOrdering (de.neemann.digital.gui.components.modification.ModifyMeasurementOrdering)1 LibraryTreeModel (de.neemann.digital.gui.components.tree.LibraryTreeModel)1 ArrayList (java.util.ArrayList)1