refactoring pycharm educational second iteration
authorEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Wed, 14 Jan 2015 14:18:47 +0000 (17:18 +0300)
committerEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Wed, 14 Jan 2015 14:18:49 +0000 (17:18 +0300)
 extracted interactive-learning (language independent) and interactive-learning-python modules

96 files changed:
python/edu/learn-python/gen/icons/StudyIcons.java [deleted file]
python/edu/learn-python/learn-python.iml [deleted file]
python/edu/learn-python/resources/META-INF/plugin.xml [deleted file]
python/edu/learn-python/src/com/jetbrains/python/edu/StudyResourceManger.java [deleted file]
python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRunAction.java [deleted file]
python/edu/main_pycharm_edu.iml
python/educational-python/interactive-learning-python/interactive-learning-python.iml
python/educational-python/interactive-learning-python/resources/META-INF/plugin.xml [new file with mode: 0644]
python/educational-python/interactive-learning-python/resources/com/jetbrains/python/edu/user_tester.py [moved from python/edu/learn-python/resources/com/jetbrains/python/edu/user_tester.py with 100% similarity]
python/educational-python/interactive-learning-python/resources/courses/introduction_course.zip [moved from python/edu/learn-python/resources/courses/introduction_course.zip with 100% similarity]
python/educational-python/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType.png with 100% similarity]
python/educational-python/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType@2x.png with 100% similarity]
python/educational-python/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType_dark.png with 100% similarity]
python/educational-python/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType_dark@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType_dark@2x.png with 100% similarity]
python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java [new file with mode: 0644]
python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyTestRunner.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyTestRunner.java with 62% similarity]
python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyUtils.java [new file with mode: 0644]
python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyIntroductionCourseAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyIntroductionCourseAction.java with 81% similarity]
python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyWatchTutorialAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWatchTutorialAction.java with 74% similarity]
python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/highlighting/PyStudyVisitorFilter.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/highlighting/StudyVisitorFilter.java with 76% similarity]
python/educational-python/interactive-learning-python/src/icons/InteractiveLearningPythonIcons.java [new file with mode: 0644]
python/educational-python/interactive-learning-python/testData/course.json [moved from python/edu/learn-python/testData/course.json with 100% similarity]
python/educational-python/interactive-learning-python/testData/helloworld.py [moved from python/edu/learn-python/testData/helloworld.py with 100% similarity]
python/educational-python/interactive-learning-python/tests/JsonParserTest.java [moved from python/edu/learn-python/tests/JsonParserTest.java with 63% similarity]
python/educational-python/interactive-learning-python/tests/StudyDocumentListenerTest.java [moved from python/edu/learn-python/tests/StudyDocumentListenerTest.java with 91% similarity]
python/educational-python/interactive-learning-python/tests/StudyTestCase.java [moved from python/edu/learn-python/tests/StudyTestCase.java with 100% similarity]
python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectGeneratorUtil.java
python/educational/interactive-learning/interactive-learning.iml
python/educational/interactive-learning/resources/META-INF/plugin.xml [new file with mode: 0644]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Lesson.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Lesson.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Lesson@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Lesson@2x.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/LessonComp@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/LessonComp@2x.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/LessonCompl.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/LessonCompl.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Sandbox.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Sandbox.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Sandbox@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Sandbox@2x.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Task.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Task.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Task@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Task@2x.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Task@2x_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Task@2x_dark.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskCompl.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskCompl.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskCompl@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskCompl@2x.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskCompl@2x_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskCompl@2x_dark.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskCompl_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskCompl_dark.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskProbl.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskProbl.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskProbl@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskProbl@2x.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskProbl@2x_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskProbl@2x_dark.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/TaskProbl_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/TaskProbl_dark.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/Task_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/Task_dark.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/WatchInput.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/WatchInput.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/prev.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/prev.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/resolve.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/resolve.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/resolve_dark.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/resolve_dark.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/showHint.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/showHint.png with 100% similarity]
python/educational/interactive-learning/resources/icons/com/jetbrains/edu/learning/showHint@2x.png [moved from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/showHint@2x.png with 100% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyDocumentListener.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyDocumentListener.java with 94% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyEditorFactoryListener.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyEditorFactoryListener.java with 94% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyInitialConfigurator.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyInitialConfigurator.java with 98% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyInstructionPainter.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyInstructionPainter.java with 95% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyNames.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyNames.java with 85% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyProjectGenerator.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyDirectoryProjectGenerator.java with 87% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyState.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyState.java with 88% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyTaskManager.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java with 95% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyTestRunner.java [new file with mode: 0644]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyUtils.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/StudyUtils.java with 76% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyUtilsExtensionPoint.java [new file with mode: 0644]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/TaskWindowDeleteHandler.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/TaskWindowDeleteHandler.java with 95% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyCheckAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyCheckAction.java with 96% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyEditInputAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyEditInputAction.java with 94% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyNextStudyTaskAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextStudyTaskAction.java with 81% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyNextWindowAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java with 87% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyPrevWindowAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyPrevWindowAction.java with 75% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyPreviousStudyTaskAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyPreviousStudyTaskAction.java with 81% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRefreshTaskFileAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskFileAction.java with 95% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRunAction.java [new file with mode: 0644]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyShowHintAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyShowHintAction.java with 89% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyTaskNavigationAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyTaskNavigationAction.java with 92% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyWindowNavigationAction.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWindowNavigationAction.java with 87% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Course.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/Course.java with 98% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/CourseInfo.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/CourseInfo.java with 96% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Lesson.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/Lesson.java with 97% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/LessonInfo.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/LessonInfo.java with 96% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Stateful.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/Stateful.java with 73% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/StudyStatus.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/StudyStatus.java with 70% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Task.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/Task.java with 98% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/TaskFile.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskFile.java with 97% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/TaskWindow.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskWindow.java with 97% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/UserTest.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/course/UserTest.java with 94% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/editor/StudyEditor.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java with 95% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/editor/StudyFileEditorProvider.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyFileEditorProvider.java with 93% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/projectView/StudyDirectoryNode.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/projectView/StudyDirectoryNode.java with 89% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/projectView/StudyTreeStructureProvider.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/projectView/StudyTreeStructureProvider.java with 91% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyCondition.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyCondition.java with 86% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyNewProjectPanel.form [moved from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyNewProjectPanel.form with 98% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyNewProjectPanel.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyNewProjectPanel.java with 93% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyProgressBar.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyProgressBar.java with 98% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyTestContentPanel.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyTestContentPanel.java with 96% similarity]
python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyToolWindowFactory.java [moved from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyToolWindowFactory.java with 91% similarity]

diff --git a/python/edu/learn-python/gen/icons/StudyIcons.java b/python/edu/learn-python/gen/icons/StudyIcons.java
deleted file mode 100644 (file)
index f1db45d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package icons;
-
-import com.intellij.openapi.util.IconLoader;
-
-import javax.swing.*;
-
-/**
- * NOTE THIS FILE IS AUTO-GENERATED
- * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
- */
-public class StudyIcons {
-  private static Icon load(String path) {
-    return IconLoader.getIcon(path, StudyIcons.class);
-  }
-
-  public static final Icon EducationalProjectType = load("/icons/com/jetbrains/python/edu/EducationalProjectType.png"); // 16x16
-  public static final Icon Lesson = load("/icons/com/jetbrains/python/edu/Lesson.png"); // 16x16
-  public static final Icon LessonCompl = load("/icons/com/jetbrains/python/edu/LessonCompl.png"); // 16x16
-  public static final Icon Prev = load("/icons/com/jetbrains/python/edu/prev.png"); // 16x16
-  public static final Icon Resolve = load("/icons/com/jetbrains/python/edu/resolve.png"); // 16x16
-  public static final Icon Sandbox = load("/icons/com/jetbrains/python/edu/Sandbox.png"); // 16x16
-  public static final Icon ShowHint = load("/icons/com/jetbrains/python/edu/showHint.png"); // 16x16
-  public static final Icon Task = load("/icons/com/jetbrains/python/edu/Task.png"); // 16x16
-  public static final Icon TaskCompl = load("/icons/com/jetbrains/python/edu/TaskCompl.png"); // 16x16
-  public static final Icon TaskProbl = load("/icons/com/jetbrains/python/edu/TaskProbl.png"); // 16x16
-  public static final Icon WatchInput = load("/icons/com/jetbrains/python/edu/WatchInput.png"); // 24x24
-}
diff --git a/python/edu/learn-python/learn-python.iml b/python/edu/learn-python/learn-python.iml
deleted file mode 100644 (file)
index f2b46e9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module" module-name="platform-impl" />
-    <orderEntry type="module" module-name="python-community" />
-    <orderEntry type="module" module-name="lang-impl" />
-    <orderEntry type="library" name="gson" level="project" />
-    <orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
-    <orderEntry type="module" module-name="python-ide-community" />
-    <orderEntry type="module" module-name="testFramework" scope="TEST" />
-  </component>
-</module>
diff --git a/python/edu/learn-python/resources/META-INF/plugin.xml b/python/edu/learn-python/resources/META-INF/plugin.xml
deleted file mode 100644 (file)
index a8e99c9..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<!--suppress XmlUnboundNsPrefix -->
-<idea-plugin version="2">
-  <id>com.jetbrains.python.edu.learn-python</id>
-  <name>Educational plugin for PyCharm</name>
-  <version>1.2</version>
-
-  <description><![CDATA[
-      Educational plugin for students. This plugin allows to learn Python
-       using intelligent PyCharm IDE.
-      ]]></description>
-
-  <change-notes><![CDATA[
-
-      ]]>
-  </change-notes>
-
-  <!--depends>com.intellij.modules.python</depends-->
-
-  <!-- please see http://confluence.jetbrains.net/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
-       on how to target different products -->
-
-  <depends>com.intellij.modules.lang</depends>
-  <depends>com.intellij.modules.python</depends>
-
-  <project-components>
-    <component>
-      <implementation-class>com.jetbrains.python.edu.StudyTaskManager</implementation-class>
-      <interface-class>com.jetbrains.python.edu.StudyTaskManager</interface-class>
-    </component>
-  </project-components>
-
-  <application-components>
-    <component>
-      <implementation-class>com.jetbrains.python.edu.StudyInitialConfigurator</implementation-class>
-      <headless-implementation-class/>
-    </component>
-  </application-components>
-
-  <actions>
-    <action id="CheckAction" class="com.jetbrains.python.edu.actions.StudyCheckAction"  text="Check Task"
-            description="Check current task">
-    </action>
-    <action id="PrevWindowAction" class="com.jetbrains.python.edu.actions.StudyPrevWindowAction" text="Previous Answer Placeholder"
-            description="Navigate to the previous answer placeholder">
-    </action>
-    <action id="NextWindow" class="com.jetbrains.python.edu.actions.StudyNextWindowAction" text="Next Answer Placeholder"
-            description="Navigate to the next answer holder">
-    </action>
-    <action id="PreviousTaskAction" class="com.jetbrains.python.edu.actions.StudyPreviousStudyTaskAction" text="Previous Task"
-            description="Navigate to previous task"/>
-    <action id="NextTaskAction" class="com.jetbrains.python.edu.actions.StudyNextStudyTaskAction" text="Next Task"
-            description="Navigate to next task"/>
-    <action id="RefreshTaskAction" class="com.jetbrains.python.edu.actions.StudyRefreshTaskFileAction" text="Reset Task File"
-            description="Refresh current task"/>
-    <action id="WatchInputAction" class="com.jetbrains.python.edu.actions.StudyEditInputAction" text="Watch Test Input"
-            description="Watch test input "/>
-    <action id="ShowHintAction" class="com.jetbrains.python.edu.actions.StudyShowHintAction" text="Show Hint for Answer Placeholder"
-            description="Show hint for answer placeholder"/>
-    <action id="StudyRunAction" class="com.jetbrains.python.edu.actions.StudyRunAction" text="Run File With Tests"
-            description="Run your code with tests"/>
-    <action id="WelcomeScreen.PythonIntro" class="com.jetbrains.python.edu.actions.StudyIntroductionCourseAction" icon="StudyIcons.EducationalProjectType">
-      <add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
-    </action>
-    <action id="StudyWatchTutorial" class="com.jetbrains.python.edu.actions.StudyWatchTutorialAction">
-      <add-to-group group-id="HelpMenu" anchor="first"/>
-    </action>
-
-  </actions>
-
-  <extensions defaultExtensionNs="com.intellij">
-    <toolWindow id="Course Description" anchor="right" factoryClass="com.jetbrains.python.edu.ui.StudyToolWindowFactory" conditionClass="com.jetbrains.python.edu.ui.StudyCondition"/>
-    <fileEditorProvider implementation="com.jetbrains.python.edu.editor.StudyFileEditorProvider"/>
-    <directoryProjectGenerator implementation="com.jetbrains.python.edu.StudyDirectoryProjectGenerator"/>
-    <treeStructureProvider implementation="com.jetbrains.python.edu.projectView.StudyTreeStructureProvider"/>
-    <applicationService serviceInterface="com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter"
-        serviceImplementation="com.jetbrains.python.edu.StudyInstructionPainter" overrides="true"/>
-    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
-  </extensions>
-  <extensions defaultExtensionNs="Pythonid">
-    <visitorFilter language="Python" implementationClass="com.jetbrains.python.edu.highlighting.StudyVisitorFilter"/>
-  </extensions>
-</idea-plugin>
\ No newline at end of file
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyResourceManger.java b/python/edu/learn-python/src/com/jetbrains/python/edu/StudyResourceManger.java
deleted file mode 100644 (file)
index 38f1c2f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.jetbrains.python.edu;
-
-public interface StudyResourceManger {
-  String USER_TESTER = "user_tester.py";
-}
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRunAction.java b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRunAction.java
deleted file mode 100644 (file)
index c1398a9..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.jetbrains.python.edu.actions;
-
-import com.intellij.execution.ExecutionException;
-import com.intellij.execution.RunContentExecutor;
-import com.intellij.execution.configurations.GeneralCommandLine;
-import com.intellij.execution.process.OSProcessHandler;
-import com.intellij.execution.process.ProcessHandler;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.project.DumbAwareAction;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.jetbrains.python.edu.StudyResourceManger;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.editor.StudyEditor;
-import com.jetbrains.python.run.PythonTracebackFilter;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-public class StudyRunAction extends DumbAwareAction {
-  private static final Logger LOG = Logger.getInstance(StudyRunAction.class.getName());
-  public static final String ACTION_ID = "StudyRunAction";
-  private ProcessHandler myHandler;
-
-  public void run(@NotNull final Project project, @NotNull final Sdk sdk) {
-    if (myHandler != null && !myHandler.isProcessTerminated()) return;
-    Editor selectedEditor = StudyEditor.getSelectedEditor(project);
-    FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
-    assert selectedEditor != null;
-    VirtualFile openedFile = fileDocumentManager.getFile(selectedEditor.getDocument());
-    StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
-    if (openedFile != null && openedFile.getCanonicalPath() != null) {
-      String filePath = openedFile.getCanonicalPath();
-      GeneralCommandLine cmd = new GeneralCommandLine();
-      cmd.withWorkDirectory(openedFile.getParent().getCanonicalPath());
-        String pythonPath = sdk.getHomePath();
-        if (pythonPath != null) {
-          cmd.setExePath(pythonPath);
-          TaskFile selectedTaskFile = taskManager.getTaskFile(openedFile);
-          assert selectedTaskFile != null;
-          Task currentTask = selectedTaskFile.getTask();
-          if (!currentTask.getUserTests().isEmpty()) {
-            cmd.addParameter(new File(project.getBaseDir().getPath(), StudyResourceManger.USER_TESTER).getPath());
-            cmd.addParameter(pythonPath);
-            cmd.addParameter(filePath);
-            Process process;
-            try {
-              process = cmd.createProcess();
-            }
-            catch (ExecutionException e) {
-              LOG.error(e);
-              return;
-            }
-            myHandler = new OSProcessHandler(process);
-            RunContentExecutor executor = new RunContentExecutor(project, myHandler).withFilter(new PythonTracebackFilter(project));
-            Disposer.register(project, executor);
-            executor.run();
-            return;
-          }
-          try {
-            cmd.addParameter(filePath);
-            Process p = cmd.createProcess();
-            myHandler = new OSProcessHandler(p);
-
-            RunContentExecutor executor = new RunContentExecutor(project, myHandler).withFilter(new PythonTracebackFilter(project));
-            Disposer.register(project, executor);
-            executor.run();
-          }
-
-          catch (ExecutionException e) {
-            LOG.error(e);
-          }
-        }
-    }
-  }
-
-  public void actionPerformed(@NotNull AnActionEvent e) {
-    Project project = e.getProject();
-    if (project == null) {
-      return;
-    }
-    Sdk sdk = StudyUtils.findPythonSdk(project);
-    if (sdk == null) {
-      return;
-    }
-    run(project, sdk);
-  }
-}
index c29ec159fc0954239a1f3ca5acb87cb8ad315be4..7dbfb712fc9c95ff1b0d4d74f45ecd944e2df035 100644 (file)
     <orderEntry type="module" module-name="platform-main" />
     <orderEntry type="module" module-name="ShortcutPromoter" />
     <orderEntry type="module" module-name="python-educational" />
-    <orderEntry type="module" module-name="learn-python" />
     <orderEntry type="module" module-name="course-creator" />
     <orderEntry type="module" module-name="course-creator-python" />
+    <orderEntry type="module" module-name="interactive-learning" />
+    <orderEntry type="module" module-name="interactive-learning-python" />
     <orderEntry type="module" module-name="hg4idea" />
   </component>
 </module>
\ No newline at end of file
index c90834f2d607afe55e6104d8aa2cdfffb713f688..96fc1b873f540868a56066a800a538b27ca1c8f8 100644 (file)
@@ -4,8 +4,26 @@
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="interactive-learning" />
+    <orderEntry type="module" module-name="lang-impl" />
+    <orderEntry type="module" module-name="python-community" />
+    <orderEntry type="module" module-name="platform-impl" />
+    <orderEntry type="module" module-name="python-ide-community" />
+    <orderEntry type="library" name="gson" level="project" />
+    <orderEntry type="module-library" scope="TEST">
+      <library>
+        <CLASSES>
+          <root url="jar://$APPLICATION_HOME_DIR$/lib/junit.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module" module-name="testFramework" scope="TEST" />
   </component>
 </module>
\ No newline at end of file
diff --git a/python/educational-python/interactive-learning-python/resources/META-INF/plugin.xml b/python/educational-python/interactive-learning-python/resources/META-INF/plugin.xml
new file mode 100644 (file)
index 0000000..be0490b
--- /dev/null
@@ -0,0 +1,43 @@
+<!--suppress XmlUnboundNsPrefix -->
+<idea-plugin version="2">
+  <id>com.jetbrains.python.edu.interactivelearning.python</id>
+  <name>Educational plugin for PyCharm</name>
+  <version>2.0</version>
+
+  <description><![CDATA[
+      Educational plugin for students. This plugin allows to learn Python
+       using intelligent PyCharm IDE.
+      ]]></description>
+
+  <change-notes><![CDATA[
+
+      ]]>
+  </change-notes>
+
+  <!--depends>com.intellij.modules.python</depends-->
+
+  <!-- please see http://confluence.jetbrains.net/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
+       on how to target different products -->
+
+  <depends>com.intellij.modules.lang</depends>
+  <depends>com.intellij.modules.python</depends>
+  <depends>com.jetbrains.edu.interactivelearning</depends>
+
+  <extensions defaultExtensionNs="com.intellij">
+  <directoryProjectGenerator implementation="com.jetbrains.edu.learning.PyStudyDirectoryProjectGenerator"/>
+  </extensions>
+  <extensions defaultExtensionNs="Pythonid">
+    <visitorFilter language="Python" implementationClass="com.jetbrains.edu.learning.highlighting.PyStudyVisitorFilter"/>
+  </extensions>
+  <extensions defaultExtensionNs="Edu">
+    <StudyUtils implementation="com.jetbrains.edu.learning.PyStudyUtils"/>
+  </extensions>
+  <actions>
+    <action id="WelcomeScreen.PythonIntro" class="com.jetbrains.edu.learning.actions.PyStudyIntroductionCourseAction" icon="InteractiveLearningPythonIcons.EducationalProjectType">
+      <add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
+    </action>
+    <action id="StudyWatchTutorial" class="com.jetbrains.edu.learning.actions.PyStudyWatchTutorialAction">
+      <add-to-group group-id="HelpMenu" anchor="first"/>
+    </action>
+  </actions>
+</idea-plugin>
\ No newline at end of file
diff --git a/python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java b/python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java
new file mode 100644 (file)
index 0000000..293282b
--- /dev/null
@@ -0,0 +1,95 @@
+package com.jetbrains.edu.learning;
+
+import com.intellij.facet.ui.FacetEditorValidator;
+import com.intellij.facet.ui.FacetValidatorsManager;
+import com.intellij.facet.ui.ValidationResult;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.progress.ProcessCanceledException;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.platform.DirectoryProjectGenerator;
+import com.jetbrains.edu.learning.course.CourseInfo;
+import com.jetbrains.edu.learning.ui.StudyNewProjectPanel;
+import com.jetbrains.python.newProject.PythonProjectGenerator;
+import icons.InteractiveLearningPythonIcons;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.io.File;
+import java.util.Map;
+
+
+public class PyStudyDirectoryProjectGenerator extends PythonProjectGenerator implements DirectoryProjectGenerator {
+  private final StudyProjectGenerator myGenerator;
+  public ValidationResult myValidationResult = new ValidationResult("selected course is not valid");
+
+  public PyStudyDirectoryProjectGenerator() {
+    myGenerator = new StudyProjectGenerator();
+    myGenerator.addSettingsStateListener(new StudyProjectGenerator.SettingsListener() {
+      @Override
+      public void stateChanged(ValidationResult result) {
+        setValidationResult(result);
+      }
+    });
+  }
+
+  @Nls
+  @NotNull
+  @Override
+  public String getName() {
+    return "Educational";
+  }
+
+  @Nullable
+  @Override
+  public Object showGenerationSettings(VirtualFile baseDir) throws ProcessCanceledException {
+    return null;
+  }
+
+  @Nullable
+  @Override
+  public Icon getLogo() {
+    return InteractiveLearningPythonIcons.EducationalProjectType;
+  }
+
+
+  @Override
+  public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
+                              @Nullable Object settings, @NotNull Module module) {
+    myGenerator.generateProject(project, baseDir);
+  }
+  @NotNull
+  @Override
+  public ValidationResult validate(@NotNull String s) {
+    return myValidationResult;
+  }
+
+  public void setValidationResult(ValidationResult validationResult) {
+    myValidationResult = validationResult;
+  }
+
+  @Nullable
+  @Override
+  public JPanel extendBasePanel() throws ProcessCanceledException {
+    StudyNewProjectPanel settingsPanel = new StudyNewProjectPanel(myGenerator);
+    settingsPanel.registerValidators(new FacetValidatorsManager() {
+      public void registerValidator(FacetEditorValidator validator, JComponent... componentsToWatch) {
+        throw new UnsupportedOperationException();
+      }
+      public void validate() {
+        fireStateChanged();
+      }
+    });
+    return settingsPanel.getContentPanel();
+  }
+
+  public Map<CourseInfo, File> getCourses() {
+    return myGenerator.getCourses();
+  }
+
+  public void setSelectedCourse(CourseInfo course) {
+    myGenerator.setSelectedCourse(course);
+  }
+}
similarity index 62%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyTestRunner.java
rename to python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyTestRunner.java
index 78eadcbfe8b2870ae7045a5f2a93860ad9474f90..bc0e563d80c969cea42759e88c5e0d6b64f909ad 100644 (file)
@@ -1,36 +1,26 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.configurations.GeneralCommandLine;
-import com.intellij.execution.process.ProcessOutput;
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.jetbrains.python.edu.course.Course;
-import com.jetbrains.python.edu.course.Task;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.edu.learning.course.Task;
 import com.jetbrains.python.sdk.PythonSdkType;
 import org.jetbrains.annotations.NotNull;
 
