EDU-1146 Remove educational plugins sources from intellij-community repo

This commit is contained in:
Liana.Bakradze
2017-11-07 18:52:24 +03:00
parent 3a90b526dd
commit 6d7730ffd1
375 changed files with 1 additions and 40243 deletions
-2
View File
@@ -3,7 +3,6 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/plugins/ByteCodeViewer/ByteCodeViewer.iml" filepath="$PROJECT_DIR$/plugins/ByteCodeViewer/ByteCodeViewer.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/python/educational-python/Edu-Python/Edu-Python.iml" filepath="$PROJECT_DIR$/python/educational-python/Edu-Python/Edu-Python.iml" group="python/educational/educational-python" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/python/IntelliLang-python/IntelliLang-python.iml" filepath="$PROJECT_DIR$/python/IntelliLang-python/IntelliLang-python.iml" group="python" />
@@ -92,7 +91,6 @@
<module fileurl="file://$PROJECT_DIR$/platform/editor-ui-api/editor-ui-api.iml" filepath="$PROJECT_DIR$/platform/editor-ui-api/editor-ui-api.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/editor-ui-ex/editor-ui-ex.iml" filepath="$PROJECT_DIR$/platform/editor-ui-ex/editor-ui-ex.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/editorconfig/editorconfig.iml" filepath="$PROJECT_DIR$/plugins/editorconfig/editorconfig.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/python/educational-core/educational-core.iml" filepath="$PROJECT_DIR$/python/educational-core/educational-core.iml" group="python/educational/educational-core" />
<module fileurl="file://$PROJECT_DIR$/python/educational-python/educational-python.iml" filepath="$PROJECT_DIR$/python/educational-python/educational-python.iml" group="python/educational" />
<module fileurl="file://$PROJECT_DIR$/java/execution/impl/execution-impl.iml" filepath="$PROJECT_DIR$/java/execution/impl/execution-impl.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml" filepath="$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml" group="java" />
@@ -155,10 +155,6 @@ class CommunityRepositoryModules {
excludeFromModule("xslt-debugger-engine-impl", "serializer.jar")
excludeFromModule("xslt-debugger-engine-impl", "xalan.jar")
},
plugin("Edu-Python") {
withResource("resources/courses", "lib/courses")
excludeFromModule("Edu-Python", "courses/**")
},
plugin("maven") {
withModule("maven-jps-plugin")
withModule("maven-server-api")
-74
View File
@@ -1,74 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
ext.kotlin_version = '1.0.6'
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'http://dl.bintray.com/jetbrains/intellij-plugin-service'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.2.0-SNAPSHOT"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: "org.jetbrains.intellij"
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
sourceSets {
main {
java.srcDir 'src'
kotlin.srcDirs 'src'
resources.srcDir 'resources'
}
test {
java.srcDir 'testSrc'
}
}
buildDir = new File(rootProject.projectDir, "gradleBuild/" + project.name)
intellij {
pluginName 'educational-core'
if (project.hasProperty('ideaPath')) {
localPath ideaPath
} else {
if (project.hasProperty('ideaVersion')) {
version ideaVersion
}
}
updateSinceUntilBuild Boolean.valueOf(updateBuildNumber)
downloadSources Boolean.valueOf(downloadIdeaSources)
sandboxDirectory = new File(rootProject.projectDir, "gradleBuild/idea-sandbox")
}
dependencies {
compile fileTree(dir: 'lib', include: ['*.jar'])
}
processResources {
filesNotMatching("**/*.png") {
it.filter(ReplaceTokens, tokens: [
'VERSION' : version.toString(),
'BUILD-NUMBER': buildNumber,
])
}
}
afterEvaluate {
tasks.getByName('buildPlugin') {
archiveName = "$intellij.pluginName-$version-${buildNumber}.zip"
}
}
@@ -1,38 +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$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/gradleBuild" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="lang-impl" />
<orderEntry type="library" name="gson" level="project" />
<orderEntry type="library" name="http-client" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/twitter4j-core-4.0.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module" module-name="platform-api" />
<orderEntry type="module" module-name="xml" />
<orderEntry type="library" name="markdownj" level="project" />
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
<orderEntry type="module" module-name="testFramework" scope="TEST" />
<orderEntry type="module" module-name="testExtensions" scope="TEST" />
<orderEntry type="module" module-name="idea-ui" />
<orderEntry type="module" module-name="openapi" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="built-in-server" />
</component>
</module>
@@ -1,6 +0,0 @@
ideaVersion IC-LATEST-TRUNK-SNAPSHOT
downloadIdeaSources false
version 4.0
buildNumber 171
javaVersion 1.8
updateBuildNumber false
Binary file not shown.
@@ -1,6 +0,0 @@
#Fri Apr 29 19:52:53 MSK 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-bin.zip
-160
View File
@@ -1,160 +0,0 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
-90
View File
@@ -1,90 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
Binary file not shown.
@@ -1,9 +0,0 @@
<idea-plugin>
<actions>
<action id="Edu.StartLearn" class="com.jetbrains.edu.learning.intellij.android.EduStartLearningAction" text="Start Learning"
description="Create New Educational Project">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="last"/>
<add-to-group group-id="FileMenu" anchor="last"/>
</action>
</actions>
</idea-plugin>
@@ -1,17 +0,0 @@
<idea-plugin>
<depends>JUnit</depends>
<extensions defaultExtensionNs="com.intellij">
<projectTemplatesFactory implementation="com.jetbrains.edu.learning.intellij.EduIntelliJTemplateFactory"/>
</extensions>
<extensions defaultExtensionNs="Edu">
<eduIntelliJProjectTemplate implementation="com.jetbrains.edu.learning.intellij.localCourses.EduCustomCourseProjectTemplate"/>
<eduIntelliJProjectTemplate implementation="com.jetbrains.edu.coursecreator.intellij.EduCCProjectTemplate"/>
</extensions>
<application-components>
<component>
<implementation-class>com.jetbrains.edu.learning.intellij.EduIntellijApplicationComponent</implementation-class>
</component>
</application-components>
</idea-plugin>
@@ -1,209 +0,0 @@
<!--suppress XmlUnboundNsPrefix -->
<idea-plugin allow-bundled-update="true">
<id>com.jetbrains.edu.interactivelearning</id>
<name>Educational plugin core</name>
<version>4.1-IJ2017.3-1</version>
<idea-version since-build="173.1" until-build="181.*" />
<description><![CDATA[
Educational plugin core for students.
]]></description>
<vendor>JetBrains</vendor>
<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 optional="true" config-file="android-dependencies.xml">com.intellij.modules.androidstudio</depends>
<depends optional="true" config-file="edu-intellij.xml">com.intellij.modules.java</depends>
<project-components>
<component>
<implementation-class>com.jetbrains.edu.learning.StudyProjectComponent</implementation-class>
<interface-class>com.jetbrains.edu.learning.StudyProjectComponent</interface-class>
</component>
<component>
<implementation-class>com.jetbrains.edu.coursecreator.CCProjectComponent</implementation-class>
</component>
</project-components>
<application-components>
<component>
<implementation-class>com.jetbrains.edu.learning.stepic.EduStepicUpdater</implementation-class>
</component>
</application-components>
<extensionPoints>
<extensionPoint qualifiedName="Edu.eduIntelliJProjectTemplate" interface="com.jetbrains.edu.learning.intellij.EduIntelliJProjectTemplate"/>
<extensionPoint qualifiedName="Edu.pluginConfigurator" beanClass="com.intellij.lang.LanguageExtensionPoint">
<with attribute="implementationClass" implements="com.jetbrains.edu.learning.EduPluginConfigurator"/>
</extensionPoint>
<extensionPoint qualifiedName="Edu.studyTwitterPluginConfigurator" interface="com.jetbrains.edu.learning.StudyTwitterPluginConfigurator"/>
<extensionPoint qualifiedName="Edu.checkListener" interface="com.jetbrains.edu.learning.checker.StudyCheckListener"/>
<extensionPoint qualifiedName="Edu.optionsProvider" beanClass="com.jetbrains.edu.learning.settings.StudyOptionsProviderEP">
<with attribute="instance" implements="com.jetbrains.edu.learning.settings.StudyOptionsProvider"/>
</extensionPoint>
</extensionPoints>
<actions>
<action id="Edu.Check" class="com.jetbrains.edu.learning.actions.StudyCheckAction"/>
<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.StudyPreviousTaskAction" text="Previous Task"
description="Navigate to the previous task"/>
<action id="NextTaskAction" class="com.jetbrains.edu.learning.actions.StudyNextTaskAction" text="Next Task"
description="Navigate to the next task"/>
<action id="RefreshTaskAction" class="com.jetbrains.edu.learning.actions.StudyRefreshTaskFileAction" text="Reset Task File"
description="Refresh current task"/>
<action id="RefreshAnswerPlaceholder" class="com.jetbrains.edu.learning.actions.StudyRefreshAnswerPlaceholder" text="Refresh Answer Placeholder">
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
</action>
<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="StudyShowAnswersAction" class="com.jetbrains.edu.learning.actions.StudyFillPlaceholdersAction"
text="Fill Answer Placeholders">
<add-to-group group-id="HelpMenu" anchor="before" relative-to-action="HelpTopics"/>
</action>
<action id="CCEnablePluginAction" class="com.jetbrains.edu.coursecreator.actions.CCPluginToggleAction"
text="Enable Course Creator Features">
<add-to-group group-id="HelpMenu" anchor="before" relative-to-action="HelpTopics"/>
</action>
<action id="StudySwitchPanel" class="com.jetbrains.edu.learning.actions.StudySwitchTaskPanelAction"
text="Switch Task Description Panel">
</action>
<action id="Edu.UpdateRecommendation" popup="true" class="com.jetbrains.edu.learning.actions.StudyUpdateRecommendationAction">
<add-to-group group-id="ProjectViewPopupMenu" anchor="before" relative-to-action="CutCopyPasteGroup"/>
</action>
<!--course creator-->
<action id="CreateLesson" class="com.jetbrains.edu.coursecreator.actions.CCCreateLesson">
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFile"/>
</action>
<action id="CreateTask" class="com.jetbrains.edu.coursecreator.actions.CCCreateTask">
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFile"/>
</action>
<action id="ChangeCourseInfo" class="com.jetbrains.edu.coursecreator.actions.CCChangeCourseInfo"/>
<group id="CC.AddSubtaskGroup">
<action class="com.jetbrains.edu.coursecreator.actions.CCNewSubtaskAction" id="CC.NewStep"/>
<separator/>
<add-to-group group-id="EditorPopupMenu" relative-to-action="AnswerPlaceholderGroup" anchor="after"/>
</group>
<group id="CCProjectViewGroup" popup="true" text="Course Creator"
class="com.jetbrains.edu.coursecreator.actions.CCProjectViewActionGroup">
<action id="AddTaskFile" class="com.jetbrains.edu.coursecreator.actions.CCAddAsTaskFile"/>
<action id="HideTaskFile" class="com.jetbrains.edu.coursecreator.actions.CCHideFromStudent"/>
<action id="ShowPreview" class="com.jetbrains.edu.coursecreator.actions.CCShowPreview">
<add-to-group group-id="EditorTabPopupMenu"/>
</action>
<separator/>
<action id="CC.SwitchSubtask" class="com.jetbrains.edu.coursecreator.actions.CCSwitchSubtask"/>
<reference id="CC.NewStep"/>
<separator/>
<action id="PackCourse" class="com.jetbrains.edu.coursecreator.actions.CCCreateCourseArchive"/>
<action id="PushTask" class="com.jetbrains.edu.coursecreator.actions.stepik.CCPushTask"/>
<action id="PushLesson" class="com.jetbrains.edu.coursecreator.actions.stepik.CCPushLesson"/>
<action id="PushCourse" class="com.jetbrains.edu.coursecreator.actions.stepik.CCPushCourse"/>
<reference id="ChangeCourseInfo"/>
<add-to-group group-id="ProjectViewPopupMenu" anchor="before" relative-to-action="CutCopyPasteGroup"/>
</group>
<group id="CCFileGroup" popup="true" text="Course Creator" class="com.jetbrains.edu.coursecreator.actions.CCFileActionGroup">
<reference id="ChangeCourseInfo"/>
<reference id="PackCourse"/>
<reference id="PushLesson"/>
<reference id="PushCourse"/>
<add-to-group group-id="FileMenu" relative-to-action="FileMainSettingsGroup" anchor="before"/>
</group>
<action id="AddTaskWindow" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCAddAnswerPlaceholder">
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
</action>
<group id="AnswerPlaceholderGroup" popup="true" text="Answer Placeholder"
class="com.jetbrains.edu.coursecreator.CCAnswerPlaceholderActionGroup">
<action id="CC.HideFromPrevSubtasks" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCHidePlaceholderFromPrevSubtasks"/>
<action id="CC.MakeVisibleFromPrevSubtasks" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCMakeVisibleForPrevSubtasks"/>
<action id="CC.ActivatePlaceholder" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCActivatePlaceholder"/>
<action id="CC.DeactivatePlaceholder" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCDeactivatePlaceholder"/>
<action id="EditAnswerPlaceholder" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCEditAnswerPlaceholder"/>
<action id="DeleteAnswerPlaceholder" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCDeleteAnswerPlaceholder"/>
<action id="DeleteAllPlaceholders" class="com.jetbrains.edu.coursecreator.actions.placeholder.CCDeleteAllAnswerPlaceholdersAction"/>
<add-to-group group-id="EditorPopupMenu" anchor="after" relative-to-action="AddTaskWindow"/>
</group>
<action id="UnpackCourse" class="com.jetbrains.edu.coursecreator.actions.CCFromCourseArchive"/>
<action id="GetCourse" class="com.jetbrains.edu.coursecreator.actions.stepik.CCGetCourseFromStepic"/>
<action id="Edu.StartCourse" class="com.jetbrains.edu.learning.newproject.EduBrowseCoursesAction">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
<add-to-group group-id="FileMenu" anchor="first"/>
</action>
</actions>
<extensions defaultExtensionNs="com.intellij">
<applicationConfigurable groupId="tools" instance="com.jetbrains.edu.learning.settings.StudyConfigurable"
id="com.jetbrains.edu.learning.settings.StudyConfigurable"
displayName="Education"/>
<toolWindow id="Task Description" anchor="right" factoryClass="com.jetbrains.edu.learning.ui.StudyToolWindowFactory" conditionClass="com.jetbrains.edu.learning.ui.StudyCondition"/>
<toolWindow id="Test Results" anchor="bottom" factoryClass="com.jetbrains.edu.learning.ui.StudyTestResultsToolWindowFactory" conditionClass="com.jetbrains.edu.learning.ui.StudyCondition"/>
<fileEditorProvider implementation="com.jetbrains.edu.learning.editor.StudyFileEditorProvider"/>
<treeStructureProvider implementation="com.jetbrains.edu.learning.projectView.StudyTreeStructureProvider"/>
<highlightErrorFilter implementation="com.jetbrains.edu.learning.editor.StudyHighlightErrorFilter"/>
<projectService serviceInterface="com.jetbrains.edu.learning.StudyTaskManager"
serviceImplementation="com.jetbrains.edu.learning.StudyTaskManager"/>
<extendWordSelectionHandler implementation="com.jetbrains.edu.learning.StudyAnswerPlaceholderExtendWordHandler"/>
<renameHandler implementation="com.jetbrains.edu.learning.StudyRenameHandler"/>
<refactoring.moveHandler implementation="com.jetbrains.edu.learning.StudyMoveDelegate" order="first"/>
<statistics.usagesCollector implementation="com.jetbrains.edu.learning.statistics.EduUsagesCollector"/>
<applicationService serviceImplementation="com.jetbrains.edu.learning.statistics.EduStatistics"/>
<applicationService serviceImplementation="com.jetbrains.edu.learning.StudySettings"/>
<editorTabTitleProvider implementation="com.jetbrains.edu.learning.StudyTabTitleProvider"/>
<typedHandler implementation="com.jetbrains.edu.learning.StudyTypeHandlerDelegate" order="first, before completionAutoPopup"/>
<httpRequestHandler implementation="com.jetbrains.edu.learning.builtInServer.EduStepikRestService"/>
<!--course creator-->
<projectService serviceImplementation="com.jetbrains.edu.coursecreator.CCProjectService"/>
<treeStructureProvider implementation="com.jetbrains.edu.coursecreator.projectView.CCTreeStructureProvider" order="last"/>
<refactoring.elementListenerProvider implementation="com.jetbrains.edu.coursecreator.CCRefactoringElementListenerProvider"/>
<refactoring.moveHandler implementation="com.jetbrains.edu.coursecreator.handlers.CCLessonMoveHandlerDelegate" order="first"/>
<refactoring.moveHandler implementation="com.jetbrains.edu.coursecreator.handlers.CCTaskMoveHandlerDelegate" order="first"/>
<renameHandler implementation="com.jetbrains.edu.coursecreator.handlers.CCTaskRenameHandler" order="first"/>
<renameHandler implementation="com.jetbrains.edu.coursecreator.handlers.CCLessonRenameHandler" order="first"/>
<applicationService serviceInterface="com.jetbrains.edu.coursecreator.settings.CCSettings"
serviceImplementation="com.jetbrains.edu.coursecreator.settings.CCSettings"/>
<highlightErrorFilter implementation="com.jetbrains.edu.coursecreator.CCHighlightErrorFilter"/>
<editorNotificationProvider implementation="com.jetbrains.edu.coursecreator.CCSubtaskEditorNotificationProvider"/>
<editorTabTitleProvider implementation="com.jetbrains.edu.coursecreator.CCTestsTabTitleProvider"/>
</extensions>
<extensions defaultExtensionNs="Edu">
<optionsProvider instance="com.jetbrains.edu.learning.stepic.StepicStudyOptions"/>
<checkListener implementation="com.jetbrains.edu.learning.twitter.StudyTwitterAction"/>
<checkListener implementation="com.jetbrains.edu.learning.stepic.EduNextRecommendationCheckListener"/>
<!--course creator-->
<optionsProvider instance="com.jetbrains.edu.coursecreator.settings.CCOptions"/>
</extensions>
<application-components>
<component>
<implementation-class>com.jetbrains.edu.learning.stepic.EduCourseUpdater</implementation-class>
</component>
</application-components>
</idea-plugin>
@@ -1,367 +0,0 @@
/*
* 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.
*/
body {
margin-left: 20px;
font-family: Helvetica, sans-serif;
}
code {
font-family: "Source Code Pro", monospace;
}
/* BASICS */
.task-help pre code {
background-color: #f7f7f7;
white-space: pre-wrap;
margin-bottom: 10px;
padding: 5px 25px 5px 15px;
display: inline-block;
margin-right: 21px;
}
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }
/* CURSOR */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0;
background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
.cm-animate-fat-cursor {
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-moz-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@-webkit-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}
.cm-tab { display: inline-block; text-decoration: inherit; }
.CodeMirror-ruler {
border-left: 1px solid #ccc;
position: absolute;
}
/* DEFAULT THEME */
.cm-s-default .cm-header {color: #589df6;}
.cm-s-default .cm-quote {color: #6a864c;}
.cm-negative {color: #d44;}
.cm-positive {color: #6a864c;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}
.cm-s-default .cm-keyword {color: #774688;}
.cm-s-default .cm-atom {color: #5fa2f6;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #589df6;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #4c73aa;}
.cm-s-default .cm-variable-3 {color: #085;}
.cm-s-default .cm-comment {color: #aa7e3e;}
.cm-s-default .cm-string {color: #aa3e3e;}
.cm-s-default .cm-string-2 {color: #ff9e39;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #6a5caa;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #467734;}
.cm-s-default .cm-attribute {color: #589df6;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #589df6;}
.cm-s-default .cm-error {color: #ff4641;}
.cm-invalidchar {color: #ff4641;}
.CodeMirror-composing { border-bottom: 2px solid; }
/* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
.CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
border-right: 30px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
z-index: 3;
}
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
margin-bottom: -30px;
/* Hack to make IE7 behave */
*zoom:1;
*display:inline;
}
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
.CodeMirror-gutter-background {
position: absolute;
top: 0; bottom: 0;
z-index: 4;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-gutter-wrapper {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.CodeMirror-lines {
cursor: text;
min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
overflow: auto;
}
.CodeMirror-widget {}
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-cursor { position: absolute; }
.CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
.CodeMirror span { *vertical-align: text-bottom; }
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }
/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }
@@ -1,147 +0,0 @@
/*
* 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.
*/
.cm-s-default span.cm-keyword {
color: #b07732;
font-weight: bold;
}
.cm-s-default span.cm-softKeyword {
color: #b07732;
font-weight: bold;
}
.cm-s-default span.cm-atom {
color: #b07732;
font-weight: bold;
}
.cm-s-default span.cm-number {
color: #b07732;
}
.cm-s-default span.cm-string {
color: #588652;
font-weight: bold;
}
.cm-s-default span.cm-def {
color: #dddddd;
}
.cm-s-default span.cm-variable {
color: #dddddd;
}
.cm-s-default span.cm-variable-2 {
color: #b07732;
}
.cm-s-default span.cm-variable-3 {
color: #dddddd;
}
.cm-s-default span.cm-property {
color: #dddddd;
}
.cm-s-default span.cm-operator {
color: #dddddd;
}
.cm-s-default span.cm-comment {
color: #7f7f7f;
}
.cm-s-default span.cm-string-2 {
color: #ff9336;
}
.cm-s-default span.cm-meta {
color: #ba9d2a;
}
.cm-s-default span.cm-error {
color: #944b5e;
}
.cm-s-default span.cm-qualifier {
color: #555;
}
.cm-s-default span.cm-builtin {
color: #795faa;
}
.cm-s-default span.cm-bracket {
color: #cc7;
}
.cm-s-default span.cm-tag {
color: #ba9d2a;
}
.cm-s-default span.cm-attribute {
color: #589df6;
}
.cm-s-default span.cm-header {
color: #9d6baa;
}
.cm-s-default span.cm-quote {
color: #6a7846;
}
.cm-s-default span.cm-hr {
color: #999;
}
.cm-s-default span.cm-link {
color: #589df6;
}
span.cm-header, span.cm-strong {
font-weight: bold;
}
span.cm-em {
font-style: italic;
}
span.cm-emstrong {
font-style: italic;
font-weight: bold;
}
span.cm-link {
text-decoration: underline;
}
div.CodeMirror span.CodeMirror-matchingbracket {
/*color: #0000ff;*/
/*border: 1px #0000ff solid;*/
/*background-color: #FFE87C;*/
background-color: #e4e4ff;
}
div.CodeMirror span.CodeMirror-nonmatchingbracket {
color: #b76b5e;
}
span.bullet {
padding-right: 5px;
}
@@ -1,147 +0,0 @@
/*
* 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.
*/
.cm-s-default span.cm-keyword {
color: #000080;
font-weight: bold;
}
.cm-s-default span.cm-softKeyword {
color: #336699;
font-weight: bold;
}
.cm-s-default span.cm-atom {
color: #336699;
font-weight: bold;
}
.cm-s-default span.cm-number {
color: #0000ff;
}
.cm-s-default span.cm-string {
color: #008000;
font-weight: bold;
}
.cm-s-default span.cm-def {
color: black;
}
.cm-s-default span.cm-variable {
color: black;
}
.cm-s-default span.cm-variable-2 {
color: #05a;
}
.cm-s-default span.cm-variable-3 {
color: black;
}
.cm-s-default span.cm-property {
color: black;
}
.cm-s-default span.cm-operator {
color: black;
}
.cm-s-default span.cm-comment {
color: #a50;
}
.cm-s-default span.cm-string-2 {
color: #f50;
}
.cm-s-default span.cm-meta {
color: #008000;
}
.cm-s-default span.cm-error {
color: #f00;
}
.cm-s-default span.cm-qualifier {
color: #555;
}
.cm-s-default span.cm-builtin {
color: #30a;
}
.cm-s-default span.cm-bracket {
color: #cc7;
}
.cm-s-default span.cm-tag {
color: #170;
}
.cm-s-default span.cm-attribute {
color: #00c;
}
.cm-s-default span.cm-header {
color: #a0a;
}
.cm-s-default span.cm-quote {
color: #090;
}
.cm-s-default span.cm-hr {
color: #999;
}
.cm-s-default span.cm-link {
color: #00c;
}
span.cm-header, span.cm-strong {
font-weight: bold;
}
span.cm-em {
font-style: italic;
}
span.cm-emstrong {
font-style: italic;
font-weight: bold;
}
span.cm-link {
text-decoration: underline;
}
div.CodeMirror span.CodeMirror-matchingbracket {
/*color: #0000ff;*/
/*border: 1px #0000ff solid;*/
/*background-color: #FFE87C;*/
background-color: #e4e4ff;
}
div.CodeMirror span.CodeMirror-nonmatchingbracket {
color: #f22;
}
span.bullet {
padding-right: 5px;
}
@@ -1,351 +0,0 @@
body {
margin-left: 20px;
font-family: Helvetica, sans-serif;
color: #4f5254;
}
code {
font-family: "Source Code Pro", monospace;
}
/* BASICS */
.task-help pre code {
background-color: #f7f7f7;
white-space: pre-wrap;
margin-bottom: 10px;
padding: 5px 25px 5px 15px;
display: inline-block;
margin-right: 21px;
}
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }
/* CURSOR */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0;
background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
.cm-animate-fat-cursor {
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-moz-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@-webkit-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}
.cm-tab { display: inline-block; text-decoration: inherit; }
.CodeMirror-ruler {
border-left: 1px solid #ccc;
position: absolute;
}
/* DEFAULT THEME */
.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3 {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}
.CodeMirror-composing { border-bottom: 2px solid; }
/* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
.CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
border-right: 30px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
z-index: 3;
}
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
margin-bottom: -30px;
/* Hack to make IE7 behave */
*zoom:1;
*display:inline;
}
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
.CodeMirror-gutter-background {
position: absolute;
top: 0; bottom: 0;
z-index: 4;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-gutter-wrapper {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.CodeMirror-lines {
cursor: text;
min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
overflow: auto;
}
.CodeMirror-widget {}
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-cursor { position: absolute; }
.CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
.CodeMirror span { *vertical-align: text-bottom; }
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }
/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }
File diff suppressed because it is too large Load Diff
@@ -1,40 +0,0 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("./runmode"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "./runmode"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
function textContent(node, out) {
if (node.nodeType == 3) return out.push(node.nodeValue);
for (var ch = node.firstChild; ch; ch = ch.nextSibling) {
textContent(ch, out);
if (isBlock.test(node.nodeType)) out.push("\n");
}
}
CodeMirror.colorize = function(collection, defaultMode) {
if (!collection) collection = document.body.getElementsByTagName("pre");
for (var i = 0; i < collection.length; ++i) {
var node = collection[i];
var mode = node.getAttribute("data-lang") || defaultMode;
if (!mode) continue;
var text = [];
textContent(node, text);
node.innerHTML = "";
CodeMirror.runMode(text.join(""), mode, node);
node.className += " cm-s-default";
}
};
});
@@ -1,742 +0,0 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// TODO actually recognize syntax of TypeScript constructs
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
function expressionAllowed(stream, state, backUp) {
return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
}
CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var statementIndent = parserConfig.statementIndent;
var jsonldMode = parserConfig.jsonld;
var jsonMode = parserConfig.json || jsonldMode;
var isTS = parserConfig.typescript;
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
// Tokenizer
var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
var jsKeywords = {
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
"return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
"var": kw("var"), "const": kw("var"), "let": kw("var"),
"function": kw("function"), "catch": kw("catch"),
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
"in": operator, "typeof": operator, "instanceof": operator,
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C
};
// Extend the 'normal' keywords with the TypeScript language extensions
if (isTS) {
var type = {type: "variable", style: "variable-3"};
var tsKeywords = {
// object-like things
"interface": kw("class"),
"implements": C,
"namespace": C,
"module": kw("module"),
"enum": kw("module"),
// scope modifiers
"public": kw("modifier"),
"private": kw("modifier"),
"protected": kw("modifier"),
"abstract": kw("modifier"),
// operators
"as": operator,
// types
"string": type, "number": type, "boolean": type, "any": type
};
for (var attr in tsKeywords) {
jsKeywords[attr] = tsKeywords[attr];
}
}
return jsKeywords;
}();
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
function readRegexp(stream) {
var escaped = false, next, inSet = false;
while ((next = stream.next()) != null) {
if (!escaped) {
if (next == "/" && !inSet) return;
if (next == "[") inSet = true;
else if (inSet && next == "]") inSet = false;
}
escaped = !escaped && next == "\\";
}
}
// Used as scratch variables to communicate multiple values without
// consing up tons of objects.
var type, content;
function ret(tp, style, cont) {
type = tp; content = cont;
return style;
}
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
return ret("number", "number");
} else if (ch == "." && stream.match("..")) {
return ret("spread", "meta");
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
return ret(ch);
} else if (ch == "=" && stream.eat(">")) {
return ret("=>", "operator");
} else if (ch == "0" && stream.eat(/x/i)) {
stream.eatWhile(/[\da-f]/i);
return ret("number", "number");
} else if (ch == "0" && stream.eat(/o/i)) {
stream.eatWhile(/[0-7]/i);
return ret("number", "number");
} else if (ch == "0" && stream.eat(/b/i)) {
stream.eatWhile(/[01]/i);
return ret("number", "number");
} else if (/\d/.test(ch)) {
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
return ret("number", "number");
} else if (ch == "/") {
if (stream.eat("*")) {
state.tokenize = tokenComment;
return tokenComment(stream, state);
} else if (stream.eat("/")) {
stream.skipToEnd();
return ret("comment", "comment");
} else if (expressionAllowed(stream, state, 1)) {
readRegexp(stream);
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
return ret("regexp", "string-2");
} else {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator", stream.current());
}
} else if (ch == "`") {
state.tokenize = tokenQuasi;
return tokenQuasi(stream, state);
} else if (ch == "#") {
stream.skipToEnd();
return ret("error", "error");
} else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator", stream.current());
} else if (wordRE.test(ch)) {
stream.eatWhile(wordRE);
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
ret("variable", "variable", word);
}
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next;
if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
state.tokenize = tokenBase;
return ret("jsonld-keyword", "meta");
}
while ((next = stream.next()) != null) {
if (next == quote && !escaped) break;
escaped = !escaped && next == "\\";
}
if (!escaped) state.tokenize = tokenBase;
return ret("string", "string");
};
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "comment");
}
function tokenQuasi(stream, state) {
var escaped = false, next;
while ((next = stream.next()) != null) {
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
state.tokenize = tokenBase;
break;
}
escaped = !escaped && next == "\\";
}
return ret("quasi", "string-2", stream.current());
}
var brackets = "([{}])";
// This is a crude lookahead trick to try and notice that we're
// parsing the argument patterns for a fat-arrow function before we
// actually hit the arrow token. It only works if the arrow is on
// the same line as the arguments and there's no strange noise
// (comments) in between. Fallback is to only notice when we hit the
// arrow, and not declare the arguments as locals for the arrow
// body.
function findFatArrow(stream, state) {
if (state.fatArrowAt) state.fatArrowAt = null;
var arrow = stream.string.indexOf("=>", stream.start);
if (arrow < 0) return;
var depth = 0, sawSomething = false;
for (var pos = arrow - 1; pos >= 0; --pos) {
var ch = stream.string.charAt(pos);
var bracket = brackets.indexOf(ch);
if (bracket >= 0 && bracket < 3) {
if (!depth) { ++pos; break; }
if (--depth == 0) break;
} else if (bracket >= 3 && bracket < 6) {
++depth;
} else if (wordRE.test(ch)) {
sawSomething = true;
} else if (/["'\/]/.test(ch)) {
return;
} else if (sawSomething && !depth) {
++pos;
break;
}
}
if (sawSomething && !depth) state.fatArrowAt = pos;
}
// Parser
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
function JSLexical(indented, column, type, align, prev, info) {
this.indented = indented;
this.column = column;
this.type = type;
this.prev = prev;
this.info = info;
if (align != null) this.align = align;
}
function inScope(state, varname) {
for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return true;
for (var cx = state.context; cx; cx = cx.prev) {
for (var v = cx.vars; v; v = v.next)
if (v.name == varname) return true;
}
}
function parseJS(state, style, type, content, stream) {
var cc = state.cc;
// Communicate our context to the combinators.
// (Less wasteful than consing up a hundred closures on every call.)
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = true;
while(true) {
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
if (combinator(type, content)) {
while(cc.length && cc[cc.length - 1].lex)
cc.pop()();
if (cx.marked) return cx.marked;
if (type == "variable" && inScope(state, content)) return "variable-2";
return style;
}
}
}
// Combinator utils
var cx = {state: null, column: null, marked: null, cc: null};
function pass() {
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
}
function cont() {
pass.apply(null, arguments);
return true;
}
function register(varname) {
function inList(list) {
for (var v = list; v; v = v.next)
if (v.name == varname) return true;
return false;
}
var state = cx.state;
cx.marked = "def";
if (state.context) {
if (inList(state.localVars)) return;
state.localVars = {name: varname, next: state.localVars};
} else {
if (inList(state.globalVars)) return;
if (parserConfig.globalVars)
state.globalVars = {name: varname, next: state.globalVars};
}
}
// Combinators
var defaultVars = {name: "this", next: {name: "arguments"}};
function pushcontext() {
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
cx.state.localVars = defaultVars;
}
function popcontext() {
cx.state.localVars = cx.state.context.vars;
cx.state.context = cx.state.context.prev;
}
function pushlex(type, info) {
var result = function() {
var state = cx.state, indent = state.indented;
if (state.lexical.type == "stat") indent = state.lexical.indented;
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
indent = outer.indented;
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
};
result.lex = true;
return result;
}
function poplex() {
var state = cx.state;
if (state.lexical.prev) {
if (state.lexical.type == ")")
state.indented = state.lexical.indented;
state.lexical = state.lexical.prev;
}
}
poplex.lex = true;
function expect(wanted) {
function exp(type) {
if (type == wanted) return cont();
else if (wanted == ";") return pass();
else return cont(exp);
};
return exp;
}
function statement(type, value) {
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
if (type == "{") return cont(pushlex("}"), block, poplex);
if (type == ";") return cont();
if (type == "if") {
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
cx.state.cc.pop()();
return cont(pushlex("form"), expression, statement, poplex, maybeelse);
}
if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
if (type == "variable") return cont(pushlex("stat"), maybelabel);
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
block, poplex, poplex);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
statement, poplex, popcontext);
if (type == "class") return cont(pushlex("form"), className, poplex);
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
return pass(pushlex("stat"), expression, expect(";"), poplex);
}
function expression(type) {
return expressionInner(type, false);
}
function expressionNoComma(type) {
return expressionInner(type, true);
}
function expressionInner(type, noComma) {
if (cx.state.fatArrowAt == cx.stream.start) {
var body = noComma ? arrowBodyNoComma : arrowBody;
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
}
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
if (type == "function") return cont(functiondef, maybeop);
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
if (type == "quasi") return pass(quasi, maybeop);
if (type == "new") return cont(maybeTarget(noComma));
return cont();
}
function maybeexpression(type) {
if (type.match(/[;\}\)\],]/)) return pass();
return pass(expression);
}
function maybeexpressionNoComma(type) {
if (type.match(/[;\}\)\],]/)) return pass();
return pass(expressionNoComma);
}
function maybeoperatorComma(type, value) {
if (type == ",") return cont(expression);
return maybeoperatorNoComma(type, value, false);
}
function maybeoperatorNoComma(type, value, noComma) {
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
var expr = noComma == false ? expression : expressionNoComma;
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
if (type == "operator") {
if (/\+\+|--/.test(value)) return cont(me);
if (value == "?") return cont(expression, expect(":"), expr);
return cont(expr);
}
if (type == "quasi") { return pass(quasi, me); }
if (type == ";") return;
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
if (type == ".") return cont(property, me);
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
}
function quasi(type, value) {
if (type != "quasi") return pass();
if (value.slice(value.length - 2) != "${") return cont(quasi);
return cont(expression, continueQuasi);
}
function continueQuasi(type) {
if (type == "}") {
cx.marked = "string-2";
cx.state.tokenize = tokenQuasi;
return cont(quasi);
}
}
function arrowBody(type) {
findFatArrow(cx.stream, cx.state);
return pass(type == "{" ? statement : expression);
}
function arrowBodyNoComma(type) {
findFatArrow(cx.stream, cx.state);
return pass(type == "{" ? statement : expressionNoComma);
}
function maybeTarget(noComma) {
return function(type) {
if (type == ".") return cont(noComma ? targetNoComma : target);
else return pass(noComma ? expressionNoComma : expression);
};
}
function target(_, value) {
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
}
function targetNoComma(_, value) {
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
}
function maybelabel(type) {
if (type == ":") return cont(poplex, statement);
return pass(maybeoperatorComma, expect(";"), poplex);
}
function property(type) {
if (type == "variable") {cx.marked = "property"; return cont();}
}
function objprop(type, value) {
if (type == "variable" || cx.style == "keyword") {
cx.marked = "property";
if (value == "get" || value == "set") return cont(getterSetter);
return cont(afterprop);
} else if (type == "number" || type == "string") {
cx.marked = jsonldMode ? "property" : (cx.style + " property");
return cont(afterprop);
} else if (type == "jsonld-keyword") {
return cont(afterprop);
} else if (type == "modifier") {
return cont(objprop)
} else if (type == "[") {
return cont(expression, expect("]"), afterprop);
} else if (type == "spread") {
return cont(expression);
}
}
function getterSetter(type) {
if (type != "variable") return pass(afterprop);
cx.marked = "property";
return cont(functiondef);
}
function afterprop(type) {
if (type == ":") return cont(expressionNoComma);
if (type == "(") return pass(functiondef);
}
function commasep(what, end) {
function proceed(type) {
if (type == ",") {
var lex = cx.state.lexical;
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
return cont(what, proceed);
}
if (type == end) return cont();
return cont(expect(end));
}
return function(type) {
if (type == end) return cont();
return pass(what, proceed);
};
}
function contCommasep(what, end, info) {
for (var i = 3; i < arguments.length; i++)
cx.cc.push(arguments[i]);
return cont(pushlex(end, info), commasep(what, end), poplex);
}
function block(type) {
if (type == "}") return cont();
return pass(statement, block);
}
function maybetype(type) {
if (isTS && type == ":") return cont(typedef);
}
function maybedefault(_, value) {
if (value == "=") return cont(expressionNoComma);
}
function typedef(type) {
if (type == "variable") {cx.marked = "variable-3"; return cont();}
}
function vardef() {
return pass(pattern, maybetype, maybeAssign, vardefCont);
}
function pattern(type, value) {
if (type == "modifier") return cont(pattern)
if (type == "variable") { register(value); return cont(); }
if (type == "spread") return cont(pattern);
if (type == "[") return contCommasep(pattern, "]");
if (type == "{") return contCommasep(proppattern, "}");
}
function proppattern(type, value) {
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
register(value);
return cont(maybeAssign);
}
if (type == "variable") cx.marked = "property";
if (type == "spread") return cont(pattern);
if (type == "}") return pass();
return cont(expect(":"), pattern, maybeAssign);
}
function maybeAssign(_type, value) {
if (value == "=") return cont(expressionNoComma);
}
function vardefCont(type) {
if (type == ",") return cont(vardef);
}
function maybeelse(type, value) {
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
}
function forspec(type) {
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
}
function forspec1(type) {
if (type == "var") return cont(vardef, expect(";"), forspec2);
if (type == ";") return cont(forspec2);
if (type == "variable") return cont(formaybeinof);
return pass(expression, expect(";"), forspec2);
}
function formaybeinof(_type, value) {
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
return cont(maybeoperatorComma, forspec2);
}
function forspec2(type, value) {
if (type == ";") return cont(forspec3);
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
return pass(expression, expect(";"), forspec3);
}
function forspec3(type) {
if (type != ")") cont(expression);
}
function functiondef(type, value) {
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
if (type == "variable") {register(value); return cont(functiondef);}
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, statement, popcontext);
}
function funarg(type) {
if (type == "spread") return cont(funarg);
return pass(pattern, maybetype, maybedefault);
}
function className(type, value) {
if (type == "variable") {register(value); return cont(classNameAfter);}
}
function classNameAfter(type, value) {
if (value == "extends") return cont(expression, classNameAfter);
if (type == "{") return cont(pushlex("}"), classBody, poplex);
}
function classBody(type, value) {
if (type == "variable" || cx.style == "keyword") {
if (value == "static") {
cx.marked = "keyword";
return cont(classBody);
}
cx.marked = "property";
if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);
return cont(functiondef, classBody);
}
if (value == "*") {
cx.marked = "keyword";
return cont(classBody);
}
if (type == ";") return cont(classBody);
if (type == "}") return cont();
}
function classGetterSetter(type) {
if (type != "variable") return pass();
cx.marked = "property";
return cont();
}
function afterExport(_type, value) {
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
return pass(statement);
}
function afterImport(type) {
if (type == "string") return cont();
return pass(importSpec, maybeFrom);
}
function importSpec(type, value) {
if (type == "{") return contCommasep(importSpec, "}");
if (type == "variable") register(value);
if (value == "*") cx.marked = "keyword";
return cont(maybeAs);
}
function maybeAs(_type, value) {
if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
}
function maybeFrom(_type, value) {
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
}
function arrayLiteral(type) {
if (type == "]") return cont();
return pass(expressionNoComma, maybeArrayComprehension);
}
function maybeArrayComprehension(type) {
if (type == "for") return pass(comprehension, expect("]"));
if (type == ",") return cont(commasep(maybeexpressionNoComma, "]"));
return pass(commasep(expressionNoComma, "]"));
}
function comprehension(type) {
if (type == "for") return cont(forspec, comprehension);
if (type == "if") return cont(expression, comprehension);
}
function isContinuedStatement(state, textAfter) {
return state.lastType == "operator" || state.lastType == "," ||
isOperatorChar.test(textAfter.charAt(0)) ||
/[,.]/.test(textAfter.charAt(0));
}
// Interface
return {
startState: function(basecolumn) {
var state = {
tokenize: tokenBase,
lastType: "sof",
cc: [],
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
localVars: parserConfig.localVars,
context: parserConfig.localVars && {vars: parserConfig.localVars},
indented: basecolumn || 0
};
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
state.globalVars = parserConfig.globalVars;
return state;
},
token: function(stream, state) {
if (stream.sol()) {
if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = false;
state.indented = stream.indentation();
findFatArrow(stream, state);
}
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
if (type == "comment") return style;
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
return parseJS(state, style, type, content, stream);
},
indent: function(state, textAfter) {
if (state.tokenize == tokenComment) return CodeMirror.Pass;
if (state.tokenize != tokenBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
// Kludge to prevent 'maybelse' from blocking lexical scope pops
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
var c = state.cc[i];
if (c == poplex) lexical = lexical.prev;
else if (c != maybeelse) break;
}
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
lexical = lexical.prev;
var type = lexical.type, closing = firstChar == type;
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "form") return lexical.indented + indentUnit;
else if (type == "stat")
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
else return lexical.indented + (closing ? 0 : indentUnit);
},
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
blockCommentStart: jsonMode ? null : "/*",
blockCommentEnd: jsonMode ? null : "*/",
lineComment: jsonMode ? null : "//",
fold: "brace",
closeBrackets: "()[]{}''\"\"``",
helperType: jsonMode ? "json" : "javascript",
jsonldMode: jsonldMode,
jsonMode: jsonMode,
expressionAllowed: expressionAllowed,
skipExpression: function(state) {
var top = state.cc[state.cc.length - 1]
if (top == expression || top == expressionNoComma) state.cc.pop()
}
};
});
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("text/ecmascript", "javascript");
CodeMirror.defineMIME("application/javascript", "javascript");
CodeMirror.defineMIME("application/x-javascript", "javascript");
CodeMirror.defineMIME("application/ecmascript", "javascript");
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
});
@@ -1,72 +0,0 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.runMode = function(string, modespec, callback, options) {
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
var ie = /MSIE \d/.test(navigator.userAgent);
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
if (callback.appendChild) {
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
var node = callback, col = 0;
node.innerHTML = "";
callback = function(text, style) {
if (text == "\n") {
// Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
// Emitting a carriage return makes everything ok.
node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
col = 0;
return;
}
var content = "";
// replace tabs
for (var pos = 0;;) {
var idx = text.indexOf("\t", pos);
if (idx == -1) {
content += text.slice(pos);
col += text.length - pos;
break;
} else {
col += idx - pos;
content += text.slice(pos, idx);
var size = tabSize - col % tabSize;
col += size;
for (var i = 0; i < size; ++i) content += " ";
pos = idx + 1;
}
}
if (style) {
var sp = node.appendChild(document.createElement("span"));
sp.className = "cm-" + style.replace(/ +/g, " cm-");
sp.appendChild(document.createTextNode(content));
} else {
node.appendChild(document.createTextNode(content));
}
};
}
var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
for (var i = 0, e = lines.length; i < e; ++i) {
if (i) callback("\n");
var stream = new CodeMirror.StringStream(lines[i]);
if (!stream.string && mode.blankLine) mode.blankLine(state);
while (!stream.eol()) {
var style = mode.token(stream, state);
callback(stream.current(), style, i, stream.start, state);
stream.start = stream.pos;
}
}
};
});
@@ -1,64 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<!--all elements like "${}" is replaced by real values while loading page in StudyBrowser-->
<!--suppress HtmlUnknownTarget -->
<link rel="stylesheet" href="${css_oldcodemirror}">
<!--suppress HtmlUnknownTarget -->
<link rel="stylesheet" href="${css_codemirror}">
<!--suppress HtmlUnknownTarget -->
<script src="${codemirror}"></script>
<!--suppress HtmlUnknownTarget -->
<script src="${colorize}"></script>
<!--suppress HtmlUnknownTarget -->
<script src="${runmode}"></script>
<!--suppress HtmlUnknownTarget -->
<script src="${highlight_mode}"></script>
<!--suppress HtmlUnknownTarget -->
<script src="${javascript}"></script>
<!--suppress HtmlUnknownTarget -->
<script src="${language_script}"></script>
<!--suppress CssInvalidPropertyValue -->
<style media="screen" type="text/css">
html, body {
height:100%;
overflow:hidden;
font-size: ${font_size}pt !important;
}
.wrapper {
overflow-y:scroll;
height: 96%;
}
/*used to place task on Stepik link*/
/*noinspection CssUnusedSymbol*/
.footer {
position:fixed;
line-height: 3.5em;
bottom: 5%;
right: 1%;
width: 95%;
text-align: right;
}
</style>
</head>
<body>
<div class=wrapper>
${code}
</div>
<script>
var nodeList = document.body.getElementsByTagName("code");
nodes = Array.prototype.slice.call(nodeList, 0);
nodes.forEach(function (node) {
var text = node.innerHTML
node.innerHTML = text.replace(/<br\s*>/g, '\n')
});
CodeMirror.colorize(nodeList, "python")
CodeMirror.colorize();
</script>
</body>
</html>
@@ -1,18 +0,0 @@
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
public class EduTestRunner {
public static void main(String[] args) throws ClassNotFoundException {
Class<?> testClass = EduTestRunner.class.getClassLoader().loadClass(args[0]);
JUnitCore runner = new JUnitCore();
runner.addListener(new RunListener() {
@Override
public void testFailure(Failure failure) throws Exception {
System.out.println("#educational_plugin FAILED + " + failure.getMessage());
}
});
runner.run(testClass);
}
}
@@ -1,4 +0,0 @@
<html>
Write your task text here.
<br>
</html>
@@ -1,3 +0,0 @@
This is the markdown document.
Write your task text here
Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

