Search in sources :

Example 1 with AvdComboBox

use of com.android.tools.idea.run.AvdComboBox in project android by JetBrains.

the class EmulatorTargetConfigurable method createUIComponents.

private void createUIComponents() {
    myAvdCombo = new AvdComboBox(myProject, true, false) {

        @Override
        public Module getModule() {
            return myContext.getModule();
        }
    };
    myAvdCombo.startUpdatingAvds(ModalityState.current());
    JComboBox avdComboBox = myAvdCombo.getComboBox();
    avdComboBox.setRenderer(new ListCellRendererWrapper() {

        @Override
        public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
            if (value instanceof IdDisplay) {
                setText(((IdDisplay) value).getDisplay());
            } else {
                setText(String.format("<html><font color='red'>Unknown AVD %1$s</font></html>", value == null ? "" : value.toString()));
            }
        }
    });
    avdComboBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            resetAvdCompatibilityWarningLabel();
        }
    });
    myAvdComboWithButton = new ComboboxWithBrowseButton(avdComboBox);
    Disposer.register(myParentDisposable, myAvdCombo);
}
Also used : ActionEvent(java.awt.event.ActionEvent) ListCellRendererWrapper(com.intellij.ui.ListCellRendererWrapper) AvdComboBox(com.android.tools.idea.run.AvdComboBox) IdDisplay(com.android.sdklib.repository.IdDisplay) ActionListener(java.awt.event.ActionListener) ComboboxWithBrowseButton(com.intellij.ui.ComboboxWithBrowseButton) Module(com.intellij.openapi.module.Module)

Aggregations

IdDisplay (com.android.sdklib.repository.IdDisplay)1 AvdComboBox (com.android.tools.idea.run.AvdComboBox)1 Module (com.intellij.openapi.module.Module)1 ComboboxWithBrowseButton (com.intellij.ui.ComboboxWithBrowseButton)1 ListCellRendererWrapper (com.intellij.ui.ListCellRendererWrapper)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1