-import java.io.*;
+import java.io.File;
 import java.util.Map;
 
-public class StudyTestRunner {
-  public static final String STUDY_PREFIX="#educational_plugin";
-  public static final String TEST_OK = "test OK";
-  private static final String TEST_FAILED = "FAILED + ";
+public class PyStudyTestRunner extends StudyTestRunner {
   private static final String PYTHONPATH = "PYTHONPATH";
-  private static final Logger LOG = Logger.getInstance(StudyTestRunner.class);
-  private final Task myTask;
-  private final VirtualFile myTaskDir;
 
-  public StudyTestRunner(Task task, VirtualFile taskDir) {
-    myTask = task;
-    myTaskDir = taskDir;
+  PyStudyTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskfile) {
+    super(task, taskfile);
   }
-
   public Process createCheckProcess(Project project, String executablePath) throws ExecutionException {
     Sdk sdk = PythonSdkType.findPythonSdk(ModuleManager.getInstance(project).getModules()[0]);
     File testRunner = new File(myTaskDir.getPath(), myTask.getTestFile());
@@ -61,20 +51,4 @@ public class StudyTestRunner {
     }
     return null;
   }
-
-
-  @NotNull
-  public String getTestsOutput(@NotNull final ProcessOutput processOutput) {
-    for (String line : processOutput.getStdoutLines()) {
-      if (line.contains(STUDY_PREFIX)) {
-        if (line.contains(TEST_OK)) {
-          continue;
-        }
-        int messageStart = line.indexOf(TEST_FAILED);
-        return line.substring(messageStart + TEST_FAILED.length());
-      }
-    }
-
-    return TEST_OK;
-  }
 }
diff --git a/python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyUtils.java b/python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyUtils.java
new file mode 100644 (file)
index 0000000..524510e
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jetbrains.edu.learning;
+
+import com.intellij.execution.RunContentExecutor;
+import com.intellij.execution.configurations.GeneralCommandLine;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.python.run.PythonTracebackFilter;
+import com.jetbrains.python.sdk.PythonSdkType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+
+public class PyStudyUtils implements StudyUtilsExtensionPoint {
+
+  @Override
+  public Sdk findSdk(@NotNull final Project project) {
+    return PythonSdkType.findPythonSdk(ModuleManager.getInstance(project).getModules()[0]);
+  }
+
+  @Nullable
+  @Override
+  public String getLinkToTutorial() {
+    return "<html>If you'd like to learn" +
+           " more about PyCharm " +
+           "Educational Edition, " +
+           "click <a href=\"https://www.jetbrains.com/pycharm-educational/quickstart/\">here</a> to watch a tutorial</html>";
+  }
+
+  @Override
+  public StudyTestRunner getTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
+    return new PyStudyTestRunner(task, taskDir);
+  }
+
+  @Override
+  public RunContentExecutor getExecutor(@NotNull final Project project, @NotNull final ProcessHandler handler) {
+    return new RunContentExecutor(project, handler).withFilter(new PythonTracebackFilter(project));
+  }
+
+  @Override
+  public void setCommandLineParameters(@NotNull final GeneralCommandLine cmd,
+                                               @NotNull final Project project,
+                                               @NotNull final String filePath,
+                                               @NotNull final String pythonPath,
+                                               @NotNull final Task currentTask) {
+    if (!currentTask.getUserTests().isEmpty()) {
+      cmd.addParameter(new File(project.getBaseDir().getPath(), StudyNames.USER_TESTER).getPath());
+      cmd.addParameter(pythonPath);
+      cmd.addParameter(filePath);
+    }
+    else {
+      cmd.addParameter(filePath);
+    }
+  }
+
+
+}
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.ide.impl.ProjectUtil;
 import com.intellij.openapi.actionSystem.AnAction;
