* @param project
*/
void projectInsertStarted(Project project) {
- ProjectPanel projectPanel = findProjectPanel(project);
- if (projectPanel == null) {
+ int projectIndex = getProjectIndex(project);
+ if (projectIndex == -1) {
return;
}
-
+ projectPane.setTitleAt(projectIndex, I18n.get("projectPanel.title.starting", project.getName()));
}
/**
* @param finalizedTotal
*/
void projectInsertProgressed(Project project, int totalBlocks, int requiredBlocks, int successfulBlocks, int failedBlocks, int fatallyFailedBlocks, boolean finalizedTotal) {
-
+ int projectIndex = getProjectIndex(project);
+ if (projectIndex == -1) {
+ return;
+ }
+ projectPane.setTitleAt(projectIndex, I18n.get("projectPanel.title.progress", project.getName(), requiredBlocks / (double) successfulBlocks));
}
/**
* @param project
*/
void projectInsertGeneratedURI(Project project) {
-
+ /* TODO - update panel. */
}
/**
* @param success
*/
void projectInsertFinished(Project project, boolean success) {
-
+ int projectIndex = getProjectIndex(project);
+ if (projectIndex == -1) {
+ return;
+ }
+ projectPane.setTitleAt(projectIndex, project.getName());
}
//
//
/**
- * Locates the project panel that contains the given project.
+ * Returns the index of the project panel that contains the given project.
*
* @param project
* The wanted project
+ * @return The index of {@link #projectPane}’s tab that contains the given
+ * project, or <code>-1</code> if the project can not be found
*/
- private ProjectPanel findProjectPanel(Project project) {
+ private int getProjectIndex(Project project) {
int tabCount = projectPane.getTabCount();
for (int tabIndex = 1; tabIndex < tabCount; tabIndex++) {
Component tabComponent = projectPane.getComponentAt(tabIndex);
if (tabComponent instanceof ProjectPanel) {
if (((ProjectPanel) tabComponent).getProject() == project) {
- return (ProjectPanel) tabComponent;
+ return tabIndex;
}
}
}
- return null;
+ return -1;
}
/**