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 @@
+
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());
}
}
});
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
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();
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..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
@@ -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 int y = cellBounds.y + myEditor.visualPositionToXY(myEditor.getCaretModel().getVisualPosition()).y;
+ int delta = myEditor.getLineHeight() * 2;
+ if (y <= rect.getY() && up) {
+ scrollPane.getVerticalScrollBar().setValue(y);
+ }
+ if (y + delta > rect.getY() + rect.getHeight() && !up) {
+ scrollPane.getVerticalScrollBar().setValue(y - rect.height + delta);
+ }
+ }
+
@Override
public void keyReleased(KeyEvent e) {
final int keyCode = e.getKeyCode();
@@ -120,6 +139,10 @@ 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 || keyCode == KeyEvent.VK_PAGE_DOWN ||
+ keyCode == KeyEvent.VK_PAGE_UP) {
+ updateVisibleArea(keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_PAGE_UP);
+ }
}
}