@@ -21,23 +21,23 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
 import com.intellij.openapi.projectRoots.Sdk;
+import com.jetbrains.edu.learning.PyStudyDirectoryProjectGenerator;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.CourseInfo;
 import com.jetbrains.python.configuration.PyConfigurableInterpreterList;
-import com.jetbrains.python.edu.StudyDirectoryProjectGenerator;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.CourseInfo;
 import com.jetbrains.python.newProject.actions.GenerateProjectCallback;
 import com.jetbrains.python.newProject.actions.ProjectSpecificSettingsStep;
-import icons.StudyIcons;
+import icons.InteractiveLearningPythonIcons;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.File;
 import java.util.List;
 import java.util.Map;
 
-public class StudyIntroductionCourseAction extends AnAction {
+public class PyStudyIntroductionCourseAction extends AnAction {
 
-  public StudyIntroductionCourseAction() {
-    super("Introduction to Python", "Introduction to Python", StudyIcons.EducationalProjectType);
+  public PyStudyIntroductionCourseAction() {
+    super("Introduction to Python", "Introduction to Python", InteractiveLearningPythonIcons.EducationalProjectType);
   }
 
   @Override
@@ -48,7 +48,7 @@ public class StudyIntroductionCourseAction extends AnAction {
     }
     else {
       final GenerateProjectCallback callback = new GenerateProjectCallback();
-      final StudyDirectoryProjectGenerator generator = new StudyDirectoryProjectGenerator();
+      final PyStudyDirectoryProjectGenerator generator = new PyStudyDirectoryProjectGenerator();
       final Map<CourseInfo, File> courses = generator.getCourses();
       CourseInfo introCourse = null;
       for (CourseInfo info : courses.keySet()) {
similarity index 74%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWatchTutorialAction.java
rename to python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyWatchTutorialAction.java
index cae18e2457adea3c9b79a365982dc4646cf44577..e9e1b2b378bb6658acf5ee6a8e038664fe17a110 100644 (file)
@@ -1,12 +1,12 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.ide.BrowserUtil;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.project.DumbAwareAction;
 import org.jetbrains.annotations.NotNull;
 
-public class StudyWatchTutorialAction extends DumbAwareAction {
-  public StudyWatchTutorialAction() {
+public class PyStudyWatchTutorialAction extends DumbAwareAction {
+  public PyStudyWatchTutorialAction() {
     super("Learn more about PyCharm Educational Edition", null, null);
   }
 
similarity index 76%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/highlighting/StudyVisitorFilter.java
rename to python/educational-python/interactive-learning-python/src/com/jetbrains/edu/learning/highlighting/PyStudyVisitorFilter.java
index dc7495adb16e7b4a007c57586cac60254ab2cafd..4b849da0bf7a0b34ff4e5c6b86d1c6308842837a 100644 (file)
@@ -1,12 +1,12 @@
-package com.jetbrains.python.edu.highlighting;
+package com.jetbrains.edu.learning.highlighting;
 
 import com.intellij.psi.PsiFile;
-import com.jetbrains.python.edu.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyTaskManager;
 import com.jetbrains.python.inspections.PythonVisitorFilter;
 import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import org.jetbrains.annotations.NotNull;
 
-public class StudyVisitorFilter implements PythonVisitorFilter {
+public class PyStudyVisitorFilter implements PythonVisitorFilter {
   @Override
   public boolean isSupported(@NotNull final Class visitorClass, @NotNull final PsiFile file) {
     if (StudyTaskManager.getInstance(file.getProject()).getCourse() == null) return true;
diff --git a/python/educational-python/interactive-learning-python/src/icons/InteractiveLearningPythonIcons.java b/python/educational-python/interactive-learning-python/src/icons/InteractiveLearningPythonIcons.java
new file mode 100644 (file)
index 0000000..08b0bdd
--- /dev/null
@@ -0,0 +1,17 @@
+package icons;
+
+import com.intellij.openapi.util.IconLoader;
+
+import javax.swing.*;
+
+/**
+ * NOTE THIS FILE IS AUTO-GENERATED
+ * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
+ */
+public class InteractiveLearningPythonIcons {
+  private static Icon load(String path) {
+    return IconLoader.getIcon(path, InteractiveLearningPythonIcons.class);
+  }
+
+  public static final Icon EducationalProjectType = load("/icons/com/jetbrains/edu/learning/EducationalProjectType.png"); // 16x16
+}
similarity index 63%
rename from python/edu/learn-python/tests/JsonParserTest.java
rename to python/educational-python/interactive-learning-python/tests/JsonParserTest.java
index df8ee03a6c397483432048a8a4980c40be34c24e..b9fd9654a90e7cd61575645d9ae23757b26c411c 100644 (file)
@@ -1,32 +1,30 @@
 import com.google.gson.FieldNamingPolicy;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
-import org.junit.Before;
-import org.junit.Test;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.Course;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.python.PythonHelpersLocator;
+import junit.framework.TestCase;
 
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.InputStreamReader;
 import java.io.Reader;
 
-import static org.junit.Assert.assertEquals;
 
 /**
  * author: liana
  * data: 7/4/14.
  */
-public class JsonParserTest {
+public class JsonParserTest extends TestCase {
   private Course myCourse = null;
-  @Before
-  public void setUp() throws FileNotFoundException {
-    Reader reader = new InputStreamReader(new FileInputStream("testData/course.json"));
+
+  public void setUp() throws Exception {
+    super.setUp();
+    Reader reader = new InputStreamReader(new FileInputStream(getTestDataPath() + "/course.json"));
     Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
     myCourse = gson.fromJson(reader, Course.class);
   }
 
-  @Test
   public void testCourseLevel() {
     assertEquals(myCourse.getName(), "Python для начинающих");
     assertEquals(StudyUtils.getFirst(myCourse.getLessons().get(1).getTaskList().get(0).getUserTests()).getInput(), "sum-input.txt");
@@ -34,4 +32,7 @@ public class JsonParserTest {
     assertEquals(myCourse.getLessons().get(0).getTaskList().size(), 2);
     assertEquals(myCourse.getLessons().get(1).getTaskList().size(), 1);
   }
+  protected String getTestDataPath() {
+    return PythonHelpersLocator.getPythonCommunityPath() + "/edu/learn-python/testData";
+  }
 }
similarity index 91%
rename from python/edu/learn-python/tests/StudyDocumentListenerTest.java
rename to python/educational-python/interactive-learning-python/tests/StudyDocumentListenerTest.java
index 9a89d12d670a471b2044d3d667bed8047dc10e58..1004bd643dd955a59293700bfbfc30b9f32bdcab 100644 (file)
@@ -3,9 +3,9 @@ import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.psi.PsiFile;
-import com.jetbrains.python.edu.StudyDocumentListener;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.course.TaskWindow;
+import com.jetbrains.edu.learning.StudyDocumentListener;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.course.TaskWindow;
 
 import java.util.ArrayList;
 import java.util.List;
index 7ccd9a8d7f6a564adf4496682d045d4bf6516e4e..2d7d03f1dc9e0ea6b4509c5e573aaa36c8d92245 100644 (file)
@@ -16,6 +16,9 @@ import org.jetbrains.annotations.NotNull;
 
 
 public class CCProjectGeneratorUtil {
+  private CCProjectGeneratorUtil() {
+  }
+
   public static void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
                               @NotNull final String name, @NotNull final String author,
                               @NotNull final String description) {
index c90834f2d607afe55e6104d8aa2cdfffb713f688..7413f5da4ba1943b16f4c1cda83722d2b09a2afa 100644 (file)
@@ -4,8 +4,11 @@
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="lang-impl" />
+    <orderEntry type="library" name="gson" level="project" />
   </component>
 </module>
\ No newline at end of file
diff --git a/python/educational/interactive-learning/resources/META-INF/plugin.xml b/python/educational/interactive-learning/resources/META-INF/plugin.xml
new file mode 100644 (file)
index 0000000..8374db0
--- /dev/null
@@ -0,0 +1,74 @@
+<!--suppress XmlUnboundNsPrefix -->
+<idea-plugin version="2">
+  <id>com.jetbrains.edu.interactivelearning</id>
+  <name>Educational plugin core</name>
+  <version>2.0</version>
+
+  <description><![CDATA[
+      Educational plugin core for students. 
+      ]]></description>
+
+  <change-notes><![CDATA[
+
+      ]]>
+  </change-notes>
+
+  <!--depends>com.intellij.modules.python</depends-->
+
+  <!-- please see http://confluence.jetbrains.net/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
+       on how to target different products -->
+
+  <depends>com.intellij.modules.lang</depends>
+
+  <project-components>
+    <component>
+      <implementation-class>com.jetbrains.edu.learning.StudyTaskManager</implementation-class>
+      <interface-class>com.jetbrains.edu.learning.StudyTaskManager</interface-class>
+    </component>
+  </project-components>
+
+  <application-components>
+    <component>
+      <implementation-class>com.jetbrains.edu.learning.StudyInitialConfigurator</implementation-class>
+      <headless-implementation-class/>
+    </component>
+  </application-components>
+
+  <extensionPoints>
+    <extensionPoint qualifiedName="Edu.StudyUtils" interface="com.jetbrains.edu.learning.StudyUtilsExtensionPoint"/>
+  </extensionPoints>
+
+  <actions>
+    <action id="CheckAction" class="com.jetbrains.edu.learning.actions.StudyCheckAction"  text="Check Task"
+            description="Check current task">
+    </action>
+    <action id="PrevWindowAction" class="com.jetbrains.edu.learning.actions.StudyPrevWindowAction" text="Previous Answer Placeholder"
+            description="Navigate to the previous answer placeholder">
+    </action>
+    <action id="NextWindow" class="com.jetbrains.edu.learning.actions.StudyNextWindowAction" text="Next Answer Placeholder"
+            description="Navigate to the next answer holder">
+    </action>
+    <action id="PreviousTaskAction" class="com.jetbrains.edu.learning.actions.StudyPreviousStudyTaskAction" text="Previous Task"
+            description="Navigate to previous task"/>
+    <action id="NextTaskAction" class="com.jetbrains.edu.learning.actions.StudyNextStudyTaskAction" text="Next Task"
+            description="Navigate to next task"/>
+    <action id="RefreshTaskAction" class="com.jetbrains.edu.learning.actions.StudyRefreshTaskFileAction" text="Reset Task File"
+            description="Refresh current task"/>
+    <action id="WatchInputAction" class="com.jetbrains.edu.learning.actions.StudyEditInputAction" text="Watch Test Input"
+            description="Watch test input "/>
+    <action id="ShowHintAction" class="com.jetbrains.edu.learning.actions.StudyShowHintAction" text="Show Hint for Answer Placeholder"
+            description="Show hint for answer placeholder"/>
+    <action id="StudyRunAction" class="com.jetbrains.edu.learning.actions.StudyRunAction" text="Run File With Tests"
+            description="Run your code with tests"/>
+
+  </actions>
+
+  <extensions defaultExtensionNs="com.intellij">
+    <toolWindow id="Course Description" anchor="right" factoryClass="com.jetbrains.edu.learning.ui.StudyToolWindowFactory" conditionClass="com.jetbrains.edu.learning.ui.StudyCondition"/>
+    <fileEditorProvider implementation="com.jetbrains.edu.learning.editor.StudyFileEditorProvider"/>
+    <treeStructureProvider implementation="com.jetbrains.edu.learning.projectView.StudyTreeStructureProvider"/>
+    <applicationService serviceInterface="com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter"
+        serviceImplementation="com.jetbrains.edu.learning.StudyInstructionPainter" overrides="true"/>
+    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
+  </extensions>
+</idea-plugin>
\ No newline at end of file
similarity index 94%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyDocumentListener.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyDocumentListener.java
index 848becfae1b1dbacaee7158588bbfe642fb83dde..9714472a5649d1b329b6386dc5b044dba2b71f3f 100644 (file)
@@ -1,12 +1,12 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.event.DocumentAdapter;
 import com.intellij.openapi.editor.event.DocumentEvent;
 import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.course.TaskWindow;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.course.TaskWindow;
 
 import java.util.ArrayList;
 import java.util.List;
similarity index 94%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyEditorFactoryListener.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyEditorFactoryListener.java
index 8d580923f6e41ee2ac5373ddb70e77383d0ef5e9..78da60815e4abb781d63ce7496438f3739e1f4f5 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 
 import com.intellij.openapi.application.ApplicationManager;
@@ -12,9 +12,9 @@ import com.intellij.openapi.editor.event.EditorMouseEvent;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.course.TaskWindow;
-import com.jetbrains.python.edu.editor.StudyEditor;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.course.TaskWindow;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.NotNull;
 
 import java.awt.*;
similarity index 95%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyInstructionPainter.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyInstructionPainter.java
index 95ecfb49651fb25e9966cba45c7a2c86f1f4278a..38266615e0cbf5131f1727e3033e1a5f6c71bb09 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 import com.intellij.openapi.actionSystem.ActionManager;
 import com.intellij.openapi.actionSystem.AnAction;
@@ -12,7 +12,7 @@ import com.intellij.ui.JBColor;
 import com.intellij.util.PairFunction;
 import com.intellij.util.ui.GraphicsUtil;
 import com.intellij.util.ui.UIUtil;
-import com.jetbrains.python.edu.actions.*;
+import com.jetbrains.edu.learning.actions.*;
 
 import javax.swing.*;
 import java.awt.*;
@@ -32,7 +32,7 @@ public class StudyInstructionPainter extends EditorEmptyTextPainter {
 
     UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.5f);
 
-    painter.appendLine("PyCharm Educational Edition").underlined(new JBColor(Gray._150, Gray._180));
+    painter.appendLine("Educational Edition").underlined(new JBColor(Gray._150, Gray._180));
     addAction(painter, "Navigate to the next answer placeholder", StudyNextWindowAction.ACTION_ID, StudyNextWindowAction.SHORTCUT2, true);
     String shortcut1 = getShortcutText(StudyPrevWindowAction.ACTION_ID, StudyPrevWindowAction.SHORTCUT, false, false);
     String shortcut2 = getShortcutText(StudyNextWindowAction.ACTION_ID, StudyNextWindowAction.SHORTCUT, false, false);
similarity index 85%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyNames.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyNames.java
index 348ce36e6d9c95ba9124257100e620c74380c66b..893f0d3b59ac765d495c3816eac1936b417c546a 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 import org.jetbrains.annotations.NonNls;
 
 @NonNls
 public class StudyNames {
-  public static final String INTRODUCTION_COURSE = "introduction_course";
   public static final String TASK_HTML = "task.html";
   public static final String TASK_TESTS = "tests.py";
-  public static final String COURSES = "courses";
   public static final String LESSON = "lesson";
   public static final String TEST_HELPER = "test_helper.py";
+  public static final String USER_TESTER = "user_tester.py";
 
   private StudyNames() {
   }
similarity index 87%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyDirectoryProjectGenerator.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyProjectGenerator.java
index cc2bc803f0ead60dbf3310e7ff6d80996c782b24..c6954c6e60d6b861690516ea09724cd8c3851e22 100644 (file)
@@ -1,9 +1,7 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 import com.google.gson.*;
 import com.google.gson.stream.JsonReader;
-import com.intellij.facet.ui.FacetEditorValidator;
-import com.intellij.facet.ui.FacetValidatorsManager;
 import com.intellij.facet.ui.ValidationResult;
 import com.intellij.ide.projectView.ProjectView;
 import com.intellij.ide.projectView.impl.AbstractProjectViewPane;
@@ -13,8 +11,6 @@ import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileEditor.FileEditorManager;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.vfs.LocalFileSystem;
@@ -24,29 +20,26 @@ import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
 import com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl;
 import com.intellij.openapi.wm.ex.ToolWindowManagerAdapter;
 import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
-import com.intellij.platform.DirectoryProjectGenerator;
 import com.intellij.platform.templates.github.GeneratorException;
 import com.intellij.platform.templates.github.ZipUtil;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
-import com.jetbrains.python.edu.course.*;
-import com.jetbrains.python.edu.ui.StudyNewProjectPanel;
-import com.jetbrains.python.newProject.PythonProjectGenerator;
-import icons.StudyIcons;
-import org.jetbrains.annotations.Nls;
+import com.intellij.util.containers.ContainerUtil;
+import com.jetbrains.edu.learning.course.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.io.*;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-
-public class StudyDirectoryProjectGenerator extends PythonProjectGenerator implements DirectoryProjectGenerator {
-  private static final Logger LOG = Logger.getInstance(StudyDirectoryProjectGenerator.class.getName());
+public class StudyProjectGenerator {
+  private static final Logger LOG = Logger.getInstance(StudyProjectGenerator.class.getName());
+  private final List<SettingsListener> myListeners = ContainerUtil.newArrayList();
   private static final String REPO_URL = "https://github.com/JetBrains/pycharm-courses/archive/master.zip";
   private static final String USER_NAME = "PyCharm";
   private static final String COURSE_META_FILE = "course.json";
@@ -59,15 +52,6 @@ public class StudyDirectoryProjectGenerator extends PythonProjectGenerator imple
   private Map<CourseInfo, File> myCourses = new HashMap<CourseInfo, File>();
   private File mySelectedCourseFile;
   private Project myProject;
-  public ValidationResult myValidationResult = new ValidationResult("selected course is not valid");
-
-  @Nls
-  @NotNull
-  @Override
-  public String getName() {
-    return "Educational";
-  }
-
 
   public void setCourses(Map<CourseInfo, File> courses) {
     myCourses = courses;
@@ -140,22 +124,7 @@ public class StudyDirectoryProjectGenerator extends PythonProjectGenerator imple
     return null;
   }
 
-  @Nullable
-  @Override
-  public Object showGenerationSettings(VirtualFile baseDir) throws ProcessCanceledException {
-    return null;
-  }
-
-  @Nullable
-  @Override
-  public Icon getLogo() {
-    return StudyIcons.EducationalProjectType;
-  }
-
-
-  @Override
-  public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
-                              @Nullable Object settings, @NotNull Module module) {
+  public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir) {
 
     myProject = project;
     Reader reader = null;
@@ -336,42 +305,6 @@ public class StudyDirectoryProjectGenerator extends PythonProjectGenerator imple
     return courseInfo;
   }
 
-  @NotNull
-  @Override
-  public ValidationResult validate(@NotNull String s) {
-    return myValidationResult;
-  }
-
-  public void setValidationResult(ValidationResult validationResult) {
-    myValidationResult = validationResult;
-  }
-
-  /**
-   * @return courses from memory or from cash file or parses course directory
-   */
-  public Map<CourseInfo, File> getCourses() {
-    if (!myCourses.isEmpty()) {
-      return myCourses;
-    }
-    if (myCoursesDir.exists()) {
-      File cacheFile = new File(myCoursesDir, CACHE_NAME);
-      if (cacheFile.exists()) {
-        myCourses = getCoursesFromCache(cacheFile);
-        if (!myCourses.isEmpty()) {
-          return myCourses;
-        }
-      }
-      myCourses = loadCourses();
-      if (!myCourses.isEmpty()) {
-        return myCourses;
-      }
-    }
-    downloadAndUnzip(false);
-    myCourses = loadCourses();
-    flushCache();
-    return myCourses;
-  }
-
   /**
    * Writes courses to cash file {@link com.jetbrains.python.edu.StudyDirectoryProjectGenerator#CACHE_NAME}
    */
@@ -417,7 +350,7 @@ public class StudyDirectoryProjectGenerator extends PythonProjectGenerator imple
     Map<CourseInfo, File> coursesFromCash = new HashMap<CourseInfo, File>();
     BufferedReader reader =  null;
     try {
-       reader = new BufferedReader(new InputStreamReader(new FileInputStream(cashFile)));
+      reader = new BufferedReader(new InputStreamReader(new FileInputStream(cashFile)));
       String line;
 
       while ((line = reader.readLine()) != null) {
@@ -446,18 +379,43 @@ public class StudyDirectoryProjectGenerator extends PythonProjectGenerator imple
     return coursesFromCash;
   }
 
-  @Nullable
-  @Override
-  public JPanel extendBasePanel() throws ProcessCanceledException {
-    StudyNewProjectPanel settingsPanel = new StudyNewProjectPanel(this);
-    settingsPanel.registerValidators(new FacetValidatorsManager() {
-      public void registerValidator(FacetEditorValidator validator, JComponent... componentsToWatch) {
-        throw new UnsupportedOperationException();
+  /**
+   * @return courses from memory or from cash file or parses course directory
+   */
+  public Map<CourseInfo, File> getCourses() {
+    if (!myCourses.isEmpty()) {
+      return myCourses;
+    }
+    if (myCoursesDir.exists()) {
+      File cacheFile = new File(myCoursesDir, CACHE_NAME);
+      if (cacheFile.exists()) {
+        myCourses = getCoursesFromCache(cacheFile);
+        if (!myCourses.isEmpty()) {
+          return myCourses;
+        }
       }
-      public void validate() {
-        fireStateChanged();
+      myCourses = loadCourses();
+      if (!myCourses.isEmpty()) {
+        return myCourses;
       }
-    });
-    return settingsPanel.getContentPanel();
+    }
+    downloadAndUnzip(false);
+    myCourses = loadCourses();
+    flushCache();
+    return myCourses;
+  }
+
+  public void addSettingsStateListener(@NotNull SettingsListener listener) {
+    myListeners.add(listener);
+  }
+
+  public interface SettingsListener {
+    void stateChanged(ValidationResult result);
+  }
+
+  public void fireStateChanged(ValidationResult result) {
+    for (SettingsListener listener : myListeners) {
+      listener.stateChanged(result);
+    }
   }
 }
similarity index 88%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyState.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyState.java
index 96dc3d9064724f3e9111a62c43f704507bec6d03..4c382e0cc6221347f17cbbaf2ce8d055664c688c 100644 (file)
@@ -1,11 +1,11 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.editor.StudyEditor;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 
 public class StudyState {
   private final StudyEditor myStudyEditor;
similarity index 95%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyTaskManager.java
index d44c251d5bb48caba2fc53233201712f1406f482..16996c0fb3315a04f7e857a2d2005e09261f2b94 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
 import com.intellij.ide.BrowserUtil;
 import com.intellij.ide.ui.UISettings;
@@ -32,13 +32,13 @@ import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.openapi.wm.*;
 import com.intellij.util.ui.update.UiNotifyConnector;
 import com.intellij.util.xmlb.XmlSerializer;
-import com.jetbrains.python.edu.actions.*;
-import com.jetbrains.python.edu.course.Course;
-import com.jetbrains.python.edu.course.Lesson;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.ui.StudyCondition;
-import com.jetbrains.python.edu.ui.StudyToolWindowFactory;
+import com.jetbrains.edu.learning.actions.*;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.edu.learning.course.Lesson;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.ui.StudyCondition;
+import com.jetbrains.edu.learning.ui.StudyToolWindowFactory;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -201,10 +201,7 @@ public class StudyTaskManager implements ProjectComponent, PersistentStateCompon
                   @Override
                   public void run() {
                     if (PropertiesComponent.getInstance().getBoolean("StudyShowPopup", true)) {
-                      String content = "<html>If you'd like to learn" +
-                                       " more about PyCharm " +
-                                       "Educational Edition, " +
-                                       "click <a href=\"https://www.jetbrains.com/pycharm-educational/quickstart/\">here</a> to watch a tutorial</html>";
+                      String content = StudyUtils.getLinkToTutorial();
                       final Notification notification =
                         new Notification("Watch Tutorials!", "", content, NotificationType.INFORMATION, new UrlOpeningListener(true));
                       Notifications.Bus.notify(notification);
diff --git a/python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyTestRunner.java b/python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyTestRunner.java
new file mode 100644 (file)
index 0000000..366a8df
--- /dev/null
@@ -0,0 +1,38 @@
+package com.jetbrains.edu.learning;
+
+import com.intellij.execution.ExecutionException;
+import com.intellij.execution.process.ProcessOutput;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.jetbrains.edu.learning.course.Task;
+import org.jetbrains.annotations.NotNull;
+
+public abstract class StudyTestRunner {
+  public static final String STUDY_PREFIX="#educational_plugin";
+  public static final String TEST_OK = "test OK";
+  private static final String TEST_FAILED = "FAILED + ";
+  protected final Task myTask;
+  protected final VirtualFile myTaskDir;
+
+  public StudyTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
+    myTask = task;
+    myTaskDir = taskDir;
+  }
+
+  public abstract Process createCheckProcess(Project project, String executablePath) throws ExecutionException;
+
+  @NotNull
+  public String getTestsOutput(@NotNull final ProcessOutput processOutput) {
+    for (String line : processOutput.getStdoutLines()) {
+      if (line.contains(STUDY_PREFIX)) {
+        if (line.contains(TEST_OK)) {
+          continue;
+        }
+        int messageStart = line.indexOf(TEST_FAILED);
+        return line.substring(messageStart + TEST_FAILED.length());
+      }
+    }
+
+    return TEST_OK;
+  }
+}
similarity index 76%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyUtils.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyUtils.java
index 324e58aa4b4c5aec480f99db22d36d44dd76f6ff..9262ac6c7041f079a354422be2fd456f60d9532f 100644 (file)
@@ -1,5 +1,8 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
 
+import com.intellij.execution.RunContentExecutor;
+import com.intellij.execution.configurations.GeneralCommandLine;
+import com.intellij.execution.process.ProcessHandler;
 import com.intellij.ide.SaveAndSyncHandlerImpl;
 import com.intellij.ide.projectView.actions.MarkRootActionBase;
 import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -11,7 +14,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.FileEditor;
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.Sdk;
@@ -24,10 +26,9 @@ import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.openapi.wm.ToolWindowManager;
 import com.intellij.util.ui.UIUtil;
-import com.jetbrains.python.edu.course.*;
-import com.jetbrains.python.edu.editor.StudyEditor;
-import com.jetbrains.python.edu.ui.StudyToolWindowFactory;
-import com.jetbrains.python.sdk.PythonSdkType;
+import com.jetbrains.edu.learning.course.*;
+import com.jetbrains.edu.learning.editor.StudyEditor;
+import com.jetbrains.edu.learning.ui.StudyToolWindowFactory;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -35,6 +36,9 @@ import java.io.*;
 import java.util.Collection;
 
 public class StudyUtils {
+  private StudyUtils() {
+  }
+
   private static final Logger LOG = Logger.getInstance(StudyUtils.class.getName());
 
   public static void closeSilently(Closeable stream) {
@@ -199,8 +203,13 @@ public class StudyUtils {
   }
 
   @Nullable
-  public static Sdk findPythonSdk(@NotNull final Project project) {
-    return PythonSdkType.findPythonSdk(ModuleManager.getInstance(project).getModules()[0]);
+  public static Sdk findSdk(@NotNull final Project project) {
+    final StudyUtilsExtensionPoint[] extensions =
+      ApplicationManager.getApplication().getExtensions(StudyUtilsExtensionPoint.EP_NAME);
+    if (extensions.length > 0) {
+      return extensions[0].findSdk(project);
+    }
+    return null;
   }
 
   public static void markDirAsSourceRoot(@NotNull final VirtualFile dir, @NotNull final Project project) {
@@ -224,4 +233,43 @@ public class StudyUtils {
       }
     });
   }
+
+  public static StudyTestRunner getTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
+    final StudyUtilsExtensionPoint[] extensions =
+      ApplicationManager.getApplication().getExtensions(StudyUtilsExtensionPoint.EP_NAME);
+    if (extensions.length > 0) {
+      return extensions[0].getTestRunner(task, taskDir);
+    }
+    return null;
+  }
+
+  public static String getLinkToTutorial() {
+    final StudyUtilsExtensionPoint[] extensions =
+      ApplicationManager.getApplication().getExtensions(StudyUtilsExtensionPoint.EP_NAME);
+    if (extensions.length > 0) {
+      return extensions[0].getLinkToTutorial();
+    }
+    return null;
+  }
+
+  public static RunContentExecutor getExecutor(@NotNull final Project project, @NotNull final ProcessHandler handler) {
+    final StudyUtilsExtensionPoint[] extensions =
+      ApplicationManager.getApplication().getExtensions(StudyUtilsExtensionPoint.EP_NAME);
+    if (extensions.length > 0) {
+      return extensions[0].getExecutor(project, handler);
+    }
+    return null;
+  }
+
+  public static void setCommandLineParameters(@NotNull final GeneralCommandLine cmd,
+                                               @NotNull final Project project,
+                                               @NotNull final String filePath,
+                                               @NotNull final String pythonPath,
+                                               @NotNull final Task currentTask) {
+  final StudyUtilsExtensionPoint[] extensions =
+      ApplicationManager.getApplication().getExtensions(StudyUtilsExtensionPoint.EP_NAME);
+    if (extensions.length > 0) {
+      extensions[0].setCommandLineParameters(cmd, project, filePath, pythonPath, currentTask);
+    }
+  }
 }
diff --git a/python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyUtilsExtensionPoint.java b/python/educational/interactive-learning/src/com/jetbrains/edu/learning/StudyUtilsExtensionPoint.java
new file mode 100644 (file)
index 0000000..2342e5d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.jetbrains.edu.learning;
+
+import com.intellij.execution.RunContentExecutor;
+import com.intellij.execution.configurations.GeneralCommandLine;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.jetbrains.edu.learning.course.Task;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public interface StudyUtilsExtensionPoint {
+  ExtensionPointName<StudyUtilsExtensionPoint> EP_NAME = ExtensionPointName.create("Edu.StudyUtils");
+
+  @Nullable
+  abstract Sdk findSdk(@NotNull final Project project);
+
+  abstract String getLinkToTutorial();
+
+  abstract StudyTestRunner getTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskDir);
+
+  public RunContentExecutor getExecutor(@NotNull final Project project, @NotNull final ProcessHandler handler);
+
+  public void setCommandLineParameters(@NotNull final GeneralCommandLine cmd,
+                                       @NotNull final Project project,
+                                       @NotNull final String filePath,
+                                       @NotNull final String pythonPath,
+                                       @NotNull final Task currentTask);
+}
similarity index 96%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyCheckAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyCheckAction.java
index 1b161278357bc014c9e446accfa10686ecb39ed6..4afe508dbc5a6df9f9d1798460d823201d5fde15 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.process.CapturingProcessHandler;
@@ -33,15 +33,15 @@ import com.intellij.openapi.wm.IdeFrame;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.openapi.wm.ex.StatusBarEx;
 import com.intellij.openapi.wm.ex.WindowManagerEx;
-import com.jetbrains.python.edu.StudyDocumentListener;
-import com.jetbrains.python.edu.StudyState;
-import com.jetbrains.python.edu.StudyTestRunner;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.StudyStatus;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.course.TaskWindow;
-import com.jetbrains.python.edu.editor.StudyEditor;
+import com.jetbrains.edu.learning.StudyDocumentListener;
+import com.jetbrains.edu.learning.StudyState;
+import com.jetbrains.edu.learning.StudyTestRunner;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.StudyStatus;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.course.TaskWindow;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -133,7 +133,7 @@ public class StudyCheckAction extends DumbAwareAction {
             final Task task = studyState.getTask();
             final VirtualFile taskDir = studyState.getTaskDir();
             flushWindows(task, taskDir);
-            Sdk sdk = StudyUtils.findPythonSdk(project);
+            final Sdk sdk = StudyUtils.findSdk(project);
             if (sdk == null) {
               createNoPythonInterpreterPopUp(project);
               return;
@@ -149,7 +149,8 @@ public class StudyCheckAction extends DumbAwareAction {
                 IdeFocusManager.getInstance(project).requestFocus(studyState.getEditor().getComponent(), true);
               }
             });
-            final StudyTestRunner testRunner = new StudyTestRunner(task, taskDir);
+
+            final StudyTestRunner testRunner = StudyUtils.getTestRunner(task, taskDir);
             Process testProcess = null;
             try {
               final VirtualFile executablePath = getTaskVirtualFile(studyState, task, taskDir);
similarity index 94%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyEditInputAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyEditInputAction.java
index 50dcc3a2e69ac27901f204dec845f5d5b803a279..b026e18388cd548a9e6eb8f7d24bc96cb14dd8df 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.icons.AllIcons;
 import com.intellij.ide.ui.UISettings;
@@ -20,13 +20,13 @@ import com.intellij.ui.tabs.TabInfo;
 import com.intellij.ui.tabs.TabsListener;
 import com.intellij.ui.tabs.impl.JBEditorTabs;
 import com.intellij.util.PlatformIcons;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.course.UserTest;
-import com.jetbrains.python.edu.editor.StudyEditor;
-import com.jetbrains.python.edu.ui.StudyTestContentPanel;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.course.UserTest;
+import com.jetbrains.edu.learning.editor.StudyEditor;
+import com.jetbrains.edu.learning.ui.StudyTestContentPanel;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -154,7 +154,7 @@ public class StudyEditInputAction extends DumbAwareAction {
     showInput(e.getProject());
   }
 
-  private class HintClosedListener extends  JBPopupAdapter {
+  private static class HintClosedListener extends JBPopupAdapter {
     private final Task myTask;
     private HintClosedListener(@NotNull final Task task) {
       myTask = task;
similarity index 81%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextStudyTaskAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyNextStudyTaskAction.java
index 27edf22529cd66230185e7fa752b775ae0e3f02e..831208fcf5fa1ba57150901c2372fdaa60656cf3 100644 (file)
@@ -1,7 +1,7 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
-import com.jetbrains.python.edu.editor.StudyEditor;
-import com.jetbrains.python.edu.course.Task;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
similarity index 87%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyNextWindowAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyNextWindowAction.java
index e4d3bb79d7a360a13611b45ceb19eb77fc761821..6dbcc19cef15356178b63d8d634e5329e1b91705 100644 (file)
@@ -1,8 +1,8 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.icons.AllIcons;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.TaskWindow;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.TaskWindow;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
similarity index 75%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyPrevWindowAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyPrevWindowAction.java
index 01f6e1688b02355b570f9c9a753fc72193ca8ca3..267944a33dc6718de6f6ee60bc22bfec7b7816b8 100644 (file)
@@ -1,8 +1,8 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.TaskWindow;
-import icons.StudyIcons;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.TaskWindow;
+import icons.InteractiveLearningIcons;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -17,7 +17,7 @@ public class StudyPrevWindowAction extends StudyWindowNavigationAction {
   public static final String SHORTCUT = "ctrl shift pressed COMMA";
 
   public StudyPrevWindowAction() {
-    super("Navigate to the Previous Answer Placeholder", "Navigate to the previous answer placeholder", StudyIcons.Prev);
+    super("Navigate to the Previous Answer Placeholder", "Navigate to the previous answer placeholder", InteractiveLearningIcons.Prev);
   }
 
 
similarity index 81%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyPreviousStudyTaskAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyPreviousStudyTaskAction.java
index 02cc363558344ebf9208bf9dbdad1a3668a1fdfb..1c3dc5a95cb63176e87ed740f4bb669c3f6f3ac6 100644 (file)
@@ -1,8 +1,8 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 
-import com.jetbrains.python.edu.editor.StudyEditor;
-import com.jetbrains.python.edu.course.Task;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
similarity index 95%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRefreshTaskFileAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRefreshTaskFileAction.java
index 9ec54b10569eeedca20db7f104d0c68373bb6fdf..3458d252a15bca1e3642a9e9f810f8cdb85a59d2 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.ide.projectView.ProjectView;
 import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -18,11 +18,11 @@ import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VfsUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.wm.IdeFocusManager;
-import com.jetbrains.python.edu.StudyDocumentListener;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.*;
-import com.jetbrains.python.edu.editor.StudyEditor;
+import com.jetbrains.edu.learning.StudyDocumentListener;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.*;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.File;
diff --git a/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRunAction.java b/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRunAction.java
new file mode 100644 (file)
index 0000000..2cd453b
--- /dev/null
@@ -0,0 +1,82 @@
+package com.jetbrains.edu.learning.actions;
+
+import com.intellij.execution.ExecutionException;
+import com.intellij.execution.RunContentExecutor;
+import com.intellij.execution.configurations.GeneralCommandLine;
+import com.intellij.execution.process.OSProcessHandler;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.editor.StudyEditor;
+import org.jetbrains.annotations.NotNull;
+
+public class StudyRunAction extends DumbAwareAction {
+  private static final Logger LOG = Logger.getInstance(StudyRunAction.class.getName());
+  public static final String ACTION_ID = "StudyRunAction";
+  private ProcessHandler myHandler;
+
+  public void run(@NotNull final Project project, @NotNull final Sdk sdk) {
+    if (myHandler != null && !myHandler.isProcessTerminated()) return;
+    Editor selectedEditor = StudyEditor.getSelectedEditor(project);
+    FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
+    assert selectedEditor != null;
+    VirtualFile openedFile = fileDocumentManager.getFile(selectedEditor.getDocument());
+
+    if (openedFile != null && openedFile.getCanonicalPath() != null) {
+      String filePath = openedFile.getCanonicalPath();
+      executeFile(project, sdk, openedFile, filePath);
+    }
+  }
+
+  private void executeFile(@NotNull final Project project, @NotNull final Sdk sdk,
+                           @NotNull final VirtualFile openedFile, @NotNull final String filePath) {
+    StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
+    GeneralCommandLine cmd = new GeneralCommandLine();
+    cmd.withWorkDirectory(openedFile.getParent().getCanonicalPath());
+    String sdkHomePath = sdk.getHomePath();
+    if (sdkHomePath != null) {
+      cmd.setExePath(sdkHomePath);
+      TaskFile selectedTaskFile = taskManager.getTaskFile(openedFile);
+      assert selectedTaskFile != null;
+      Task currentTask = selectedTaskFile.getTask();
+      Process process;
+      StudyUtils.setCommandLineParameters(cmd, project, filePath, sdkHomePath, currentTask);
+
+      try {
+        process = cmd.createProcess();
+      }
+      catch (ExecutionException e) {
+        LOG.error(e);
+        return;
+      }
+      myHandler = new OSProcessHandler(process);
+      RunContentExecutor executor = StudyUtils.getExecutor(project, myHandler);
+      Disposer.register(project, executor);
+      executor.run();
+
+    }
+  }
+
+  public void actionPerformed(@NotNull AnActionEvent e) {
+    Project project = e.getProject();
+    if (project == null) {
+      return;
+    }
+    Sdk sdk = StudyUtils.findSdk(project);
+    if (sdk == null) {
+      return;
+    }
+    run(project, sdk);
+  }
+}
similarity index 89%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyShowHintAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyShowHintAction.java
index a5d37cbd2c2e6cefc195fa07c270f0416eb72053..94e3cc4bd5efaf0c716b4d53dfce3069aa208314 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.codeInsight.documentation.DocumentationComponent;
 import com.intellij.codeInsight.documentation.DocumentationManager;
@@ -13,13 +13,13 @@ import com.intellij.openapi.util.Disposer;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
-import com.jetbrains.python.edu.StudyState;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.Course;
-import com.jetbrains.python.edu.course.TaskWindow;
-import com.jetbrains.python.edu.editor.StudyEditor;
-import icons.StudyIcons;
+import com.jetbrains.edu.learning.StudyState;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.edu.learning.course.TaskWindow;
+import com.jetbrains.edu.learning.editor.StudyEditor;
+import icons.InteractiveLearningIcons;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -32,7 +32,7 @@ public class StudyShowHintAction extends DumbAwareAction {
   public static final String HINT_NOT_AVAILABLE = "There is no hint for this answer placeholder";
 
   public StudyShowHintAction() {
-    super("Show hint", "Show hint", StudyIcons.ShowHint);
+    super("Show hint", "Show hint", InteractiveLearningIcons.ShowHint);
   }
 
   public void actionPerformed(@NotNull AnActionEvent e) {
similarity index 92%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyTaskNavigationAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyTaskNavigationAction.java
index b98bbd09877660576dece0f90c22fd49e31c9732..721ff2f10ccb65bbba56753907c1ef62373c0707 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.ide.projectView.ProjectView;
 import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -14,11 +14,11 @@ import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.openapi.wm.ToolWindowId;
 import com.intellij.openapi.wm.ToolWindowManager;
 import com.intellij.util.ui.tree.TreeUtil;
-import com.jetbrains.python.edu.StudyState;
-import com.jetbrains.python.edu.course.Lesson;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.editor.StudyEditor;
+import com.jetbrains.edu.learning.StudyState;
+import com.jetbrains.edu.learning.course.Lesson;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
similarity index 87%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWindowNavigationAction.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyWindowNavigationAction.java
index e401fcee021f2e07ae2c1d211e0c95428fad6183..cc5fea2dc9ec8616cc6ef0d25affbf755e355b79 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
 
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.editor.Editor;
@@ -6,11 +6,11 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.course.TaskWindow;
-import com.jetbrains.python.edu.editor.StudyEditor;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.course.TaskWindow;
+import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
similarity index 98%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/Course.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Course.java
index d461a48071516de7e48a9e76504c2df0ddcd8612..94196dd45e26ddcb86eba2ec9540cb2434dc5627 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
similarity index 96%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/CourseInfo.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/CourseInfo.java
index 9f820c12c57206ba119a1557410552a26df6c7b5..6cf9b18ea6d297aa87ae5701380a404a1654206a 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 /**
  * Implementation of class which contains information to be shawn in course description in tool window
similarity index 97%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/Lesson.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Lesson.java
index b4a3286dfd9416e074dc91ea2b9e5922ba764234..34be407bf5ef234e2158acd2b6a9504b2037b6fc 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -58,7 +58,7 @@ public class Lesson implements Stateful {
    *
    * @param courseDir    project directory of course
    * @param resourceRoot directory where original lesson stored
-   * @throws java.io.IOException
+   * @throws IOException
    */
   public void create(@NotNull final VirtualFile courseDir, @NotNull final File resourceRoot,
                      @NotNull final Project project) throws IOException {
similarity index 96%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/LessonInfo.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/LessonInfo.java
index 85e2eb8be1a9801152b5e2b66bdbd4a8eabbc2cd..2de9bad0af6f93faf62880854e2bcdd866001e79 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 /**
  * Implementation of class which contains information about student progress in current lesson
similarity index 73%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/Stateful.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Stateful.java
index 3a163622f56d4433443a63aedbe4fcc373029781..4ba655e5066e2533b85d2bab7bfa4685cff6d905 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 public interface Stateful {
   StudyStatus getStatus();
similarity index 98%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/Task.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/Task.java
index 0a106ff597ad8db057f00b5455518b61396d3d15..abdda07da02fb509c6de60c8ba5ca4059945d6b6 100644 (file)
@@ -1,10 +1,10 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.xmlb.annotations.Transient;
-import com.jetbrains.python.edu.StudyUtils;
+import com.jetbrains.edu.learning.StudyUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -83,7 +83,7 @@ public class Task implements Stateful {
    *
    * @param lessonDir    project directory of lesson which task belongs to
    * @param resourceRoot directory where original task file stored
-   * @throws java.io.IOException
+   * @throws IOException
    */
   public void create(@NotNull final VirtualFile lessonDir, @NotNull final File resourceRoot,
                      @NotNull final Project project) throws IOException {
similarity index 97%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskFile.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/TaskFile.java
index b8908b606311ead9ef18effef4c64f74360d0551..1f5f7ebbbb52bfdfe7d9b97e97bdc5cb320cb5fc 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
@@ -13,8 +13,8 @@ import com.intellij.openapi.editor.markup.RangeHighlighter;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.xmlb.annotations.Transient;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.TaskWindowDeleteHandler;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.TaskWindowDeleteHandler;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -85,7 +85,7 @@ public class TaskFile implements Stateful {
    *
    * @param taskDir      project directory of task which task file belongs to
    * @param resourceRoot directory where original task file stored
-   * @throws java.io.IOException
+   * @throws IOException
    */
   public void create(@NotNull final VirtualFile taskDir, @NotNull final File resourceRoot,
                      @NotNull final String name) throws IOException {
similarity index 97%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/course/TaskWindow.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/course/TaskWindow.java
index 2229309092e723ba0b8a7ec03a8a875f944b88e8..2cd4c4ce775968bc3a0f9dc1c7ed8c0eda5733ba 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.course;
+package com.jetbrains.edu.learning.course;
 
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.process.CapturingProcessHandler;
@@ -18,9 +18,9 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.ui.JBColor;
-import com.jetbrains.python.edu.StudyDocumentListener;
-import com.jetbrains.python.edu.StudyTestRunner;
-import com.jetbrains.python.edu.StudyUtils;
+import com.jetbrains.edu.learning.StudyDocumentListener;
+import com.jetbrains.edu.learning.StudyTestRunner;
+import com.jetbrains.edu.learning.StudyUtils;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.File;
similarity index 95%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyEditor.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/editor/StudyEditor.java
index 14f932ede2f08d4fa4a020c17c1cbc0c38c129bd..a5c7edb9291af03b737214c4a90de676c8508109 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.editor;
+package com.jetbrains.edu.learning.editor;
 
 import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
 import com.intellij.icons.AllIcons;
@@ -34,13 +34,13 @@ import com.intellij.ui.HideableTitledPanel;
 import com.intellij.ui.JBColor;
 import com.intellij.util.ui.EmptyClipboardOwner;
 import com.intellij.util.ui.UIUtil;
-import com.jetbrains.python.edu.StudyDocumentListener;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.actions.*;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import icons.StudyIcons;
+import com.jetbrains.edu.learning.StudyDocumentListener;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.actions.*;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
+import icons.InteractiveLearningIcons;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -205,13 +205,13 @@ public class StudyEditor implements TextEditor {
   }
 
   private void initializeButtons(@NotNull final JPanel taskActionsPanel, @NotNull final TaskFile taskFile) {
-    myCheckButton = addButton(taskActionsPanel, StudyCheckAction.ACTION_ID, StudyIcons.Resolve, StudyCheckAction.SHORTCUT);
-    myPrevTaskButton = addButton(taskActionsPanel, StudyPreviousStudyTaskAction.ACTION_ID, StudyIcons.Prev, StudyPreviousStudyTaskAction.SHORTCUT);
+    myCheckButton = addButton(taskActionsPanel, StudyCheckAction.ACTION_ID, InteractiveLearningIcons.Resolve, StudyCheckAction.SHORTCUT);
+    myPrevTaskButton = addButton(taskActionsPanel, StudyPreviousStudyTaskAction.ACTION_ID, InteractiveLearningIcons.Prev, StudyPreviousStudyTaskAction.SHORTCUT);
     myNextTaskButton = addButton(taskActionsPanel, StudyNextStudyTaskAction.ACTION_ID, AllIcons.Actions.Forward, StudyNextStudyTaskAction.SHORTCUT);
     myRefreshButton = addButton(taskActionsPanel, StudyRefreshTaskFileAction.ACTION_ID, AllIcons.Actions.Refresh, StudyRefreshTaskFileAction.SHORTCUT);
-    JButton myShowHintButton = addButton(taskActionsPanel, StudyShowHintAction.ACTION_ID, StudyIcons.ShowHint, StudyShowHintAction.SHORTCUT);
+    JButton myShowHintButton = addButton(taskActionsPanel, StudyShowHintAction.ACTION_ID, InteractiveLearningIcons.ShowHint, StudyShowHintAction.SHORTCUT);
     if (!taskFile.getTask().getUserTests().isEmpty()) {
-      final Sdk sdk = StudyUtils.findPythonSdk(myProject);
+      final Sdk sdk = StudyUtils.findSdk(myProject);
       if (sdk != null) {
         JButton runButton = addButton(taskActionsPanel, StudyRunAction.ACTION_ID, AllIcons.General.Run, null);
         runButton.addActionListener(new ActionListener() {
@@ -221,7 +221,7 @@ public class StudyEditor implements TextEditor {
             studyRunAction.run(myProject, sdk);
           }
         });
-        JButton watchInputButton = addButton(taskActionsPanel, "WatchInputAction", StudyIcons.WatchInput, null);
+        JButton watchInputButton = addButton(taskActionsPanel, "WatchInputAction", InteractiveLearningIcons.WatchInput, null);
         watchInputButton.addActionListener(new ActionListener() {
           @Override
           public void actionPerformed(ActionEvent e) {
similarity index 93%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/editor/StudyFileEditorProvider.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/editor/StudyFileEditorProvider.java
index 631b5a9eaf4c2ee30ce52bf61d168e19790b0fc2..ae8df16526817e0e0d06bd8aae0d8c6205d20e91 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.editor;
+package com.jetbrains.edu.learning.editor;
 
 import com.intellij.openapi.fileEditor.FileEditor;
 import com.intellij.openapi.fileEditor.FileEditorPolicy;
@@ -8,10 +8,10 @@ import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.course.TaskFile;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.course.TaskFile;
 
 /**
  * User: lia
similarity index 89%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/projectView/StudyDirectoryNode.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/projectView/StudyDirectoryNode.java
index 4bd8df9baee7c325ec01db93c69374a8aca30095..a76e98ca50de6a3ecab5dab7536852dd5de69002 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.projectView;
+package com.jetbrains.edu.learning.projectView;
 
 import com.intellij.ide.projectView.PresentationData;
 import com.intellij.ide.projectView.ProjectView;
@@ -11,10 +11,10 @@ import com.intellij.psi.PsiDirectory;
 import com.intellij.psi.PsiElement;
 import com.intellij.ui.JBColor;
 import com.intellij.ui.SimpleTextAttributes;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.*;
-import icons.StudyIcons;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.*;
+import icons.InteractiveLearningIcons;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -35,7 +35,7 @@ public class StudyDirectoryNode extends PsiDirectoryNode {
 
   @Override
   protected void updateImpl(PresentationData data) {
-    data.setIcon(StudyIcons.Task);
+    data.setIcon(InteractiveLearningIcons.Task);
     String valueName = myValue.getName();
     StudyTaskManager studyTaskManager = StudyTaskManager.getInstance(myProject);
     Course course = studyTaskManager.getCourse();
@@ -72,7 +72,7 @@ public class StudyDirectoryNode extends PsiDirectoryNode {
       if (myValue.getParent() != null) {
         if (!myValue.getParent().getName().contains(Course.SANDBOX_DIR)) {
           data.setPresentableText(Course.SANDBOX_DIR);
-          data.setIcon(StudyIcons.Sandbox);
+          data.setIcon(InteractiveLearningIcons.Sandbox);
           return;
         }
       }
@@ -94,16 +94,16 @@ public class StudyDirectoryNode extends PsiDirectoryNode {
     StudyStatus taskStatus = stateful.getStatus();
     switch (taskStatus) {
       case Unchecked: {
-        updatePresentation(data, additionalName, JBColor.BLACK, stateful instanceof Lesson ? StudyIcons.Lesson : StudyIcons.Task);
+        updatePresentation(data, additionalName, JBColor.BLACK, stateful instanceof Lesson ? InteractiveLearningIcons.Lesson : InteractiveLearningIcons.Task);
         break;
       }
       case Solved: {
         updatePresentation(data, additionalName, new JBColor(new Color(0, 134, 0), new Color(98, 150, 85)),
-                           stateful instanceof Lesson ? StudyIcons.LessonCompl : StudyIcons.TaskCompl);
+                           stateful instanceof Lesson ? InteractiveLearningIcons.LessonCompl : InteractiveLearningIcons.TaskCompl);
         break;
       }
       case Failed: {
-        updatePresentation(data, additionalName, JBColor.RED, stateful instanceof Lesson ? StudyIcons.Lesson : StudyIcons.TaskProbl);
+        updatePresentation(data, additionalName, JBColor.RED, stateful instanceof Lesson ? InteractiveLearningIcons.Lesson : InteractiveLearningIcons.TaskProbl);
       }
     }
   }
similarity index 91%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/projectView/StudyTreeStructureProvider.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/projectView/StudyTreeStructureProvider.java
index 29b328a5da45740f9aa31b23d65aeb9fae6a13da..375a350f8bbbb88e97b44c81a5da3a0331b786db 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.projectView;
+package com.jetbrains.edu.learning.projectView;
 
 import com.intellij.ide.projectView.TreeStructureProvider;
 import com.intellij.ide.projectView.ViewSettings;
@@ -8,10 +8,10 @@ import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiDirectory;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.course.Course;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.edu.learning.course.TaskFile;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
similarity index 86%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyCondition.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyCondition.java
index 5add6c934ecd167738132f28024013c6131a70b8..9d82fa4813a3590bdfe9074c93025fb05c4f67dc 100644 (file)
@@ -1,9 +1,9 @@
-package com.jetbrains.python.edu.ui;
+package com.jetbrains.edu.learning.ui;
 
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
-import com.jetbrains.python.edu.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyTaskManager;
 
 /**
  * author: liana
similarity index 98%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyNewProjectPanel.form
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyNewProjectPanel.form
index 8dd6506d710c6b46847346915074acd03d45749f..e6d745da6a7b239177991d725d50ec0f8b7f20cb 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.python.edu.ui.StudyNewProjectPanel">
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.edu.learning.ui.StudyNewProjectPanel">
   <grid id="27dc6" binding="myContentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
similarity index 93%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyNewProjectPanel.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyNewProjectPanel.java
index 6edad63586f0426d7569d32ded09ffc326c080ee..b7064784e0bf837d81b9337fee3892ef5c9cd90e 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.ui;
+package com.jetbrains.edu.learning.ui;
 
 import com.intellij.facet.ui.FacetValidatorsManager;
 import com.intellij.facet.ui.ValidationResult;
@@ -7,9 +7,9 @@ import com.intellij.openapi.fileChooser.FileChooser;
 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.Consumer;
-import com.jetbrains.python.edu.StudyDirectoryProjectGenerator;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.CourseInfo;
+import com.jetbrains.edu.learning.StudyProjectGenerator;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.CourseInfo;
 
 import javax.swing.*;
 import java.awt.event.ActionEvent;
@@ -33,12 +33,12 @@ public class StudyNewProjectPanel{
   private JLabel myAuthorLabel;
   private JLabel myDescriptionLabel;
   private JLabel myLabel;
-  private final StudyDirectoryProjectGenerator myGenerator;
+  private final StudyProjectGenerator myGenerator;
   private static final String CONNECTION_ERROR = "<html>Failed to download courses.<br>Check your Internet connection.</html>";
   private static final String INVALID_COURSE = "Selected course is invalid";
   private FacetValidatorsManager myValidationManager;
 
-  public StudyNewProjectPanel(StudyDirectoryProjectGenerator generator) {
+  public StudyNewProjectPanel(StudyProjectGenerator generator) {
     myGenerator = generator;
     Map<CourseInfo, File> courses = myGenerator.getCourses();
     if (courses.isEmpty()) {
@@ -110,14 +110,14 @@ public class StudyNewProjectPanel{
   }
 
   private void setError(String errorMessage) {
-    myGenerator.setValidationResult(new ValidationResult(errorMessage));
+    myGenerator.fireStateChanged(new ValidationResult(errorMessage));
     if (myValidationManager != null) {
       myValidationManager.validate();
     }
   }
 
   private void setOK() {
-    myGenerator.setValidationResult(ValidationResult.OK);
+    myGenerator.fireStateChanged(ValidationResult.OK);
     if (myValidationManager != null) {
       myValidationManager.validate();
     }
@@ -196,4 +196,5 @@ public class StudyNewProjectPanel{
       setOK();
     }
   }
+
 }
similarity index 98%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyProgressBar.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyProgressBar.java
index a25c98b99e3597ff065ddd64c4e9049194147c95..e7ae06b6e363be2df201ddda4076b41702ce98c3 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.ui;
+package com.jetbrains.edu.learning.ui;
 
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.ui.GraphicsConfig;
similarity index 96%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyTestContentPanel.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyTestContentPanel.java
index dee4fbaf9d0172c1042c58959c85bd26598eb6a7..6863ad597992b445db02868ada1a9a0268095d91 100644 (file)
@@ -1,9 +1,9 @@
-package com.jetbrains.python.edu.ui;
+package com.jetbrains.edu.learning.ui;
 
 import com.intellij.ui.DocumentAdapter;
 import com.intellij.ui.components.JBScrollPane;
+import com.jetbrains.edu.learning.course.UserTest;
 import org.jetbrains.annotations.NotNull;
-import com.jetbrains.python.edu.course.UserTest;
 
 import javax.swing.*;
 import javax.swing.event.DocumentEvent;
similarity index 91%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/ui/StudyToolWindowFactory.java
rename to python/educational/interactive-learning/src/com/jetbrains/edu/learning/ui/StudyToolWindowFactory.java
index 1c312af6e5d9f18e6057cc771a49549a63422ba2..73930ab662dd44b2f930bcb3519c83787b36989f 100644 (file)
@@ -1,4 +1,4 @@
-package com.jetbrains.python.edu.ui;
+package com.jetbrains.edu.learning.ui;
 
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
@@ -8,11 +8,11 @@ import com.intellij.ui.JBColor;
 import com.intellij.ui.content.Content;
 import com.intellij.ui.content.ContentFactory;
 import com.intellij.util.ui.UIUtil;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.course.Course;
-import com.jetbrains.python.edu.course.Lesson;
-import com.jetbrains.python.edu.course.LessonInfo;
-import com.jetbrains.python.edu.course.StudyStatus;
+import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.edu.learning.course.Lesson;
+import com.jetbrains.edu.learning.course.LessonInfo;
+import com.jetbrains.edu.learning.course.StudyStatus;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;