diff --git a/python/educational-core/resources/META-INF/plugin.xml b/python/educational-core/resources/META-INF/plugin.xml
index 249be31cb07f..b18e496e6292 100644
--- a/python/educational-core/resources/META-INF/plugin.xml
+++ b/python/educational-core/resources/META-INF/plugin.xml
@@ -49,7 +49,6 @@
-
@@ -173,7 +172,7 @@
-
+
diff --git a/python/educational-core/src/com/jetbrains/edu/learning/EduPluginConfigurator.java b/python/educational-core/src/com/jetbrains/edu/learning/EduPluginConfigurator.java
index c41739bef591..4bee8f58103d 100644
--- a/python/educational-core/src/com/jetbrains/edu/learning/EduPluginConfigurator.java
+++ b/python/educational-core/src/com/jetbrains/edu/learning/EduPluginConfigurator.java
@@ -12,6 +12,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
+import com.intellij.util.Consumer;
import com.jetbrains.edu.learning.actions.*;
import com.jetbrains.edu.learning.core.EduNames;
import com.jetbrains.edu.learning.courseFormat.Course;
@@ -131,4 +132,8 @@ public interface EduPluginConfigurator {
default List getBundledCoursePaths() {
return Collections.emptyList();
}
+
+ default boolean createCourseProject(@NotNull Course course, @Nullable Consumer onCreated) {
+ return false;
+ }
}
diff --git a/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/BuiltInServerUtils.java b/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduBuiltInServerUtils.java
similarity index 94%
rename from python/educational-core/src/com/jetbrains/edu/learning/builtInServer/BuiltInServerUtils.java
rename to python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduBuiltInServerUtils.java
index 3f704ee5a336..b69957f95d3b 100644
--- a/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/BuiltInServerUtils.java
+++ b/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduBuiltInServerUtils.java
@@ -25,6 +25,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.util.Consumer;
import com.intellij.util.xmlb.XmlSerializationException;
+import com.jetbrains.edu.learning.EduPluginConfigurator;
import com.jetbrains.edu.learning.StudySettings;
import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.courseFormat.Course;
@@ -51,8 +52,8 @@ import static com.jetbrains.edu.learning.navigation.StudyNavigator.navigateToTas
/**
* @author meanmail
*/
-public class BuiltInServerUtils {
- private static final Logger LOG = Logger.getInstance(BuiltInServerUtils.class);
+public class EduBuiltInServerUtils {
+ private static final Logger LOG = Logger.getInstance(EduBuiltInServerUtils.class);
public static boolean focusOpenProject(int courseId, int stepId) {
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
@@ -189,7 +190,11 @@ public class BuiltInServerUtils {
navigateToStep(project, targetCourse, stepId);
}
});
- return EduProjectCreator.createProject(course[0], onCreated);
+ EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(course[0].getLanguageById());
+ if (configurator == null) {
+ return false;
+ }
+ return configurator.createCourseProject(course[0], onCreated);
}
return false;
}
diff --git a/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduProjectCreator.java b/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduProjectCreator.java
deleted file mode 100644
index 6f1bc099fb84..000000000000
--- a/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduProjectCreator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2000-2017 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.jetbrains.edu.learning.builtInServer;
-
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.Consumer;
-import com.jetbrains.edu.learning.courseFormat.Course;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author meanmail
- */
-public class EduProjectCreator {
- public static final ExtensionPointName EP_NAME = ExtensionPointName.create("Edu.eduProjectCreator");
-
- public static boolean createProject(@NotNull Course course, @Nullable Consumer onCreated) {
- EduProjectCreator[] extensions = Extensions.getExtensions(EP_NAME);
-
- for (EduProjectCreator projectCreator : extensions) {
- if (projectCreator.canCreateProject(course)) {
- return projectCreator.createCourseProject(course, onCreated);
- }
- }
-
- return false;
- }
-
- public boolean createCourseProject(@NotNull Course course, @Nullable Consumer onCreated) {
- return false;
- }
-
- public boolean canCreateProject(@NotNull Course course) {
- return false;
- }
-}
diff --git a/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/StepikRestService.java b/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduStepikRestService.java
similarity index 93%
rename from python/educational-core/src/com/jetbrains/edu/learning/builtInServer/StepikRestService.java
rename to python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduStepikRestService.java
index e9bcc6ea8544..5a2ccad1dc3b 100644
--- a/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/StepikRestService.java
+++ b/python/educational-core/src/com/jetbrains/edu/learning/builtInServer/EduStepikRestService.java
@@ -30,15 +30,15 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static com.jetbrains.edu.learning.builtInServer.BuiltInServerUtils.*;
+import static com.jetbrains.edu.learning.builtInServer.EduBuiltInServerUtils.*;
import static com.jetbrains.edu.learning.core.EduNames.SERVICE_NAME;
import static com.jetbrains.edu.learning.core.EduNames.STEP_ID;
/**
* @author meanmail
*/
-public class StepikRestService extends RestService {
- private static final Logger LOG = Logger.getInstance(StepikRestService.class.getName());
+public class EduStepikRestService extends RestService {
+ private static final Logger LOG = Logger.getInstance(EduStepikRestService.class.getName());
private static final Pattern OPEN_COURSE = Pattern.compile("/" + SERVICE_NAME + "/course/(\\d+)");
@NotNull
diff --git a/python/educational-python/Edu-Python/resources/META-INF/plugin.xml b/python/educational-python/Edu-Python/resources/META-INF/plugin.xml
index e39f149ef86e..1d4b1055bfba 100644
--- a/python/educational-python/Edu-Python/resources/META-INF/plugin.xml
+++ b/python/educational-python/Edu-Python/resources/META-INF/plugin.xml
@@ -36,7 +36,6 @@
-
onCreated) {
+ ApplicationManager.getApplication().invokeAndWait(() -> {
+ AbstractNewProjectDialog dlg = new AbstractNewProjectDialog() {
+ @Override
+ protected DefaultActionGroup createRootStep() {
+ return new EduBuiltInServerNewProjectStep(course, onCreated);
+ }
+ };
+ dlg.show();
+ });
+ return true;
+ }
}
diff --git a/python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/BuiltInServerNewProjectStep.java b/python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/EduBuiltInServerNewProjectStep.java
similarity index 88%
rename from python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/BuiltInServerNewProjectStep.java
rename to python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/EduBuiltInServerNewProjectStep.java
index 4b329ffbc3c6..305f88c0cca8 100644
--- a/python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/BuiltInServerNewProjectStep.java
+++ b/python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/EduBuiltInServerNewProjectStep.java
@@ -30,9 +30,9 @@ import java.util.ArrayList;
/**
* @author meanmail
*/
-public class BuiltInServerNewProjectStep extends PyCharmNewProjectStep {
- public BuiltInServerNewProjectStep(@NotNull Course course, @Nullable Consumer onCreated) {
- super(new BuiltInServerNewProjectStep.MyCustomization(course, onCreated));
+public class EduBuiltInServerNewProjectStep extends PyCharmNewProjectStep {
+ public EduBuiltInServerNewProjectStep(@NotNull Course course, @Nullable Consumer onCreated) {
+ super(new EduBuiltInServerNewProjectStep.MyCustomization(course, onCreated));
}
protected static class MyCustomization extends PyCharmNewProjectStep.Customization {
diff --git a/python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/EduPythonProjectCreator.java b/python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/EduPythonProjectCreator.java
deleted file mode 100644
index ca927450bfe6..000000000000
--- a/python/educational-python/Edu-Python/src/com/jetbrains/edu/learning/builtInServer/EduPythonProjectCreator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2000-2017 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.jetbrains.edu.learning.builtInServer;
-
-import com.intellij.ide.util.projectWizard.AbstractNewProjectDialog;
-import com.intellij.openapi.actionSystem.DefaultActionGroup;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.Consumer;
-import com.jetbrains.edu.learning.courseFormat.Course;
-import com.jetbrains.python.PythonLanguage;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author meanmail
- */
-public class EduPythonProjectCreator extends EduProjectCreator {
- @Override
- public boolean canCreateProject(@NotNull Course course) {
- return course.getLanguageById() == PythonLanguage.getInstance();
- }
-
- @Override
- public boolean createCourseProject(@NotNull Course course, @Nullable Consumer onCreated) {
- ApplicationManager.getApplication().invokeAndWait(() -> {
- AbstractNewProjectDialog dlg = new AbstractNewProjectDialog() {
- @Override
- protected DefaultActionGroup createRootStep() {
- return new BuiltInServerNewProjectStep(course, onCreated);
- }
- };
- dlg.show();
- });
- return true;
- }
-}