fixed a bug concerning the import of non unique circuits

This commit is contained in:
hneemann 2017-07-16 21:13:55 +02:00
parent 6b51407101
commit abc404d523

View File

@ -42,17 +42,19 @@ public final class InsertAction extends ToolTipAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
VisualElement visualElement = new VisualElement(node.getName()).setPos(new Vector(10, 10)).setShapeFactory(shapeFactory); if (node.isUnique()) {
circuitComponent.setPartToInsert(visualElement); VisualElement visualElement = new VisualElement(node.getName()).setPos(new Vector(10, 10)).setShapeFactory(shapeFactory);
if (getIcon() == null) { circuitComponent.setPartToInsert(visualElement);
try { if (getIcon() == null) {
node.getDescription(); try {
setIcon(node.getIcon(shapeFactory)); node.getDescription();
} catch (IOException ex) { setIcon(node.getIcon(shapeFactory));
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel_N0", node.getName())).addCause(ex)); } catch (IOException ex) {
SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel_N0", node.getName())).addCause(ex));
}
} }
insertHistory.add(this);
} }
insertHistory.add(this);
} }
/** /**
@ -95,7 +97,7 @@ public final class InsertAction extends ToolTipAction {
/** /**
* Implements a lazy loading of the tooltips. * Implements a lazy loading of the tooltips.
* Avoids the reading of all tooltips from the lib files if menu is created. * Avoids the reading of all tooltips from the lib files if menu is created.
* This code ensures, that the tooltips are onli loaded from the file if the text is shown to the user. * This code ensures that the tooltips are only loaded from the file if the text is shown to the user.
* *
* @return the JMenuItem created * @return the JMenuItem created
*/ */
@ -108,6 +110,7 @@ public final class InsertAction extends ToolTipAction {
} }
}; };
i.addActionListener(InsertAction.this); i.addActionListener(InsertAction.this);
i.setEnabled(node.isUnique());
ToolTipManager.sharedInstance().registerComponent(i); ToolTipManager.sharedInstance().registerComponent(i);
return i; return i;
} }