From 2321caecd7189892a4bc01bf3fc6efc0cc4075ba Mon Sep 17 00:00:00 2001 From: jdotzki Date: Sat, 7 Mar 2015 12:59:22 +0100 Subject: [PATCH] improve(contextpad): remove modeling options behind throwing link events related #219 --- .../context-pad/ContextPadProvider.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/features/context-pad/ContextPadProvider.js b/lib/features/context-pad/ContextPadProvider.js index d2bd89ed..eba42069 100644 --- a/lib/features/context-pad/ContextPadProvider.js +++ b/lib/features/context-pad/ContextPadProvider.js @@ -1,7 +1,8 @@ 'use strict'; -var assign = require('lodash/object/assign'); +var assign = require('lodash/object/assign'), + forEach = require('lodash/collection/forEach'); var getReplacementMenuEntries = require('./ReplaceMenuFactory').getReplacementMenuEntries; @@ -117,7 +118,8 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) { if (bpmnElement.$instanceOf('bpmn:FlowNode')) { if (!bpmnElement.$instanceOf('bpmn:EndEvent') && - !bpmnElement.$instanceOf('bpmn:EventBasedGateway')) { + !bpmnElement.$instanceOf('bpmn:EventBasedGateway') && + !isEventType(bpmnElement, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition')) { assign(actions, { 'append.end-event': appendAction('bpmn:EndEvent', 'icon-01-none-end-event'), @@ -208,5 +210,20 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) { return actions; }; +function isEventType(eventBo, type, definition) { + + var isType = eventBo.$instanceOf(type); + var isDefinition = false; + + var definitions = eventBo.eventDefinitions || []; + forEach(definitions, function(def) { + if (def.$type === definition) { + isDefinition = true; + } + }); + + return isType && isDefinition; +} + module.exports = ContextPadProvider;