switch to new project when project is created
[jSite2.git] / src / net / pterodactylus / jsite / gui / MainWindow.java
index 551cfbb..7eea5cf 100644 (file)
@@ -250,13 +250,19 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
         * 
         * @param project
         *            The project to add
+        * @param switchToProject
+        *            <code>true</code> to switch to the new panel,
+        *            <code>false</code> 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);
+               }
        }
 
        //