From c9bf556dc69f4985dd4c4015d26f6f252e5ffdfd Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 2 Aug 2016 19:31:08 +0300 Subject: [PATCH 1/6] [file-history] fix compilation (implement dispose method) --- plugins/git4idea/src/git4idea/update/GitSkippedCommits.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/git4idea/src/git4idea/update/GitSkippedCommits.java b/plugins/git4idea/src/git4idea/update/GitSkippedCommits.java index 896600901617..c18dc9d60ccf 100644 --- a/plugins/git4idea/src/git4idea/update/GitSkippedCommits.java +++ b/plugins/git4idea/src/git4idea/update/GitSkippedCommits.java @@ -193,6 +193,10 @@ public class GitSkippedCommits extends PanelWithActionsAndCloseButton { }); } + @Override + public void dispose() { + } + /** * Wrapper for vcs root */ From 2710d59344f385f77d78354ea41fc35542631696 Mon Sep 17 00:00:00 2001 From: Liana Bakradze Date: Tue, 2 Aug 2016 19:35:23 +0300 Subject: [PATCH 2/6] EDU-425 Show actual lesson name --- .../handlers/CCRenameHandler.java | 5 +++ .../student/resources/META-INF/plugin.xml | 1 + .../edu/learning/StudyTabTitleProvider.java | 45 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 python/educational-core/student/src/com/jetbrains/edu/learning/StudyTabTitleProvider.java diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/handlers/CCRenameHandler.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/handlers/CCRenameHandler.java index e98ba1ab133f..9814a6631fe2 100644 --- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/handlers/CCRenameHandler.java +++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/handlers/CCRenameHandler.java @@ -4,6 +4,7 @@ import com.intellij.ide.projectView.ProjectView; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.text.StringUtil; @@ -50,6 +51,10 @@ public abstract class CCRenameHandler implements RenameHandler { } rename(project, course, directory); ProjectView.getInstance(project).refresh(); + FileEditorManagerEx managerEx = FileEditorManagerEx.getInstanceEx(project); + for (VirtualFile virtualFile : managerEx.getOpenFiles()) { + managerEx.updateFilePresentation(virtualFile); + } } protected abstract void rename(@NotNull Project project, @NotNull Course course, @NotNull PsiDirectory directory); diff --git a/python/educational-core/student/resources/META-INF/plugin.xml b/python/educational-core/student/resources/META-INF/plugin.xml index a5ac8e742d05..c0ad88e0a788 100644 --- a/python/educational-core/student/resources/META-INF/plugin.xml +++ b/python/educational-core/student/resources/META-INF/plugin.xml @@ -106,6 +106,7 @@ + diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/StudyTabTitleProvider.java b/python/educational-core/student/src/com/jetbrains/edu/learning/StudyTabTitleProvider.java new file mode 100644 index 000000000000..e2a96a1d6c42 --- /dev/null +++ b/python/educational-core/student/src/com/jetbrains/edu/learning/StudyTabTitleProvider.java @@ -0,0 +1,45 @@ +package com.jetbrains.edu.learning; + +import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider; +import com.intellij.openapi.fileEditor.impl.UniqueNameEditorTabTitleProvider; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.VirtualFile; +import com.jetbrains.edu.learning.core.EduNames; +import com.jetbrains.edu.learning.courseFormat.Lesson; +import com.jetbrains.edu.learning.courseFormat.Task; +import com.jetbrains.edu.learning.courseFormat.TaskFile; +import org.jetbrains.annotations.Nullable; + +import java.io.File; + +public class StudyTabTitleProvider implements EditorTabTitleProvider { + @Nullable + @Override + public String getEditorTabTitle(Project project, VirtualFile file) { + TaskFile taskFile = StudyUtils.getTaskFile(project, file); + if (taskFile == null) { + return null; + } + String title = new UniqueNameEditorTabTitleProvider().getEditorTabTitle(project, file); + if (title == null) { + return null; + } + String[] split = title.split(File.separator); + for (int i = 0; i < split.length; i++) { + String part = split[i]; + Task task = taskFile.getTask(); + VirtualFile taskDir = task.getTaskDir(project); + if (taskDir != null && part.equals(taskDir.getName())) { + split[i] = task.getName(); + continue; + } + Lesson lesson = task.getLesson(); + int lessonIndex = lesson.getIndex(); + if (part.equals(EduNames.LESSON + lessonIndex)) { + split[i] = lesson.getName(); + } + } + return StringUtil.join(split, File.separator); + } +} From 315417e18363183c180d49a7eee7ab1e9be32785 Mon Sep 17 00:00:00 2001 From: Liana Bakradze Date: Tue, 2 Aug 2016 19:52:45 +0300 Subject: [PATCH 3/6] EDU-692 Change default selected option and task name in "Create new task" dialog --- .../jetbrains/edu/coursecreator/ui/CCCreateStudyItemPanel.java | 3 ++- .../jetbrains/edu/coursecreator/ui/CCItemPositionPanel.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateStudyItemPanel.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateStudyItemPanel.java index 572ba0806508..b006845318a9 100644 --- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateStudyItemPanel.java +++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateStudyItemPanel.java @@ -13,7 +13,8 @@ public class CCCreateStudyItemPanel extends JPanel { public CCCreateStudyItemPanel(String itemName, String thresholdName, int thresholdIndex) { myThresholdName = thresholdName; myItemName = itemName; - myNameField.setText(itemName + thresholdIndex); + int newIndex = thresholdIndex + 1; + myNameField.setText(itemName + newIndex); add(myPanel, BorderLayout.CENTER); } diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCItemPositionPanel.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCItemPositionPanel.java index 2b15aa9b85b4..a680c07f04c3 100644 --- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCItemPositionPanel.java +++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCItemPositionPanel.java @@ -22,7 +22,7 @@ public class CCItemPositionPanel extends JPanel { group.add(myAfterButton); myBeforeButton.setText("before " + postfix); myAfterButton.setText("after " + postfix); - myBeforeButton.setSelected(true); + myAfterButton.setSelected(true); } public int getIndexDelta() { From 4e0f092dea38423dfd60cc56feac02ac0df3668d Mon Sep 17 00:00:00 2001 From: Lada Gagina Date: Tue, 2 Aug 2016 20:14:40 +0300 Subject: [PATCH 4/6] Add missing magic methods to PyNames and fix __rpow__ completion test --- python/psi-api/src/com/jetbrains/python/PyNames.java | 12 ++++++++++++ python/testData/completion/rPowSignature.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/python/psi-api/src/com/jetbrains/python/PyNames.java b/python/psi-api/src/com/jetbrains/python/PyNames.java index 99896e451317..97244d9e285c 100644 --- a/python/psi-api/src/com/jetbrains/python/PyNames.java +++ b/python/psi-api/src/com/jetbrains/python/PyNames.java @@ -288,12 +288,15 @@ public class PyNames { //_BuiltinMethods.put("__author__", _only_self_descr); //_BuiltinMethods.put("__bases__", _only_self_descr); .put("__call__", new BuiltinDescription("(self, *args, **kwargs)")) + .put("__ceil__", _only_self_descr) //_BuiltinMethods.put("__class__", _only_self_descr); .put("__cmp__", _self_other_descr) .put("__coerce__", _self_other_descr) .put("__complex__", _only_self_descr) .put("__contains__", _self_item_descr) + .put("__copy__", _only_self_descr) //_BuiltinMethods.put("__debug__", _only_self_descr); + .put("__deepcopy__", new BuiltinDescription("(self, memodict={})")) .put("__del__", _only_self_descr) .put("__delete__", new BuiltinDescription("(self, instance)")) .put("__delattr__", _self_item_descr) @@ -308,14 +311,18 @@ public class PyNames { .put("__eq__", _self_other_descr) //_BuiltinMethods.put("__file__", _only_self_descr); .put("__float__", _only_self_descr) + .put("__floor__", _only_self_descr) .put("__floordiv__", _self_other_descr) //_BuiltinMethods.put("__future__", _only_self_descr); .put("__ge__", _self_other_descr) .put("__get__", new BuiltinDescription("(self, instance, owner)")) .put("__getattr__", _self_item_descr) .put("__getattribute__", _self_item_descr) + .put("__getinitargs__", _only_self_descr) .put("__getitem__", _self_item_descr) + .put("__getnewargs__", _only_self_descr) //_BuiltinMethods.put("__getslice__", new BuiltinDescription("(self, i, j)")); + .put("__getstate__", _only_self_descr) .put("__gt__", _self_other_descr) .put("__hash__", _only_self_descr) .put("__hex__", _only_self_descr) @@ -345,6 +352,7 @@ public class PyNames { .put("__lt__", _self_other_descr) //_BuiltinMethods.put("__members__", _only_self_descr); //_BuiltinMethods.put("__metaclass__", _only_self_descr); + .put("__missing__", _self_key_descr) .put("__mod__", _self_other_descr) //_BuiltinMethods.put("__mro__", _only_self_descr); .put("__mul__", _self_other_descr) @@ -362,6 +370,7 @@ public class PyNames { .put("__rdiv__", _self_other_descr) .put("__rdivmod__", _self_other_descr) .put("__reduce__", _only_self_descr) + .put("__reduce_ex__", new BuiltinDescription("(self, protocol)")) .put("__repr__", _only_self_descr) .put("__reversed__", _only_self_descr) .put("__rfloordiv__", _self_other_descr) @@ -384,6 +393,7 @@ public class PyNames { .put("__str__", _only_self_descr) .put("__sub__", _self_other_descr) .put("__truediv__", _self_other_descr) + .put("__trunc__", _only_self_descr) .put("__unicode__", _only_self_descr) //_BuiltinMethods.put("__version__", _only_self_descr); .put("__xor__", _self_other_descr) @@ -401,8 +411,10 @@ public class PyNames { .put("__bool__", _only_self_descr) .put("__bytes__", _only_self_descr) .put("__format__", new BuiltinDescription("(self, format_spec)")) + .put("__instancecheck__", new BuiltinDescription("(self, instance)")) .put("__prepare__", new BuiltinDescription("(metacls, name, bases)")) .put("__round__", new BuiltinDescription("(self, n=None)")) + .put("__subclasscheck__", new BuiltinDescription("(self, subclass)")) .put(DUNDER_NEXT, _only_self_descr) .build(); diff --git a/python/testData/completion/rPowSignature.py b/python/testData/completion/rPowSignature.py index 128c85c9ee2f..4dcce9829023 100644 --- a/python/testData/completion/rPowSignature.py +++ b/python/testData/completion/rPowSignature.py @@ -1,2 +1,2 @@ class Cl(object): - def __rp \ No newline at end of file + def __rpo \ No newline at end of file From 0897c8fe909f219632ee2b239fc75c3d7dce1c39 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 2 Aug 2016 20:13:20 +0300 Subject: [PATCH 5/6] IDEA-159106 TraceableDisposable$DisposalException at at com.intellij.openapi.util.TraceableDisposable.throwDisposalError() --- .../intellij/codeInsight/lookup/impl/LookupActionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java index 2e830e523320..263f514c4e0c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java @@ -56,7 +56,7 @@ public abstract class LookupActionHandler extends EditorActionHandler { LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor); if (lookup == null || !lookup.isAvailableToUser() || myRequireFocusedLookup && !lookup.isFocused()) { Project project = editor.getProject(); - if (project != null) { + if (project != null && lookup != null) { LookupManager.getInstance(project).hideActiveLookup(); } myOriginalHandler.execute(editor, caret, dataContext); From 03a7f693bebe0a87fd468405837f601cffca2b61 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 2 Aug 2016 20:35:37 +0300 Subject: [PATCH 6/6] remove usages of deprecated method in LookupActionHandler --- .../codeInsight/lookup/impl/LookupActionHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java index 263f514c4e0c..3630bf548420 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupActionHandler.java @@ -32,6 +32,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.ui.ScrollingUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -70,9 +71,9 @@ public abstract class LookupActionHandler extends EditorActionHandler { protected abstract void executeInLookup(LookupImpl lookup, DataContext context, @Nullable Caret caret); @Override - public boolean isEnabled(Editor editor, DataContext dataContext) { + public boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor); - return lookup != null || myOriginalHandler.isEnabled(editor, dataContext); + return lookup != null || myOriginalHandler.isEnabled(editor, caret, dataContext); } private static void executeUpOrDown(LookupImpl lookup, boolean up) {