- int tabCount = projectPane.getTabCount();
- for (int tabIndex = 0; tabIndex < tabCount; tabIndex++) {
- Component tabComponent = projectPane.getComponentAt(tabIndex);
- if (tabComponent instanceof ProjectPanel) {
- Project tabProject = ((ProjectPanel) tabComponent).getProject();
- if (tabProject.equals(project)) {
- projectPane.setTitleAt(tabIndex, project.getName());
- projectPane.setToolTipTextAt(tabIndex, project.getDescription());
- projectPane.repaint();
- }
- }
+ int projectIndex = getProjectIndex(project);
+ if (projectIndex != -1) {
+ projectPane.setTitleAt(projectIndex, project.getName());
+ projectPane.setToolTipTextAt(projectIndex, project.getDescription());
+ projectPane.repaint();