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,6 +42,7 @@ public final class InsertAction extends ToolTipAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (node.isUnique()) {
VisualElement visualElement = new VisualElement(node.getName()).setPos(new Vector(10, 10)).setShapeFactory(shapeFactory); VisualElement visualElement = new VisualElement(node.getName()).setPos(new Vector(10, 10)).setShapeFactory(shapeFactory);
circuitComponent.setPartToInsert(visualElement); circuitComponent.setPartToInsert(visualElement);
if (getIcon() == null) { if (getIcon() == null) {
@ -54,6 +55,7 @@ public final class InsertAction extends ToolTipAction {
} }
insertHistory.add(this); insertHistory.add(this);
} }
}
/** /**
* @return true if element to insert is a custom element * @return true if element to insert is a custom element
@ -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;
} }