From 994de29bad0ca3a84efd610edf8f0cf81983e502 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Wed, 14 Oct 2015 17:28:16 +0300 Subject: [PATCH 1/6] fixed PY-16984 iPython notebook clicking in cell causes odd scrolling handled up/down inside code cell --- .../plugins/ipnb/editor/IpnbFileEditor.java | 4 ++++ .../panels/code/IpnbCodeSourcePanel.java | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java index 2fd362c1512d..b72dd2c1403d 100644 --- a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java +++ b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java @@ -452,4 +452,8 @@ public class IpnbFileEditor extends UserDataHolderBase implements FileEditor { public VirtualFile getVirtualFile() { return myFile; } + + public JScrollPane getScrollPane() { + return myScrollPane; + } } diff --git a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java index 5b9e19fc6f1c..14235a26fee6 100644 --- a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java +++ b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java @@ -26,6 +26,7 @@ import com.intellij.ui.components.panels.HorizontalLayout; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.ipnb.editor.IpnbEditorUtil; +import org.jetbrains.plugins.ipnb.editor.IpnbFileEditor; import org.jetbrains.plugins.ipnb.editor.actions.IpnbRunCellAction; import org.jetbrains.plugins.ipnb.editor.actions.IpnbRunCellBaseAction; import org.jetbrains.plugins.ipnb.editor.actions.IpnbRunCellInplaceAction; @@ -97,6 +98,24 @@ public class IpnbCodeSourcePanel extends IpnbPanel imp } } + private void updateVisibleArea(boolean up) { + final IpnbFileEditor fileEditor = myParent.getFileEditor(); + final IpnbFilePanel ipnbPanel = fileEditor.getIpnbFilePanel(); + final Rectangle rect = ipnbPanel.getVisibleRect(); + + final Rectangle cellBounds = IpnbCodeSourcePanel.this.getIpnbCodePanel().getBounds(); + final JScrollPane scrollPane = fileEditor.getScrollPane(); + + final double y = cellBounds.getY() + myEditor.visualPositionToXY(myEditor.getCaretModel().getVisualPosition()).getY(); + int delta = myEditor.getLineHeight(); + if (y <= rect.getY() && up) { + scrollPane.getVerticalScrollBar().setValue(rect.y - delta); + } + if (y + delta > rect.getY() + rect.getHeight() && !up) { + scrollPane.getVerticalScrollBar().setValue(rect.y + delta); + } + } + @Override public void keyReleased(KeyEvent e) { final int keyCode = e.getKeyCode(); @@ -120,6 +139,9 @@ public class IpnbCodeSourcePanel extends IpnbPanel imp else if (keyCode == KeyEvent.VK_ENTER && InputEvent.SHIFT_DOWN_MASK == e.getModifiersEx()) { IpnbRunCellBaseAction.runCell(ipnbFilePanel, true); } + else if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN) { + updateVisibleArea(keyCode == KeyEvent.VK_UP); + } } } From 9bb7ca15d76d8964e21cc24eefaada27a34b1468 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Wed, 14 Oct 2015 17:40:28 +0300 Subject: [PATCH 2/6] fixed PY-16984 iPython notebook clicking in cell causes odd scrolling handled page up/down inside code cell --- .../editor/panels/code/IpnbCodeSourcePanel.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java index 14235a26fee6..32031ceebf33 100644 --- a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java +++ b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodeSourcePanel.java @@ -106,13 +106,13 @@ public class IpnbCodeSourcePanel extends IpnbPanel imp final Rectangle cellBounds = IpnbCodeSourcePanel.this.getIpnbCodePanel().getBounds(); final JScrollPane scrollPane = fileEditor.getScrollPane(); - final double y = cellBounds.getY() + myEditor.visualPositionToXY(myEditor.getCaretModel().getVisualPosition()).getY(); - int delta = myEditor.getLineHeight(); + final int y = cellBounds.y + myEditor.visualPositionToXY(myEditor.getCaretModel().getVisualPosition()).y; + int delta = myEditor.getLineHeight() * 2; if (y <= rect.getY() && up) { - scrollPane.getVerticalScrollBar().setValue(rect.y - delta); + scrollPane.getVerticalScrollBar().setValue(y); } if (y + delta > rect.getY() + rect.getHeight() && !up) { - scrollPane.getVerticalScrollBar().setValue(rect.y + delta); + scrollPane.getVerticalScrollBar().setValue(y - rect.height + delta); } } @@ -139,8 +139,9 @@ public class IpnbCodeSourcePanel extends IpnbPanel imp else if (keyCode == KeyEvent.VK_ENTER && InputEvent.SHIFT_DOWN_MASK == e.getModifiersEx()) { IpnbRunCellBaseAction.runCell(ipnbFilePanel, true); } - else if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN) { - updateVisibleArea(keyCode == KeyEvent.VK_UP); + else if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_PAGE_DOWN || + keyCode == KeyEvent.VK_PAGE_UP) { + updateVisibleArea(keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_PAGE_UP); } } From ad98b1ae27e58f2f2f48739422c21a458852ab87 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 16 Oct 2015 16:03:52 +0300 Subject: [PATCH 3/6] merging Android Studio 1.4 --- community-main.iml | 1 + 1 file changed, 1 insertion(+) diff --git a/community-main.iml b/community-main.iml index f26de9512bd7..63ff7f1979aa 100644 --- a/community-main.iml +++ b/community-main.iml @@ -84,6 +84,7 @@ + From c40ea482f8c0be2181f1b3f17cfa129e093cef65 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 16 Oct 2015 14:50:24 +0200 Subject: [PATCH 4/6] IDEA-146476 (AutoCloseable inspection doesn't recognize Java 8 method references) --- .../AutoCloseableResourceInspectionBase.java | 31 ++++++++++++++----- .../AutoCloseableResourceInspectionTest.java | 18 +++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/resources/AutoCloseableResourceInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/resources/AutoCloseableResourceInspectionBase.java index 737b1581fd56..a26af33bb593 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/resources/AutoCloseableResourceInspectionBase.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/resources/AutoCloseableResourceInspectionBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -18,6 +18,7 @@ package com.siyeh.ig.resources; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.WriteExternalException; import com.intellij.psi.*; +import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PsiUtil; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; @@ -59,9 +60,7 @@ public class AutoCloseableResourceInspectionBase extends BaseInspection { @NotNull @Override protected String buildErrorString(Object... infos) { - final PsiExpression expression = (PsiExpression)infos[0]; - final PsiType type = expression.getType(); - assert type != null; + final PsiType type = (PsiType)infos[0]; final String text = type.getPresentableText(); return InspectionGadgetsBundle.message("auto.closeable.resource.problem.descriptor", text); } @@ -108,7 +107,7 @@ public class AutoCloseableResourceInspectionBase extends BaseInspection { if (!isNotSafelyClosedResource(expression)) { return; } - registerNewExpressionError(expression, expression); + registerNewExpressionError(expression, expression.getType()); } @Override @@ -120,11 +119,29 @@ public class AutoCloseableResourceInspectionBase extends BaseInspection { if (!isNotSafelyClosedResource(expression)) { return; } - registerMethodCallError(expression, expression); + registerMethodCallError(expression, expression.getType()); + } + + @Override + public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) { + super.visitMethodReferenceExpression(expression); + if (!expression.isConstructor()) { + return; + } + final PsiType type = PsiMethodReferenceUtil.getQualifierType(expression); + if (!InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_AUTO_CLOSEABLE)) { + return; + } + for (String ignoredType : ignoredTypes) { + if (InheritanceUtil.isInheritor(type, ignoredType)) { + return; + } + } + registerError(expression, type); } private boolean isNotSafelyClosedResource(PsiExpression expression) { - if (!TypeUtils.expressionHasTypeOrSubtype(expression, "java.lang.AutoCloseable")) { + if (!TypeUtils.expressionHasTypeOrSubtype(expression, CommonClassNames.JAVA_LANG_AUTO_CLOSEABLE)) { return false; } if (TypeUtils.expressionHasTypeOrSubtype(expression, ignoredTypes)) { diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/resources/AutoCloseableResourceInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/resources/AutoCloseableResourceInspectionTest.java index 5f3002a14c78..8b862b24a72b 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/resources/AutoCloseableResourceInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/resources/AutoCloseableResourceInspectionTest.java @@ -16,7 +16,9 @@ package com.siyeh.ig.resources; import com.intellij.codeInspection.LocalInspectionTool; +import com.intellij.testFramework.LightProjectDescriptor; import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.NotNull; /** * @author Bas Leijdekkers @@ -68,6 +70,22 @@ public class AutoCloseableResourceInspectionTest extends LightInspectionTestCase "}"); } + public void testMethodReference() { + doTest("import java.util.*;" + + "class X {" + + " void m(List list) {" + + " final Z f = /*'X.Y' used without 'try'-with-resources statement*/Y::new/**/;" + + " }" + + " class Y implements java.io.Closeable {" + + " Y(String s) {}" + + " public void close() throws java.io.IOException {}" + + " }" + + " interface Z {\n" + + " R apply(T t);" + + " }" + + "}"); + } + @Override protected LocalInspectionTool getInspection() { return new AutoCloseableResourceInspection(); From a7b2169ef23a05080262752a60a0cc080f501b3d Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Fri, 16 Oct 2015 15:28:21 +0300 Subject: [PATCH 5/6] IDEA-146446 Can't switch JDK on OS X 10.11 (cherry picked from commit ed016a2) --- .../com/intellij/openapi/util/SwitchBootJdkAction.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java b/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java index 6d42647ba651..ffae634ec9ea 100644 --- a/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java @@ -167,7 +167,10 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { final ArrayList pathsList = JdkUtil.findJdkPaths(); if (!jdkBundlesList.isEmpty()) { - pathsList.add(0, jdkBundlesList.get(0)); + JdkBundleDescriptor jdkBundleDescription = jdkBundlesList.get(0); + if (jdkBundleDescription != null) { + pathsList.add(0, jdkBundleDescription); + } } myComboBox = new ComboBox(); @@ -191,7 +194,7 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { JdkBundleDescriptor jdkBundleDescriptor = ((JdkBundleDescriptor)value); setText(jdkBundleDescriptor.getVisualRepresentation()); } else { - LOG.error("Null value has been passed to a cell renderer. Available JDKs count: " + pathsList.size()); + LOG.debug("Null value has been passed to a cell renderer. Available JDKs count: " + pathsList.size()); StringBuilder jdkNames = new StringBuilder(); for (JdkBundleDescriptor jdkBundlePath : pathsList) { if (!jdkBundlesList.isEmpty()) { @@ -199,7 +202,7 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { } jdkNames.append(jdkBundlePath.getVisualRepresentation()).append("; "); } - LOG.error("Available JDKs names: " + jdkNames.toString()); + LOG.debug("Available JDKs names: " + jdkNames.toString()); } } }); From 026a23fdde5a2b1b5d361669949b765ce93e8c90 Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Fri, 16 Oct 2015 16:19:22 +0300 Subject: [PATCH 6/6] Disabling recent projects in jumplist (IDEA-143209 Pinned to Taskbar in Windows 10 isn't combined with opened windows.) --- platform/util/resources/misc/registry.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index a4764620846c..a7e1d7ffbea4 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -428,7 +428,7 @@ ide.mac.message.sheets.java.emulation.dialogs=true ide.mac.message.sheets.java.emulation.dialogs.description=Use Java message sheets based on awt dialogs instead of native sheets linux.native.menu=false linux.native.menu.description=Enables native menu on Ubuntu -windows.jumplist=true +windows.jumplist=false windows.jumplist.description=Enables JumpLists on Windows GRADLE.system.in.process=true