diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCPushLesson.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCPushLesson.java index 4e3f7ecc7414..ee08eb530032 100644 --- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCPushLesson.java +++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCPushLesson.java @@ -39,7 +39,7 @@ public class CCPushLesson extends DumbAwareAction { return; } final Lesson lesson = course.getLesson(lessonDir.getName()); - if (lesson != null && lesson.id > 0) { + if (lesson != null && lesson.getId() > 0) { e.getPresentation().setEnabledAndVisible(true); } } diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java b/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java index d8d4276575bc..b85cad3d58bf 100644 --- a/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java @@ -15,6 +15,7 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.RangeMarker; import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.editor.colors.EditorColors; +import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.FileEditor; @@ -24,7 +25,9 @@ import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.popup.Balloon; +import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; @@ -76,6 +79,26 @@ public class StudyUtils { private static final Logger LOG = Logger.getInstance(StudyUtils.class.getName()); private static final String EMPTY_TASK_TEXT = "Please, open any task to see task description"; + private static final String ourPrefix = "
"; + + private static final String ourPostfix = "
"; public static void closeSilently(@Nullable final Closeable stream) { if (stream != null) { @@ -452,11 +475,12 @@ public class StudyUtils { return text; } if (taskDirectory != null) { + final String prefix = String.format(ourPrefix, EditorColorsManager.getInstance().getGlobalScheme().getEditorFontSize()); final String taskTextFileHtml = getTaskTextFromTaskName(taskDirectory, EduNames.TASK_HTML); - if (taskTextFileHtml != null) return taskTextFileHtml; + if (taskTextFileHtml != null) return prefix + taskTextFileHtml + ourPostfix; final String taskTextFileMd = getTaskTextFromTaskName(taskDirectory, EduNames.TASK_MD); - if (taskTextFileMd != null) return convertToHtml(taskTextFileMd); + if (taskTextFileMd != null) return prefix + convertToHtml(taskTextFileMd) + ourPostfix; } return null; } @@ -694,4 +718,10 @@ public class StudyUtils { } return FileDocumentManager.getInstance().getDocument(taskFile); } + + public static void showErrorPopupOnToolbar(@NotNull Project project) { + final Balloon balloon = + JBPopupFactory.getInstance().createHtmlTextBalloonBuilder("Couldn't post your reaction", MessageType.ERROR, null).createBalloon(); + showCheckPopUp(project, balloon); + } }