@@ -56,16 +56,22 @@ public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descri
5656 String text = entry .getText ();
5757 AppSettingsState instance = AppSettingsState .getInstance ();
5858 String xmlPath = instance .xmlPath ;
59- getFeatureId (project , instance , mainViewModel );
59+ if (instance .fixProduceType == AppSettingsState .feature_id_type_script_produce && (instance .fixProduceScriptPath == null || instance .fixProduceScriptPath .trim ().length () == 0 )) {
60+ Messages .showMessageDialog ("Can't process" , "Python Script not Defined" , Messages .getErrorIcon ());
61+ return ;
62+ }
6063 if (xmlPath == null || !new File (xmlPath ).exists ()) {
6164 Messages .showMessageDialog ("Can't process" , "xml " + xmlPath + " not exists" , Messages .getErrorIcon ());
6265 return ;
6366 }
67+ extractFeatureId (project , instance , mainViewModel );
68+
6469 String prefix = mainViewModel .prefix .value ;
6570 if (prefix == null || prefix .trim ().isEmpty ()) {
66- Messages .showMessageDialog ("Can't process" , "FeatureId not Exists " , Messages .getErrorIcon ());
71+ Messages .showMessageDialog ("Can't process" , "Prefix not Defined " , Messages .getErrorIcon ());
6772 return ;
6873 }
74+
6975 mainViewModel .moonDest .setValue (xmlPath );
7076 String trans = mainViewModel .trans (text );
7177 if (instance .maxWordType == AppSettingsState .max_word_type_word ) {
@@ -92,10 +98,11 @@ public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descri
9298 };
9399 }
94100
95- private void getFeatureId (@ NotNull Project project , AppSettingsState instance , MainViewModel mainViewModel ) {
101+ private void extractFeatureId (@ NotNull Project project , AppSettingsState instance , MainViewModel mainViewModel ) {
96102 if (instance .fixProduceType == AppSettingsState .feature_id_type_fixed_string ) {
97103 mainViewModel .prefix .setValue (instance .prefix );
98104 mainViewModel .suffix .setValue (instance .suffix );
105+ return ;
99106 }
100107 Process process = null ;
101108 InputStream inputStream = null ;
@@ -113,8 +120,14 @@ private void getFeatureId(@NotNull Project project, AppSettingsState instance, M
113120 bufferedInputStream = new BufferedInputStream (inputStream );
114121 byte [] bytes = bufferedInputStream .readAllBytes ();
115122 String [] split = new String (bytes ).trim ().split ("/" );
116- mainViewModel .prefix .setValue (split [0 ]);
117- mainViewModel .suffix .setValue (split [1 ]);
123+ if (split .length == 1 ) {
124+ mainViewModel .prefix .setValue (split [0 ]);
125+ mainViewModel .suffix .setValue ("" );
126+ } else {
127+ mainViewModel .prefix .setValue (split [0 ]);
128+ mainViewModel .suffix .setValue (split [1 ]);
129+ }
130+ return ;
118131 }
119132 } catch (IOException | InterruptedException e ) {
120133 e .printStackTrace ();
0 commit comments