private void initializeDeviceCombo() { myDevicesComboBox.setModel(myComboBoxModel); myDevicesComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object sel = myDevicesComboBox.getSelectedItem(); IDevice device = (sel instanceof IDevice) ? (IDevice) sel : null; updateClientsForDevice(device); myDeviceContext.fireDeviceSelected(device); myDeviceContext.fireClientSelected(null); } }); myDevicesComboBox.setRenderer(new DeviceRenderer.DeviceComboBoxRenderer()); }
private void setBridge(@Nullable AndroidDebugBridge bridge) { myBridge = bridge; myComboBoxModel.removeAllElements(); IDevice[] devices = myBridge == null ? null : myBridge.getDevices(); if (devices == null || devices.length == 0) { myComboBoxModel.addElement(NO_DEVICES); } else { for (IDevice device : devices) { myComboBoxModel.addElement(device); } } myDevicesComboBox.setSelectedIndex(0); }
public void selectDevice(@NotNull final IDevice device) { myDevicesComboBox.setSelectedItem(device); }