diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java index cd21f5792fd9..09d597eebac1 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java @@ -693,4 +693,9 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc updateMethodPresentation((PsiMethod)p, null, context); } } + + @Override + public boolean supportsOverloadSwitching() { + return CodeInsightSettings.getInstance().SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION; + } } diff --git a/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoHandler.java b/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoHandler.java index c8cc41b96138..00f96e4795f4 100644 --- a/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoHandler.java +++ b/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoHandler.java @@ -46,5 +46,6 @@ public interface ParameterInfoHandler { @Nullable String getParameterCloseChars(); boolean tracksParameterIndex(); + default boolean supportsOverloadSwitching() { return false; } default void dispose() {} } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java index cfdfe4786132..20f62d42198a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java @@ -17,14 +17,17 @@ package com.intellij.codeInsight.hint; import com.google.common.collect.ImmutableMap; +import com.intellij.codeInsight.CodeInsightBundle; import com.intellij.lang.parameterInfo.ParameterInfoHandler; import com.intellij.lang.parameterInfo.ParameterInfoUIContextEx; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.ui.*; import com.intellij.util.Function; +import com.intellij.util.ui.JBEmptyBorder; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.accessibility.AccessibleContextUtil; import com.intellij.xml.util.XmlStringUtil; @@ -48,6 +51,7 @@ public class ParameterInfoComponent extends JPanel { @NotNull private final ParameterInfoHandler myHandler; private final OneElementComponent[] myPanels; + private final JLabel myShortcutLabel; private final Font NORMAL_FONT; private final Font BOLD_FONT; @@ -123,6 +127,13 @@ public class ParameterInfoComponent extends JPanel { pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); add(pane, BorderLayout.CENTER); + myShortcutLabel = new JLabel(CodeInsightBundle.message("parameter.info.switch.overload.shortcuts")); + myShortcutLabel.setForeground(new JBColor(0x787878, 0x787878)); + Font labelFont = UIUtil.getLabelFont(); + myShortcutLabel.setFont(labelFont.deriveFont(labelFont.getSize2D() - (SystemInfo.isWindows ? 1 : 2))); + myShortcutLabel.setBorder(new JBEmptyBorder(3, 0, 0, 0)); + add(myShortcutLabel, BorderLayout.SOUTH); + myCurrentParameterIndex = -1; } @@ -255,6 +266,8 @@ public class ParameterInfoComponent extends JPanel { } } + myShortcutLabel.setVisible(!singleParameterInfo && myObjects.length > 1 && myHandler.supportsOverloadSwitching()); + invalidate(); validate(); repaint(); diff --git a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties index 9658e17f4466..4bcb071ea967 100644 --- a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties +++ b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties @@ -557,4 +557,6 @@ block.comment.intersects.existing.comment=Selected region intersects existing co block.comment.wrapping.suffix=Selected region contains block comment suffix block.comment.nested.comment=Selected region contained block {0, choice, 1#comment|2#comments},\nsurrounding ranges were commented. -intention.unroll.loop.family=Unroll loop \ No newline at end of file +intention.unroll.loop.family=Unroll loop + +parameter.info.switch.overload.shortcuts=Switch with \u2191 or \u2193 \ No newline at end of file