mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-08-15 06:27:24 +00:00
Hooked up delete buttons for Image, Map and Tile
This commit is contained in:
@@ -21,6 +21,7 @@ import javafx.util.Callback;
|
|||||||
import static org.badvision.outlaweditor.Application.currentPlatform;
|
import static org.badvision.outlaweditor.Application.currentPlatform;
|
||||||
import static org.badvision.outlaweditor.Application.gameData;
|
import static org.badvision.outlaweditor.Application.gameData;
|
||||||
import static org.badvision.outlaweditor.data.PropertyHelper.*;
|
import static org.badvision.outlaweditor.data.PropertyHelper.*;
|
||||||
|
import static org.badvision.outlaweditor.UIAction.*;
|
||||||
import org.badvision.outlaweditor.data.TileUtils;
|
import org.badvision.outlaweditor.data.TileUtils;
|
||||||
import org.badvision.outlaweditor.data.TilesetUtils;
|
import org.badvision.outlaweditor.data.TilesetUtils;
|
||||||
import org.badvision.outlaweditor.data.xml.Image;
|
import org.badvision.outlaweditor.data.xml.Image;
|
||||||
@@ -377,7 +378,13 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onImageDeletePressed(ActionEvent event) {
|
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
|
@Override
|
||||||
@@ -408,7 +415,13 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMapDeletePressed(ActionEvent event) {
|
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
|
@Override
|
||||||
@@ -478,7 +491,13 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTileDeletePressed(ActionEvent event) {
|
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
|
@Override
|
||||||
|
@@ -145,4 +145,8 @@ public class UIAction {
|
|||||||
|
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean confirm(String string) {
|
||||||
|
return JOptionPane.showConfirmDialog(null, string) == JOptionPane.YES_OPTION;
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user