@@ -63,42 +63,42 @@ public static void decompileSaveAll()
63
63
64
64
MiscUtils .createNewThread ("Decompile Save-All Thread" , () ->
65
65
{
66
- //signal to the user that BCV is performing an action in the background
67
- BytecodeViewer .updateBusyStatus (true );
66
+ try
67
+ {
68
+ //signal to the user that BCV is performing an action in the background
69
+ BytecodeViewer .updateBusyStatus (true );
68
70
69
- //auto compile before decompilation
70
- if (!BytecodeViewer .autoCompileSuccessful ())
71
- return ;
71
+ //auto compile before decompilation
72
+ if (!BytecodeViewer .autoCompileSuccessful ())
73
+ return ;
72
74
73
- final JFileChooser fc = new FileChooser (Configuration .getLastSaveDirectory (),
74
- "Select Zip Export" , "Zip Archives" , "zip" );
75
+ final JFileChooser fc = FileChooser . create (Configuration .getLastSaveDirectory (),
76
+ "Select Zip Export" , "Zip Archives" , "zip" );
75
77
76
- //if the user doesn't select a file then we should stop while we're ahead
77
- if (fc .showSaveDialog (BytecodeViewer .viewer ) != JFileChooser .APPROVE_OPTION )
78
- return ;
78
+ //if the user doesn't select a file then we should stop while we're ahead
79
+ if (fc .showSaveDialog (BytecodeViewer .viewer ) != JFileChooser .APPROVE_OPTION )
80
+ return ;
79
81
80
- //set the last touched save directory for BCV
81
- Configuration .setLastSaveDirectory (fc .getSelectedFile ());
82
+ //set the last touched save directory for BCV
83
+ Configuration .setLastSaveDirectory (fc .getSelectedFile ());
82
84
83
- //get the save file and auto append zip extension
84
- final File outputZip = MiscUtils .autoAppendFileExtension (".zip" , fc .getSelectedFile ());
85
+ //get the save file and auto append zip extension
86
+ final File outputZip = MiscUtils .autoAppendFileExtension (".zip" , fc .getSelectedFile ());
85
87
86
- //prompt the user for a dialogue override-this-file option if the file already exists
87
- if (!DialogUtils .canOverwriteFile (outputZip ))
88
- return ;
88
+ //prompt the user for a dialogue override-this-file option if the file already exists
89
+ if (!DialogUtils .canOverwriteFile (outputZip ))
90
+ return ;
89
91
90
- //this temporary jar file will be used to store the classes while BCV performs decompilation
91
- File temporaryTargetJar = MiscUtils .deleteExistingFile (new File (TEMP_DIRECTORY + FS
92
- + "temp_" + MiscUtils .getRandomizedName () + ".jar" ));
92
+ //this temporary jar file will be used to store the classes while BCV performs decompilation
93
+ File temporaryTargetJar = MiscUtils .deleteExistingFile (new File (TEMP_DIRECTORY + FS
94
+ + "temp_" + MiscUtils .getRandomizedName () + ".jar" ));
93
95
94
- //extract all the loaded classes imported into BCV to the temporary target jar
95
- JarUtils .saveAsJarClassesOnly (BytecodeViewer .getLoadedClasses (), temporaryTargetJar .getAbsolutePath ());
96
+ //extract all the loaded classes imported into BCV to the temporary target jar
97
+ JarUtils .saveAsJarClassesOnly (BytecodeViewer .getLoadedClasses (), temporaryTargetJar .getAbsolutePath ());
96
98
97
- //signal to the user that BCV is finished performing that action
98
- BytecodeViewer .updateBusyStatus (false );
99
+ //signal to the user that BCV is finished performing that action
100
+ BytecodeViewer .updateBusyStatus (false );
99
101
100
- try
101
- {
102
102
//handle the result of the user selection
103
103
switch (promptDecompilerUserSelect () + DECOMPILE_SAVE_ALL )
104
104
{
@@ -159,34 +159,35 @@ public static void decompileSaveOpenedResource()
159
159
160
160
MiscUtils .createNewThread ("Decompile Save Opened Resource" , () ->
161
161
{
162
- //signal to the user that BCV is performing an action in the background
163
- BytecodeViewer .updateBusyStatus (true );
162
+ try
163
+ {
164
+ //signal to the user that BCV is performing an action in the background
165
+ BytecodeViewer .updateBusyStatus (true );
164
166
165
- //auto compile before decompilation
166
- if (!BytecodeViewer .autoCompileSuccessful ())
167
- return ;
167
+ //auto compile before decompilation
168
+ if (!BytecodeViewer .autoCompileSuccessful ())
169
+ return ;
168
170
169
- JFileChooser fc = new FileChooser (Configuration .getLastSaveDirectory (), "Select Java Files" , "Java Source Files" , "java" );
171
+ JFileChooser fc = FileChooser .create (Configuration .getLastSaveDirectory (),
172
+ "Select Java Files" , "Java Source Files" , "java" );
170
173
171
- //if the user doesn't select a file then we should stop while we're ahead
172
- if (fc .showSaveDialog (BytecodeViewer .viewer ) != JFileChooser .APPROVE_OPTION )
173
- return ;
174
+ //if the user doesn't select a file then we should stop while we're ahead
175
+ if (fc .showSaveDialog (BytecodeViewer .viewer ) != JFileChooser .APPROVE_OPTION )
176
+ return ;
174
177
175
- //set the last touched save directory for BCV
176
- Configuration .setLastSaveDirectory (fc .getSelectedFile ());
178
+ //set the last touched save directory for BCV
179
+ Configuration .setLastSaveDirectory (fc .getSelectedFile ());
177
180
178
- //get the save file and auto append java extension
179
- File file = MiscUtils .autoAppendFileExtension (".java" , fc .getSelectedFile ());
181
+ //get the save file and auto append java extension
182
+ File file = MiscUtils .autoAppendFileExtension (".java" , fc .getSelectedFile ());
180
183
181
- //prompt the user for a dialogue override-this-file option if the file already exists
182
- if (!DialogUtils .canOverwriteFile (file ))
183
- return ;
184
+ //prompt the user for a dialogue override-this-file option if the file already exists
185
+ if (!DialogUtils .canOverwriteFile (file ))
186
+ return ;
184
187
185
- //signal to the user that BCV is finished performing that action
186
- BytecodeViewer .updateBusyStatus (false );
188
+ //signal to the user that BCV is finished performing that action
189
+ BytecodeViewer .updateBusyStatus (false );
187
190
188
- try
189
- {
190
191
//handle the result of the user selection
191
192
switch (promptDecompilerUserSelect () + DECOMPILE_OPENED_ONLY_ALL )
192
193
{
0 commit comments