remove Introduction to Python action (EDU-926)

This commit is contained in:
Liana.Bakradze
2017-05-15 10:43:23 +03:00
committed by liana.bakradze
parent 4a9a4ed413
commit 201bd33a55
2 changed files with 0 additions and 88 deletions
@@ -38,10 +38,6 @@
<pluginConfigurator implementationClass="com.jetbrains.edu.learning.PyEduPluginConfigurator" language="Python"/>
</extensions>
<actions>
<action id="WelcomeScreen.PythonIntro" class="com.jetbrains.edu.learning.actions.PyStudyIntroductionCourseAction"
icon="InteractiveLearningPythonIcons.EducationalProjectType">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
</action>
<action id="StudyWatchTutorial" class="com.jetbrains.edu.learning.actions.PyStudyWatchTutorialAction">
<add-to-group group-id="HelpMenu" anchor="before" relative-to-action="HelpTopics"/>
</action>
@@ -1,84 +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.learning.actions;
import com.intellij.ide.impl.ProjectUtil;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.jetbrains.edu.learning.EduPluginConfigurator;
import com.jetbrains.edu.learning.PyEduPluginConfigurator;
import com.jetbrains.edu.learning.PyStudyDirectoryProjectGenerator;
import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.courseGeneration.StudyProjectGenerator;
import com.jetbrains.python.PythonLanguage;
import com.jetbrains.python.newProject.steps.ProjectSpecificSettingsStep;
import com.jetbrains.python.newProject.steps.PythonGenerateProjectCallback;
import icons.InteractiveLearningPythonIcons;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.List;
public class PyStudyIntroductionCourseAction extends AnAction {
public static final String INTRODUCTION_TO_PYTHON = "Introduction to Python";
public static final String INTRODUCTION_FOLDER = "PythonIntroduction";
public PyStudyIntroductionCourseAction() {
super(INTRODUCTION_TO_PYTHON, INTRODUCTION_TO_PYTHON, InteractiveLearningPythonIcons.EducationalProjectType);
}
@Override
public void update(AnActionEvent e) {
final File projectDir = new File(ProjectUtil.getBaseDir(), INTRODUCTION_FOLDER);
if (projectDir.exists()) {
return;
}
final EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(PythonLanguage.getInstance());
final List<String> paths = configurator.getBundledCoursePaths();
if (!paths.isEmpty()) {
return;
}
Presentation presentation = e.getPresentation();
presentation.setVisible(false);
presentation.setEnabled(false);
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final File projectDir = new File(ProjectUtil.getBaseDir(), INTRODUCTION_FOLDER);
if (projectDir.exists()) {
ProjectUtil.openProject(projectDir.getPath(), null, false);
}
else {
final PyStudyDirectoryProjectGenerator generator = new PyStudyDirectoryProjectGenerator(true);
final EduPluginConfigurator configurator = new PyEduPluginConfigurator();
final String bundledCoursePath = configurator.getBundledCoursePaths().get(0);
Course introCourse = StudyProjectGenerator.getCourse(bundledCoursePath);
if (introCourse == null) {
return;
}
final PythonGenerateProjectCallback callback = new PythonGenerateProjectCallback();
final ProjectSpecificSettingsStep step = new ProjectSpecificSettingsStep(generator, callback);
step.createPanel(); // initialize panel to set location
step.setLocation(projectDir.toString());
generator.setCourse(introCourse);
callback.consume(step);
}
}
}