IDEA-131113 Use project names in Redmine repository UI

Seems that in some old versions of Redmine it was possible to create
project without unique identifier assigned and thus such projects were shown
as "null"s in projects tree.
This commit is contained in:
Mikhail Golubev
2014-10-15 19:00:41 +04:00
parent 1458ac8af0
commit 32c1932fe9
2 changed files with 5 additions and 9 deletions
@@ -232,7 +232,7 @@ public class RedmineRepository extends NewBaseRepositoryImpl {
public String getPresentableName() {
String name = super.getPresentableName();
if (myCurrentProject != null && myCurrentProject != UNSPECIFIED_PROJECT) {
name += "/projects/" + myCurrentProject.getIdentifier();
name += "/projects/" + StringUtil.notNullize(myCurrentProject.getIdentifier(), myCurrentProject.getName());
}
return name;
}
@@ -3,6 +3,7 @@ package com.intellij.tasks.redmine;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.tasks.config.BaseRepositoryEditor;
import com.intellij.tasks.impl.TaskUiUtil;
import com.intellij.tasks.redmine.model.RedmineProject;
@@ -106,16 +107,11 @@ public class RedmineRepositoryEditor extends BaseRepositoryEditor<RedmineReposit
//if (value.myLevel == 0 && value.myProject != RedmineRepository.UNSPECIFIED_PROJECT) {
//setFont(UIUtil.getListFont().deriveFont(Font.BOLD));
//}
StringBuilder builder = new StringBuilder();
if (value.myLevel != 0) {
for (int i = 0; i < value.myLevel; i++) {
builder.append(" ");
}
}
setText(builder.append(value.myProject.getIdentifier()).toString());
setText(StringUtil.repeat(" ", value.myLevel) + value.myProject.getName());
}
else {
setText(value.myProject.getIdentifier());
// Do not indent selected project
setText(value.myProject.getName());
}
}
}