use of com.intellij.openapi.fileEditor.impl.UniqueNameEditorTabTitleProvider in project intellij-community by JetBrains.
the class StudyTabTitleProvider method getEditorTabTitle.
@Nullable
@Override
public String getEditorTabTitle(Project project, VirtualFile file) {
TaskFile taskFile = StudyUtils.getTaskFile(project, file);
if (taskFile == null) {
return null;
}
String title = new UniqueNameEditorTabTitleProvider().getEditorTabTitle(project, file);
if (title == null) {
return null;
}
String[] split = title.split(Pattern.quote(File.separator));
for (int i = 0; i < split.length; i++) {
String part = split[i];
Task task = taskFile.getTask();
VirtualFile taskDir = task.getTaskDir(project);
if (taskDir != null && part.equals(taskDir.getName())) {
split[i] = task.getName();
continue;
}
Lesson lesson = task.getLesson();
int lessonIndex = lesson.getIndex();
if (part.equals(EduNames.LESSON + lessonIndex)) {
split[i] = lesson.getName();
}
}
return StringUtil.join(split, File.separator);
}
Aggregations