diff --git a/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java b/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java index ee05c96cff88e631e8a98fba20ab312e0f2b9b2e..019c2076c35954ec279aa835b688f530756ac365 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java +++ b/GUI/src/main/java/cz/fidentis/analyst/project/ProjectPanel.java @@ -745,37 +745,28 @@ public class ProjectPanel extends JPanel { * project */ public void openExistingOrNewProject() { - ImageIcon recentProjectImage = new ImageIcon(ProjectTopComp.class.getClassLoader().getResource("/" + "recent_project.png")); - ImageIcon newProjectImage = new ImageIcon(ProjectTopComp.class.getClassLoader().getResource("/" + "new.png")); - ImageIcon existingProjectImage = new ImageIcon(ProjectTopComp.class.getClassLoader().getResource("/" + "open.png")); - Object[] options = {recentProjectImage, newProjectImage, existingProjectImage}; File recentProjectFile = getRecentProject(); - String recentProjectInfo; if (recentProjectFile != null) { - recentProjectInfo = "\n\nMost recent project is : " + recentProjectFile.getAbsolutePath(); - } else { - recentProjectInfo = "\n\nCouldn't find most recent project"; + openProjectFromFile(recentProjectFile); + return; } + ImageIcon newProjectImage = new ImageIcon(ProjectTopComp.class.getClassLoader().getResource("/" + "new.png")); + ImageIcon existingProjectImage = new ImageIcon(ProjectTopComp.class.getClassLoader().getResource("/" + "open.png")); + Object[] options = {newProjectImage, existingProjectImage}; + + int choice = JOptionPane.showOptionDialog(this, - "Would you like to create a new project or open an existing project?" - + recentProjectInfo, + "Would you like to create a new project or open an existing project?", "Select project", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, - options[1]); + options[0]); - switch (choice) { - case 0: - openRecentProject(); - break; - case 2: - openProject(); - break; - default: - break; + if (choice == 1) { + openProject(); } } @@ -872,14 +863,6 @@ public class ProjectPanel extends JPanel { } } - /** - * Opens most recent project (loads project from user preferences) - */ - private void openRecentProject() { - File f = getRecentProject(); - openProjectFromFile(f); - } - /** * Loads most recent project from user preferences * @return File where project is saved, null if no project was found