@@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Stepik Authorization Succeeded</title>
<style>
body {
color: #161616;
font-size: 400%;
line-height: 1;
font-family: "GraublauSlab-Semibold", Helvetica, Arial, sans-serif;
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
text-align: center;
}
</style>
</head>
<body>
Authorization failed.
<br>
Couldn't find code parameter for Stepik OAuth
</body>
</html>
@@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Stepik Authorization Succeeded</title>
<style>
body {
color: #161616;
font-size: 400%;
line-height: 1;
font-family: "GraublauSlab-Semibold", Helvetica, Arial, sans-serif;
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
text-align: center;
}
</style>
</head>
<body>
Authorization succeeded.
<br>
You may return to %IDE_NAME
</body>
</html>
@@ -1,22 +0,0 @@
.radio-button .radio {
-fx-border-radius: 15px;
-fx-padding: 5px;
}
.radio-button .dot {
-fx-background-radius: 15px;
-fx-padding: 4px;
}
.check-box .box {
-fx-background-color: -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color;
-fx-background-insets: 0 0 -1 0, 0, 1, 2;
-fx-background-radius: 2, 2, 1, 1;
-fx-padding: 0.25em; /* 3 -- padding from the outside edge to the mark */
}
.check-box .mark {
-fx-background-insets: 1 0 -1 0, 0;
-fx-padding: 0.333333em; /* 4 -- this is half the size of the mark */
-fx-shape: "M14.596,2.055L12.455,0C9.687,2.884,6.011,6.714,5.158,7.602L2.055,4.624L0,6.765l5.242,5.037l0.003-0.004 l0.003,0.004L14.596,2.055z";
}
@@ -1,64 +0,0 @@
.radio-button {
-fx-text-fill: #bababa;
}
.radio-button:selected .radio {
-fx-border-radius: 15px;
-fx-padding: 5px;
-fx-background-color: #4f5254;
-fx-border-color: #589df6;
}
.radio-button .radio {
-fx-border-radius: 15px;
-fx-padding: 5px;
-fx-background-color: #4f5254;
-fx-border-color: #323232;
}
.radio-button:selected .dot {
-fx-background-color: #bababa;
}
.toggle-button:selected {
-fx-background-color: #3c3f41;
-fx-background-insets: 0 0 0 0, 0, 0;
}
.toggle-button:selected:focused {
-fx-background-color: #3c3f41;
-fx-background-insets: 1, 1, 1, 1;
-fx-background-radius: 2, 2, 2, 2;
}
.radio-button .dot {
-fx-background-radius: 15px;
-fx-padding: 4px;
-fx-background-color: transparent;
}
.check-box {
-fx-text-fill: #bababa;
}
.check-box .box {
-fx-background-color: #4f5254;
/*-fx-background-color: -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color;*/
-fx-background-insets: 0 0 -1 0, 0, 1, 2;
-fx-background-radius: 2, 2, 1, 1;
-fx-padding: 0.25em; /* 3 -- padding from the outside edge to the mark */
}
.check-box .mark {
-fx-background-color: transparent;
-fx-background-insets: 1 0 -1 0, 0;
-fx-padding: 0.333333em; /* 4 -- this is half the size of the mark */
-fx-shape: "M14.596,2.055L12.455,0C9.687,2.884,6.011,6.714,5.158,7.602L2.055,4.624L0,6.765l5.242,5.037l0.003-0.004 l0.003,0.004L14.596,2.055z";
}
.check-box:selected .mark {
-fx-background-color: #bababa;
-fx-background-insets: 1 0 -1 0, 0;
-fx-padding: 0.333333em; /* 4 -- this is half the size of the mark */
-fx-shape: "M14.596,2.055L12.455,0C9.687,2.884,6.011,6.714,5.158,7.602L2.055,4.624L0,6.765l5.242,5.037l0.003-0.004 l0.003,0.004L14.596,2.055z";
}
@@ -1,20 +0,0 @@
.example {
background-color: #c4c4c4;
}
a {
text-decoration: none;
position: relative;
}
a:after {
content: '';
width: 100%;
position: absolute;
left: 0;
bottom: 1px;
border-width: 0 0 1px;
border-style: solid;
}
@@ -1,43 +0,0 @@
::-webkit-scrollbar-corner {
background-color: #3c3f41;
}
body {
background-color: #3c3f41;
color: #bababa
}
p img {
background-color: #bababa;
}
textarea {
background-color: #3c3f41;
color: #bababa
}
a {
color: #589df6;
text-decoration: none;
position: relative;
}
a:after {
content: '';
width: 100%;
position: absolute;
left: 0;
bottom: 1px;
border-width: 0 0 1px;
border-style: solid;
}
tr {
text-align: left
}
.example {
background-color: #4f5254;
}
@@ -1,56 +0,0 @@
.scroll-bar{
-fx-background-color: #3c3f41;
-fx-background-radius: 2em;
}
.scroll-bar:horizontal .track,
.scroll-bar:vertical .track {
-fx-background-color: #3c3f41;
-fx-border-color:transparent;
-fx-background-radius: 2em;
}
.scroll-bar:vertical .track-background,
.scroll-bar:horizontal .track-background {
-fx-background-color: #3c3f41;
}
.scroll-bar:horizontal .thumb {
-fx-background-color: #bbbbbb;
-fx-background-insets: 4 0 4 0;
-fx-background-radius: 2em;
-fx-opacity: 0.2;
}
.scroll-bar:vertical .thumb {
-fx-background-color: #bbbbbb;
-fx-background-insets: 0 4 0 4;
-fx-background-radius: 2em;
-fx-opacity: 0.2;
}
.scroll-bar:vertical:corner-present {
-fx-shape: " ";
-fx-width: 0;
}
.scroll-bar:horizontal:corner-present {
-fx-shape: " ";
-fx-width: 0;
}
.scroll-bar-corner {
-fx-background-color: #3c3f41;
}
.scroll-bar:horizontal .increment-arrow {
-fx-shape: " "
}
.scroll-bar:vertical .increment-arrow {
-fx-shape: " "
}
.scroll-bar:horizontal .decrement-arrow {
-fx-shape: " "
}
.scroll-bar:vertical .decrement-arrow {
-fx-shape: " "
}
@@ -1,51 +0,0 @@
.scroll-bar{
-fx-background-color: #ffffff;
-fx-background-radius: 2em;
}
.scroll-bar:horizontal .track,
.scroll-bar:vertical .track {
-fx-background-color: #ffffff;
-fx-border-color:transparent;
-fx-background-radius: 2em;
}
.scroll-bar:vertical .track-background,
.scroll-bar:horizontal .track-background {
-fx-background-color: #ffffff;
}
.scroll-bar:horizontal .thumb {
-fx-background-color: #dddddd;
-fx-background-insets: 4 0 4 0;
-fx-background-radius: 2em;
}
.scroll-bar:vertical .thumb {
-fx-background-color: #dddddd;
-fx-background-insets: 0 4 0 4;
-fx-background-radius: 2em;
}
.scroll-bar:vertical:corner-present {
-fx-shape: " ";
-fx-width: 0;
}
.scroll-bar:horizontal:corner-present {
-fx-shape: " ";
-fx-width: 0;
}
.scroll-bar-corner {
-fx-background-color: #ffffff;
}
.scroll-bar:horizontal .increment-arrow {
-fx-shape: " "
}
.scroll-bar:vertical .increment-arrow {
-fx-shape: " "
}
.scroll-bar:horizontal .decrement-arrow {
-fx-shape: " "
}
.scroll-bar:vertical .decrement-arrow {
-fx-shape: " "
}
@@ -1,12 +0,0 @@
package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.project.DumbAware;
public class CCAnswerPlaceholderActionGroup extends DefaultActionGroup implements DumbAware {
@Override
public void update(AnActionEvent e) {
CCUtils.updateActionGroup(e);
}
}
@@ -1,25 +0,0 @@
package com.jetbrains.edu.coursecreator;
import com.intellij.codeInsight.highlighting.HighlightErrorFilter;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiErrorElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
public class CCHighlightErrorFilter extends HighlightErrorFilter {
@Override
public boolean shouldHighlightErrorElement(@NotNull PsiErrorElement element) {
PsiFile file = element.getContainingFile();
if (file == null) {
return true;
}
VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile == null) {
return true;
}
if (virtualFile.getPath().contains(CCUtils.GENERATED_FILES_FOLDER)) {
return false;
}
return true;
}
}
@@ -1,126 +0,0 @@
package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.core.EduNames;
import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.courseFormat.Lesson;
import com.jetbrains.edu.learning.courseFormat.TaskFile;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
import com.jetbrains.edu.learning.statistics.EduUsagesCollector;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class CCProjectComponent extends AbstractProjectComponent {
private static final Logger LOG = Logger.getInstance(CCProjectComponent.class);
private CCVirtualFileListener myTaskFileLifeListener;
private final Project myProject;
protected CCProjectComponent(Project project) {
super(project);
myProject = project;
}
public void migrateIfNeeded() {
Course studyCourse = StudyTaskManager.getInstance(myProject).getCourse();
if (studyCourse == null) {
Course oldCourse = CCProjectService.getInstance(myProject).getCourse();
if (oldCourse == null) {
return;
}
StudyTaskManager.getInstance(myProject).setCourse(oldCourse);
CCProjectService.getInstance(myProject).setCourse(null);
oldCourse.initCourse(true);
oldCourse.setCourseMode(CCUtils.COURSE_MODE);
StudyUtils.registerStudyToolWindow(oldCourse, myProject);
transformFiles(oldCourse, myProject);
}
}
private static void transformFiles(Course course, Project project) {
List<VirtualFile> files = getAllAnswerTaskFiles(course, project);
for (VirtualFile answerFile : files) {
ApplicationManager.getApplication().runWriteAction(() -> {
String answerName = answerFile.getName();
String nameWithoutExtension = FileUtil.getNameWithoutExtension(answerName);
String name = FileUtil.getNameWithoutExtension(nameWithoutExtension) + "." + FileUtilRt.getExtension(answerName);
VirtualFile parent = answerFile.getParent();
VirtualFile file = parent.findChild(name);
try {
if (file != null) {
file.delete(CCProjectComponent.class);
}
VirtualFile windowsDescrFile = parent.findChild(FileUtil.getNameWithoutExtension(name) + EduNames.WINDOWS_POSTFIX);
if (windowsDescrFile != null) {
windowsDescrFile.delete(CCProjectComponent.class);
}
answerFile.rename(CCProjectComponent.class, name);
}
catch (IOException e) {
LOG.error(e);
}
});
}
}
private static List<VirtualFile> getAllAnswerTaskFiles(@NotNull Course course, @NotNull Project project) {
List<VirtualFile> result = new ArrayList<>();
for (Lesson lesson : course.getLessons()) {
for (Task task : lesson.getTaskList()) {
for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
String name = entry.getKey();
String answerName = FileUtil.getNameWithoutExtension(name) + CCUtils.ANSWER_EXTENSION_DOTTED + FileUtilRt.getExtension(name);
String taskPath = FileUtil.join(project.getBasePath(), EduNames.LESSON + lesson.getIndex(), EduNames.TASK + task.getIndex());
VirtualFile taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, answerName));
if (taskFile == null) {
taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, EduNames.SRC, answerName));
}
if (taskFile != null) {
result.add(taskFile);
}
}
}
}
return result;
}
@NotNull
public String getComponentName() {
return "CCProjectComponent";
}
public void projectOpened() {
migrateIfNeeded();
if (CCUtils.isCourseCreator(myProject)) {
registerListener();
EduUsagesCollector.projectTypeOpened(CCUtils.COURSE_MODE);
}
}
public void registerListener() {
if (myTaskFileLifeListener == null) {
myTaskFileLifeListener = new CCVirtualFileListener(myProject);
VirtualFileManager.getInstance().addVirtualFileListener(myTaskFileLifeListener);
}
}
public void projectClosed() {
if (myTaskFileLifeListener != null) {
VirtualFileManager.getInstance().removeVirtualFileListener(myTaskFileLifeListener);
}
}
}
@@ -1,113 +0,0 @@
/*
* Copyright 2000-2013 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.coursecreator;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.xmlb.XmlSerializer;
import com.intellij.util.xmlb.annotations.Transient;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.courseFormat.Course;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
import static com.jetbrains.edu.learning.StudySerializationUtils.*;
import static com.jetbrains.edu.learning.StudySerializationUtils.Xml.*;
/**
* @deprecated since version 3
*/
@State(name = "CCProjectService", storages = @Storage("course_service.xml"))
public class CCProjectService implements PersistentStateComponent<Element> {
private static final Logger LOG = Logger.getInstance(CCProjectService.class);
private Course myCourse;
@Transient private final Project myProject;
public CCProjectService() {
this(null);
}
public CCProjectService(Project project) {
myProject = project;
}
public Course getCourse() {
return myCourse;
}
public void setCourse(Course course) {
myCourse = course;
}
@Override
public Element getState() {
if (myCourse == null) {
return null;
}
return XmlSerializer.serialize(this);
}
@Override
public void loadState(Element state) {
try {
Element courseElement = getChildWithName(state, COURSE).getChild(COURSE_TITLED);
for (Element lesson : getChildList(courseElement, LESSONS, true)) {
int lessonIndex = getAsInt(lesson, INDEX);
for (Element task : getChildList(lesson, TASK_LIST, true)) {
int taskIndex = getAsInt(task, INDEX);
Map<String, Element> taskFiles = getChildMap(task, TASK_FILES, true);
for (Map.Entry<String, Element> entry : taskFiles.entrySet()) {
Element taskFileElement = entry.getValue();
String name = entry.getKey();
String answerName = FileUtil.getNameWithoutExtension(name) + CCUtils.ANSWER_EXTENSION_DOTTED + FileUtilRt.getExtension(name);
Document document = StudyUtils.getDocument(myProject.getBasePath(), lessonIndex, taskIndex, answerName);
if (document == null) {
document = StudyUtils.getDocument(myProject.getBasePath(), lessonIndex, taskIndex, name);
if (document == null) {
continue;
}
}
for (Element placeholder : getChildList(taskFileElement, ANSWER_PLACEHOLDERS, true)) {
Element lineElement = getChildWithName(placeholder, LINE, true);
int line = lineElement != null ? Integer.valueOf(lineElement.getAttributeValue(VALUE)) : 0;
Element startElement = getChildWithName(placeholder, START, true);
int start = startElement != null ? Integer.valueOf(startElement.getAttributeValue(VALUE)) : 0;
int offset = document.getLineStartOffset(line) + start;
addChildWithName(placeholder, OFFSET, offset);
addChildWithName(placeholder, "useLength", "false");
}
}
}
}
XmlSerializer.deserializeInto(this, state);
} catch (StudyUnrecognizedFormatException e) {
LOG.error(e);
}
}
public static CCProjectService getInstance(@NotNull Project project) {
return ServiceManager.getService(project, CCProjectService.class);
}
}
@@ -1,101 +0,0 @@
/*
* 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.coursecreator;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.refactoring.listeners.RefactoringElementAdapter;
import com.intellij.refactoring.listeners.RefactoringElementListener;
import com.intellij.refactoring.listeners.RefactoringElementListenerProvider;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.core.EduNames;
import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.courseFormat.Lesson;
import com.jetbrains.edu.learning.courseFormat.TaskFile;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
public class CCRefactoringElementListenerProvider implements RefactoringElementListenerProvider {
@Nullable
@Override
public RefactoringElementListener getListener(PsiElement element) {
return new CCRenameListener(element);
}
static class CCRenameListener extends RefactoringElementAdapter {
private String myElementRelativePath;
public CCRenameListener(PsiElement element) {
if (element instanceof PsiFile) {
PsiFile psiFile = (PsiFile)element;
myElementRelativePath = StudyUtils.pathRelativeToTask(psiFile.getVirtualFile());
}
}
@Override
protected void elementRenamedOrMoved(@NotNull PsiElement newElement) {
if (newElement instanceof PsiFile && myElementRelativePath != null) {
PsiFile psiFile = (PsiFile)newElement;
tryToRenameTaskFile(psiFile, myElementRelativePath);
}
}
private static void tryToRenameTaskFile(PsiFile file, String oldName) {
final PsiDirectory taskDir = file.getContainingDirectory();
final Project project = file.getProject();
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
if (taskDir == null || !taskDir.getName().contains(EduNames.TASK)) {
return;
}
PsiDirectory lessonDir = taskDir.getParent();
if (lessonDir == null || !lessonDir.getName().contains(EduNames.LESSON)) {
return;
}
Lesson lesson = course.getLesson(lessonDir.getName());
if (lesson == null) {
return;
}
Task task = lesson.getTask(taskDir.getName());
if (task == null) {
return;
}
Map<String, TaskFile> taskFiles = task.getTaskFiles();
TaskFile taskFile = task.getTaskFile(oldName);
if (taskFile == null) {
return;
}
taskFiles.remove(oldName);
taskFiles.put(StudyUtils.pathRelativeToTask(file.getVirtualFile()), taskFile);
}
@Override
public void undoElementMovedOrRenamed(@NotNull PsiElement newElement, @NotNull String oldQualifiedName) {
}
}
}
@@ -1,276 +0,0 @@
package com.jetbrains.edu.coursecreator;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.ui.popup.ListSeparator;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.EditorNotificationPanel;
import com.intellij.ui.EditorNotifications;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.EmptyIcon;
import com.jetbrains.edu.coursecreator.actions.CCNewSubtaskAction;
import com.jetbrains.edu.learning.StudySubtaskUtils;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.core.EduNames;
import com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder;
import com.jetbrains.edu.learning.courseFormat.AnswerPlaceholderSubtaskInfo;
import com.jetbrains.edu.learning.courseFormat.Lesson;
import com.jetbrains.edu.learning.courseFormat.TaskFile;
import com.jetbrains.edu.learning.courseFormat.tasks.PyCharmTask;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
import com.jetbrains.edu.learning.courseFormat.tasks.TaskWithSubtasks;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.io.IOException;
import java.util.*;
import static com.jetbrains.edu.coursecreator.CCUtils.renameFiles;
public class CCSubtaskEditorNotificationProvider extends EditorNotifications.Provider<EditorNotificationPanel> implements DumbAware {
private static final Key<EditorNotificationPanel> KEY = Key.create("edu.coursecreator.subtask");
public static final String SWITCH_SUBTASK = "Switch subtask";
public static final Integer ADD_SUBTASK_ID = -1;
private static final Logger LOG = Logger.getInstance(CCSubtaskEditorNotificationProvider.class);
private final Project myProject;
public CCSubtaskEditorNotificationProvider(Project project) {
myProject = project;
}
@NotNull
@Override
public Key<EditorNotificationPanel> getKey() {
return KEY;
}
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (!CCUtils.isCourseCreator(myProject)) {
return null;
}
boolean isTestFile = CCUtils.isTestsFile(myProject, file);
if (!isTestFile && StudyUtils.getTaskFile(myProject, file) == null) {
return null;
}
Task task = StudyUtils.getTaskForFile(myProject, file);
if (task instanceof TaskWithSubtasks) {
final TaskWithSubtasks withSubtasks = (TaskWithSubtasks)task;
EditorNotificationPanel panel = new EditorNotificationPanel(EditorColors.GUTTER_BACKGROUND);
String header = (isTestFile ? "test" : "task") + " file";
int activeSubtaskIndex = withSubtasks.getActiveSubtaskIndex() + 1;
int subtaskSize = withSubtasks.getLastSubtaskIndex() + 1;
panel.setText("This is a " + header + " for " + EduNames.SUBTASK + " " + activeSubtaskIndex + "/" + subtaskSize);
panel
.createActionLabel(SWITCH_SUBTASK, () -> createPopup(withSubtasks, myProject).show(RelativePoint.getSouthEastOf(panel)));
return panel;
}
return null;
}
@NotNull
public static ListPopup createPopup(@NotNull TaskWithSubtasks task, @NotNull Project project) {
ArrayList<Integer> values = new ArrayList<>();
for (int i = 0; i <= task.getLastSubtaskIndex(); i++) {
values.add(i);
}
values.add(ADD_SUBTASK_ID);
return JBPopupFactory.getInstance().createListPopup(new SwitchSubtaskPopupStep(SWITCH_SUBTASK, values, task, project));
}
public static class SwitchSubtaskPopupStep extends BaseListPopupStep<Integer> {
private final TaskWithSubtasks myTask;
private final Project myProject;
public SwitchSubtaskPopupStep(@Nullable String title,
List<Integer> values,
@NotNull TaskWithSubtasks task,
@NotNull Project project) {
super(title, values);
myTask = task;
myProject = project;
}
@NotNull
@Override
public String getTextFor(Integer value) {
if (value.equals(ADD_SUBTASK_ID)) {
return CCNewSubtaskAction.NEW_SUBTASK;
}
int subtaskNum = value + 1;
return " " + EduNames.SUBTASK + " " + subtaskNum;
}
@Override
public Icon getIconFor(Integer value) {
return value == myTask.getActiveSubtaskIndex() ? AllIcons.Actions.Checked : EmptyIcon.create(AllIcons.Actions.Checked);
}
@Override
public PopupStep onChosen(Integer selectedValue, boolean finalChoice) {
if (finalChoice) {
if (selectedValue.equals(ADD_SUBTASK_ID)) {
return doFinalStep(() -> CCNewSubtaskAction.addSubtask(myTask, myProject));
}
StudySubtaskUtils.switchStep(myProject, myTask, selectedValue);
}
else {
if (hasSubstep(selectedValue)) {
return new ActionsPopupStep(myTask, selectedValue, myProject);
}
}
return super.onChosen(selectedValue, false);
}
@Override
public boolean hasSubstep(Integer selectedValue) {
return !selectedValue.equals(ADD_SUBTASK_ID);
}
@Override
public int getDefaultOptionIndex() {
return myTask.getActiveSubtaskIndex();
}
@Nullable
@Override
public ListSeparator getSeparatorAbove(Integer value) {
return value.equals(ADD_SUBTASK_ID) ? new ListSeparator() : null;
}
}
private static class ActionsPopupStep extends BaseListPopupStep<String> {
public static final String SELECT = "Select";
public static final String DELETE = "Delete";
private final TaskWithSubtasks myTask;
private final int mySubtaskIndex;
private final Project myProject;
public ActionsPopupStep(@NotNull TaskWithSubtasks task, int subtaskIndex, @NotNull Project project) {
super(null, Arrays.asList(SELECT, DELETE));
myTask = task;
mySubtaskIndex = subtaskIndex;
myProject = project;
}
@Override
public PopupStep onChosen(String selectedValue, boolean finalChoice) {
if (finalChoice) {
if (selectedValue.equals(SELECT)) {
StudySubtaskUtils.switchStep(myProject, myTask, mySubtaskIndex);
}
else {
return deleteSubtask();
}
}
return super.onChosen(selectedValue, finalChoice);
}
@Nullable
private PopupStep deleteSubtask() {
final int lastSubtaskIndex = myTask.getLastSubtaskIndex();
for (TaskFile taskFile : myTask.getTaskFiles().values()) {
List<AnswerPlaceholder> emptyPlaceholders = new ArrayList<>();
for (AnswerPlaceholder placeholder : taskFile.getAnswerPlaceholders()) {
Map<Integer, AnswerPlaceholderSubtaskInfo> infos = placeholder.getSubtaskInfos();
if (infos.containsKey(mySubtaskIndex)) {
infos.remove(mySubtaskIndex);
if (infos.isEmpty()) {
emptyPlaceholders.add(placeholder);
}
}
}
taskFile.getAnswerPlaceholders().removeAll(emptyPlaceholders);
}
VirtualFile taskDir = myTask.getTaskDir(myProject);
if (taskDir == null) {
return FINAL_CHOICE;
}
deleteSubtaskFiles(taskDir);
if (mySubtaskIndex != lastSubtaskIndex) {
renameFiles(taskDir, myProject, mySubtaskIndex);
updateInfoIndexes();
}
myTask.setLastSubtaskIndex(lastSubtaskIndex - 1);
int activeSubtaskIndex = myTask.getActiveSubtaskIndex();
if (mySubtaskIndex != 0 && activeSubtaskIndex == mySubtaskIndex) {
StudySubtaskUtils.switchStep(myProject, myTask, mySubtaskIndex - 1);
}
if (activeSubtaskIndex > mySubtaskIndex) {
myTask.setActiveSubtaskIndex(activeSubtaskIndex - 1);
}
StudySubtaskUtils.updateUI(myProject, myTask, true);
for (VirtualFile file : FileEditorManager.getInstance(myProject).getOpenFiles()) {
EditorNotifications.getInstance(myProject).updateNotifications(file);
}
if (lastSubtaskIndex == 1) {
convertToTask();
}
return FINAL_CHOICE;
}
private void convertToTask() {
final Lesson lesson = myTask.getLesson();
final List<Task> list = lesson.getTaskList();
final int i = list.indexOf(myTask);
final Task task = new PyCharmTask();
task.copyTaskParameters(myTask);
for (TaskFile taskFile : task.getTaskFiles().values()) {
taskFile.setTask(task);
}
list.set(i, task);
renameFiles(task.getTaskDir(myProject), myProject, -2);
}
private void updateInfoIndexes() {
for (TaskFile taskFile : myTask.getTaskFiles().values()) {
for (AnswerPlaceholder placeholder : taskFile.getAnswerPlaceholders()) {
List<Integer> filtered = ContainerUtil.filter(placeholder.getSubtaskInfos().keySet(), index -> index > mySubtaskIndex);
Map<Integer, AnswerPlaceholderSubtaskInfo> savedInfos = new HashMap<>();
for (Integer index : filtered) {
savedInfos.put(index, placeholder.getSubtaskInfos().get(index));
placeholder.getSubtaskInfos().remove(index);
}
for (Integer index : filtered) {
placeholder.getSubtaskInfos().put(index - 1, savedInfos.get(index));
}
}
}
}
private void deleteSubtaskFiles(VirtualFile taskDir) {
ApplicationManager.getApplication().runWriteAction(() -> {
List<VirtualFile> filesToDelete = new ArrayList<>();
for (VirtualFile file : taskDir.getChildren()) {
int index = CCUtils.getSubtaskIndex(myProject, file);
if (index != -1 && mySubtaskIndex == index) {
filesToDelete.add(file);
}
}
for (VirtualFile file : filesToDelete) {
try {
file.delete(myProject);
}
catch (IOException e) {
LOG.info(e);
}
}
});
}
}
}
@@ -1,29 +0,0 @@
package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.edu.learning.EduPluginConfigurator;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.courseFormat.Course;
import org.jetbrains.annotations.Nullable;
public class CCTestsTabTitleProvider implements EditorTabTitleProvider {
@Nullable
@Override
public String getEditorTabTitle(Project project, VirtualFile file) {
if (!CCUtils.isCourseCreator(project)) {
return null;
}
if (!CCUtils.isTestsFile(project, file)) {
return null;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
assert course != null;
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(course.getLanguageById());
if (configurator == null) {
return null;
}
return configurator.getTestFileName();
}
}
@@ -1,310 +0,0 @@
package com.jetbrains.edu.coursecreator;
import com.google.common.collect.Collections2;
import com.intellij.lang.Language;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileVisitor;
import com.intellij.psi.PsiDirectory;
import com.intellij.util.Function;
import com.intellij.util.containers.hash.HashMap;
import com.jetbrains.edu.learning.EduPluginConfigurator;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.core.EduNames;
import com.jetbrains.edu.learning.core.EduUtils;
import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.courseFormat.Lesson;
import com.jetbrains.edu.learning.courseFormat.StudyItem;
import com.jetbrains.edu.learning.courseFormat.TaskFile;
import com.jetbrains.edu.learning.courseFormat.tasks.PyCharmTask;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
import org.apache.commons.codec.binary.Base64;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
public class CCUtils {
public static final String ANSWER_EXTENSION_DOTTED = ".answer.";
public static final String TASK_DESCRIPTION_TEXT = "Write task description here using markdown or html";
private static final Logger LOG = Logger.getInstance(CCUtils.class);
public static final String GENERATED_FILES_FOLDER = ".coursecreator";
public static final String COURSE_MODE = "Course Creator";
public static int getSubtaskIndex(@NotNull Project project, @NotNull VirtualFile file) {
String fileName = file.getName();
String name = FileUtil.getNameWithoutExtension(fileName);
if (!isTestsFile(project, file)) {
return -1;
}
if (!name.contains(EduNames.SUBTASK_MARKER)) {
return 0;
}
int markerIndex = name.indexOf(EduNames.SUBTASK_MARKER);
String index = name.substring(markerIndex + EduNames.SUBTASK_MARKER.length());
if (index.isEmpty()) {
return -1;
}
try {
return Integer.valueOf(index);
}
catch (NumberFormatException e) {
return -1;
}
}
/**
* This method decreases index and updates directory names of
* all tasks/lessons that have higher index than specified object
*
* @param dirs directories that are used to get tasks/lessons
* @param getStudyItem function that is used to get task/lesson from VirtualFile. This function can return null
* @param threshold index is used as threshold
* @param prefix task or lesson directory name prefix
*/
public static void updateHigherElements(VirtualFile[] dirs,
@NotNull final Function<VirtualFile, ? extends StudyItem> getStudyItem,
final int threshold,
final String prefix,
final int delta) {
ArrayList<VirtualFile> dirsToRename = new ArrayList<>
(Collections2.filter(Arrays.asList(dirs), dir -> {
final StudyItem item = getStudyItem.fun(dir);
if (item == null) {
return false;
}
int index = item.getIndex();
return index > threshold;
}));
Collections.sort(dirsToRename, (o1, o2) -> {
StudyItem item1 = getStudyItem.fun(o1);
StudyItem item2 = getStudyItem.fun(o2);
//if we delete some dir we should start increasing numbers in dir names from the end
return (-delta) * EduUtils.INDEX_COMPARATOR.compare(item1, item2);
});
for (final VirtualFile dir : dirsToRename) {
final StudyItem item = getStudyItem.fun(dir);
final int newIndex = item.getIndex() + delta;
item.setIndex(newIndex);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
dir.rename(this, prefix + newIndex);
}
catch (IOException e) {
LOG.error(e);
}
}
});
}
}
public static boolean isLessonDir(PsiDirectory sourceDirectory) {
if (sourceDirectory == null) {
return false;
}
Project project = sourceDirectory.getProject();
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course != null && isCourseCreator(project) && course.getLesson(sourceDirectory.getName()) != null) {
return true;
}
return false;
}
public static VirtualFile getGeneratedFilesFolder(@NotNull Project project, @NotNull Module module) {
VirtualFile baseDir = project.getBaseDir();
VirtualFile folder = baseDir.findChild(GENERATED_FILES_FOLDER);
if (folder != null) {
return folder;
}
final Ref<VirtualFile> generatedRoot = new Ref<>();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
generatedRoot.set(baseDir.createChildDirectory(this, GENERATED_FILES_FOLDER));
VirtualFile contentRootForFile =
ProjectRootManager.getInstance(module.getProject()).getFileIndex().getContentRootForFile(generatedRoot.get());
if (contentRootForFile == null) {
return;
}
ModuleRootModificationUtil.updateExcludedFolders(module, contentRootForFile, Collections.emptyList(),
Collections.singletonList(generatedRoot.get().getUrl()));
}
catch (IOException e) {
LOG.info("Failed to create folder for generated files", e);
}
}
});
return generatedRoot.get();
}
@Nullable
public static VirtualFile generateFolder(@NotNull Project project, @NotNull Module module, String name) {
VirtualFile generatedRoot = getGeneratedFilesFolder(project, module);
if (generatedRoot == null) {
return null;
}
final Ref<VirtualFile> folder = new Ref<>(generatedRoot.findChild(name));
//need to delete old folder
ApplicationManager.getApplication().runWriteAction(() -> {
try {
if (folder.get() != null) {
folder.get().delete(null);
}
folder.set(generatedRoot.createChildDirectory(null, name));
}
catch (IOException e) {
LOG.info("Failed to generate folder " + name, e);
}
});
return folder.get();
}
public static boolean isCourseCreator(@NotNull Project project) {
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return false;
}
return COURSE_MODE.equals(course.getCourseMode());
}
public static boolean isTestsFile(@NotNull Project project, @NotNull VirtualFile file) {
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return false;
}
Language language = course.getLanguageById();
if (language == null) {
return false;
}
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
if (configurator == null) {
return false;
}
return configurator.isTestFile(file);
}
public static void updateActionGroup(AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
presentation.setEnabledAndVisible(project != null && isCourseCreator(project));
}
/**
* @param fromIndex -1 if task converted to TaskWithSubtasks, -2 if task converted from TaskWithSubtasks
*/
public static void renameFiles(VirtualFile taskDir, Project project, int fromIndex) {
ApplicationManager.getApplication().runWriteAction(() -> {
Map<VirtualFile, String> newNames = new HashMap<>();
for (VirtualFile virtualFile : taskDir.getChildren()) {
int subtaskIndex = getSubtaskIndex(project, virtualFile);
if (subtaskIndex == -1) {
continue;
}
if (subtaskIndex > fromIndex) {
String index;
if (fromIndex == -1) { // add new subtask
index = "0";
}
else { // remove subtask
index = fromIndex == -2 ? "" : Integer.toString(subtaskIndex - 1);
}
String fileName = virtualFile.getName();
String nameWithoutExtension = FileUtil.getNameWithoutExtension(fileName);
String extension = FileUtilRt.getExtension(fileName);
int subtaskMarkerIndex = nameWithoutExtension.indexOf(EduNames.SUBTASK_MARKER);
String newName = subtaskMarkerIndex == -1
? nameWithoutExtension
: nameWithoutExtension.substring(0, subtaskMarkerIndex);
newName += index.isEmpty() ? "" : EduNames.SUBTASK_MARKER;
newName += index + "." + extension;
newNames.put(virtualFile, newName);
}
}
for (Map.Entry<VirtualFile, String> entry : newNames.entrySet()) {
try {
entry.getKey().rename(project, entry.getValue());
}
catch (IOException e) {
LOG.info(e);
}
}
});
}
@Nullable
public static Lesson createAdditionalLesson(Course course, Project project) {
final VirtualFile baseDir = project.getBaseDir();
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(course.getLanguageById());
final Lesson lesson = new Lesson();
lesson.setName(EduNames.PYCHARM_ADDITIONAL);
final Task task = new PyCharmTask();
task.setLesson(lesson);
task.setName(EduNames.PYCHARM_ADDITIONAL);
task.setIndex(1);
VfsUtilCore.visitChildrenRecursively(baseDir, new VirtualFileVisitor(VirtualFileVisitor.NO_FOLLOW_SYMLINKS) {
@Override
public boolean visitFile(@NotNull VirtualFile file) {
final String name = file.getName();
if (name.equals(EduNames.COURSE_META_FILE) || name.equals(EduNames.HINTS) || name.startsWith(".")) return false;
String sanitizedName = FileUtil.sanitizeFileName(course.getName());
final String archiveName = sanitizedName.startsWith("_") ? EduNames.COURSE : sanitizedName;
if (name.equals(archiveName + ".zip")) return false;
if (GENERATED_FILES_FOLDER.equals(name) || Project.DIRECTORY_STORE_FOLDER.equals(name)) {
return false;
}
if (file.isDirectory()) return true;
if (StudyUtils.isTestsFile(project, name)) return true;
if (name.contains(".iml") || (configurator != null && configurator.excludeFromArchive(file.getPath()))) {
return false;
}
final TaskFile taskFile = StudyUtils.getTaskFile(project, file);
if (taskFile == null) {
final String path = VfsUtilCore.getRelativePath(file, baseDir);
try {
if (EduUtils.isImage(file.getName())) {
task.addTestsTexts(path, Base64.encodeBase64URLSafeString(FileUtil.loadBytes(file.getInputStream())));
}
else {
task.addTestsTexts(path, FileUtil.loadTextAndClose(file.getInputStream()));
}
}
catch (IOException e) {
LOG.error("Can't find file " + path);
}
}
return true;
}
});
if (task.getTestsText().isEmpty()) return null;
lesson.addTask(task);
lesson.setIndex(course.getLessons().size());
return lesson;
}
}
@@ -1,136 +0,0 @@
package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileEvent;
import com.intellij.openapi.vfs.VirtualFileListener;
import com.jetbrains.edu.learning.EduPluginConfigurator;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.core.EduNames;
import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.courseFormat.Lesson;
import com.jetbrains.edu.learning.courseFormat.TaskFile;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
import org.jetbrains.annotations.NotNull;
public class CCVirtualFileListener implements VirtualFileListener {
private final Project myProject;
public CCVirtualFileListener(Project project) {
myProject = project;
}
@Override
public void fileCreated(@NotNull VirtualFileEvent event) {
VirtualFile createdFile = event.getFile();
if (createdFile.isDirectory()) {
return;
}
if (createdFile.getPath().contains(CCUtils.GENERATED_FILES_FOLDER)) {
return;
}
if (myProject.getBasePath() !=null && !FileUtil.isAncestor(myProject.getBasePath(), createdFile.getPath(), true)) {
return;
}
Course course = StudyTaskManager.getInstance(myProject).getCourse();
if (course == null) {
return;
}
TaskFile taskFile = StudyUtils.getTaskFile(myProject, createdFile);
if (taskFile != null) {
return;
}
String taskRelativePath = StudyUtils.pathRelativeToTask(createdFile);
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(course.getLanguageById());
if (configurator != null && configurator.excludeFromArchive(createdFile.getPath())) {
return;
}
if (CCUtils.isTestsFile(myProject, createdFile)
|| taskRelativePath.contains(EduNames.WINDOW_POSTFIX)
|| taskRelativePath.contains(EduNames.WINDOWS_POSTFIX)
|| taskRelativePath.contains(EduNames.ANSWERS_POSTFIX)) {
return;
}
VirtualFile taskVF = StudyUtils.getTaskDir(createdFile);
if (taskVF == null) {
return;
}
Task task = StudyUtils.getTask(myProject, taskVF);
if (task == null) {
return;
}
task.addTaskFile(taskRelativePath, task.getTaskFiles().size()+1);
}
@Override
public void fileDeleted(@NotNull VirtualFileEvent event) {
VirtualFile removedFile = event.getFile();
String path = removedFile.getPath();
if (path.contains(CCUtils.GENERATED_FILES_FOLDER)) {
return;
}
if (myProject == null) {
return;
}
if (myProject.getBasePath() !=null && !FileUtil.isAncestor(myProject.getBasePath(), removedFile.getPath(), true)) {
return;
}
Course course = StudyTaskManager.getInstance(myProject).getCourse();
if (course == null) {
return;
}
final TaskFile taskFile = StudyUtils.getTaskFile(myProject, removedFile);
if (taskFile != null) {
deleteTaskFile(removedFile, taskFile);
return;
}
if (removedFile.getName().contains(EduNames.TASK)) {
deleteTask(course, removedFile);
}
if (removedFile.getName().contains(EduNames.LESSON)) {
deleteLesson(course, removedFile, myProject);
}
}
private static void deleteLesson(@NotNull final Course course, @NotNull final VirtualFile removedLessonFile, Project project) {
Lesson removedLesson = course.getLesson(removedLessonFile.getName());
if (removedLesson == null) {
return;
}
VirtualFile courseDir = project.getBaseDir();
CCUtils.updateHigherElements(courseDir.getChildren(), file -> course.getLesson(file.getName()), removedLesson.getIndex(), EduNames.LESSON, -1);
course.removeLesson(removedLesson);
}
private static void deleteTask(@NotNull final Course course, @NotNull final VirtualFile removedTask) {
VirtualFile lessonDir = removedTask.getParent();
if (lessonDir == null || !lessonDir.getName().contains(EduNames.LESSON)) {
return;
}
final Lesson lesson = course.getLesson(lessonDir.getName());
if (lesson == null) {
return;
}
Task task = lesson.getTask(removedTask.getName());
if (task == null) {
return;
}
CCUtils.updateHigherElements(lessonDir.getChildren(), file -> lesson.getTask(file.getName()), task.getIndex(), EduNames.TASK, -1);
lesson.getTaskList().remove(task);
}
private static void deleteTaskFile(@NotNull final VirtualFile removedTaskFile, TaskFile taskFile) {
Task task = taskFile.getTask();
if (task == null) {
return;
}
task.getTaskFiles().remove(StudyUtils.pathRelativeToTask(removedTaskFile));
}
}
@@ -1,69 +0,0 @@
package com.jetbrains.edu.coursecreator.actions;
import com.intellij.ide.projectView.ProjectView;
import com.intellij.openapi.command.undo.BasicUndoableAction;
import com.intellij.openapi.command.undo.UnexpectedUndoException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.edu.coursecreator.CCUtils;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.core.EduUtils;
import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.courseFormat.TaskFile;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
public class CCAddAsTaskFile extends CCTaskFileActionBase {
public static final String ACTION_NAME = "Make Visible to Student";
public CCAddAsTaskFile() {
super(ACTION_NAME);
}
protected void performAction(VirtualFile file, Task task, Course course, Project project) {
EduUtils.runUndoableAction(project, ACTION_NAME, new AddTaskFile(file, null, project, task));
}
protected boolean isAvailable(Project project, VirtualFile file) {
return StudyUtils.getTaskFile(project, file) == null && !CCUtils.isTestsFile(project, file);
}
private static class AddTaskFile extends BasicUndoableAction {
private final VirtualFile myFile;
private TaskFile myTaskFile;
private final Project myProject;
private final Task myTask;
public AddTaskFile(VirtualFile file, TaskFile taskFile, Project project, Task task) {
super(file);
myFile = file;
myTaskFile = taskFile;
myProject = project;
myTask = task;
}
@Override
public void undo() throws UnexpectedUndoException {
if (myTaskFile == null) return;
CCHideFromStudent.hideFromStudent(myFile, myProject, myTask.getTaskFiles(), myTaskFile);
ProjectView.getInstance(myProject).refresh();
}
@Override
public void redo() throws UnexpectedUndoException {
if (myTaskFile != null) {
myTask.addTaskFile(myTaskFile);
} else {
final String taskRelativePath = StudyUtils.pathRelativeToTask(myFile);
myTask.addTaskFile(taskRelativePath, myTask.getTaskFiles().size());
myTaskFile = myTask.getTaskFile(taskRelativePath);
}
ProjectView.getInstance(myProject).refresh();
}
@Override
public boolean isGlobal() {
return true;
}
}
}
@@ -1,91 +0,0 @@
package com.jetbrains.edu.coursecreator.actions;
import com.intellij.ide.IdeView;
import com.intellij.ide.projectView.ProjectView;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogBuilder;
import com.intellij.profile.codeInspection.ProjectInspectionProfileManager;
import com.intellij.psi.PsiDirectory;
import com.jetbrains.edu.coursecreator.CCUtils;
import com.jetbrains.edu.coursecreator.ui.CCNewProjectPanel;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.courseFormat.Course;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
public class CCChangeCourseInfo extends DumbAwareAction {
private static final String ACTION_TEXT = "Change Course Information";
public CCChangeCourseInfo() {
super(ACTION_TEXT, ACTION_TEXT, null);
}
@Override
public void update(@NotNull AnActionEvent event) {
final Project project = event.getProject();
final Presentation presentation = event.getPresentation();
if (project == null) {
return;
}
presentation.setEnabledAndVisible(false);
if (!CCUtils.isCourseCreator(project)) {
return;
}
final IdeView view = event.getData(LangDataKeys.IDE_VIEW);
if (view == null) {
return;
}
final PsiDirectory[] directories = view.getDirectories();
if (directories.length == 0) {
return;
}
presentation.setEnabledAndVisible(true);
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
CCNewProjectPanel panel =
new CCNewProjectPanel(course.getName(), Course.getAuthorsString(course.getAuthors()), course.getDescription());
setupLanguageLevels(course, panel);
DialogBuilder builder = createChangeInfoDialog(project, panel);
if (builder.showAndGet()) {
course.setAuthorsAsString(panel.getAuthors());
course.setName(panel.getName());
course.setDescription(panel.getDescription());
setVersion(course, panel);
ProjectView.getInstance(project).refresh();
ProjectInspectionProfileManager.getInstance(project).fireProfileChanged();
}
}
protected void setVersion(Course course, CCNewProjectPanel panel) {}
protected void setupLanguageLevels(Course course, CCNewProjectPanel panel) {}
private static DialogBuilder createChangeInfoDialog(Project project, @NotNull CCNewProjectPanel panel) {
DialogBuilder builder = new DialogBuilder(project);
builder.setTitle(ACTION_TEXT);
JPanel changeInfoPanel = panel.getMainPanel();
changeInfoPanel.setPreferredSize(new Dimension(450, 300));
changeInfoPanel.setMinimumSize(new Dimension(450, 300));
builder.setCenterPanel(changeInfoPanel);
return builder;
}
}
@@ -1,222 +0,0 @@
package com.jetbrains.edu.coursecreator.actions;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.intellij.ide.projectView.ProjectView;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.containers.hash.HashMap;
import com.intellij.util.io.ZipUtil;
import com.jetbrains.edu.coursecreator.CCUtils;
import com.jetbrains.edu.coursecreator.ui.CreateCourseArchiveDialog;
import com.jetbrains.edu.learning.StudySerializationUtils;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.core.EduNames;
import com.jetbrains.edu.learning.core.EduUtils;
import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.courseFormat.Lesson;
import com.jetbrains.edu.learning.courseFormat.TaskFile;
import com.jetbrains.edu.learning.courseFormat.tasks.Task;
import com.jetbrains.edu.learning.statistics.EduUsagesCollector;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.zip.ZipOutputStream;
public class CCCreateCourseArchive extends DumbAwareAction {
private static final Logger LOG = Logger.getInstance(CCCreateCourseArchive.class.getName());
public static final String GENERATE_COURSE_ARCHIVE = "Generate Course Archive";
private String myZipName;
private String myLocationDir;
public void setZipName(String zipName) {
myZipName = zipName;
}
public void setLocationDir(String locationDir) {
myLocationDir = locationDir;
}
public CCCreateCourseArchive() {
super(GENERATE_COURSE_ARCHIVE, GENERATE_COURSE_ARCHIVE, null);
}
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
presentation.setEnabledAndVisible(project != null && CCUtils.isCourseCreator(project));
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final Module module = e.getData(LangDataKeys.MODULE);
if (project == null || module == null) {
return;
}
CreateCourseArchiveDialog dlg = new CreateCourseArchiveDialog(project, this);
dlg.show();
if (dlg.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
return;
}
createCourseArchive(project, module, myZipName, myLocationDir, true);
EduUsagesCollector.createdCourseArchive();
}
public static void createCourseArchive(final Project project, Module module, String zipName, String locationDir, boolean showMessage) {
final Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) return;
final VirtualFile baseDir = project.getBaseDir();
VirtualFile archiveFolder = CCUtils.generateFolder(project, module, zipName);
if (archiveFolder == null) {
return;
}
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
archiveFolder.refresh(false, true);
Course courseCopy = course.copy();
replaceAnswerFilesWithTaskFiles(courseCopy);
courseCopy.sortLessons();
createAdditionalFiles(courseCopy);
generateJson(archiveFolder, courseCopy);
VirtualFileManager.getInstance().refreshWithoutFileWatcher(false);
packCourse(archiveFolder, locationDir, zipName, showMessage);
synchronize(project);
}
private void createAdditionalFiles(Course course) {
final Lesson lesson = CCUtils.createAdditionalLesson(course, project);
if (lesson != null) {
course.addLesson(lesson);
}
}
private void replaceAnswerFilesWithTaskFiles(Course courseCopy) {
for (Lesson lesson : courseCopy.getLessons()) {
String lessonDirName = EduNames.LESSON + String.valueOf(lesson.getIndex());
final VirtualFile lessonDir = baseDir.findChild(lessonDirName);
if (lessonDir == null) continue;
for (Task task : lesson.getTaskList()) {
final VirtualFile taskDir = task.getTaskDir(project);
if (taskDir == null) continue;
convertToStudentTaskFiles(task, taskDir);
addTestsToTask(task);
}
}
}
private void convertToStudentTaskFiles(Task task, VirtualFile taskDir) {
final HashMap<String, TaskFile> studentTaskFiles = new HashMap<>();
for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
VirtualFile answerFile = taskDir.findFileByRelativePath(entry.getKey());
if (answerFile == null) {
continue;
}
final TaskFile studentFile = EduUtils.createStudentFile(project, answerFile, task, 0);
if (studentFile != null) {
studentTaskFiles.put(entry.getKey(), studentFile);
}
}
task.taskFiles = studentTaskFiles;
}
private void addTestsToTask(Task task) {
final List<VirtualFile> testFiles = getTestFiles(task, project);
for (VirtualFile file : testFiles) {
try {
task.addTestsTexts(file.getName(), VfsUtilCore.loadText(file));
}
catch (IOException e) {
LOG.warn("Failed to load text " + file.getName());
}
}
}
private List<VirtualFile> getTestFiles(@NotNull Task task, @NotNull Project project) {
List<VirtualFile> testFiles = new ArrayList<>();
VirtualFile taskDir = task.getTaskDir(project);
if (taskDir == null) {
return testFiles;
}
testFiles.addAll(Arrays.stream(taskDir.getChildren())
.filter(file -> StudyUtils.isTestsFile(project, file.getName()))
.collect(Collectors.toList()));
return testFiles;
}
});
}
private static void synchronize(@NotNull final Project project) {
VirtualFileManager.getInstance().refreshWithoutFileWatcher(true);
ProjectView.getInstance(project).refresh();
}
private static void packCourse(@NotNull final VirtualFile baseDir, String locationDir, String zipName, boolean showMessage) {
try {
final File zipFile = new File(locationDir, zipName + ".zip");
ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
VirtualFile[] courseFiles = baseDir.getChildren();
for (VirtualFile file : courseFiles) {
ZipUtil.addFileOrDirRecursively(zos, null, new File(file.getPath()), file.getName(), null, null);
}
zos.close();
if (showMessage) {
ApplicationManager.getApplication().invokeLater(
() -> Messages.showInfoMessage("Course archive was saved to " + zipFile.getPath(),
"Course Archive Was Created Successfully"));
}
}
catch (IOException e1) {
LOG.error(e1);
}
}
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private static void generateJson(VirtualFile parentDir, Course course) {
final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().
registerTypeAdapter(Task.class, new StudySerializationUtils.Json.TaskAdapter()).create();
final String json = gson.toJson(course);
final File courseJson = new File(parentDir.getPath(), EduNames.COURSE_META_FILE);
OutputStreamWriter outputStreamWriter = null;
try {
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(courseJson), "UTF-8");
outputStreamWriter.write(json);
}
catch (Exception e) {
Messages.showErrorDialog(e.getMessage(), "Failed to Generate Json");
LOG.info(e);
}
finally {
try {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
}
catch (IOException e1) {
//close silently
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More