Skip to content

Commit f840d3e

Browse files
committed
Only one code view can be opened at a time.
1 parent c7085bb commit f840d3e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/ee/ut/similaritydetector/ui/controllers/ResultsViewController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ private void viewClusters() {
131131
* @throws IOException if the code view could not be opened
132132
*/
133133
private void openCodeView() throws IOException {
134+
// If already open then bring to front and don't open new one
135+
if (codeViewStage != null) {
136+
codeViewStage.toFront();
137+
return;
138+
}
134139
FXMLLoader loader = new FXMLLoader(getClass().getResource(
135140
"/ee/ut/similaritydetector/fxml/code_view.fxml"));
136141
Parent root = loader.load();
@@ -153,6 +158,7 @@ private void openCodeView() throws IOException {
153158

154159
newWindow.show();
155160
codeViewStage = newWindow;
161+
codeViewStage.setOnCloseRequest(event -> codeViewStage = null);
156162

157163
// Resize cluster table columns
158164
Platform.runLater(controller::resizeClusterTableColumns);

0 commit comments

Comments
 (0)