From: David ‘Bombe’ Roden Date: Thu, 22 May 2008 00:37:47 +0000 (+0000) Subject: switch to new project when project is created X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=ad11717224be5736a9edead8ae355f54a8b98902;p=jSite2.git switch to new project when project is created git-svn-id: http://trooper/svn/projects/jSite/trunk@928 c3eda9e8-030b-0410-8277-bc7414b0a119 --- diff --git a/src/net/pterodactylus/jsite/gui/MainWindow.java b/src/net/pterodactylus/jsite/gui/MainWindow.java index 551cfbb..7eea5cf 100644 --- a/src/net/pterodactylus/jsite/gui/MainWindow.java +++ b/src/net/pterodactylus/jsite/gui/MainWindow.java @@ -250,13 +250,19 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop * * @param project * The project to add + * @param switchToProject + * true to switch to the new panel, + * false to not change the current panel */ - void addProject(Project project) { + void addProject(Project project, boolean switchToProject) { ProjectPanel projectPanel = new ProjectPanel(swingInterface, project); int newTabIndex = projectPane.getTabCount(); projectPane.add(project.getName(), projectPanel); projectPane.setToolTipTextAt(newTabIndex, project.getDescription()); project.addPropertyChangeListener(this); + if (switchToProject) { + projectPane.setSelectedIndex(newTabIndex); + } } // diff --git a/src/net/pterodactylus/jsite/gui/SwingInterface.java b/src/net/pterodactylus/jsite/gui/SwingInterface.java index 6f97944..10e6532 100644 --- a/src/net/pterodactylus/jsite/gui/SwingInterface.java +++ b/src/net/pterodactylus/jsite/gui/SwingInterface.java @@ -820,7 +820,7 @@ public class SwingInterface implements CoreListener, LoggingListener { private void addProject() { try { Project project = core.createProject(); - mainWindow.addProject(project); + mainWindow.addProject(project, true); project.setName(I18n.get("general.newProject.name")); project.setDescription(I18n.get("general.newProject.description", new Date())); } catch (JSiteException nne1) { @@ -856,7 +856,7 @@ public class SwingInterface implements CoreListener, LoggingListener { public void loadingProjectsDone(String directory) { mainWindow.setStatusBarText(I18n.get("mainWindow.statusBar.projectLoadingDone")); for (Project project: core.getProjects()) { - mainWindow.addProject(project); + mainWindow.addProject(project, false); } }