fix menu items
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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()){
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user