@@ -14,6 +14,7 @@ import { assertNever } from "../../common/helpers-pure";
14
14
import { ModelEditorViewTracker } from "../model-editor-view-tracker" ;
15
15
import { ModelConfigListener } from "../../config" ;
16
16
import { DatabaseItem } from "../../databases/local-databases" ;
17
+ import { ModelingEvents } from "../modeling-events" ;
17
18
18
19
export class MethodModelingViewProvider extends AbstractWebviewViewProvider <
19
20
ToMethodModelingMessage ,
@@ -27,6 +28,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
27
28
constructor (
28
29
app : App ,
29
30
private readonly modelingStore : ModelingStore ,
31
+ private readonly modelingEvents : ModelingEvents ,
30
32
private readonly editorViewTracker : ModelEditorViewTracker ,
31
33
private readonly modelConfig : ModelConfigListener ,
32
34
) {
@@ -35,7 +37,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
35
37
36
38
protected override async onWebViewLoaded ( ) : Promise < void > {
37
39
await Promise . all ( [ this . setViewState ( ) , this . setInitialState ( ) ] ) ;
38
- this . registerToModelingStoreEvents ( ) ;
40
+ this . registerToModelingEvents ( ) ;
39
41
this . registerToModelConfigEvents ( ) ;
40
42
}
41
43
@@ -150,9 +152,9 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
150
152
await view ?. revealMethod ( method ) ;
151
153
}
152
154
153
- private registerToModelingStoreEvents ( ) : void {
155
+ private registerToModelingEvents ( ) : void {
154
156
this . push (
155
- this . modelingStore . onModeledMethodsChanged ( async ( e ) => {
157
+ this . modelingEvents . onModeledMethodsChanged ( async ( e ) => {
156
158
if ( this . webviewView && e . isActiveDb && this . method ) {
157
159
const modeledMethods = e . modeledMethods [ this . method . signature ] ;
158
160
if ( modeledMethods ) {
@@ -167,7 +169,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
167
169
) ;
168
170
169
171
this . push (
170
- this . modelingStore . onModifiedMethodsChanged ( async ( e ) => {
172
+ this . modelingEvents . onModifiedMethodsChanged ( async ( e ) => {
171
173
if ( this . webviewView && e . isActiveDb && this . method ) {
172
174
const isModified = e . modifiedMethods . has ( this . method . signature ) ;
173
175
await this . postMessage ( {
@@ -179,7 +181,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
179
181
) ;
180
182
181
183
this . push (
182
- this . modelingStore . onSelectedMethodChanged ( async ( e ) => {
184
+ this . modelingEvents . onSelectedMethodChanged ( async ( e ) => {
183
185
if ( this . webviewView ) {
184
186
this . method = e . method ;
185
187
this . databaseItem = e . databaseItem ;
@@ -196,7 +198,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
196
198
) ;
197
199
198
200
this . push (
199
- this . modelingStore . onDbOpened ( async ( ) => {
201
+ this . modelingEvents . onDbOpened ( async ( ) => {
200
202
await this . postMessage ( {
201
203
t : "setInModelingMode" ,
202
204
inModelingMode : true ,
@@ -205,7 +207,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
205
207
) ;
206
208
207
209
this . push (
208
- this . modelingStore . onDbClosed ( async ( dbUri ) => {
210
+ this . modelingEvents . onDbClosed ( async ( dbUri ) => {
209
211
if ( ! this . modelingStore . anyDbsBeingModeled ( ) ) {
210
212
await this . postMessage ( {
211
213
t : "setInModelingMode" ,
@@ -220,7 +222,7 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
220
222
) ;
221
223
222
224
this . push (
223
- this . modelingStore . onInProgressMethodsChanged ( async ( e ) => {
225
+ this . modelingEvents . onInProgressMethodsChanged ( async ( e ) => {
224
226
if ( this . method && this . databaseItem ) {
225
227
const dbUri = this . databaseItem . databaseUri . toString ( ) ;
226
228
if ( e . dbUri === dbUri ) {
0 commit comments