-
Notifications
You must be signed in to change notification settings - Fork 2
/
di.config.ts
186 lines (165 loc) · 7.69 KB
/
di.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import './diagram.css';
import {
ConsoleLogger,
CustomFeatures,
DeleteElementContextMenuItemProvider,
FeatureModule,
GModelElement,
IView,
LogLevel,
SetViewportAction,
TYPES,
configureActionHandler,
configureCommand,
configureModelElement,
moveFeature,
selectFeature
} from '@eclipse-glsp/client';
import { interfaces } from 'inversify';
import { ShowGridAction } from '@axonivy/process-editor-protocol';
import { breakpointFeature } from '../breakpoint/model';
import { goToSourceFeature, jumpFeature } from '../jump/model';
import { IvyMovementRestrictor } from '../tools/movement-restrictor';
import { NegativeMarker } from '../tools/negative-area/model';
import { SNegativeMarkerView } from '../tools/negative-area/view';
import { multipleOutgoingEdgesFeature } from '../ui-tools/quick-action/edge/model';
import { singleWrapFeature, unwrapFeature } from '../wrap/model';
import { ActivityNodeView, SubActivityNodeView } from './activities/activity-views';
import { errorBoundaryFeature, signalBoundaryFeature } from './boundary/model';
import { EventNodeView, IntermediateEventNodeView } from './events/event-views';
import { GatewayNodeView } from './gateways/gateway-views';
import { ShowGridActionHandler } from './grid/action-handler';
import { GridFeedbackCommand } from './grid/feedback-action';
import { LaneNodeView, PoolNodeView, RotateLabelView } from './lanes/lane-views';
import {
ActivityLabel,
ActivityNode,
CommentNode,
Edge,
EdgeLabel,
EndEventNode,
EventNode,
GatewayNode,
LaneNode,
MulitlineEditLabel,
RotateLabel,
StartEventNode
} from './model';
import { IvyGridSnapper } from './snap';
import {
ActivityTypes,
EdgeTypes,
EventBoundaryTypes,
EventEndTypes,
EventIntermediateTypes,
EventStartTypes,
GatewayTypes,
LabelType,
LaneTypes
} from './view-types';
import { AssociationEdgeView, ForeignLabelView, WorkflowEdgeView } from './views';
const ivyDiagramModule = new FeatureModule((bind, unbind, isBound, rebind) => {
rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn);
bind(TYPES.ISnapper).to(IvyGridSnapper);
bind(TYPES.IContextMenuItemProvider).to(DeleteElementContextMenuItemProvider);
bind(TYPES.IMovementRestrictor).to(IvyMovementRestrictor);
bind(ShowGridActionHandler).toSelf().inSingletonScope();
configureActionHandler({ bind, isBound }, ShowGridAction.KIND, ShowGridActionHandler);
configureActionHandler({ bind, isBound }, SetViewportAction.KIND, ShowGridActionHandler);
configureCommand({ bind, isBound }, GridFeedbackCommand);
const context = { bind, unbind, isBound, rebind };
configureStartEvent(EventStartTypes.START);
configureStartEvent(EventStartTypes.START_ERROR);
configureStartEvent(EventStartTypes.START_SIGNAL);
configureStartEvent(EventStartTypes.START_PROGRAM, { enable: [goToSourceFeature] });
configureStartEvent(EventStartTypes.START_SUB);
configureStartEvent(EventStartTypes.START_WS);
configureStartEvent(EventStartTypes.START_HD);
configureStartEvent(EventStartTypes.START_HD_METHOD);
configureStartEvent(EventStartTypes.START_HD_EVENT);
configureStartEvent(EventStartTypes.START_EMBEDDED);
configureStartEvent(EventStartTypes.START_THIRD_PARTY);
configureEndEvent(EventEndTypes.END);
configureEndEvent(EventEndTypes.END_ERROR);
configureEndEvent(EventEndTypes.END_PAGE);
configureEndEvent(EventEndTypes.END_SUB);
configureEndEvent(EventEndTypes.END_WS);
configureEndEvent(EventEndTypes.END_HD);
configureEndEvent(EventEndTypes.END_HD_EXIT);
configureEndEvent(EventEndTypes.END_EMBEDDED);
configureIvyModelElement(EventIntermediateTypes.INTERMEDIATE_TASK, EventNode, IntermediateEventNodeView);
configureIvyModelElement(EventIntermediateTypes.INTERMEDIATE_WAIT, EventNode, IntermediateEventNodeView, { enable: [goToSourceFeature] });
configureIvyModelElement(EventIntermediateTypes.INTERMEDIATE_THIRD_PARTY, EventNode, IntermediateEventNodeView);
configureIvyModelElement(EventBoundaryTypes.BOUNDARY_ERROR, StartEventNode, IntermediateEventNodeView);
configureIvyModelElement(EventBoundaryTypes.BOUNDARY_SIGNAL, StartEventNode, IntermediateEventNodeView);
configureGateway(GatewayTypes.TASK);
configureGateway(GatewayTypes.JOIN, { disable: [multipleOutgoingEdgesFeature] });
configureGateway(GatewayTypes.SPLIT);
configureGateway(GatewayTypes.ALTERNATIVE);
configureIvyModelElement(ActivityTypes.LABEL, ActivityLabel, ForeignLabelView);
configureIvyModelElement(ActivityTypes.COMMENT, CommentNode, ActivityNodeView, {
disable: [breakpointFeature, errorBoundaryFeature, singleWrapFeature]
});
configureActivity(ActivityTypes.GENERIC);
configureActivity(ActivityTypes.SCRIPT);
configureActivity(ActivityTypes.SOAP);
configureActivity(ActivityTypes.REST);
configureActivity(ActivityTypes.DB);
configureActivity(ActivityTypes.EMAIL);
configureActivity(ActivityTypes.THIRD_PARTY);
configureActivity(ActivityTypes.THIRD_PARTY_RULE);
configureActivity(ActivityTypes.PROGRAM, { enable: [goToSourceFeature] });
configureActivity(ActivityTypes.TRIGGER, { enable: [jumpFeature] });
configureActivity(ActivityTypes.HD, { enable: [jumpFeature, goToSourceFeature] });
configureActivity(ActivityTypes.USER, {
enable: [signalBoundaryFeature, jumpFeature, goToSourceFeature]
});
configureEmbedded(ActivityTypes.SUB_PROCESS, { enable: [jumpFeature], disable: [singleWrapFeature] });
configureEmbedded(ActivityTypes.EMBEDDED_PROCESS);
configureEmbedded(ActivityTypes.BPMN_GENERIC);
configureEmbedded(ActivityTypes.BPMN_MANUAL);
configureEmbedded(ActivityTypes.BPMN_RECEIVE);
configureEmbedded(ActivityTypes.BPMN_RULE);
configureEmbedded(ActivityTypes.BPMN_SCRIPT);
configureEmbedded(ActivityTypes.BPMN_SEND);
configureEmbedded(ActivityTypes.BPMN_SERVICE);
configureEmbedded(ActivityTypes.BPMN_USER);
configureIvyModelElement(LaneTypes.LANE, LaneNode, LaneNodeView);
configureIvyModelElement(LaneTypes.POOL, LaneNode, PoolNodeView);
configureIvyModelElement(LaneTypes.LABEL, RotateLabel, RotateLabelView);
configureIvyModelElement(EdgeTypes.DEFAULT, Edge, WorkflowEdgeView);
configureIvyModelElement(EdgeTypes.ASSOCIATION, Edge, AssociationEdgeView);
configureIvyModelElement(EdgeTypes.LABEL, EdgeLabel, ForeignLabelView, { enable: [selectFeature, moveFeature] });
configureIvyModelElement(LabelType.DEFAULT, MulitlineEditLabel, ForeignLabelView, { enable: [selectFeature, moveFeature] });
configureIvyModelElement(NegativeMarker.TYPE, NegativeMarker, SNegativeMarkerView);
function configureIvyModelElement(
type: string,
modelConstr: new () => GModelElement,
viewConstr: interfaces.ServiceIdentifier<IView>,
features?: CustomFeatures
): void {
configureModelElement(context, type, modelConstr, viewConstr, features);
}
function configureStartEvent(type: string, features?: CustomFeatures): void {
configureIvyModelElement(type, StartEventNode, EventNodeView, features);
}
function configureEndEvent(type: string, features?: CustomFeatures): void {
configureIvyModelElement(type, EndEventNode, EventNodeView, features);
}
function configureGateway(type: string, features?: CustomFeatures): void {
configureIvyModelElement(type, GatewayNode, GatewayNodeView, features);
}
function configureActivity(type: string, features?: CustomFeatures): void {
configureIvyModelElement(type, ActivityNode, ActivityNodeView, features);
}
function configureEmbedded(type: string, features?: CustomFeatures): void {
configureIvyModelElement(
type,
ActivityNode,
SubActivityNodeView,
features ? features : { enable: [jumpFeature, unwrapFeature, multipleOutgoingEdgesFeature], disable: [singleWrapFeature] }
);
}
});
export default ivyDiagramModule;