*
* @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);
+ }
}
//
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) {
public void loadingProjectsDone(String directory) {
mainWindow.setStatusBarText(I18n.get("mainWindow.statusBar.projectLoadingDone"));
for (Project project: core.getProjects()) {
- mainWindow.addProject(project);
+ mainWindow.addProject(project, false);
}
}