Skip to content

Commit 4ad3dd7

Browse files
Merge pull request #12 from DazedNConfused-/refactors/code
2 parents 925835a + fc49686 commit 4ad3dd7

File tree

7 files changed

+437
-114
lines changed

7 files changed

+437
-114
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ indent_size = 4
55
indent_style = space
66
insert_final_newline = false
77
tab_width = 4
8-
ij_continuation_indent_size = 8
8+
ij_continuation_indent_size = 4
99

1010
[*.java]
1111
ij_java_blank_lines_after_imports = 1

src/main/java/com/dazednconfused/catalauncher/backup/SaveManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ public static boolean deleteBackup(File toBeDeleted) {
8686
return toBeDeleted.delete();
8787
}
8888

89+
/**
90+
* Renames given {@code toBeRenamed} backup.
91+
* */
92+
public static File renameBackup(File toBeRenamed, String newName) {
93+
LOGGER.info("Renaming backup [{}] into [{}]...", toBeRenamed, newName);
94+
95+
File newFile = new File(toBeRenamed.getParentFile().getPath() + "/" + newName + ".zip");
96+
return Try.of(() -> Files.move(toBeRenamed.toPath(), newFile.toPath())).onFailure(
97+
t -> LOGGER.error("There was an error while renaming save [{}] into [{}]", toBeRenamed, newFile, t)
98+
).get().toFile();
99+
}
100+
89101
/**
90102
* Returns all save backups currently found in {@link com.dazednconfused.catalauncher.helper.Constants#SAVE_BACKUP_PATH}.
91103
* */

src/main/java/com/dazednconfused/catalauncher/gui/MainWindow.form

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<properties/>
1717
<border type="none"/>
1818
<children>
19-
<tabbedpane id="276d4">
19+
<tabbedpane id="276d4" binding="tabbedPane">
2020
<constraints>
2121
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false">
2222
<minimum-size width="800" height="400"/>
@@ -244,10 +244,10 @@
244244
<properties/>
245245
<border type="none"/>
246246
<children>
247-
<component id="dd00a" class="javax.swing.JTable" binding="saveBackupTable">
247+
<component id="dd00a" class="javax.swing.JTable" binding="saveBackupsTable">
248248
<constraints/>
249249
<properties>
250-
<enabled value="false"/>
250+
<enabled value="true"/>
251251
</properties>
252252
</component>
253253
</children>
@@ -272,7 +272,7 @@
272272
<component id="38613" class="javax.swing.JTable" binding="soundpacksTable">
273273
<constraints/>
274274
<properties>
275-
<enabled value="false"/>
275+
<enabled value="true"/>
276276
</properties>
277277
</component>
278278
</children>

0 commit comments

Comments
 (0)