src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java
/**
     * Returns the default provider that we are supposed to handle URIs through
     * or null if there aren't any. Depending on the implementation this method
     * may require user intervention so make sure you don't rely on a quick
     * outcome when chatting it.
     *
     * @param uri the uri that we'd like to handle with the provider that we are
     *            about to select.
     *
     * @return the provider that we should handle URIs through.
     *
     * @throws OperationFailedException with code <tt>OPERATION_CANCELED</tt> if
     *             the users.
     */
Returns the default provider that we are supposed to handle URIs through
or null if there aren't any. Depending on the implementation this method
may require user intervention so make sure you don't rely on a quick
outcome when chatting it.

@param uri the uri that we'd like to handle with the provider that we are
about to select.

@return the provider that we should handle URIs through.

@throws OperationFailedException with code OPERATION_CANCELED if
the users.
Returns the default provider that we are supposed to handle URIs through or null if there aren ' t any . Depending on the implementation this method may require user intervention so make sure you don ' t rely on a quick outcome when chatting it . @param uri the uri that we ' d like to handle with the provider that we are about to select . @return the provider that we should handle URIs through . @throws OperationFailedException with code OPERATION_CANCELED if the users .
public ProtocolProviderService selectHandlingProvider(String uri)
        throws OperationFailedException
    {
        ArrayList<AccountID> registeredAccounts =
            protoFactory.getRegisteredAccounts();
        if (registeredAccounts.size() == 0)
        {
            return null;
        }
        if (registeredAccounts.size() == 1)
        {
            ServiceReference<?> providerReference =
                protoFactory.getProviderForAccount(registeredAccounts.get(0));
            ProtocolProviderService provider =
                (ProtocolProviderService) JabberActivator.bundleContext
                    .getService(providerReference);
            return provider;
        }
        ArrayList<ProviderComboBoxEntry> providers =
            new ArrayList<ProviderComboBoxEntry>();
        for (AccountID accountID : registeredAccounts)
        {
            ServiceReference<?> providerReference =
                protoFactory.getProviderForAccount(accountID);
            ProtocolProviderService provider =
                (ProtocolProviderService) JabberActivator.bundleContext
                    .getService(providerReference);
            providers.add(new ProviderComboBoxEntry(provider));
        }
        Object result
            = JabberActivator.getUIService().getPopupDialog()
                    .showInputPopupDialog(
                            "Please select the account that you would like \n"
                                + "to use to chat with " + uri,
                            "Account Selection",
                            PopupDialog.OK_CANCEL_OPTION,
                            providers.toArray(),
                            providers.get(0));
        if (result == null)
        {
            throw new OperationFailedException("Operation cancelled",
                OperationFailedException.OPERATION_CANCELED);
        }
        return ((ProviderComboBoxEntry) result).provider;
    }
public ProtocolProviderService selectHandlingProvider ( String uri ) throws OperationFailedException { ArrayList < AccountID > registeredAccounts = protoFactory . getRegisteredAccounts ( ) ; if ( registeredAccounts . size ( ) == 0 ) { return null ; } if ( registeredAccounts . size ( ) == 1 ) { ServiceReference < ? > providerReference = protoFactory . getProviderForAccount ( registeredAccounts . get ( 0 ) ) ; ProtocolProviderService provider = ( ProtocolProviderService ) JabberActivator . bundleContext . getService ( providerReference ) ; return provider ; } ArrayList < ProviderComboBoxEntry > providers = new ArrayList < ProviderComboBoxEntry > ( ) ; for ( AccountID accountID : registeredAccounts ) { ServiceReference < ? > providerReference = protoFactory . getProviderForAccount ( accountID ) ; ProtocolProviderService provider = ( ProtocolProviderService ) JabberActivator . bundleContext . getService ( providerReference ) ; providers . add ( new ProviderComboBoxEntry ( provider ) ) ; } Object result = JabberActivator . getUIService ( ) . getPopupDialog ( ) . showInputPopupDialog ( "Please select the account that you would like \n" + "to use to chat with " + uri , "Account Selection" , PopupDialog . OK_CANCEL_OPTION , providers . toArray ( ) , providers . get ( 0 ) ) ; if ( result == null ) { throw new OperationFailedException ( "Operation cancelled" , OperationFailedException . OPERATION_CANCELED ) ; } return ( ( ProviderComboBoxEntry ) result ) . provider ; }
Returns the default provider that we are supposed to handle URIs through
 or null if there aren't any.
Returns the default provider that we are supposed to handle URIs through or null if there aren ' t any .
// if we don't have any providers - return null. // if we only have one provider - select it // otherwise - ask the user.