public XDebuggerExpressionComboBox( @NotNull Project project, @NotNull XDebuggerEditorsProvider debuggerEditorsProvider, @Nullable @NonNls String historyId, @Nullable XSourcePosition sourcePosition, boolean showEditor) { super(project, debuggerEditorsProvider, EvaluationMode.EXPRESSION, historyId, sourcePosition); myComboBox = new ComboBox<>(100); myComboBox.setEditable(true); myExpression = XExpressionImpl.EMPTY_EXPRESSION; Dimension minimumSize = new Dimension(myComboBox.getMinimumSize()); minimumSize.width = 100; myComboBox.setMinimumSize(minimumSize); initEditor(); fillComboBox(); myComponent = decorate(myComboBox, false, showEditor); }
GitCheckinOptions(@NotNull final Project project, @NotNull CheckinProjectPanel panel) { super(project, panel); myVcs = GitVcs.getInstance(project); final Insets insets = new Insets(2, 2, 2, 2); // add authors drop down GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.WEST; c.insets = insets; final JLabel authorLabel = new JLabel(GitBundle.message("commit.author")); myPanel.add(authorLabel, c); c = new GridBagConstraints(); c.anchor = GridBagConstraints.CENTER; c.insets = insets; c.gridx = 1; c.gridy = 0; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; final List<String> usersList = getUsersList(project); final Set<String> authors = usersList == null ? new HashSet<String>() : new HashSet<String>(usersList); ContainerUtil.addAll(authors, mySettings.getCommitAuthors()); List<String> list = new ArrayList<String>(authors); Collections.sort(list); list = ObjectsConvertor.convert( list, new Convertor<String, String>() { @Override public String convert(String o) { return StringUtil.shortenTextWithEllipsis(o, 30, 0); } }); myAuthor = new ComboBox(ArrayUtil.toObjectArray(list)); myAuthor.insertItemAt("", 0); myAuthor.setSelectedItem(""); myAuthor.setEditable(true); authorLabel.setLabelFor(myAuthor); myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip")); myPanel.add(myAuthor, c); }
private void setUpNameComboBox(Collection<String> possibleNames) { final EditorComboBoxEditor comboEditor = new StringComboboxEditor(myProject, HaxeFileType.HAXE_FILE_TYPE, myNameComboBox); myNameComboBox.setEditor(comboEditor); myNameComboBox.setRenderer(new EditorComboBoxRenderer(comboEditor)); myNameComboBox.setEditable(true); myNameComboBox.setMaximumRowCount(8); myContentPane.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { myNameComboBox.requestFocus(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); for (String possibleName : possibleNames) { myNameComboBox.addItem(possibleName); } }