mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-95292
This commit is contained in:
+18
-1
@@ -44,6 +44,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.plaf.basic.ComboPopup;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.EnumSet;
|
||||
@@ -90,7 +91,7 @@ public class ResourceEditor extends PropertyEditor {
|
||||
});
|
||||
}
|
||||
else if (formats.contains(AttributeFormat.Enum)) {
|
||||
ComboboxWithBrowseButton editor = new ComboboxWithBrowseButton(SystemInfo.isWindows ? new ComboBox() : new JComboBox()) {
|
||||
ComboboxWithBrowseButton editor = new ComboboxWithBrowseButton(SystemInfo.isWindows ? new MyComboBox() : new JComboBox()) {
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
return getComponentPreferredSize();
|
||||
@@ -333,4 +334,20 @@ public class ResourceEditor extends PropertyEditor {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final class MyComboBox extends ComboBox {
|
||||
public MyComboBox() {
|
||||
((JTextField)getEditor().getEditorComponent()).addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (isPopupVisible()) {
|
||||
ComboPopup popup = getPopup();
|
||||
if (popup != null) {
|
||||
setSelectedItem(popup.getList().getSelectedValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user