src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java
/**
         * Refresh combo box when the user click on it.
         *
         * @param ev The click on the combo box.
         */
Refresh combo box when the user click on it.
@param ev The click on the combo box.
Refresh combo box when the user click on it . @param ev The click on the combo box .
public void actionPerformed(ActionEvent ev)
        {
            synchronized (this)
            {
                deviceSessionToSet = null;
                deviceSessionToSetIsNull = true;
                setDeviceSessionExecutor.execute(setDeviceSessionTask);
            }
            CaptureDeviceInfo cdi;
            if (comboBox == null)
            {
                cdi
                    = soundLevelIndicator.isShowing()
                        ? audioSystem.getSelectedDevice(
                                AudioSystem.DataFlow.CAPTURE)
                        : null;
            }
            else
            {
                Object selectedItem
                    = soundLevelIndicator.isShowing()
                        ? comboBox.getSelectedItem()
                        : null;
                cdi
                    = (selectedItem
                            instanceof
                                DeviceConfigurationComboBoxModel.CaptureDevice)
                        ? ((DeviceConfigurationComboBoxModel.CaptureDevice)
                                selectedItem)
                            .info
                        : null;
            }
            if (cdi != null)
            {
                for (MediaDevice md: mediaService.getDevices(
                            MediaType.AUDIO,
                            MediaUseCase.ANY))
                {
                    if (md instanceof AudioMediaDeviceImpl)
                    {
                        AudioMediaDeviceImpl amd = (AudioMediaDeviceImpl) md;
                        if (cdi.equals(amd.getCaptureDeviceInfo()))
                        {
                            try
                            {
                                MediaDeviceSession deviceSession
                                    = amd.createSession();
                                boolean deviceSessionIsSet = false;
                                try
                                {
                                    if (deviceSession instanceof
                                            AudioMediaDeviceSession)
                                    {
                                        synchronized (this)
                                        {
                                            deviceSessionToSet
                                                = (AudioMediaDeviceSession)
                                                    deviceSession;
                                            deviceSessionToSetIsNull
                                                = (deviceSessionToSet == null);
                                            setDeviceSessionExecutor.execute(
                                                    setDeviceSessionTask);
                                        }
                                        deviceSessionIsSet = true;
                                    }
                                }
                                finally
                                {
                                    if (!deviceSessionIsSet)
                                        deviceSession.close();
                                }
                            }
                            catch (Throwable t)
                            {
                                if (t instanceof ThreadDeath)
                                    throw (ThreadDeath) t;
                            }
                            break;
                        }
                    }
                }
            }
        }
public void actionPerformed ( ActionEvent ev ) { synchronized ( this ) { deviceSessionToSet = null ; deviceSessionToSetIsNull = true ; setDeviceSessionExecutor . execute ( setDeviceSessionTask ) ; } CaptureDeviceInfo cdi ; if ( comboBox == null ) { cdi = soundLevelIndicator . isShowing ( ) ? audioSystem . getSelectedDevice ( AudioSystem . DataFlow . CAPTURE ) : null ; } else { Object selectedItem = soundLevelIndicator . isShowing ( ) ? comboBox . getSelectedItem ( ) : null ; cdi = ( selectedItem instanceof DeviceConfigurationComboBoxModel . CaptureDevice ) ? ( ( DeviceConfigurationComboBoxModel . CaptureDevice ) selectedItem ) . info : null ; } if ( cdi != null ) { for ( MediaDevice md : mediaService . getDevices ( MediaType . AUDIO , MediaUseCase . ANY ) ) { if ( md instanceof AudioMediaDeviceImpl ) { AudioMediaDeviceImpl amd = ( AudioMediaDeviceImpl ) md ; if ( cdi . equals ( amd . getCaptureDeviceInfo ( ) ) ) { try { MediaDeviceSession deviceSession = amd . createSession ( ) ; boolean deviceSessionIsSet = false ; try { if ( deviceSession instanceof AudioMediaDeviceSession ) { synchronized ( this ) { deviceSessionToSet = ( AudioMediaDeviceSession ) deviceSession ; deviceSessionToSetIsNull = ( deviceSessionToSet == null ) ; setDeviceSessionExecutor . execute ( setDeviceSessionTask ) ; } deviceSessionIsSet = true ; } } finally { if ( ! deviceSessionIsSet ) deviceSession . close ( ) ; } } catch ( Throwable t ) { if ( t instanceof ThreadDeath ) throw ( ThreadDeath ) t ; } break ; } } } } }
Refresh combo box when the user click on it.
Refresh combo box when the user click on it .