@@ -78,22 +78,6 @@ public void initialize(FxmlStageHolder fxmlStageHolder) {
78
78
});
79
79
}
80
80
81
- private void updateFields (String currentMainText , TextField field , boolean isCommand ) {
82
- final String sourceMainText = isCommand ? sourceCommand .getCommand () : sourceCommand .getDescription ();
83
- final String sourceSecText = isCommand ? sourceCommand .getDescription () : sourceCommand .getCommand ();
84
- final String currentSecText = isCommand ? description .getText () : command .getText ();
85
-
86
- if (sourceMainText .equals (currentMainText )){
87
- field .setStyle (GREEN_TEXT_CSS_STYLE );
88
- if (sourceSecText .equals (currentSecText )) {
89
- save .setDisable (true );
90
- }
91
- } else {
92
- save .setDisable (false );
93
- field .setStyle (RED_TEXT_CSS_STYLE );
94
- }
95
- }
96
-
97
81
@ FXML
98
82
protected void browseDirectory () {
99
83
DirectoryChooser directoryChooser = new DirectoryChooser ();
@@ -119,11 +103,15 @@ protected void clean() {
119
103
@ FXML
120
104
protected void chooseFromSaved () {
121
105
FxmlStageHolder holder = StageFactory .createModalExploreWindow ();
122
-
123
- ExploreController exploreController = holder .getFxmlLoader ().getController ();
124
- exploreController .setExecuteController (this );
125
-
126
106
holder .getStage ().showAndWait ();
107
+ ExploreController exploreController = holder .getFxmlLoader ().getController ();
108
+ final CommandDto pickedItem = exploreController .getPickedItem ();
109
+ if (pickedItem != null ) {
110
+ specifySourceCommand (pickedItem );
111
+ }
112
+ for (CommandDto removed : exploreController .getRemovedItems ()) {
113
+ removeSourceCommand (removed );
114
+ }
127
115
}
128
116
129
117
@ FXML
@@ -189,7 +177,23 @@ protected void foundIssue() {
189
177
AppConfig .getInstance ().getHostServices ().showDocument (AppConstants .LINK_TO_GIT_CONTRIBUTING_FILE );
190
178
}
191
179
192
- void specifySourceCommand (CommandDto commandDto ) {
180
+ private void updateFields (String currentMainText , TextField field , boolean isCommand ) {
181
+ final String sourceMainText = isCommand ? sourceCommand .getCommand () : sourceCommand .getDescription ();
182
+ final String sourceSecText = isCommand ? sourceCommand .getDescription () : sourceCommand .getCommand ();
183
+ final String currentSecText = isCommand ? description .getText () : command .getText ();
184
+
185
+ if (sourceMainText .equals (currentMainText )){
186
+ field .setStyle (GREEN_TEXT_CSS_STYLE );
187
+ if (sourceSecText .equals (currentSecText )) {
188
+ save .setDisable (true );
189
+ }
190
+ } else {
191
+ save .setDisable (false );
192
+ field .setStyle (RED_TEXT_CSS_STYLE );
193
+ }
194
+ }
195
+
196
+ private void specifySourceCommand (CommandDto commandDto ) {
193
197
save .setDisable (true );
194
198
sourceCommand = commandDto ;
195
199
if (commandDto == null ) {
@@ -205,7 +209,8 @@ void specifySourceCommand(CommandDto commandDto) {
205
209
}
206
210
}
207
211
208
- void removeSavedCommand (CommandDto commandDto ) {
212
+ private void removeSourceCommand (CommandDto commandDto ) {
213
+ AppConfig .getInstance ().removeCommand (commandDto );
209
214
if (Objects .equals (commandDto , sourceCommand )) {
210
215
sourceCommand = null ;
211
216
command .setStyle (BLACK_TEXT_CSS_STYLE );
0 commit comments