if (source == deleteTileButton) {
int answer = JOptionPane.showConfirmDialog(this, Resources.getString("action.tile.delete.confirm.message"),
Resources.getString("action.tile.delete.confirm.title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (answer == JOptionPane.YES_OPTION) {
Tile tile = (Tile) tileList.getSelectedValue();
if (tile != null) {
tileset.removeTile(tile.getId());
}
queryTiles();
}
} else if (source == changeImageButton) {
changeImage();
} else if (source == addImagesButton) {
addImages();
} else if (source == duplicateTileButton) {
Tile newTile = new Tile(currentTile);
tileset.addNewTile(newTile);
queryTiles();
// Select the last (cloned) tile
tileList.setSelectedIndex(tileset.size() - 1);
tileList.ensureIndexIsVisible(tileset.size() - 1);
// } else if (source == animationButton) {
// AnimationDialog ad = new AnimationDialog(this,
// ((AnimatedTile)currentTile).getSprite());
// ad.setVisible(true);
}
/*
* else if (source == setImagesCheck) { if (setImagesCheck.isSelected())
* { tileset.enablesetImages(); updateEnabledState(); } else { int
* answer = JOptionPane.YES_OPTION; if
* (!tileset.safeToDisablesetImages()) { answer =
* JOptionPane.showConfirmDialog( this,
* "This tileset uses features that require the " +
* "use of shared images. Disable the use of shared " + "images?",
* "Are you sure?", JOptionPane.YES_NO_OPTION,
* JOptionPane.QUESTION_MESSAGE); } if (answer ==
* JOptionPane.YES_OPTION) { tileset.disablesetImages();
* updateEnabledState(); } else { setImagesCheck.setSelected(true); } }
* }
*/
else if (source == createTileButton) {
Object[] imgs = imageList.getSelectedValues();
if (imgs.length == 0)
return;
for (Object img : imgs) {
Tile newTile = new Tile(tileset);
newTile.setImage(tileset.getIdByImage((Image) img));
tileset.addNewTile(newTile);
}
queryTiles();
// Select the last (cloned) tile