use of de.neemann.digital.gui.components.expression.ExpressionDialog in project Digital by hneemann.
the class Main method createAnalyseMenu.
/**
* Creates the analyse menu
*
* @param menuBar the menu bar
*/
private void createAnalyseMenu(JMenuBar menuBar) {
JMenu analyse = new JMenu(Lang.get("menu_analyse"));
menuBar.add(analyse);
analyse.add(new ToolTipAction(Lang.get("menu_analyse")) {
@Override
public void actionPerformed(ActionEvent e) {
try {
Model model = new ModelCreator(circuitComponent.getCircuit(), library).createModel(false);
try {
if (model.isInvalidSignal())
new ErrorMessage(Lang.get("msg_invalidSignalsAnalysed")).show(Main.this);
else
new TableDialog(Main.this, new ModelAnalyser(model).analyse(), library, shapeFactory, getBaseFileName()).setVisible(true);
ensureModelIsStopped();
} finally {
model.close();
}
} catch (PinException | NodeException | AnalyseException | ElementNotFoundException | BacktrackException | RuntimeException e1) {
showErrorWithoutARunningModel(Lang.get("msg_analyseErr"), e1);
}
}
}.setToolTip(Lang.get("menu_analyse_tt")).setAccelerator("F9").createJMenuItem());
analyse.add(new ToolTipAction(Lang.get("menu_synthesise")) {
@Override
public void actionPerformed(ActionEvent e) {
TruthTable tt = new TruthTable(3).addResult();
new TableDialog(Main.this, tt, library, shapeFactory, getBaseFileName()).setVisible(true);
ensureModelIsStopped();
}
}.setToolTip(Lang.get("menu_synthesise_tt")).createJMenuItem());
analyse.add(new ToolTipAction(Lang.get("menu_expression")) {
@Override
public void actionPerformed(ActionEvent e) {
new ExpressionDialog(Main.this, library, shapeFactory, getBaseFileName()).setVisible(true);
}
}.setToolTip(Lang.get("menu_expression_tt")).createJMenuItem());
}
Aggregations