mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Edu: remove all project guessing
This commit is contained in:
+5
-7
@@ -1,7 +1,6 @@
|
||||
package com.jetbrains.edu.coursecreator;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectUtil;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileEvent;
|
||||
@@ -77,18 +76,17 @@ public class CCVirtualFileListener implements VirtualFileListener {
|
||||
return;
|
||||
}
|
||||
|
||||
Project project = ProjectUtil.guessProjectForFile(removedFile);
|
||||
if (project == null) {
|
||||
if (myProject == null) {
|
||||
return;
|
||||
}
|
||||
if (project.getBasePath() !=null && !FileUtil.isAncestor(project.getBasePath(), removedFile.getPath(), true)) {
|
||||
if (myProject.getBasePath() !=null && !FileUtil.isAncestor(myProject.getBasePath(), removedFile.getPath(), true)) {
|
||||
return;
|
||||
}
|
||||
Course course = StudyTaskManager.getInstance(project).getCourse();
|
||||
Course course = StudyTaskManager.getInstance(myProject).getCourse();
|
||||
if (course == null) {
|
||||
return;
|
||||
}
|
||||
final TaskFile taskFile = StudyUtils.getTaskFile(project, removedFile);
|
||||
final TaskFile taskFile = StudyUtils.getTaskFile(myProject, removedFile);
|
||||
if (taskFile != null) {
|
||||
deleteTaskFile(removedFile, taskFile);
|
||||
return;
|
||||
@@ -97,7 +95,7 @@ public class CCVirtualFileListener implements VirtualFileListener {
|
||||
deleteTask(course, removedFile);
|
||||
}
|
||||
if (removedFile.getName().contains(EduNames.LESSON)) {
|
||||
deleteLesson(course, removedFile, project);
|
||||
deleteLesson(course, removedFile, myProject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,7 @@ import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
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.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -41,7 +38,7 @@ import static com.jetbrains.edu.learning.StudySerializationUtils.Xml.REMOTE_COUR
|
||||
* about study in context of current project
|
||||
*/
|
||||
|
||||
@State(name = "StudySettings", storages = @Storage("study_project.xml"))
|
||||
@State(name = "StudySettings", storages = @Storage(value = "study_project.xml", roamingType = RoamingType.DISABLED))
|
||||
public class StudyTaskManager implements PersistentStateComponent<Element>, DumbAware {
|
||||
private static final Logger LOG = Logger.getInstance(StudyTaskManager.class);
|
||||
public static final int CURRENT_VERSION = 6;
|
||||
|
||||
+1
-2
@@ -8,7 +8,6 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.module.ModuleUtilCore
|
||||
import com.intellij.openapi.options.ShowSettingsUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.guessProjectForContentFile
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import com.intellij.psi.util.PsiUtilCore
|
||||
import com.jetbrains.edu.learning.courseFormat.Course
|
||||
@@ -42,7 +41,7 @@ class PyStudyLanguageLevelInspection : PyInspection() {
|
||||
val sdk = PythonSdkType.findPythonSdk(module)
|
||||
if (sdk != null) {
|
||||
val projectLanguageLevel = PythonSdkType.getLanguageLevelForSdk(sdk)
|
||||
val project = guessProjectForContentFile(node.virtualFile) ?: return
|
||||
val project = node.project
|
||||
val course = StudyTaskManager.getInstance(project).course ?: return
|
||||
checkIfLanguageLevelSupported(course, projectLanguageLevel, node)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user