aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-10-02 19:29:28 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-10-02 19:29:28 +0000
commit7d22a7dcb4d727a38176543dfaaaecb3463b57cc (patch)
tree79e00755600d7dfd30a70ec5b7af475be11adf75 /src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java
parent216ba08327fbf2434340f3382c913e37d2ff5e7c (diff)
downloadjitsi-7d22a7dcb4d727a38176543dfaaaecb3463b57cc.zip
jitsi-7d22a7dcb4d727a38176543dfaaaecb3463b57cc.tar.gz
jitsi-7d22a7dcb4d727a38176543dfaaaecb3463b57cc.tar.bz2
- Fixes ClassCastException in ChatRoom-related code which handles failure of delivery of a message and in its respective AdHocChatRoom duplicate.
- Simplifies a bit and speeds up ChatWindowManager. Part of the approach to remove its #syncChat and prevent a deadlock with IRC. - Removes a field or two to reduce the shallow runtime size of the instances of the affected class. - Fixes a few redundant-cast warnings caused by ProtocolProviderService#getOperationSet(). While doing, fixes an occurrence of a double calling to the method in question while only one call suffices and is faster.
Diffstat (limited to 'src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java
index 68e2916..6a6e6a4 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java
@@ -41,52 +41,53 @@ public class ContactListTransferHandler
* Handles transfers to the contact list from the clip board or a
* DND drop operation. The <tt>Transferable</tt> parameter contains the
* data that needs to be imported.
- * <p>
- * @param comp the component to receive the transfer;
+ *
+ * @param comp the component to receive the transfer
* @param t the data to import
- * @return true if the data was inserted into the component and false
- * otherwise
- * @see #importData(TransferHandler.TransferSupport)
+ * @return <tt>true</tt> if the data was inserted into the component;
+ * <tt>false</tt>, otherwise
+ * @see TransferHandler#importData(JComponent. Transferable)
*/
@SuppressWarnings("unchecked") //taken care of
public boolean importData(JComponent comp, Transferable t)
{
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
{
+ Object o = null;
+
try
{
- Object o = t.getTransferData(DataFlavor.javaFileListFlavor);
+ o = t.getTransferData(DataFlavor.javaFileListFlavor);
+ }
+ catch (UnsupportedFlavorException e)
+ {
+ logger.debug("Failed to drop files.", e);
+ }
+ catch (IOException e)
+ {
+ logger.debug("Failed to drop files.", e);
+ }
+ if (o instanceof Collection)
+ {
ChatPanel chatPanel = getChatPanel();
if (chatPanel != null)
{
- if (o instanceof java.util.Collection)
- {
- Collection<File> files = (Collection<File>) o;
+ Collection<File> files = (Collection<File>) o;
- for(File file: files)
- {
- if (chatPanel != null)
- chatPanel.sendFile(file);
-
- GuiActivator.getUIService().getChatWindowManager()
- .openChat(chatPanel, false);
- }
+ for (File file : files)
+ {
+ chatPanel.sendFile(file);
- // Otherwise fire files dropped event.
- return true;
+ GuiActivator.getUIService().getChatWindowManager()
+ .openChat(chatPanel, false);
}
+
+ // Otherwise fire files dropped event.
+ return true;
}
}
- catch (UnsupportedFlavorException e)
- {
- logger.debug("Failed to drop files.", e);
- }
- catch (IOException e)
- {
- logger.debug("Failed to drop files.", e);
- }
}
return false;
}
@@ -101,10 +102,9 @@ public class ContactListTransferHandler
private ChatPanel getChatPanel()
{
ChatPanel chatPanel = null;
-
Object selectedObject = contactList.getSelectedValue();
- if (selectedObject != null && selectedObject instanceof MetaContact)
+ if (selectedObject instanceof MetaContact)
{
MetaContact metaContact = (MetaContact) selectedObject;