Minor Rename study settings
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / twitter / StudyTwitterAction.java
1 package com.jetbrains.edu.learning.twitter;
2
3 import com.intellij.openapi.project.Project;
4 import com.jetbrains.edu.learning.StudyTwitterPluginConfigurator;
5 import com.jetbrains.edu.learning.actions.StudyAfterCheckAction;
6 import com.jetbrains.edu.learning.courseFormat.StudyStatus;
7 import com.jetbrains.edu.learning.courseFormat.Task;
8 import org.jetbrains.annotations.NotNull;
9
10 /**
11  * Action that provide tweeting functionality to plugin.
12  * Is performed for every solved task and configured by StudyPluginConfigurator instance.
13  * 
14  * In order to provide tweeting functionality in your plugin you should override twitter 
15  * methods in StudyPluginConfigurator instance of your plugin.
16  */
17 public class StudyTwitterAction extends StudyAfterCheckAction {
18   private StudyTwitterPluginConfigurator myConfigurator;
19
20   public StudyTwitterAction(@NotNull final StudyTwitterPluginConfigurator configurator) {
21     myConfigurator = configurator;
22   }
23
24   @Override
25   public void run(@NotNull Project project, @NotNull Task solvedTask, StudyStatus statusBeforeCheck) {
26
27     if (myConfigurator.askToTweet(project, solvedTask, statusBeforeCheck)) {
28       StudyTwitterUtils.createTwitterDialogAndShow(project, myConfigurator, solvedTask);
29     }
30   }
31 }