remove usages of redundant CCProjectService
[idea/community.git] / python / educational-core / course-creator / src / com / jetbrains / edu / coursecreator / ui / CreateCourseArchiveDialog.java
1 package com.jetbrains.edu.coursecreator.ui;
2
3 import com.intellij.openapi.project.Project;
4 import com.intellij.openapi.ui.DialogWrapper;
5 import com.jetbrains.edu.learning.StudyTaskManager;
6 import com.jetbrains.edu.learning.courseFormat.Course;
7 import com.jetbrains.edu.coursecreator.actions.CCCreateCourseArchive;
8 import org.jetbrains.annotations.NotNull;
9 import org.jetbrains.annotations.Nullable;
10
11 import javax.swing.*;
12
13 public class CreateCourseArchiveDialog extends DialogWrapper {
14
15   private CreateCourseArchivePanel myPanel;
16   private CCCreateCourseArchive myAction;
17
18   public CreateCourseArchiveDialog(@NotNull final  Project project, CCCreateCourseArchive action) {
19     super(project);
20     Course course = StudyTaskManager.getInstance(project).getCourse();
21     assert course != null;
22     setTitle("Create Course Archive");
23     myPanel = new CreateCourseArchivePanel(project, this, course.getName());
24     myAction = action;
25     init();
26   }
27
28   @Nullable
29   @Override
30   protected JComponent createCenterPanel() {
31     return myPanel;
32   }
33
34   public void enableOKAction(boolean isEnabled) {
35     myOKAction.setEnabled(isEnabled);
36   }
37
38   @Override
39   protected void doOKAction() {
40     myAction.setZipName(myPanel.getZipName());
41     myAction.setLocationDir(myPanel.getLocationPath());
42     super.doOKAction();
43   }
44 }