improve(contextpad): remove modeling options behind throwing link events

related #219
This commit is contained in:
jdotzki 2015-03-07 12:59:22 +01:00
parent 6aceab9dbf
commit 2321caecd7
1 changed files with 19 additions and 2 deletions

View File

@ -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;