Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit 848fe58

Browse files
committed
Added checks if Directories are Chosen and changed some text...
1 parent 0571be8 commit 848fe58

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

  • src/org/petschko/rpgmakermv/decrypt

src/org/petschko/rpgmakermv/decrypt/GUI.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private void createMainMenu() {
114114
private void createWindowGUI() {
115115
JPanel middleFileContainer = new JPanel(new GridLayout(1, 2));
116116
JPanel footContainer = new JPanel(new GridLayout(1, 3));
117-
JLabelWrap filesListText = new JLabelWrap("Please open a RPG-Maker MV Project (File -> Open)");
117+
JLabelWrap filesListText = new JLabelWrap("Please open a RPG-Maker MV Project (\"File\" -> \"Select RPG MV Project\")");
118118
filesListText.setColumns(20);
119119

120120
/*JScrollPane scrollPane = new JScrollPane(
@@ -151,11 +151,16 @@ private void assignMainMenuListener() {
151151

152152
UIManager.put("FileChooser.readOnly", Boolean.TRUE);
153153
JDirectoryChooser dirChooser = new JDirectoryChooser(openDir);
154-
dirChooser.showDialog(this.mainWindow, null);
154+
int choose = dirChooser.showDialog(this.mainWindow, null);
155155

156-
if(dirChooser.getSelectedFile() != null) {
156+
if(dirChooser.getSelectedFile() != null && choose == JDirectoryChooser.APPROVE_OPTION) {
157157
App.preferences.setConfig(Preferences.lastRPGDir, dirChooser.getCurrentDirectory().getPath());
158-
this.openRPGProject(dirChooser.getSelectedFile().getPath());
158+
159+
if(this.openRPGProject(dirChooser.getSelectedFile().getPath())) {
160+
InfoWindow infoWindow = new InfoWindow("RPG-Maker Project loaded..." + Const.newLine +
161+
"Please use \"Decrypt\" -> \"All\" Files to Decrypt.");
162+
infoWindow.show(this.mainWindow);
163+
}
159164
}
160165
}
161166
);
@@ -168,9 +173,9 @@ private void assignMainMenuListener() {
168173

169174
UIManager.put("FileChooser.readOnly", Boolean.TRUE);
170175
JDirectoryChooser dirChooser = new JDirectoryChooser(openDir);
171-
dirChooser.showDialog(this.mainWindow, null);
176+
int choose = dirChooser.showDialog(this.mainWindow, null);
172177

173-
if(dirChooser.getSelectedFile() != null) {
178+
if(dirChooser.getSelectedFile() != null && choose == JDirectoryChooser.APPROVE_OPTION) {
174179
App.preferences.setConfig(Preferences.lastOutputParentDir, dirChooser.getCurrentDirectory().getPath());
175180
this.setNewOutputDir(dirChooser.getSelectedFile().getPath());
176181
}
@@ -208,9 +213,9 @@ private void assignRPGActionListener() {
208213
/**
209214
* Opens the RPG-MV-Project
210215
*
211-
* @param currentDirectory -
216+
* @param currentDirectory - Current RPG-Maker Directory
212217
*/
213-
private void openRPGProject(@NotNull String currentDirectory) {
218+
private boolean openRPGProject(@NotNull String currentDirectory) {
214219
try {
215220
this.rpgProject = new RPGProject(
216221
File.ensureDSonEndOfPath(currentDirectory),
@@ -220,18 +225,20 @@ private void openRPGProject(@NotNull String currentDirectory) {
220225
ErrorWindow errorWindow = new ErrorWindow(e.getMessage(), ErrorWindow.ERROR_LEVEL_WARNING, false);
221226
errorWindow.show(this.mainWindow);
222227

223-
return;
228+
return false;
224229
} catch(Exception e) {
225230
ErrorWindow errorWindow = new ErrorWindow(e.getMessage(), ErrorWindow.ERROR_LEVEL_ERROR, false);
226231
errorWindow.show(this.mainWindow);
227232

228-
return;
233+
return false;
229234
}
230235

231236
this.decrypter = new Decrypter();
232237
this.rpgProject.setOutputPath(App.outputDir);
233238
this.mainMenu.enableOnRPGProject(true);
234239
this.assignRPGActionListener();
240+
241+
return true;
235242
}
236243

237244
/**

0 commit comments

Comments
 (0)