if (command.equals(Resources.getString("menu.edit.brush"))) {
BrushDialog bd = new BrushDialog(this, YaFrame.get(), currentBrush);
bd.setVisible(true);
} else if (command.equals(Resources.getString("menu.tilesets.new"))) {
if (currentMap != null) {
NewTilesetDialog dialog = new NewTilesetDialog(YaFrame.get(), currentMap);
TileSet newSet = dialog.create();
if (newSet != null) {
currentMap.addTileset(newSet);
}
}
} else if (command.equals(Resources.getString("menu.tilesets.import"))) {
if (currentMap != null) {
JFileChooser chooser = new JFileChooser(currentMap.getFilename());
MapHelper.addExtension(chooser);
int ret = chooser.showOpenDialog(appFrame);
if (ret == JFileChooser.APPROVE_OPTION) {
String filename = chooser.getSelectedFile().getAbsolutePath();
try {
TileSet set = MapHelper.loadTileset(filename);
currentMap.addTileset(set);
} catch (Exception e) {
e.printStackTrace();
}
}
}
} else if (command.equals(Resources.getString("menu.tilesets.refresh"))) {
if (currentMap != null) {
Vector<TileSet> tilesets = currentMap.getTilesets();
for (TileSet tileset : tilesets) {
try {
tileset.checkUpdate();
} catch (IOException e) {
JOptionPane.showMessageDialog(appFrame, e.getLocalizedMessage(), IMPORT_ERROR_MSG, JOptionPane.WARNING_MESSAGE);
}
}
mapView.repaint();
brushPreview.setBrush(currentBrush);
}
} else if (command.equals(Resources.getString("menu.tilesets.manager"))) {
if (currentMap != null) {
TilesetManager manager = new TilesetManager(YaFrame.get(), currentMap);
manager.setVisible(true);
}
} else if (command.equals(Resources.getString("menu.map.properties"))) {
PropertiesDialog pd = new PropertiesDialog(YaFrame.get(), currentMap.getProperties());
pd.setTitle(Resources.getString("dialog.properties.map.title"));
pd.getProps();
} else if (command.equals(Resources.getString("menu.layer.properties"))) {
MapLayer layer = getCurrentLayer();
PropertiesDialog lpd = new PropertiesDialog(YaFrame.get(), layer.getProperties());
lpd.setTitle(layer.getName() + " " + Resources.getString("dialog.properties.title"));
lpd.getProps();
} else if (command.equals(Resources.getString("menu.view.boundaries")) || command.equals("Hide Boundaries")) {
mapView.toggleMode(MapView.PF_BOUNDARYMODE);
} else if (command.equals(Resources.getString("menu.view.grid"))) {
// Toggle grid
Preferences displayPrefs = prefs.node("display");
boolean showGrid = displayPrefs.getBoolean("showGrid", false);
displayPrefs.putBoolean("showGrid", !showGrid);
} else if (command.equals(Resources.getString("menu.view.coordinates"))) {
// Toggle coordinates
mapView.toggleMode(MapView.PF_COORDINATES);
} else if (command.equals(Resources.getString("menu.view.cursor"))) {
prefs.putBoolean("cursorhighlight", cursorMenuItem.isSelected());
cursorHighlight.setVisible(cursorMenuItem.isSelected());
} else if (command.equals(Resources.getString("menu.map.resize"))) {
ResizeDialog rd = new ResizeDialog(YaFrame.get(), this);
rd.setVisible(true);
} else if (command.equals(Resources.getString("menu.map.search"))) {
SearchDialog sd = new SearchDialog(YaFrame.get(), currentMap);
sd.setVisible(true);
} else if (command.equals(Resources.getString("menu.help.about"))) {
showAboutDialog();
} else if (command.equals(Resources.getString("menu.edit.preferences"))) {
ConfigurationDialog dialog = new ConfigurationDialog(YaFrame.get());
dialog.configure();
} else {
System.out.println(event);
}
}