Added standard models in the drop down menu of the component toolbar

This commit is contained in:
Bane Stojkovic
2022-11-15 22:48:54 +01:00
parent b5087a4d77
commit 76965ffa23
2 changed files with 11 additions and 1 deletions
@@ -271,7 +271,6 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
@Override
public void mousePressed(MouseEvent e) {
LOG.info("Pressed: " + e.isPopupTrigger());
canvasPanel.requestFocus();
pressedEvent = e;
}
@@ -430,6 +430,17 @@ class ComponentTabbedPane extends JTabbedPane {
variantPopup.add(new SelectAllAction(plugInPort, componentType));
variantPopup.add(shortcutSubmenu);
variantPopup.add(new JSeparator());
if (componentType.getDatasheet() != null && !componentType.getDatasheet().isEmpty()) {
List<Component> items = ComponentButtonFactory.createDatasheetItems(plugInPort, componentType, new ArrayList<String>(), model -> {
LOG.info("Creating datasheet model " + String.join(", ", model));
plugInPort.setNewComponentTypeSlot(componentType, null, model, false);
});
for (Component item : items) {
variantPopup.add(item);
}
variantPopup.add(new JSeparator());
}
List<Template> templates = plugInPort.getVariantsFor(componentType);
if (templates == null || templates.isEmpty()) {