remove usages of redundant CCProjectService
[idea/community.git] / python / educational-core / course-creator / src / com / jetbrains / edu / coursecreator / actions / CCPushCourse.java
index 78410c9ad3a1beca5375304fac0bf23382ed35f0..f1a1f3006bf61ac7c5280734ff62533d73651bae 100644 (file)
@@ -4,10 +4,12 @@ import com.intellij.ide.IdeView;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.LangDataKeys;
+import com.intellij.openapi.actionSystem.Presentation;
 import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
+import com.jetbrains.edu.coursecreator.CCUtils;
+import com.jetbrains.edu.learning.StudyTaskManager;
 import com.jetbrains.edu.learning.courseFormat.Course;
-import com.jetbrains.edu.coursecreator.CCProjectService;
 import com.jetbrains.edu.learning.stepic.EduStepicConnector;
 import org.jetbrains.annotations.NotNull;
 
@@ -18,7 +20,9 @@ public class CCPushCourse extends DumbAwareAction {
 
   @Override
   public void update(@NotNull AnActionEvent e) {
-    CCProjectService.setCCActionAvailable(e);
+    Presentation presentation = e.getPresentation();
+    Project project = e.getProject();
+    presentation.setEnabledAndVisible(project != null && CCUtils.isCourseCreator(project));
   }
 
   @Override
@@ -28,7 +32,7 @@ public class CCPushCourse extends DumbAwareAction {
     if (view == null || project == null) {
       return;
     }
-    final Course course = CCProjectService.getInstance(project).getCourse();
+    final Course course = StudyTaskManager.getInstance(project).getCourse();
     if (course == null) {
       return;
     }