Minor Inspect code

This commit is contained in:
Valentina Kiryushkina
2016-11-22 13:01:40 +03:00
parent 57b17be93c
commit 6bc1b9c47a
3 changed files with 10 additions and 4 deletions
@@ -31,7 +31,10 @@ import javax.imageio.ImageIO;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
public class EduUtils {
private EduUtils() {
@@ -39,7 +42,7 @@ public class EduUtils {
private static final Logger LOG = Logger.getInstance(EduUtils.class.getName());
public static final Comparator<StudyItem> INDEX_COMPARATOR = (o1, o2) -> o1.getIndex() - o2.getIndex();
public static final Comparator<StudyItem> INDEX_COMPARATOR = Comparator.comparingInt(StudyItem::getIndex);
public static void enableAction(@NotNull final AnActionEvent event, boolean isEnable) {
final Presentation presentation = event.getPresentation();
@@ -283,7 +283,7 @@ public class EduAdaptiveStepicConnector {
final VirtualFile taskDir = VfsUtil
.findFileByIoFile(new File(lessonDir.getCanonicalPath(), EduNames.TASK + unsolvedTask.getIndex()), true);
final File resourceRoot = new File(course.getCourseDirectory(), lessonDir.getName());
File newResourceRoot = null;
File newResourceRoot;
if (taskDir != null) {
newResourceRoot = new File(resourceRoot, taskDir.getName());
File[] filesInTask = newResourceRoot.listFiles();
@@ -122,6 +122,7 @@ public class StudyNewProjectPanel extends JPanel implements PanelWithAnchor {
else {
addCoursesToCombobox(myAvailableCourses);
final CourseInfo selectedCourse = StudyUtils.getFirst(myAvailableCourses);
if (selectedCourse == null) return;
final String authorsString = Course.getAuthorsString(selectedCourse.getAuthors());
myAuthorLabel.setText(!StringUtil.isEmptyOrSpaces(authorsString) ? "Author: " + authorsString : "");
myDescriptionPane.setText(selectedCourse.getDescription());
@@ -270,7 +271,9 @@ public class StudyNewProjectPanel extends JPanel implements PanelWithAnchor {
myCoursesComboBox.removeAllItems();
addCoursesToCombobox(courses);
myGenerator.setSelectedCourse(StudyUtils.getFirst(courses));
final CourseInfo selectedCourse = StudyUtils.getFirst(courses);
if (selectedCourse == null) return;
myGenerator.setSelectedCourse(selectedCourse);
myGenerator.setCourses(courses);
myAvailableCourses = courses;