Make inlay parameter hints blacklist explanation text overridable per language

PHP WI-35135 Java-specific help text in "Configure Parameter Name Hint" dialog

(cherry picked from commit 409eb3d)
This commit is contained in:
Alexey Gopachenko
2017-03-17 20:38:36 +01:00
parent 7e879c3e95
commit 8b38ef0120
2 changed files with 18 additions and 1 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.codeInsight.hints;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.lang.Language;
import com.intellij.psi.PsiElement;
import com.intellij.util.containers.ContainerUtil;
@@ -75,6 +76,13 @@ public interface InlayParameterHintsProvider {
return true;
}
/**
* Text explaining black list patterns
*/
default String getBlacklistExplanationHTML() {
return CodeInsightBundle.message("inlay.hints.blacklist.pattern.explanation");
}
/**
* Customise hints presentation
*/
@@ -222,12 +222,21 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
blacklistPanel.setLayout(layout);
blacklistPanel.setBorder(IdeBorderFactory.createTitledBorder("Blacklist"));
blacklistPanel.add(new JBLabel(CodeInsightBundle.message("inlay.hints.blacklist.pattern.explanation")));
blacklistPanel.add(new JBLabel(getBlacklistExplanationHTML(language)));
blacklistPanel.add(editorTextField);
return blacklistPanel;
}
@NotNull
private String getBlacklistExplanationHTML(Language language) {
InlayParameterHintsProvider hintsProvider = InlayParameterHintsExtension.INSTANCE.forLanguage(language);
if (hintsProvider == null) {
return CodeInsightBundle.message("inlay.hints.blacklist.pattern.explanation");
}
return hintsProvider.getBlacklistExplanationHTML();
}
@Nullable
private JPanel createOptionsPanel(@NotNull Language language) {
List<Option> options = getOptions(language);