mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplify Combobox ctor +review
use idea Combobox
This commit is contained in:
+1
-1
@@ -272,7 +272,7 @@ public class MakeParameterizedStaticDialog extends AbstractMakeStaticDialog {
|
||||
}
|
||||
|
||||
private JComboBox createComboBoxForName() {
|
||||
final ComboBox combobox = new ComboBox(myNameSuggestions,-1);
|
||||
final ComboBox combobox = new ComboBox(myNameSuggestions);
|
||||
|
||||
combobox.setEditable(true);
|
||||
combobox.setSelectedIndex(0);
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
|
||||
|
||||
gbConstraints.gridx = 1;
|
||||
gbConstraints.insets = new Insets(0, 4, 0, 0);
|
||||
myExpandByCombo = new ComboBox(new Object[]{myDefaultShortcutItem, SPACE, TAB, ENTER}, -1);
|
||||
myExpandByCombo = new ComboBox(new String[]{myDefaultShortcutItem, SPACE, TAB, ENTER});
|
||||
myExpandByCombo.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
|
||||
@@ -64,8 +64,10 @@ import javax.swing.*;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
@@ -766,7 +768,7 @@ public class FindDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
Arrays.sort(names,String.CASE_INSENSITIVE_ORDER);
|
||||
myModuleComboBox = new ComboBox(names, -1);
|
||||
myModuleComboBox = new ComboBox(names);
|
||||
scopePanel.add(myModuleComboBox, gbConstraints);
|
||||
|
||||
if (modules.length == 1) {
|
||||
|
||||
@@ -73,7 +73,7 @@ public class NameSuggestionsField extends JPanel {
|
||||
myComponent = createTextFieldForName(nameSuggestions, fileType);
|
||||
}
|
||||
else {
|
||||
final ComboBox combobox = new ComboBox(nameSuggestions,-1);
|
||||
final ComboBox combobox = new ComboBox(nameSuggestions);
|
||||
combobox.setSelectedIndex(0);
|
||||
setupComboBox(combobox, fileType);
|
||||
myComponent = combobox;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.ui.MacUIUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -194,6 +195,9 @@ public class ComboBox extends ComboBoxWithWidePopup implements AWTEventListener
|
||||
registerCancelOnEscape();
|
||||
}
|
||||
|
||||
public ComboBox(@NotNull Object[] items) {
|
||||
this(items, -1);
|
||||
}
|
||||
|
||||
public boolean isSwingPopup() {
|
||||
return mySwingPopup;
|
||||
|
||||
@@ -168,7 +168,7 @@ public class MvcRunTargetDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
myTargetField = new ComboBox(MvcRunTargetHistoryService.getInstance().getHistory(), -1);
|
||||
myTargetField = new ComboBox(MvcRunTargetHistoryService.getInstance().getHistory());
|
||||
myTargetField.setLightWeightPopupEnabled(false);
|
||||
|
||||
EditorComboBoxEditor editor = new StringComboboxEditor(myModule.getProject(), PlainTextFileType.INSTANCE, myTargetField);
|
||||
|
||||
+2
-2
@@ -25,6 +25,7 @@ import com.intellij.ui.EditorComboBoxEditor;
|
||||
import com.intellij.ui.EditorComboBoxRenderer;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.StringComboboxEditor;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.model.MavenConstants;
|
||||
@@ -74,8 +75,7 @@ public class MavenEditGoalDialog extends DialogWrapper {
|
||||
goalsLabel.setLabelFor(goalsEditor);
|
||||
}
|
||||
else {
|
||||
//noinspection SSBasedInspection
|
||||
goalsComboBox = new ComboBox(myHistory.toArray(new String[myHistory.size()]), -1);
|
||||
goalsComboBox = new ComboBox(ArrayUtilRt.toStringArray(myHistory));
|
||||
goalComponent = goalsComboBox;
|
||||
|
||||
goalsLabel.setLabelFor(goalsComboBox);
|
||||
|
||||
Reference in New Issue
Block a user