mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-11 21:29:46 +00:00
Hooked up delete buttons for Image, Map and Tile
This commit is contained in:
parent
452d72e8a7
commit
908d248af6
@ -21,6 +21,7 @@ import javafx.util.Callback;
|
||||
import static org.badvision.outlaweditor.Application.currentPlatform;
|
||||
import static org.badvision.outlaweditor.Application.gameData;
|
||||
import static org.badvision.outlaweditor.data.PropertyHelper.*;
|
||||
import static org.badvision.outlaweditor.UIAction.*;
|
||||
import org.badvision.outlaweditor.data.TileUtils;
|
||||
import org.badvision.outlaweditor.data.TilesetUtils;
|
||||
import org.badvision.outlaweditor.data.xml.Image;
|
||||
@ -377,7 +378,13 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
||||
|
||||
@Override
|
||||
public void onImageDeletePressed(ActionEvent event) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
if (currentImage == null) return;
|
||||
if (confirm("Delete image '"+currentImage.getName()+"'. Are you sure?")) {
|
||||
Image del = currentImage;
|
||||
setCurrentImage(null);
|
||||
Application.gameData.getImage().remove(del);
|
||||
rebuildImageSelector();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -408,7 +415,13 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
||||
|
||||
@Override
|
||||
public void onMapDeletePressed(ActionEvent event) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
if (currentMap == null) return;
|
||||
if (confirm("Delete map '"+currentMap.getName()+"'. Are you sure?")) {
|
||||
org.badvision.outlaweditor.data.xml.Map del = currentMap;
|
||||
setCurrentMap(null);
|
||||
Application.gameData.getMap().remove(del);
|
||||
rebuildMapSelectors();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -478,7 +491,13 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
||||
|
||||
@Override
|
||||
public void onTileDeletePressed(ActionEvent event) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
if (currentTile == null) return;
|
||||
if (confirm("Delete tile '"+currentTile.getName()+"'. Are you sure?")) {
|
||||
Tile del = currentTile;
|
||||
setCurrentTile(null);
|
||||
Application.gameData.getTile().remove(del);
|
||||
rebuildTileSelectors();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -145,4 +145,8 @@ public class UIAction {
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
public static boolean confirm(String string) {
|
||||
return JOptionPane.showConfirmDialog(null, string) == JOptionPane.YES_OPTION;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user