src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
/**
     * Sends the given file through the currently selected chat transport.
     *
     * @param file the file to send
     */
Sends the given file through the currently selected chat transport.
@param file the file to send
Sends the given file through the currently selected chat transport . @param file the file to send
public void sendFile(final File file)
    {
        if (!SwingUtilities.isEventDispatchThread())
        {
            SwingUtilities.invokeLater(new Runnable()
            {
                public void run()
                {
                    sendFile(file);
                }
            });
            return;
        }
        final ChatTransport fileTransferTransport
            = findFileTransferChatTransport();
        if (fileTransferTransport == null)
        {
            logger.error("Failed to send file.");
            this.addErrorMessage(
                chatSession.getChatName(),
                GuiActivator.getResources().getI18NString(
                    "service.gui.FILE_SEND_FAILED",
                    new String[]{file.getName()}),
                GuiActivator.getResources().getI18NString(
                    "service.gui.FILE_TRANSFER_NOT_SUPPORTED"));
            return;
        }
        final SendFileConversationComponent fileComponent
            = new SendFileConversationComponent(
                this,
                fileTransferTransport.getDisplayName(),
                file);
        if (ConfigurationUtils.isHistoryShown() && !isHistoryLoaded)
        {
            synchronized (incomingEventBuffer)
            {
                incomingEventBuffer.add(fileComponent);
            }
        }
        else
            getChatConversationPanel().addComponent(fileComponent);
        this.sendFile(file, fileComponent);
    }
public void sendFile ( final File file ) { if ( ! SwingUtilities . isEventDispatchThread ( ) ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { sendFile ( file ) ; } } ) ; return ; } final ChatTransport fileTransferTransport = findFileTransferChatTransport ( ) ; if ( fileTransferTransport == null ) { logger . error ( "Failed to send file." ) ; this . addErrorMessage ( chatSession . getChatName ( ) , GuiActivator . getResources ( ) . getI18NString ( "service.gui.FILE_SEND_FAILED" , new String [ ] { file . getName ( ) } ) , GuiActivator . getResources ( ) . getI18NString ( "service.gui.FILE_TRANSFER_NOT_SUPPORTED" ) ) ; return ; } final SendFileConversationComponent fileComponent = new SendFileConversationComponent ( this , fileTransferTransport . getDisplayName ( ) , file ) ; if ( ConfigurationUtils . isHistoryShown ( ) && ! isHistoryLoaded ) { synchronized ( incomingEventBuffer ) { incomingEventBuffer . add ( fileComponent ) ; } } else getChatConversationPanel ( ) . addComponent ( fileComponent ) ; this . sendFile ( file , fileComponent ) ; }
Sends the given file through the currently selected chat transport.
Sends the given file through the currently selected chat transport .
// We need to be sure that the following code is executed in the event // dispatch thread. // If there's no operation set we show some "not supported" messages // and we return.