[project] IDE launcher in Windows jump list instead of the custom one (IDEA-156078)
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / ui / StudyToolWindowFactory.java
1 package com.jetbrains.edu.learning.ui;
2
3 import com.intellij.openapi.project.DumbAware;
4 import com.intellij.openapi.project.Project;
5 import com.intellij.openapi.util.Disposer;
6 import com.intellij.openapi.wm.ToolWindow;
7 import com.intellij.openapi.wm.ToolWindowFactory;
8 import com.intellij.ui.content.Content;
9 import com.intellij.ui.content.ContentManager;
10 import com.jetbrains.edu.learning.StudyTaskManager;
11 import com.jetbrains.edu.learning.StudyUtils;
12 import com.jetbrains.edu.learning.courseFormat.Course;
13 import icons.InteractiveLearningIcons;
14 import org.jetbrains.annotations.NotNull;
15
16 public class StudyToolWindowFactory implements ToolWindowFactory, DumbAware {
17   public static final String STUDY_TOOL_WINDOW = "Task Description";
18
19
20   @Override
21   public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
22     toolWindow.setIcon(InteractiveLearningIcons.TaskDescription);
23     StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
24     final Course course = taskManager.getCourse();
25     if (course != null) {
26
27       final StudyToolWindow studyToolWindow;
28       if (StudyUtils.hasJavaFx() && StudyTaskManager.getInstance(project).shouldUseJavaFx()) {
29         studyToolWindow = new StudyJavaFxToolWindow();
30       }
31       else {
32         studyToolWindow = new StudySwingToolWindow();
33       }
34       studyToolWindow.init(project);
35       final ContentManager contentManager = toolWindow.getContentManager();
36       final Content content = contentManager.getFactory().createContent(studyToolWindow, null, false);
37       contentManager.addContent(content);
38       Disposer.register(project, studyToolWindow);
39     }
40   }
41 }