Fixed #1672
This commit is contained in:
@@ -39,6 +39,8 @@ be.check = Check for updates
|
|||||||
schematic = Schematic
|
schematic = Schematic
|
||||||
schematic.add = Save Schematic...
|
schematic.add = Save Schematic...
|
||||||
schematics = Schematics
|
schematics = Schematics
|
||||||
|
schematic.replace = A schematic by that name already exists. Replace it?
|
||||||
|
schematic.exists = A schematic by that name already exists.
|
||||||
schematic.import = Import Schematic...
|
schematic.import = Import Schematic...
|
||||||
schematic.exportfile = Export File
|
schematic.exportfile = Export File
|
||||||
schematic.importfile = Import File
|
schematic.importfile = Import File
|
||||||
|
|||||||
@@ -255,10 +255,19 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(lastSchematic == null) return;
|
if(lastSchematic == null) return;
|
||||||
|
|
||||||
ui.showTextInput("$schematic.add", "$name", "", text -> {
|
ui.showTextInput("$schematic.add", "$name", "", text -> {
|
||||||
lastSchematic.tags.put("name", text);
|
Schematic replacement = schematics.all().find(s -> s.name().equals(text));
|
||||||
schematics.add(lastSchematic);
|
if(replacement != null){
|
||||||
ui.showInfoFade("$schematic.saved");
|
ui.showConfirm("$confirm", "$schematic.replace", () -> {
|
||||||
ui.schematics.showInfo(lastSchematic);
|
schematics.overwrite(replacement, lastSchematic);
|
||||||
|
ui.showInfoFade("$schematic.saved");
|
||||||
|
ui.schematics.showInfo(replacement);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
lastSchematic.tags.put("name", text);
|
||||||
|
schematics.add(lastSchematic);
|
||||||
|
ui.showInfoFade("$schematic.saved");
|
||||||
|
ui.schematics.showInfo(lastSchematic);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,13 @@ public class SchematicsDialog extends FloatingDialog{
|
|||||||
|
|
||||||
buttons.addImageButton(Icon.pencil, style, () -> {
|
buttons.addImageButton(Icon.pencil, style, () -> {
|
||||||
ui.showTextInput("$schematic.rename", "$name", s.name(), res -> {
|
ui.showTextInput("$schematic.rename", "$name", s.name(), res -> {
|
||||||
|
Schematic replacement = schematics.all().find(other -> other.name().equals(res) && other != s);
|
||||||
|
if(replacement != null){
|
||||||
|
//renaming to an existing schematic is not allowed, as it is not clear how the tags would be merged, and which one should be removed
|
||||||
|
ui.showErrorMessage("$schematic.exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
s.tags.put("name", res);
|
s.tags.put("name", res);
|
||||||
s.save();
|
s.save();
|
||||||
rebuildPane[0].run();
|
rebuildPane[0].run();
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=c1eab295b1a55397957fd54bec2f37daee0e8b4b
|
archash=b8f094ba9916ba5a0ce5b4c9dc0fc3d2d0cf89fd
|
||||||
|
|||||||
Reference in New Issue
Block a user