From 05d3c1fde43b31912cd440c697657a85e3045e05 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Tue, 28 Aug 2012 20:22:27 +0400 Subject: [PATCH 1/2] fixed PY-7089 Insert type assertion: leads to syntactically incorrect code when invoked for one-line function --- .../python/codeInsight/intentions/TypeAssertionIntention.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java index 4fd66c48b40d..18ae05f5dfb7 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java @@ -95,7 +95,7 @@ public class TypeAssertionIntention implements IntentionAction { final Document document = editor.getDocument(); if (statementList != null) { - PsiElement statementListParent = statementList.getParent(); + PsiElement statementListParent = PsiTreeUtil.getParentOfType(statementList, PyStatement.class); if (document.getLineNumber(statementList.getTextOffset()) == document.getLineNumber(statementListParent.getTextOffset())) { final String substring = @@ -105,7 +105,6 @@ public class TypeAssertionIntention implements IntentionAction { text + "\n\t" + statementList.getText()); statementListParent = statementListParent.replace(foo); - statementListParent = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(statementListParent); statementList = PsiTreeUtil.findChildOfType(statementListParent, PyStatementList.class); element = statementList.getStatements()[0]; } From 387174914333a9961270218062a46b822f71b8f5 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Tue, 28 Aug 2012 20:46:36 +0400 Subject: [PATCH 2/2] Icons classes generated for every plugin. Those aren't used yet though --- python/helpers/icons/PythonHelpersIcons.java | 14 ++++++++++++++ python/python-helpers.iml | 1 + python/rest/src/icons/RestIcons.java | 13 +++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 python/helpers/icons/PythonHelpersIcons.java create mode 100644 python/rest/src/icons/RestIcons.java diff --git a/python/helpers/icons/PythonHelpersIcons.java b/python/helpers/icons/PythonHelpersIcons.java new file mode 100644 index 000000000000..c80728d8bc73 --- /dev/null +++ b/python/helpers/icons/PythonHelpersIcons.java @@ -0,0 +1,14 @@ +package icons; + +import com.intellij.openapi.util.IconLoader; + +import javax.swing.*; + +/** + * NOTE THIS FILE IS AUTO-GENERATED by the build/scripts/icons.gant + * Don't repeat mistakes of others ;-) + */ +public class PythonHelpersIcons { + public static final Icon Keybd_closed = IconLoader.getIcon("/coverage/htmlfiles/keybd_closed.png"); // 35x12 + public static final Icon Keybd_open = IconLoader.getIcon("/coverage/htmlfiles/keybd_open.png"); // 35x12 +} diff --git a/python/python-helpers.iml b/python/python-helpers.iml index 880a7f9e4113..9d65a5f9a331 100644 --- a/python/python-helpers.iml +++ b/python/python-helpers.iml @@ -7,6 +7,7 @@ + diff --git a/python/rest/src/icons/RestIcons.java b/python/rest/src/icons/RestIcons.java new file mode 100644 index 000000000000..37a8509d1aee --- /dev/null +++ b/python/rest/src/icons/RestIcons.java @@ -0,0 +1,13 @@ +package icons; + +import com.intellij.openapi.util.IconLoader; + +import javax.swing.*; + +/** + * NOTE THIS FILE IS AUTO-GENERATED by the build/scripts/icons.gant + * Don't repeat mistakes of others ;-) + */ +public class RestIcons { + public static final Icon Rst = IconLoader.getIcon("/com/jetbrains/rest/res/rst.png"); // 16x16 +}