Skip to content

Commit

Permalink
throw exception when gui is not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Ogefest committed Feb 18, 2021
1 parent dac7208 commit af8404e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/main/java/notepack/MainViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ public void windowRestore() {
SplitPane notePaneBackground;
try {

// FXMLLoader loader2 = new FXMLLoader(getClass().getResource("/notepack/TodoPaneBackground.fxml"));
// BorderPane todoPaneBackground = loader2.load();
// TodoPaneBackgroundController ctrl2 = loader2.getController();
// todoPaneBackground.setUserData(ctrl2);
// ctrl2.setApp(app);

FXMLLoader loader = new FXMLLoader(getClass().getResource("/notepack/NotePaneBackground.fxml"));
notePaneBackground = loader.load();
NotePaneBackgroundController ctrl = loader.getController();
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/notepack/app/task/WorkspaceSelectNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import notepack.app.domain.Note;
import notepack.app.domain.Task;
import notepack.app.domain.Workspace;
import notepack.app.domain.exception.GuiNotReadyError;
import notepack.gui.TaskUtil;

public class WorkspaceSelectNote implements Task, TypeGui {
Expand All @@ -26,11 +27,14 @@ public WorkspaceSelectNote(Note note) {
}

@Override
public void guiWork(TaskUtil taskUtil, App app) {
public void guiWork(TaskUtil taskUtil, App app) throws GuiNotReadyError {

Workspace workspace = note.getWorkspace();
TabPane container = taskUtil.getWorkspaceContainer();
Tab workspaceTab = taskUtil.getWorkspaceTab(workspace);
if (workspaceTab == null) {
throw new GuiNotReadyError("Workspace tab container not exists");
}
WorkspaceTabController ctrl = (WorkspaceTabController) workspaceTab.getUserData();

container.getSelectionModel().select(workspaceTab);
Expand Down

0 comments on commit af8404e

Please sign in to comment.