diff --git a/lib/features/popup-menu/ReplaceMenuProvider.js b/lib/features/popup-menu/ReplaceMenuProvider.js index 851bdf0d..c11a224c 100644 --- a/lib/features/popup-menu/ReplaceMenuProvider.js +++ b/lib/features/popup-menu/ReplaceMenuProvider.js @@ -77,8 +77,8 @@ ReplaceMenuProvider.prototype.getEntries = function(element) { var differentType = isDifferentType(element); - // start events outside event sub processes - if (is(businessObject, 'bpmn:StartEvent') && !isEventSubProcess(businessObject.$parent)) { + // start events outside sub processes + if (is(businessObject, 'bpmn:StartEvent') && !is(businessObject.$parent, 'bpmn:SubProcess')) { entries = filter(replaceOptions.START_EVENT, differentType); @@ -97,7 +97,6 @@ ReplaceMenuProvider.prototype.getEntries = function(element) { // start events inside event sub processes if (is(businessObject, 'bpmn:StartEvent') && isEventSubProcess(businessObject.$parent)) { - entries = filter(replaceOptions.EVENT_SUB_PROCESS_START_EVENT, function(entry) { var target = entry.target; @@ -114,6 +113,14 @@ ReplaceMenuProvider.prototype.getEntries = function(element) { return this._createEntries(element, entries); } + // start events inside sub processes + if (is(businessObject, 'bpmn:StartEvent') && !isEventSubProcess(businessObject.$parent) + && is(businessObject.$parent, 'bpmn:SubProcess')) { + entries = filter(replaceOptions.START_EVENT_SUB_PROCESS, differentType); + + return this._createEntries(element, entries); + } + // end events if (is(businessObject, 'bpmn:EndEvent')) { diff --git a/lib/features/replace/ReplaceOptions.js b/lib/features/replace/ReplaceOptions.js index 07bd2772..b132368e 100644 --- a/lib/features/replace/ReplaceOptions.js +++ b/lib/features/replace/ReplaceOptions.js @@ -61,6 +61,33 @@ export var START_EVENT = [ } ]; +export var START_EVENT_SUB_PROCESS = [ + { + label: 'Start Event', + actionName: 'replace-with-none-start', + className: 'bpmn-icon-start-event-none', + target: { + type: 'bpmn:StartEvent' + } + }, + { + label: 'Intermediate Throw Event', + actionName: 'replace-with-none-intermediate-throwing', + className: 'bpmn-icon-intermediate-event-none', + target: { + type: 'bpmn:IntermediateThrowEvent' + } + }, + { + label: 'End Event', + actionName: 'replace-with-none-end', + className: 'bpmn-icon-end-event-none', + target: { + type: 'bpmn:EndEvent' + } + } +]; + export var INTERMEDIATE_EVENT = [ { label: 'Start Event', diff --git a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js index 3383248f..5287495b 100644 --- a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +++ b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js @@ -657,6 +657,24 @@ describe('features/popup-menu - replace menu provider', function() { }) ); + it('should contain only start event, end event and intermediate throw event inside sub process except the current one', + inject(function(bpmnReplace, elementRegistry) { + + // given + var startEvent = elementRegistry.get('StartEvent_2'); + + // when + openPopup(startEvent); + + // then + expect(queryEntry('replace-with-message-start')).to.be.null; + expect(queryEntry('replace-with-none-end')).to.exist; + expect(queryEntry('replace-with-none-intermediate-throwing')).to.exist; + + expect(queryEntries()).to.have.length(2); + }) + ); + it('should contain all intermediate events except the current one', inject(function(bpmnReplace, elementRegistry) {