cleanup, removed unneeded parameters
authorEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Mon, 20 Jun 2016 16:38:35 +0000 (19:38 +0300)
committerEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Fri, 24 Jun 2016 08:55:04 +0000 (11:55 +0300)
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/CCUtils.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAddAnswerPlaceholder.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAnswerPlaceholderAction.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCEditAnswerPlaceholder.java
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCTreeStructureProvider.java
python/educational-core/student/src/com/jetbrains/edu/learning/actions/StudyNextWindowAction.java

index 5ab441fd84bfd27935e19544f5a6d013e8f1d76c..edd3a7f240ac260c66e97129a1ab2debd8053860 100644 (file)
@@ -18,7 +18,6 @@ import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileEvent;
 import com.intellij.psi.PsiDirectory;
 import com.intellij.util.DocumentUtil;
 import com.intellij.util.Function;
@@ -31,7 +30,10 @@ import org.jetbrains.annotations.Nullable;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.*;
+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.";
@@ -144,11 +146,8 @@ public class CCUtils {
     return generatedRoot.get();
   }
 
-  /**
-   * @param requestor {@link VirtualFileEvent#getRequestor}
-   */
   @Nullable
-  public static VirtualFile generateFolder(@NotNull Project project, @NotNull Module module, @Nullable Object requestor, String name) {
+  public static VirtualFile generateFolder(@NotNull Project project, @NotNull Module module, String name) {
     VirtualFile generatedRoot = getGeneratedFilesFolder(project, module);
     if (generatedRoot == null) {
       return null;
@@ -159,9 +158,9 @@ public class CCUtils {
     ApplicationManager.getApplication().runWriteAction(() -> {
       try {
         if (folder.get() != null) {
-          folder.get().delete(requestor);
+          folder.get().delete(null);
         }
-        folder.set(generatedRoot.createChildDirectory(requestor, name));
+        folder.set(generatedRoot.createChildDirectory(null, name));
       }
       catch (IOException e) {
         LOG.info("Failed to generate folder " + name, e);
index 41275862f6f099fbc2ffb5096c03961e197e419f..0643eaa8cf0cb66d6dd1bf5d7ddf9455968ce22f 100644 (file)
@@ -26,7 +26,7 @@ import java.util.List;
 public class CCAddAnswerPlaceholder extends CCAnswerPlaceholderAction {
 
   public CCAddAnswerPlaceholder() {
-    super("Add/Delete Answer Placeholder", "Add/Delete answer placeholder", null);
+    super("Add/Delete Answer Placeholder", "Add/Delete answer placeholder");
   }
 
 
index 4a04794030947afda716c3c1053be71a62939a58..ba3db4d16fb1a5cb74dcceb97b4db6ffc03462ae 100644 (file)
@@ -14,12 +14,10 @@ import com.jetbrains.edu.learning.courseFormat.TaskFile;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import javax.swing.*;
-
 abstract public class CCAnswerPlaceholderAction extends DumbAwareAction {
 
-  protected CCAnswerPlaceholderAction(@Nullable String text, @Nullable String description, @Nullable Icon icon) {
-    super(text, description, icon);
+  protected CCAnswerPlaceholderAction(@Nullable String text, @Nullable String description) {
+    super(text, description, null);
   }
 
   @Nullable
index 8425c71b04830712a6fed37098903267a123c451..50e2336444f5034b2d5b3002fcad1a41033548c7 100644 (file)
@@ -77,7 +77,7 @@ public class CCCreateCourseArchive extends DumbAwareAction {
     final Course course = StudyTaskManager.getInstance(project).getCourse();
     if (course == null) return;
     final VirtualFile baseDir = project.getBaseDir();
-    VirtualFile archiveFolder = CCUtils.generateFolder(project, module, null, zipName);
+    VirtualFile archiveFolder = CCUtils.generateFolder(project, module, zipName);
     if (archiveFolder == null) {
       return;
     }
index 622ddacf1cac6a1b34689b90ed03cec6b54ebb29..72a33a1e02613d37a20aedb33f072326daf55e6f 100644 (file)
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
 public class CCEditAnswerPlaceholder extends CCAnswerPlaceholderAction {
 
   public CCEditAnswerPlaceholder() {
-    super("Edit Answer Placeholder", "Edit answer placeholder", null);
+    super("Edit Answer Placeholder", "Edit answer placeholder");
   }
 
   @Override
index 3ba35d688992c81d419903747437429df44b0e3f..39d0ab89145b33dcac471037fb3a1035eb84c9d0 100644 (file)
@@ -12,7 +12,6 @@ import com.jetbrains.edu.learning.StudyUtils;
 import com.jetbrains.edu.learning.projectView.StudyTreeStructureProvider;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.ArrayList;
 import java.util.Collection;
 
 public class CCTreeStructureProvider extends StudyTreeStructureProvider {
@@ -24,7 +23,7 @@ public class CCTreeStructureProvider extends StudyTreeStructureProvider {
     if (!needModify(parent)) {
       return children;
     }
-    Collection<AbstractTreeNode> modifiedChildren = new ArrayList(super.modify(parent, children, settings));
+    Collection<AbstractTreeNode> modifiedChildren = super.modify(parent, children, settings);
 
     for (AbstractTreeNode node : children) {
       Project project = node.getProject();
@@ -41,7 +40,8 @@ public class CCTreeStructureProvider extends StudyTreeStructureProvider {
           if (virtualFile == null) {
             continue;
           }
-          if (StudyUtils.getTaskFile(project, virtualFile) == null && !StudyUtils.isTaskDescriptionFile(virtualFile.getName())) {
+          if (project != null && StudyUtils.getTaskFile(project, virtualFile) == null
+              && !StudyUtils.isTaskDescriptionFile(virtualFile.getName())) {
             modifiedChildren.add(new CCStudentInvisibleFileNode(project, ((PsiFileNode)node).getValue(), settings));
           }
         }
index 01fd8dcbceecfcc2225aaf42800ff4b47e88bf93..17769a98828217f73cdb36dc9150936fc5ff1df3 100644 (file)
@@ -26,7 +26,7 @@ public class StudyNextWindowAction extends StudyWindowNavigationAction {
     List<AnswerPlaceholder> windows = window.getTaskFile().getAnswerPlaceholders();
     if (StudyUtils.indexIsValid(index, windows)) {
       int newIndex = index + 1;
-        return newIndex == windows.size() ? windows.get(0) : windows.get(newIndex);
+      return windows.get(newIndex == windows.size() ? 0 : newIndex);
     }
     return null;
   }