@@ -6,7 +6,6 @@ import { LabelTypeRegistry } from "../labels/LabelTypeRegistry";
66import { EditorModeController } from "../settings/editorMode" ;
77import { DfdWebSocket } from "../webSocket/webSocket" ;
88import { Action } from "sprotty-protocol" ;
9- import { FileName } from "../fileName/fileName" ;
109import { SETTINGS } from "../settings/Settings" ;
1110import { ConstraintRegistry } from "../constraint/constraintRegistry" ;
1211import { LoadingIndicator } from "../loadingIndicator/loadingIndicator" ;
@@ -28,7 +27,6 @@ export class SaveDfdAndDdFileCommand extends SaveFileCommand {
2827 @inject ( ConstraintRegistry ) constraintRegistry : ConstraintRegistry ,
2928 @inject ( SETTINGS . Mode ) editorModeController : EditorModeController ,
3029 @inject ( DfdWebSocket ) private readonly dfdWebSocket : DfdWebSocket ,
31- @inject ( FileName ) private readonly fileName : FileName ,
3230 @inject ( LoadingIndicator ) loadingIndicator : LoadingIndicator ,
3331 ) {
3432 super ( labelTypeRegistry , constraintRegistry , editorModeController , loadingIndicator ) ;
@@ -38,19 +36,20 @@ export class SaveDfdAndDdFileCommand extends SaveFileCommand {
3836 const savedDiagram = this . createSavedDiagram ( context ) ;
3937
4038 const response = await this . dfdWebSocket . sendMessage ( "Json2DFD:" + JSON . stringify ( savedDiagram ) ) ;
39+ const nameEndIndex = response . indexOf ( ":" ) ;
40+ const name = response . substring ( 0 , nameEndIndex ) ;
4141 const endIndex =
4242 response . indexOf ( SaveDfdAndDdFileCommand . CLOSING_TAG ) + SaveDfdAndDdFileCommand . CLOSING_TAG . length ;
43- const dfdContent = response . substring ( 0 , endIndex ) . trim ( ) ;
43+ const dfdContent = response . substring ( nameEndIndex + 1 , endIndex ) . trim ( ) ;
4444 const ddContent = response . substring ( endIndex ) . trim ( ) ;
4545
46- const fileName = this . fileName . getName ( ) ;
4746 return Promise . resolve ( [
4847 {
49- fileName : fileName + ".dataflowdiagram" ,
48+ fileName : name + ".dataflowdiagram" ,
5049 content : dfdContent ,
5150 } ,
5251 {
53- fileName : fileName + ".datadictionary" ,
52+ fileName : name + ".datadictionary" ,
5453 content : ddContent ,
5554 } ,
5655 ] ) ;
0 commit comments