package de.prob2.ui.menu;

import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Singleton;
import de.prob2.ui.chart.HistoryChartStage;
import de.prob2.ui.dynamic.dotty.DotView;
import de.prob2.ui.dynamic.table.ExpressionTableView;
import de.prob2.ui.internal.StageManager;
import de.prob2.ui.prob2fx.CurrentProject;
import de.prob2.ui.prob2fx.CurrentTrace;
import javafx.fxml.FXML;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;

/**
 * @author Christoph Heinzen
 * @since 21.09.17
 */
@Singleton
public class VisualisationMenu extends Menu {
	@FXML private MenuItem graphVisualization;
	@FXML private MenuItem tableVisualization;
	
	private final Injector injector;
	private final CurrentTrace currentTrace;
	private final CurrentProject currentProject;

	@Inject
	public VisualisationMenu(final StageManager stageManager, final Injector injector, final CurrentTrace currentTrace, final CurrentProject currentProject) {
		this.currentTrace = currentTrace;
		this.currentProject = currentProject;
		this.injector = injector;
		stageManager.loadFXML(this, "visualisationMenu.fxml");
	}

	@FXML
	public void initialize() {
		this.graphVisualization.disableProperty().bind(currentProject.currentMachineProperty().isNull());
		this.tableVisualization.disableProperty().bind(currentProject.currentMachineProperty().isNull());
	}
	
	@FXML
	private void openGraphVisualisation() {
		injector.getInstance(DotView.class).show();
	}
	
	@FXML
	private void openTableVisualisation() {
		injector.getInstance(ExpressionTableView.class).show();
	}


	@FXML
	private void handleHistoryChart() {
		final Stage chartStage = injector.getInstance(HistoryChartStage.class);
		chartStage.show();
		chartStage.toFront();
	}

}

@@ -124,16 +124,17 @@
 gleton;%0A
+%0A
 import d
@@ -354,49 +354,8 @@
 ct;%0A
-import de.prob2.ui.prob2fx.CurrentTrace;%0A
 impo
@@ -590,25 +590,26 @@
 enu %7B%0A%09@FXML
- 
+%0A%09
 private Menu
@@ -639,17 +639,18 @@
 ;%0A%09@FXML
- 
+%0A%09
 private 
@@ -678,17 +678,16 @@
 zation;%0A
-%09
 %0A%09privat
@@ -717,50 +717,8 @@
 or;%0A
-%09private final CurrentTrace currentTrace;%0A
 %09pri
@@ -856,42 +856,12 @@
 tor,
- final CurrentTrace currentTrace, 
+%0A%09%09%09
 fina
@@ -899,44 +899,8 @@
 ) %7B%0A
-%09%09this.currentTrace = currentTrace;%0A
 %09%09th
@@ -1258,25 +1258,24 @@
 Null());%0A%09%7D%0A
-%09
 %0A%09@FXML%0A%09pri
@@ -1360,17 +1360,16 @@
 w();%0A%09%7D%0A
-%09
 %0A%09@FXML%0A
@@ -1471,17 +1471,16 @@
 ();%0A%09%7D%0A%0A
-%0A
 %09@FXML%0A%09

remove unused currentTrace from Visualisation Menu