private void initEditor() { myEditor = new EditorComboBoxEditor(getProject(), getEditorsProvider().getFileType()) { @Override public void setItem(Object anObject) { if (anObject == null) { anObject = XExpressionImpl.EMPTY_EXPRESSION; } XExpression expression = (XExpression) anObject; getEditorComponent() .setNewDocumentAndFileType(getFileType(expression), createDocument(expression)); } @Override protected void onEditorCreate(EditorEx editor) { editor.putUserData(DebuggerCopyPastePreprocessor.REMOVE_NEWLINES_ON_PASTE, true); editor.getColorsScheme().setEditorFontSize(myComboBox.getFont().getSize()); } }; myEditor.getEditorComponent().setFontInheritedFromLAF(false); myComboBox.setEditor(myEditor); // myEditor.setItem(myExpression); myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor)); myComboBox.setMaximumRowCount(XDebuggerHistoryManager.MAX_RECENT_EXPRESSIONS); }
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); } }