Archived
0

fix menu items

This commit is contained in:
iMoHax
2015-11-05 17:21:03 +03:00
parent 61b46b4e49
commit 36f9a34aa5
3 changed files with 21 additions and 7 deletions

View File

@@ -222,14 +222,14 @@ public class MainController {
public void editSystem(ActionEvent actionEvent){
SystemModel system = offersController.getSystem();
if (system != null) {
if (!ModelFabric.isFake(system)) {
Screeners.showSystemsEditor(system);
}
}
public void removeSystem(ActionEvent actionEvent){
SystemModel system = offersController.getSystem();
if (system != null) {
if (!ModelFabric.isFake(system)) {
Action res = Screeners.showConfirm(String.format(Localization.getString("dialog.confirm.remove"), system.getName()));
if (res == Dialog.ACTION_YES) {
market.remove(system);
@@ -238,22 +238,22 @@ public class MainController {
}
public void addStation(ActionEvent actionEvent) {
SystemModel system = offersController.getSystem();
if (system != null){
SystemModel system = profile.getSystem();
if (!ModelFabric.isFake(system)) {
Screeners.showAddStation(offersController.getSystem());
}
}
public void editStation(ActionEvent actionEvent) {
StationModel station = profile.getStation();
if (station != null) {
if (!ModelFabric.isFake(station)) {
Screeners.showEditStation(station);
}
}
public void removeStation(ActionEvent actionEvent){
StationModel station = offersController.getStation();
if (station != null) {
StationModel station = profile.getStation();
if (!ModelFabric.isFake(station)) {
Action res = Screeners.showConfirm(String.format(Localization.getString("dialog.confirm.remove"), station.getName()));
if (res == Dialog.ACTION_YES) {
station.getSystem().remove(station);

View File

@@ -5,6 +5,8 @@ import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.input.MouseButton;
import org.controlsfx.control.action.Action;
import org.controlsfx.dialog.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.trader.core.SERVICE_TYPE;
@@ -13,6 +15,7 @@ import ru.trader.model.support.BindingsHelper;
import ru.trader.model.support.ChangeMarketListener;
import ru.trader.view.support.FactionStringConverter;
import ru.trader.view.support.GovernmentStringConverter;
import ru.trader.view.support.Localization;
import ru.trader.view.support.ViewUtils;
import ru.trader.view.support.autocomplete.AutoCompletion;
import ru.trader.view.support.autocomplete.CachedSuggestionProvider;
@@ -204,6 +207,16 @@ public class OffersController {
}
}
@FXML
private void removeStation() {
StationModel s = getStation();
if (!ModelFabric.isFake(s)){
Action res = Screeners.showConfirm(String.format(Localization.getString("dialog.confirm.remove"), s.getName()));
if (res == org.controlsfx.dialog.Dialog.ACTION_YES) {
s.getSystem().remove(s);
}
}
}
private void addOffer(OfferModel offer){
switch (offer.getType()){

View File

@@ -28,6 +28,7 @@
<items>
<MenuItem text="%main.menu.edit.addStation" onAction="#addStation" />
<MenuItem text="%main.menu.edit.editStation" onAction="#editStation" />
<MenuItem text="%main.menu.edit.removeStation" onAction="#removeStation" />
</items>
</ContextMenu>
</contextMenu>