@Test public void testAddEditBusinessKnowledgeModelAction() { final List<ToolboxAction<AbstractCanvasHandler>> actions = new ArrayList<>(); final Element element = mock(Element.class); final Node node = mock(Node.class); final Definition definition = mock(Definition.class); final BusinessKnowledgeModel bkm = mock(BusinessKnowledgeModel.class); when(element.asNode()).thenReturn(node); when(element.getContent()).thenReturn(definition); when(definition.getDefinition()).thenReturn(bkm); tested.addEditAction(element, actions); assertEquals(1, actions.size()); assertTrue(DMNEditBusinessKnowledgeModelToolboxAction.class.isInstance(actions.get(0))); }
void addEditAction(final Element<?> element, final List<ToolboxAction<AbstractCanvasHandler>> actions) { if (isDecision(element)) { actions.add(editDecisionToolboxActions.get()); } else if (isBusinessKnowledgeModel(element)) { actions.add(editBusinessKnowledgeModelToolboxActions.get()); } }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { void addEditAction(final Element<?> element, final List<ToolboxAction<AbstractCanvasHandler>> actions) { if (isDecision(element)) { actions.add(editDecisionToolboxActions.get()); } else if (isBusinessKnowledgeModel(element)) { actions.add(editBusinessKnowledgeModelToolboxActions.get()); } } }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { void addEditAction(final Element<?> element, final List<ToolboxAction<AbstractCanvasHandler>> actions) { if (isDecision(element)) { actions.add(editDecisionToolboxActions.get()); } else if (isBusinessKnowledgeModel(element)) { actions.add(editBusinessKnowledgeModelToolboxActions.get()); } } @Inject  DMNCommonActionsToolboxFactory(final @Any ManagedInstance<DMNEditDecisionToolboxAction> editDecisionToolboxActions,
                                          final @Any ManagedInstance<DMNEditBusinessKnowledgeModelToolboxAction> editBusinessKnowledgeModelToolboxActions,
                                          final @Any ManagedInstance<DMNEditDRDToolboxAction> editDRDToolboxActions,
                                          final @Any @CommonActionsToolbox ManagedInstance<ActionsToolboxView> views,
                                          final CanvasCommandManager<AbstractCanvasHandler> commandManager,
                                          final @DMNEditor DefaultCanvasCommandFactory commandFactory,
                                          final @DMNEditor ManagedInstance<DeleteNodeToolboxAction> deleteNodeActions,
                                          final @DMNEditor ReadOnlyProvider readOnlyProvider); }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { void addEditAction(final Element<?> element, final List<ToolboxAction<AbstractCanvasHandler>> actions) { if (isDecision(element)) { actions.add(editDecisionToolboxActions.get()); } else if (isBusinessKnowledgeModel(element)) { actions.add(editBusinessKnowledgeModelToolboxActions.get()); } } @Inject  DMNCommonActionsToolboxFactory(final @Any ManagedInstance<DMNEditDecisionToolboxAction> editDecisionToolboxActions,
                                          final @Any ManagedInstance<DMNEditBusinessKnowledgeModelToolboxAction> editBusinessKnowledgeModelToolboxActions,
                                          final @Any ManagedInstance<DMNEditDRDToolboxAction> editDRDToolboxActions,
                                          final @Any @CommonActionsToolbox ManagedInstance<ActionsToolboxView> views,
                                          final CanvasCommandManager<AbstractCanvasHandler> commandManager,
                                          final @DMNEditor DefaultCanvasCommandFactory commandFactory,
                                          final @DMNEditor ManagedInstance<DeleteNodeToolboxAction> deleteNodeActions,
                                          final @DMNEditor ReadOnlyProvider readOnlyProvider); @Override @SuppressWarnings("unchecked") Collection<ToolboxAction<AbstractCanvasHandler>> getActions(final AbstractCanvasHandler canvasHandler,
                                                                       final Element<?> element); @PreDestroy void destroy(); }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { void addEditAction(final Element<?> element, final List<ToolboxAction<AbstractCanvasHandler>> actions) { if (isDecision(element)) { actions.add(editDecisionToolboxActions.get()); } else if (isBusinessKnowledgeModel(element)) { actions.add(editBusinessKnowledgeModelToolboxActions.get()); } } @Inject  DMNCommonActionsToolboxFactory(final @Any ManagedInstance<DMNEditDecisionToolboxAction> editDecisionToolboxActions,
                                          final @Any ManagedInstance<DMNEditBusinessKnowledgeModelToolboxAction> editBusinessKnowledgeModelToolboxActions,
                                          final @Any ManagedInstance<DMNEditDRDToolboxAction> editDRDToolboxActions,
                                          final @Any @CommonActionsToolbox ManagedInstance<ActionsToolboxView> views,
                                          final CanvasCommandManager<AbstractCanvasHandler> commandManager,
                                          final @DMNEditor DefaultCanvasCommandFactory commandFactory,
                                          final @DMNEditor ManagedInstance<DeleteNodeToolboxAction> deleteNodeActions,
                                          final @DMNEditor ReadOnlyProvider readOnlyProvider); @Override @SuppressWarnings("unchecked") Collection<ToolboxAction<AbstractCanvasHandler>> getActions(final AbstractCanvasHandler canvasHandler,
                                                                       final Element<?> element); @PreDestroy void destroy();  }