mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Parameter Name Hints] added language combobox
This commit is contained in:
+32
-3
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.codeInsight.hints.settings.ParameterNameHintsConfigurable">
|
||||
<grid id="27dc6" binding="myConfigurable" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myConfigurable" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="2069" height="400"/>
|
||||
@@ -11,7 +11,7 @@
|
||||
<grid id="dda71" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -54,9 +54,38 @@
|
||||
</grid>
|
||||
<vspacer id="ca768">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="8ca84" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="4be87" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Language:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="5eb47">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="6747b" class="com.intellij.openapi.ui.ComboBox" binding="myCurrentLanguageCombo" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
+20
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.hints.settings;
|
||||
|
||||
import com.intellij.codeInsight.hints.InlayParameterHintsExtension;
|
||||
import com.intellij.codeInsight.hints.filtering.MatcherConstructor;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -23,15 +24,20 @@ import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.ListCellRendererWrapper;
|
||||
import com.intellij.util.containers.JBIterable;
|
||||
import org.jdesktop.swingx.combobox.ListComboBoxModel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -39,6 +45,7 @@ import java.util.stream.Collectors;
|
||||
public class ParameterNameHintsConfigurable extends DialogWrapper {
|
||||
public JPanel myConfigurable;
|
||||
private EditorTextField myEditorTextField;
|
||||
private ComboBox<Language> myCurrentLanguageCombo;
|
||||
|
||||
private final Set<String> myDefaultBlackList;
|
||||
private final Language myLanguage;
|
||||
@@ -107,6 +114,19 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
|
||||
updateOkEnabled();
|
||||
}
|
||||
});
|
||||
|
||||
Collection<Language> allLanguages = Language.getRegisteredLanguages();
|
||||
JBIterable<Language> languagesWithHintsSupport = JBIterable.from(allLanguages)
|
||||
.filter((lang) -> !InlayParameterHintsExtension.INSTANCE.forKey(lang).isEmpty());
|
||||
|
||||
ListComboBoxModel<Language> model = new ListComboBoxModel<>(languagesWithHintsSupport.toList());
|
||||
myCurrentLanguageCombo = new ComboBox<>(model);
|
||||
myCurrentLanguageCombo.setRenderer(new ListCellRendererWrapper<Language>() {
|
||||
@Override
|
||||
public void customize(JList list, Language value, int index, boolean selected, boolean hasFocus) {
|
||||
setText(value.getDisplayName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private EditorTextField createEditor(@NotNull Set<String> blacklist, @Nullable String newPreselectedItem) {
|
||||
|
||||
Reference in New Issue
Block a user