[sip-comm-dev] Re: svn commit: r5943 - trunk/src/net/java/sip/communicator: impl/gui/main/chat impl/gui/main/chat/conference impl/gui/main/chat/toolBars impl/gui/main...


#1

Hi George,

When you want to #setCurrentContact(), you cannot just take a Component, check that it's a PluginComponent and then cast it to PluginComponent to invoke #setCurrentContact(). The reason is that PluginComponent returns its Component through its #getComponent() method so the Component may or may not be a PluginComponent. The fact is that at the time of your commit there were already PluginComponents which are not of type Component. I just made all existing PluginComponents not extend Component and rather create it on demand (in order to improve memory and execution times on startup) so even your PluginComponent implementations for OTR are no longer of type Component. I'll look into fixing the invocation of #setCurrentContact().

I'd also like to share my opinion that if one has to add a new method to an interface and then has to paste empty implementations in multiple implementing classes, it likely means there is no default implementation of the interface to take care of the new method for implementers which do not care about the new method, and there is duplication which makes us pay with runtime memory, execution speed, distribution size, maintenance.

Regards,
Lubomir

···

On 11.09.2009 16:00, 666f6f@dev.java.net wrote:

Author: 666f6f
Date: 2009-09-11 13:00:04+0000
New Revision: 5943

Added:
    trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java (contents, props changed)
Modified:
    trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
    trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
    trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java
    trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java
    trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java
    trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
    trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java
    trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
    trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java
    trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf
    trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java
    trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java
    trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf
    trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
    trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
    trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
    trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java
    trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf
    trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java
    trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java
    trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java

Log:
Added PluginComponent.setCurrentContact(Contact) method. The method is initially added so the OTR button in the toolbar can correctly react when user changes the chat transport via the chat transport selector box. The method is called from MainToolBar as of this revision.

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java 2009-09-11 13:00:04+0000
@@ -94,7 +94,7 @@

      private boolean isShown = false;

- private ChatSession chatSession;
+ public ChatSession chatSession;

      private long firstHistoryMsgTimestamp;

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java 2009-09-11 13:00:04+0000
@@ -22,7 +22,6 @@
      final String[] chatHistoryFilter
          = new String[]{ MessageHistoryService.class.getName(),
                          FileHistoryService.class.getName()};
-
      /**
       * Returns the descriptor of this chat session.
       *
@@ -186,4 +185,20 @@
       * list of (multiple) participants; otherwise,<tt>false</tt>
       */
      public boolean isContactListSupported();
+
+ /**
+ * Adds the given {@link ChatSessionChangeListener} to this
+ *<tt>ChatSession</tt>.
+ *
+ * @param l the<tt>ChatSessionChangeListener</tt> to add
+ */
+ public void addChatTransportChangeListener(ChatSessionChangeListener l);
+
+ /**
+ * Removes the given {@link ChatSessionChangeListener} to this
+ *<tt>ChatSession</tt>.
+ *
+ * @param l the<tt>ChatSessionChangeListener</tt> to add
+ */
+ public void removeChatTransportChangeListener(ChatSessionChangeListener l);
  }

Added: trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java?view=auto&rev=5943

--- (empty file)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java 2009-09-11 13:00:04+0000
@@ -0,0 +1,23 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.chat;
+
+/**
+ * Listens for changes in {@link ChatSession}.
+ * @author George Politis
+ */
+public interface ChatSessionChangeListener
+{
+ /**
+ * Called when the current {@link ChatTransport} has
+ * changed.
+ *
+ * @param chatSession the {@link ChatSession} it's current
+ * {@link ChatTransport} has changed
+ */
+ public void currentChatTransportChanged(ChatSession chatSession);
+}

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java 2009-09-11 13:00:04+0000
@@ -46,6 +46,9 @@
      private ChatTransport currentChatTransport;

      private final ChatSessionRenderer sessionRenderer;
+
+ private final java.util.List<ChatSessionChangeListener> chatTransportChangeListeners =
+ new Vector<ChatSessionChangeListener>();

      /**
       * Creates an instance of<tt>MetaContactChatSession</tt> by specifying the
@@ -365,6 +368,10 @@
      public void setCurrentChatTransport(ChatTransport chatTransport)
      {
          this.currentChatTransport = chatTransport;
+ for (ChatSessionChangeListener l : chatTransportChangeListeners)
+ {
+ l.currentChatTransportChanged(this);
+ }
      }

      public void childContactsReordered(MetaContactGroupEvent evt)
@@ -621,4 +628,21 @@
      {
          return false;
      }
+
+ public void addChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ if (!chatTransportChangeListeners.contains(l))
+ chatTransportChangeListeners.add(l);
+ }
+ }
+
+ public void removeChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ chatTransportChangeListeners.remove(l);
+ }
+ }
  }

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java 2009-09-11 13:00:04+0000
@@ -39,6 +39,9 @@
      private final ChatRoomWrapper chatRoomWrapper;

      private final ChatSessionRenderer sessionRenderer;
+
+ private final java.util.List<ChatSessionChangeListener> chatTransportChangeListeners =
+ new Vector<ChatSessionChangeListener>();

      /**
       * Creates an instance of<tt>ConferenceChatSession</tt>, by specifying the
@@ -346,6 +349,10 @@
      public void setCurrentChatTransport(ChatTransport chatTransport)
      {
          this.currentChatTransport = chatTransport;
+ for (ChatSessionChangeListener l : chatTransportChangeListeners)
+ {
+ l.currentChatTransportChanged(this);
+ }
      }

      /**
@@ -560,4 +567,21 @@
              !chatRoom.isSystem()
                  && !ConferenceChatManager.isPrivate(chatRoom);
      }
+
+ public void addChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ if (!chatTransportChangeListeners.contains(l))
+ chatTransportChangeListeners.add(l);
+ }
+ }
+
+ public void removeChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ chatTransportChangeListeners.remove(l);
+ }
+ }
  }

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java 2009-09-11 13:00:04+0000
@@ -23,6 +23,7 @@
  import net.java.sip.communicator.service.contactlist.MetaContact;
  import net.java.sip.communicator.service.gui.*;
  import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;
  import net.java.sip.communicator.util.*;
  import net.java.sip.communicator.util.swing.*;

@@ -132,6 +133,9 @@
          {
              public void chatChanged(ChatPanel panel)
              {
+ if (panel == null)
+ return;
+
                  MetaContact contact =
                      GuiActivator.getUIService().getChatContact(panel);

@@ -142,6 +146,37 @@

                      ((PluginComponent)c).setCurrentContact(contact);
                  }
+
+ if (panel.chatSession != null)
+ {
+ panel.chatSession
+ .addChatTransportChangeListener(new ChatSessionChangeListener()
+ {
+ public void currentChatTransportChanged(
+ ChatSession chatSession)
+ {
+ if (chatSession == null)
+ return;
+
+ ChatTransport currentTransport =
+ chatSession.getCurrentChatTransport();
+ if (currentTransport.getDescriptor() instanceof Contact)
+ {
+ Contact contact =
+ (Contact) currentTransport
+ .getDescriptor();
+ for (Component c : getComponents())
+ {
+ if (!(c instanceof PluginComponent))
+ continue;
+
+ ((PluginComponent) c)
+ .setCurrentContact(contact);
+ }
+ }
+ }
+ });
+ }
              }
          });
      }

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java 2009-09-11 13:00:04+0000
@@ -17,6 +17,7 @@
  import net.java.sip.communicator.service.contactlist.*;
  import net.java.sip.communicator.service.gui.*;
  import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

  /**
   * @author Yana Stamcheva
@@ -76,6 +77,10 @@
          this.repaint();
      }

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
      public void setCurrentContact(MetaContact metaContact)
      {
      }

Modified: trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java&p2=trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java 2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@

  import net.java.sip.communicator.service.contactlist.*;
  import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;

  public class AboutWindowPluginComponent
      implements PluginComponent
@@ -73,6 +74,10 @@
                      .getI18NString("plugin.branding.ABOUT_MENU_ENTRY");
      }

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
      public void setCurrentContact(MetaContact metaContact)
      {
      }

Modified: trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf (original)
+++ trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf 2009-09-11 13:00:04+0000
@@ -10,6 +10,7 @@
   net.java.sip.communicator.service.resources,
   net.java.sip.communicator.service.gui,
   net.java.sip.communicator.service.gui.event,
+ net.java.sip.communicator.service.protocol,
   net.java.sip.communicator.util,
   net.java.sip.communicator.util.swing,
   javax.swing,

Modified: trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java&p2=trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java 2009-09-11 13:00:04+0000
@@ -15,6 +15,7 @@
  import net.java.sip.communicator.service.contactlist.*;
  import net.java.sip.communicator.service.gui.*;
  import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

  /**
   * The<tt>ExtendedCallHistorySearchButton</tt> is the button that will be
@@ -86,6 +87,10 @@
          return historyMenuItem.getText();
      }

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
      public void setCurrentContact(MetaContact metaContact)
      {
      }

Modified: trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf (original)
+++ trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf 2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@
   net.java.sip.communicator.service.gui,
   net.java.sip.communicator.service.gui.event,
   net.java.sip.communicator.service.resources,
+ net.java.sip.communicator.service.protocol,
   net.java.sip.communicator.util,
   net.java.sip.communicator.util.swing,
   javax.swing,

Modified: trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java 2009-09-11 13:00:04+0000
@@ -14,6 +14,7 @@
  import net.java.sip.communicator.service.contactlist.*;
  import net.java.sip.communicator.service.gui.*;
  import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

  /**
   *
@@ -38,6 +39,9 @@
          menuItem.addActionListener(this);
      }

+ public void setCurrentContact(Contact contact)
+ {}
+
      /**
       * Sets the currently selected<tt>MetaContact</tt>.
       * @param metaContact the currently selected meta contact

Modified: trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java 2009-09-11 13:00:04+0000
@@ -12,9 +12,9 @@

  import javax.swing.JMenuItem;

-import net.java.sip.communicator.service.contactlist.MetaContact;
-import net.java.sip.communicator.service.contactlist.MetaContactGroup;
+import net.java.sip.communicator.service.contactlist.*;
  import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;

  /**
   * The<tt>ExamplePluginMenuItem</tt> is a<tt>JMenuItem</tt> that implements
@@ -42,6 +42,9 @@
          this.addActionListener(this);
      }

+ public void setCurrentContact(Contact contact)
+ {}
+
      /**
       * Sets the current<tt>MetaContact</tt>. This in the case of the contact
       * right button menu container would be the underlying contact in the

Modified: trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf (original)
+++ trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf 2009-09-11 13:00:04+0000
@@ -9,6 +9,7 @@
   net.java.sip.communicator.service.contactlist.event,
   net.java.sip.communicator.service.gui,
   net.java.sip.communicator.service.gui.event,
+ net.java.sip.communicator.service.protocol,
   net.java.sip.communicator.util,
   net.java.sip.communicator.util.swing,
   javax.swing,

Modified: trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java 2009-09-11 13:00:04+0000
@@ -66,7 +66,7 @@
                  if (OtrMetaContactButton.this.contact != null)
                      setPolicy(OtrActivator.scOtrEngine
                          .getContactPolicy(contact));
- }
+ }
          });

          OtrActivator.scOtrKeyManager.addListener(new ScOtrKeyManagerListener()
@@ -79,10 +79,10 @@
                      setStatus(OtrActivator.scOtrEngine
                          .getSessionStatus(contact));
                  }
-
+
              }
          });
-
+
          this.addActionListener(new ActionListener()
          {
              public void actionPerformed(ActionEvent e)
@@ -94,7 +94,8 @@
                  {
                  case ENCRYPTED:
                  case FINISHED:
- // Default action for finished and encrypted sessions is end session.
+ // Default action for finished and encrypted sessions is end
+ // session.
                      OtrActivator.scOtrEngine.endSession(contact);
                      break;
                  case PLAINTEXT:
@@ -132,6 +133,13 @@
          return false;
      }

+ public void setCurrentContact(Contact contact)
+ {
+ this.contact = contact;
+ this.setStatus(OtrActivator.scOtrEngine.getSessionStatus(contact));
+ this.setPolicy(OtrActivator.scOtrEngine.getContactPolicy(contact));
+ }
+
      public void setCurrentContact(MetaContact metaContact)
      {
          contact = metaContact.getDefaultContact();
@@ -165,8 +173,7 @@
                      .setImage(ImageIO
                          .read(OtrActivator.resourceService
                              .getImageURL((OtrActivator.scOtrKeyManager
- .isVerified(contact))
- ? "plugin.otr.ENCRYPTED_ICON_22x22"
+ .isVerified(contact)) ? "plugin.otr.ENCRYPTED_ICON_22x22"
                                  : "plugin.otr.ENCRYPTED_UNVERIFIED_ICON_22x22")));
              }
              catch (IOException e)

Modified: trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java 2009-09-11 13:00:04+0000
@@ -71,6 +71,10 @@
          return false;
      }

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
      public void setCurrentContact(MetaContact metaContact)
      {
          // Rebuild menu.

Modified: trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java 2009-09-11 13:00:04+0000
@@ -167,6 +167,9 @@

      public KeyPair loadKeyPair(AccountID account)
      {
+ if (account == null)
+ return null;
+
          String accountID = account.getAccountUniqueID();
          // Load Private Key.
          byte[] b64PrivKey =
@@ -212,6 +215,9 @@

      public void generateKeyPair(AccountID account)
      {
+ if (account == null)
+ return;
+
          String accountID = account.getAccountUniqueID();
          KeyPair keyPair;
          try

Modified: trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java&p2=trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java 2009-09-11 13:00:04+0000
@@ -15,6 +15,7 @@
  import javax.swing.*;
  import net.java.sip.communicator.service.contactlist.*;
  import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;
  import net.sf.profiler4j.console.*;

  public class SettingsWindowMenuEntry implements PluginComponent
@@ -66,6 +67,10 @@
          return Resources.getString( PROFILER_NAME );
      }

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
      public void setCurrentContact(MetaContact metaContact)
      {
      }

Modified: trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf (original)
+++ trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf 2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@
    net.java.sip.communicator.service.contactlist,
    net.java.sip.communicator.service.gui,
    net.java.sip.communicator.service.resources,
+ net.java.sip.communicator.service.protocol,
    net.java.sip.communicator.util,
    javax.swing,
    javax.swing.border,

Modified: trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java&p2=trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java 2009-09-11 13:00:04+0000
@@ -650,6 +650,10 @@
              return updateMenuItem;
          }

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
          public void setCurrentContact(MetaContact metaContact)
          {
          }

Modified: trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java 2009-09-11 13:00:04+0000
@@ -49,6 +49,10 @@
              Resources.getImage ("plugin.whiteboard.MPEN_ICON"));
      }

+ public void setCurrentContact (Contact contact)
+ {
+ }
+
      /**
       * Sets the current meta contact.
       *

Modified: trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java&p2=trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java&r1=5942&r2=5943

--- trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java (original)
+++ trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java 2009-09-11 13:00:04+0000
@@ -7,6 +7,7 @@
  package net.java.sip.communicator.service.gui;

  import net.java.sip.communicator.service.contactlist.*;
+import net.java.sip.communicator.service.protocol.*;

  /**
   * The<tt>PluginComponent</tt> is an interface meant to be implemented by
@@ -77,6 +78,15 @@
      public Object getComponent();

      /**
+ * Sets the current contact. Meant to be used by plugin components that
+ * are interested of the current contact. The current contact is the contact
+ * for the currently selected chat transport.
+ *
+ * @param contact the current contact
+ */
+ public void setCurrentContact(Contact contact);
+
+ /**
       * Sets the current meta contact. Meant to be used by plugin components that
       * are interested of the current contact. The current contact could be the
       * contact currently selected in the contact list or the contact for the

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hi again George,

I think r5947 fixes the OTR chat menu and button which I broke with my previous commit.

I'm unclear though why MainToolBar deals with the current chat transport while MessageWindowMenuBar doesn't. Does it mean that the PluginComponents in the chat menu don't need to track the current chat transport and the PluginComponents in the chat tool bar need to?

Regards,
Lubomir

···

On 12.09.2009 16:52, Lubomir Marinov wrote:

Hi George,

When you want to #setCurrentContact(), you cannot just take a Component,
check that it's a PluginComponent and then cast it to PluginComponent to
invoke #setCurrentContact(). The reason is that PluginComponent returns
its Component through its #getComponent() method so the Component may or
may not be a PluginComponent. The fact is that at the time of your
commit there were already PluginComponents which are not of type
Component. I just made all existing PluginComponents not extend
Component and rather create it on demand (in order to improve memory and
execution times on startup) so even your PluginComponent implementations
for OTR are no longer of type Component. I'll look into fixing the
invocation of #setCurrentContact().

I'd also like to share my opinion that if one has to add a new method to
an interface and then has to paste empty implementations in multiple
implementing classes, it likely means there is no default implementation
of the interface to take care of the new method for implementers which
do not care about the new method, and there is duplication which makes
us pay with runtime memory, execution speed, distribution size,
maintenance.

Regards,
Lubomir

On 11.09.2009 16:00, 666f6f@dev.java.net wrote:

Author: 666f6f
Date: 2009-09-11 13:00:04+0000
New Revision: 5943

Added:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java
(contents, props changed)
Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java

trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java

trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java

trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java

trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java

trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf

trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java

trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java

trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf

trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java

trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf

trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java

trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java

trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java

Log:
Added PluginComponent.setCurrentContact(Contact) method. The method is
initially added so the OTR button in the toolbar can correctly react
when user changes the chat transport via the chat transport selector
box. The method is called from MainToolBar as of this revision.

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
2009-09-11 13:00:04+0000
@@ -94,7 +94,7 @@

private boolean isShown = false;

- private ChatSession chatSession;
+ public ChatSession chatSession;

private long firstHistoryMsgTimestamp;

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java (original)

+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java 2009-09-11
13:00:04+0000
@@ -22,7 +22,6 @@
final String[] chatHistoryFilter
= new String[]{ MessageHistoryService.class.getName(),
FileHistoryService.class.getName()};
-
/**
* Returns the descriptor of this chat session.
*
@@ -186,4 +185,20 @@
* list of (multiple) participants; otherwise,<tt>false</tt>
*/
public boolean isContactListSupported();
+
+ /**
+ * Adds the given {@link ChatSessionChangeListener} to this
+ *<tt>ChatSession</tt>.
+ *
+ * @param l the<tt>ChatSessionChangeListener</tt> to add
+ */
+ public void addChatTransportChangeListener(ChatSessionChangeListener
l);
+
+ /**
+ * Removes the given {@link ChatSessionChangeListener} to this
+ *<tt>ChatSession</tt>.
+ *
+ * @param l the<tt>ChatSessionChangeListener</tt> to add
+ */
+ public void
removeChatTransportChangeListener(ChatSessionChangeListener l);
}

Added:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java?view=auto&rev=5943

==============================================================================

--- (empty file)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java
2009-09-11 13:00:04+0000
@@ -0,0 +1,23 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging
client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.chat;
+
+/**
+ * Listens for changes in {@link ChatSession}.
+ * @author George Politis
+ */
+public interface ChatSessionChangeListener
+{
+ /**
+ * Called when the current {@link ChatTransport} has
+ * changed.
+ *
+ * @param chatSession the {@link ChatSession} it's current
+ * {@link ChatTransport} has changed
+ */
+ public void currentChatTransportChanged(ChatSession chatSession);
+}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java
(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java
2009-09-11 13:00:04+0000
@@ -46,6 +46,9 @@
private ChatTransport currentChatTransport;

private final ChatSessionRenderer sessionRenderer;
+
+ private final java.util.List<ChatSessionChangeListener>
chatTransportChangeListeners =
+ new Vector<ChatSessionChangeListener>();

/**
* Creates an instance of<tt>MetaContactChatSession</tt> by specifying the
@@ -365,6 +368,10 @@
public void setCurrentChatTransport(ChatTransport chatTransport)
{
this.currentChatTransport = chatTransport;
+ for (ChatSessionChangeListener l : chatTransportChangeListeners)
+ {
+ l.currentChatTransportChanged(this);
+ }
}

public void childContactsReordered(MetaContactGroupEvent evt)
@@ -621,4 +628,21 @@
{
return false;
}
+
+ public void addChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ if (!chatTransportChangeListeners.contains(l))
+ chatTransportChangeListeners.add(l);
+ }
+
+ public void
removeChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ chatTransportChangeListeners.remove(l);
+ }
}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java
(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java
2009-09-11 13:00:04+0000
@@ -39,6 +39,9 @@
private final ChatRoomWrapper chatRoomWrapper;

private final ChatSessionRenderer sessionRenderer;
+
+ private final java.util.List<ChatSessionChangeListener>
chatTransportChangeListeners =
+ new Vector<ChatSessionChangeListener>();

/**
* Creates an instance of<tt>ConferenceChatSession</tt>, by specifying the
@@ -346,6 +349,10 @@
public void setCurrentChatTransport(ChatTransport chatTransport)
{
this.currentChatTransport = chatTransport;
+ for (ChatSessionChangeListener l : chatTransportChangeListeners)
+ {
+ l.currentChatTransportChanged(this);
+ }
}

/**
@@ -560,4 +567,21 @@
!chatRoom.isSystem()
&& !ConferenceChatManager.isPrivate(chatRoom);
}
+
+ public void addChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ if (!chatTransportChangeListeners.contains(l))
+ chatTransportChangeListeners.add(l);
+ }
+
+ public void
removeChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ chatTransportChangeListeners.remove(l);
+ }
}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java
(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java
2009-09-11 13:00:04+0000
@@ -23,6 +23,7 @@
import net.java.sip.communicator.service.contactlist.MetaContact;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;

@@ -132,6 +133,9 @@
{
public void chatChanged(ChatPanel panel)
{
+ if (panel == null)
+ return;
+
MetaContact contact =
GuiActivator.getUIService().getChatContact(panel);

@@ -142,6 +146,37 @@

((PluginComponent)c).setCurrentContact(contact);
}
+
+ if (panel.chatSession != null)
+ {
+ panel.chatSession
+ .addChatTransportChangeListener(new ChatSessionChangeListener()
+ {
+ public void currentChatTransportChanged(
+ ChatSession chatSession)
+ {
+ if (chatSession == null)
+ return;
+
+ ChatTransport currentTransport =
+ chatSession.getCurrentChatTransport();
+ if (currentTransport.getDescriptor() instanceof Contact)
+ {
+ Contact contact =
+ (Contact) currentTransport
+ .getDescriptor();
+ for (Component c : getComponents())
+ {
+ if (!(c instanceof PluginComponent))
+ continue;
+
+ ((PluginComponent) c)
+ .setCurrentContact(contact);
+ }
+ });
+ }
}
});
}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java (original)

+++
trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java 2009-09-11
13:00:04+0000
@@ -17,6 +17,7 @@
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

/**
* @author Yana Stamcheva
@@ -76,6 +77,10 @@
this.repaint();
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java&p2=trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java
2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@

import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;

public class AboutWindowPluginComponent
implements PluginComponent
@@ -73,6 +74,10 @@
.getI18NString("plugin.branding.ABOUT_MENU_ENTRY");
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
(original)
+++
trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
2009-09-11 13:00:04+0000
@@ -10,6 +10,7 @@
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.swing,

Modified:
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java&p2=trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java
2009-09-11 13:00:04+0000
@@ -15,6 +15,7 @@
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

/**
* The<tt>ExtendedCallHistorySearchButton</tt> is the button that will be
@@ -86,6 +87,10 @@
return historyMenuItem.getText();
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf
(original)
+++
trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf
2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.resources,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.swing,

Modified:
trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java
2009-09-11 13:00:04+0000
@@ -14,6 +14,7 @@
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

/**
*
@@ -38,6 +39,9 @@
menuItem.addActionListener(this);
}

+ public void setCurrentContact(Contact contact)
+ {}
+
/**
* Sets the currently selected<tt>MetaContact</tt>.
* @param metaContact the currently selected meta contact

Modified:
trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java
2009-09-11 13:00:04+0000
@@ -12,9 +12,9 @@

import javax.swing.JMenuItem;

-import net.java.sip.communicator.service.contactlist.MetaContact;
-import net.java.sip.communicator.service.contactlist.MetaContactGroup;
+import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;

/**
* The<tt>ExamplePluginMenuItem</tt> is a<tt>JMenuItem</tt> that
implements
@@ -42,6 +42,9 @@
this.addActionListener(this);
}

+ public void setCurrentContact(Contact contact)
+ {}
+
/**
* Sets the current<tt>MetaContact</tt>. This in the case of the contact
* right button menu container would be the underlying contact in the

Modified:
trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf
(original)
+++
trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf
2009-09-11 13:00:04+0000
@@ -9,6 +9,7 @@
net.java.sip.communicator.service.contactlist.event,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.swing,

Modified:
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
2009-09-11 13:00:04+0000
@@ -66,7 +66,7 @@
if (OtrMetaContactButton.this.contact != null)
setPolicy(OtrActivator.scOtrEngine
.getContactPolicy(contact));
- }
+ }
});

OtrActivator.scOtrKeyManager.addListener(new ScOtrKeyManagerListener()
@@ -79,10 +79,10 @@
setStatus(OtrActivator.scOtrEngine
.getSessionStatus(contact));
}
-
+
}
});
-
+
this.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -94,7 +94,8 @@
{
case ENCRYPTED:
case FINISHED:
- // Default action for finished and encrypted sessions is end session.
+ // Default action for finished and encrypted sessions is end
+ // session.
OtrActivator.scOtrEngine.endSession(contact);
break;
case PLAINTEXT:
@@ -132,6 +133,13 @@
return false;
}

+ public void setCurrentContact(Contact contact)
+ {
+ this.contact = contact;
+ this.setStatus(OtrActivator.scOtrEngine.getSessionStatus(contact));
+ this.setPolicy(OtrActivator.scOtrEngine.getContactPolicy(contact));
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
contact = metaContact.getDefaultContact();
@@ -165,8 +173,7 @@
.setImage(ImageIO
.read(OtrActivator.resourceService
.getImageURL((OtrActivator.scOtrKeyManager
- .isVerified(contact))
- ? "plugin.otr.ENCRYPTED_ICON_22x22"
+ .isVerified(contact)) ? "plugin.otr.ENCRYPTED_ICON_22x22"
: "plugin.otr.ENCRYPTED_UNVERIFIED_ICON_22x22")));
}
catch (IOException e)

Modified:
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
2009-09-11 13:00:04+0000
@@ -71,6 +71,10 @@
return false;
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
// Rebuild menu.

Modified:
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java (original)

+++
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java 2009-09-11
13:00:04+0000
@@ -167,6 +167,9 @@

public KeyPair loadKeyPair(AccountID account)
{
+ if (account == null)
+ return null;
+
String accountID = account.getAccountUniqueID();
// Load Private Key.
byte[] b64PrivKey =
@@ -212,6 +215,9 @@

public void generateKeyPair(AccountID account)
{
+ if (account == null)
+ return;
+
String accountID = account.getAccountUniqueID();
KeyPair keyPair;
try

Modified:
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java&p2=trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java
2009-09-11 13:00:04+0000
@@ -15,6 +15,7 @@
import javax.swing.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;
import net.sf.profiler4j.console.*;

public class SettingsWindowMenuEntry implements PluginComponent
@@ -66,6 +67,10 @@
return Resources.getString( PROFILER_NAME );
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf
(original)
+++
trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf
2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@
net.java.sip.communicator.service.contactlist,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.resources,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
javax.swing,
javax.swing.border,

Modified:
trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java&p2=trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java
2009-09-11 13:00:04+0000
@@ -650,6 +650,10 @@
return updateMenuItem;
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java
2009-09-11 13:00:04+0000
@@ -49,6 +49,10 @@
Resources.getImage ("plugin.whiteboard.MPEN_ICON"));
}

+ public void setCurrentContact (Contact contact)
+ {
+ }
+
/**
* Sets the current meta contact.
*

Modified:
trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java&p2=trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java
(original)
+++
trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java
2009-09-11 13:00:04+0000
@@ -7,6 +7,7 @@
package net.java.sip.communicator.service.gui;

import net.java.sip.communicator.service.contactlist.*;
+import net.java.sip.communicator.service.protocol.*;

/**
* The<tt>PluginComponent</tt> is an interface meant to be implemented by
@@ -77,6 +78,15 @@
public Object getComponent();

/**
+ * Sets the current contact. Meant to be used by plugin components that
+ * are interested of the current contact. The current contact is the
contact
+ * for the currently selected chat transport.
+ *
+ * @param contact the current contact
+ */
+ public void setCurrentContact(Contact contact);
+
+ /**
* Sets the current meta contact. Meant to be used by plugin components
that
* are interested of the current contact. The current contact could be the
* contact currently selected in the contact list or the contact for the

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Hello Lubomir,

Lubomir Marinov wrote:

Hi again George,

I think r5947 fixes the OTR chat menu and button which I broke with my
previous commit.

Thank you for the hints and for the fixes, it looks much more correct now :slight_smile:

I'm unclear though why MainToolBar deals with the current chat transport
while MessageWindowMenuBar doesn't. Does it mean that the
PluginComponents in the chat menu don't need to track the current chat
transport and the PluginComponents in the chat tool bar need to?

Yes exactly, in the chat menu there is a submenu foreach contact of the
metacontact while in the chat toolbar there is only one button that has
to be updated when the user chooses to change the chat transport via the
selector box.

kind regards,
George

···

Regards,
Lubomir

On 12.09.2009 16:52, Lubomir Marinov wrote:

Hi George,

When you want to #setCurrentContact(), you cannot just take a Component,
check that it's a PluginComponent and then cast it to PluginComponent to
invoke #setCurrentContact(). The reason is that PluginComponent returns
its Component through its #getComponent() method so the Component may or
may not be a PluginComponent. The fact is that at the time of your
commit there were already PluginComponents which are not of type
Component. I just made all existing PluginComponents not extend
Component and rather create it on demand (in order to improve memory and
execution times on startup) so even your PluginComponent implementations
for OTR are no longer of type Component. I'll look into fixing the
invocation of #setCurrentContact().

I'd also like to share my opinion that if one has to add a new method to
an interface and then has to paste empty implementations in multiple
implementing classes, it likely means there is no default implementation
of the interface to take care of the new method for implementers which
do not care about the new method, and there is duplication which makes
us pay with runtime memory, execution speed, distribution size,
maintenance.

Regards,
Lubomir

On 11.09.2009 16:00, 666f6f@dev.java.net wrote:

Author: 666f6f
Date: 2009-09-11 13:00:04+0000
New Revision: 5943

Added:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java

(contents, props changed)
Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java

trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java

trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java

trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java

trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java

trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf

trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java

trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java

trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf

trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java

trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf

trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java

trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java

trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java

Log:
Added PluginComponent.setCurrentContact(Contact) method. The method is
initially added so the OTR button in the toolbar can correctly react
when user changes the chat transport via the chat transport selector
box. The method is called from MainToolBar as of this revision.

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
2009-09-11 13:00:04+0000
@@ -94,7 +94,7 @@

private boolean isShown = false;

- private ChatSession chatSession;
+ public ChatSession chatSession;

private long firstHistoryMsgTimestamp;

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
(original)

+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSession.java
2009-09-11
13:00:04+0000
@@ -22,7 +22,6 @@
final String[] chatHistoryFilter
= new String[]{ MessageHistoryService.class.getName(),
FileHistoryService.class.getName()};
-
/**
* Returns the descriptor of this chat session.
*
@@ -186,4 +185,20 @@
* list of (multiple) participants; otherwise,<tt>false</tt>
*/
public boolean isContactListSupported();
+
+ /**
+ * Adds the given {@link ChatSessionChangeListener} to this
+ *<tt>ChatSession</tt>.
+ *
+ * @param l the<tt>ChatSessionChangeListener</tt> to add
+ */
+ public void addChatTransportChangeListener(ChatSessionChangeListener
l);
+
+ /**
+ * Removes the given {@link ChatSessionChangeListener} to this
+ *<tt>ChatSession</tt>.
+ *
+ * @param l the<tt>ChatSessionChangeListener</tt> to add
+ */
+ public void
removeChatTransportChangeListener(ChatSessionChangeListener l);
}

Added:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java?view=auto&rev=5943

==============================================================================

--- (empty file)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatSessionChangeListener.java

2009-09-11 13:00:04+0000
@@ -0,0 +1,23 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging
client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.chat;
+
+/**
+ * Listens for changes in {@link ChatSession}.
+ * @author George Politis
+ */
+public interface ChatSessionChangeListener
+{
+ /**
+ * Called when the current {@link ChatTransport} has
+ * changed.
+ *
+ * @param chatSession the {@link ChatSession} it's current
+ * {@link ChatTransport} has changed
+ */
+ public void currentChatTransportChanged(ChatSession chatSession);
+}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java

(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java

2009-09-11 13:00:04+0000
@@ -46,6 +46,9 @@
private ChatTransport currentChatTransport;

private final ChatSessionRenderer sessionRenderer;
+
+ private final java.util.List<ChatSessionChangeListener>
chatTransportChangeListeners =
+ new Vector<ChatSessionChangeListener>();

/**
* Creates an instance of<tt>MetaContactChatSession</tt> by specifying
the
@@ -365,6 +368,10 @@
public void setCurrentChatTransport(ChatTransport chatTransport)
{
this.currentChatTransport = chatTransport;
+ for (ChatSessionChangeListener l : chatTransportChangeListeners)
+ {
+ l.currentChatTransportChanged(this);
+ }
}

public void childContactsReordered(MetaContactGroupEvent evt)
@@ -621,4 +628,21 @@
{
return false;
}
+
+ public void
addChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ if (!chatTransportChangeListeners.contains(l))
+ chatTransportChangeListeners.add(l);
+ }
+ }
+
+ public void
removeChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ chatTransportChangeListeners.remove(l);
+ }
+ }
}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java

(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatSession.java

2009-09-11 13:00:04+0000
@@ -39,6 +39,9 @@
private final ChatRoomWrapper chatRoomWrapper;

private final ChatSessionRenderer sessionRenderer;
+
+ private final java.util.List<ChatSessionChangeListener>
chatTransportChangeListeners =
+ new Vector<ChatSessionChangeListener>();

/**
* Creates an instance of<tt>ConferenceChatSession</tt>, by specifying
the
@@ -346,6 +349,10 @@
public void setCurrentChatTransport(ChatTransport chatTransport)
{
this.currentChatTransport = chatTransport;
+ for (ChatSessionChangeListener l : chatTransportChangeListeners)
+ {
+ l.currentChatTransportChanged(this);
+ }
}

/**
@@ -560,4 +567,21 @@
!chatRoom.isSystem()
&& !ConferenceChatManager.isPrivate(chatRoom);
}
+
+ public void
addChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ if (!chatTransportChangeListeners.contains(l))
+ chatTransportChangeListeners.add(l);
+ }
+ }
+
+ public void
removeChatTransportChangeListener(ChatSessionChangeListener l)
+ {
+ synchronized (chatTransportChangeListeners)
+ {
+ chatTransportChangeListeners.remove(l);
+ }
+ }
}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java

(original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java

2009-09-11 13:00:04+0000
@@ -23,6 +23,7 @@
import net.java.sip.communicator.service.contactlist.MetaContact;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;

@@ -132,6 +133,9 @@
{
public void chatChanged(ChatPanel panel)
{
+ if (panel == null)
+ return;
+
MetaContact contact =
GuiActivator.getUIService().getChatContact(panel);

@@ -142,6 +146,37 @@

((PluginComponent)c).setCurrentContact(contact);
}
+
+ if (panel.chatSession != null)
+ {
+ panel.chatSession
+ .addChatTransportChangeListener(new ChatSessionChangeListener()
+ {
+ public void currentChatTransportChanged(
+ ChatSession chatSession)
+ {
+ if (chatSession == null)
+ return;
+
+ ChatTransport currentTransport =
+ chatSession.getCurrentChatTransport();
+ if (currentTransport.getDescriptor() instanceof Contact)
+ {
+ Contact contact =
+ (Contact) currentTransport
+ .getDescriptor();
+ for (Component c : getComponents())
+ {
+ if (!(c instanceof PluginComponent))
+ continue;
+
+ ((PluginComponent) c)
+ .setCurrentContact(contact);
+ }
+ }
+ }
+ });
+ }
}
});
}

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
(original)

+++
trunk/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java
2009-09-11
13:00:04+0000
@@ -17,6 +17,7 @@
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

/**
* @author Yana Stamcheva
@@ -76,6 +77,10 @@
this.repaint();
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java&p2=trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java

(original)
+++
trunk/src/net/java/sip/communicator/plugin/branding/AboutWindowPluginComponent.java

2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@

import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;

public class AboutWindowPluginComponent
implements PluginComponent
@@ -73,6 +74,10 @@
.getI18NString("plugin.branding.ABOUT_MENU_ENTRY");
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
(original)
+++
trunk/src/net/java/sip/communicator/plugin/branding/branding.manifest.mf
2009-09-11 13:00:04+0000
@@ -10,6 +10,7 @@
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.swing,

Modified:
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java&p2=trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java

(original)
+++
trunk/src/net/java/sip/communicator/plugin/callhistoryform/ExtendedCallHistorySearchItem.java

2009-09-11 13:00:04+0000
@@ -15,6 +15,7 @@
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

/**
* The<tt>ExtendedCallHistorySearchButton</tt> is the button that will be
@@ -86,6 +87,10 @@
return historyMenuItem.getText();
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf

(original)
+++
trunk/src/net/java/sip/communicator/plugin/callhistoryform/callhistoryform.manifest.mf

2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.resources,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.swing,

Modified:
trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java

(original)
+++
trunk/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoMenuItem.java

2009-09-11 13:00:04+0000
@@ -14,6 +14,7 @@
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
+import net.java.sip.communicator.service.protocol.*;

/**
*
@@ -38,6 +39,9 @@
menuItem.addActionListener(this);
}

+ public void setCurrentContact(Contact contact)
+ {}
+
/**
* Sets the currently selected<tt>MetaContact</tt>.
* @param metaContact the currently selected meta contact

Modified:
trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java

(original)
+++
trunk/src/net/java/sip/communicator/plugin/exampleplugin/ExamplePluginMenuItem.java

2009-09-11 13:00:04+0000
@@ -12,9 +12,9 @@

import javax.swing.JMenuItem;

-import net.java.sip.communicator.service.contactlist.MetaContact;
-import net.java.sip.communicator.service.contactlist.MetaContactGroup;
+import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;

/**
* The<tt>ExamplePluginMenuItem</tt> is a<tt>JMenuItem</tt> that
implements
@@ -42,6 +42,9 @@
this.addActionListener(this);
}

+ public void setCurrentContact(Contact contact)
+ {}
+
/**
* Sets the current<tt>MetaContact</tt>. This in the case of the contact
* right button menu container would be the underlying contact in the

Modified:
trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf

(original)
+++
trunk/src/net/java/sip/communicator/plugin/exampleplugin/exampleplugin.manifest.mf

2009-09-11 13:00:04+0000
@@ -9,6 +9,7 @@
net.java.sip.communicator.service.contactlist.event,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
javax.swing,

Modified:
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactButton.java
2009-09-11 13:00:04+0000
@@ -66,7 +66,7 @@
if (OtrMetaContactButton.this.contact != null)
setPolicy(OtrActivator.scOtrEngine
.getContactPolicy(contact));
- }
+ }
});

OtrActivator.scOtrKeyManager.addListener(new ScOtrKeyManagerListener()
@@ -79,10 +79,10 @@
setStatus(OtrActivator.scOtrEngine
.getSessionStatus(contact));
}
-
+
}
});
-
+
this.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -94,7 +94,8 @@
{
case ENCRYPTED:
case FINISHED:
- // Default action for finished and encrypted sessions is end session.
+ // Default action for finished and encrypted sessions is end
+ // session.
OtrActivator.scOtrEngine.endSession(contact);
break;
case PLAINTEXT:
@@ -132,6 +133,13 @@
return false;
}

+ public void setCurrentContact(Contact contact)
+ {
+ this.contact = contact;
+ this.setStatus(OtrActivator.scOtrEngine.getSessionStatus(contact));
+ this.setPolicy(OtrActivator.scOtrEngine.getContactPolicy(contact));
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
contact = metaContact.getDefaultContact();
@@ -165,8 +173,7 @@
.setImage(ImageIO
.read(OtrActivator.resourceService
.getImageURL((OtrActivator.scOtrKeyManager
- .isVerified(contact))
- ? "plugin.otr.ENCRYPTED_ICON_22x22"
+ .isVerified(contact)) ? "plugin.otr.ENCRYPTED_ICON_22x22"
: "plugin.otr.ENCRYPTED_UNVERIFIED_ICON_22x22")));
}
catch (IOException e)

Modified:
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
(original)
+++
trunk/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
2009-09-11 13:00:04+0000
@@ -71,6 +71,10 @@
return false;
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
// Rebuild menu.

Modified:
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java&p2=trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
(original)

+++
trunk/src/net/java/sip/communicator/plugin/otr/ScOtrKeyManagerImpl.java
2009-09-11
13:00:04+0000
@@ -167,6 +167,9 @@

public KeyPair loadKeyPair(AccountID account)
{
+ if (account == null)
+ return null;
+
String accountID = account.getAccountUniqueID();
// Load Private Key.
byte[] b64PrivKey =
@@ -212,6 +215,9 @@

public void generateKeyPair(AccountID account)
{
+ if (account == null)
+ return;
+
String accountID = account.getAccountUniqueID();
KeyPair keyPair;
try

Modified:
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java&p2=trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java

(original)
+++
trunk/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java

2009-09-11 13:00:04+0000
@@ -15,6 +15,7 @@
import javax.swing.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.*;
import net.sf.profiler4j.console.*;

public class SettingsWindowMenuEntry implements PluginComponent
@@ -66,6 +67,10 @@
return Resources.getString( PROFILER_NAME );
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf&p2=trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf

(original)
+++
trunk/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf

2009-09-11 13:00:04+0000
@@ -12,6 +12,7 @@
net.java.sip.communicator.service.contactlist,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.resources,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.util,
javax.swing,
javax.swing.border,

Modified:
trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java&p2=trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java

(original)
+++
trunk/src/net/java/sip/communicator/plugin/updatechecker/UpdateCheckActivator.java

2009-09-11 13:00:04+0000
@@ -650,6 +650,10 @@
return updateMenuItem;
}

+ public void setCurrentContact(Contact contact)
+ {
+ }
+
public void setCurrentContact(MetaContact metaContact)
{
}

Modified:
trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java

Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java&p2=trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java

(original)
+++
trunk/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardMenuItem.java

2009-09-11 13:00:04+0000
@@ -49,6 +49,10 @@
Resources.getImage ("plugin.whiteboard.MPEN_ICON"));
}

+ public void setCurrentContact (Contact contact)
+ {
+ }
+
/**
* Sets the current meta contact.
*

Modified:
trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java?view=diff&rev=5943&p1=trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java&p2=trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java&r1=5942&r2=5943

==============================================================================

---
trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java
(original)
+++
trunk/src/net/java/sip/communicator/service/gui/PluginComponent.java
2009-09-11 13:00:04+0000
@@ -7,6 +7,7 @@
package net.java.sip.communicator.service.gui;

import net.java.sip.communicator.service.contactlist.*;
+import net.java.sip.communicator.service.protocol.*;

/**
* The<tt>PluginComponent</tt> is an interface meant to be implemented by
@@ -77,6 +78,15 @@
public Object getComponent();

/**
+ * Sets the current contact. Meant to be used by plugin components that
+ * are interested of the current contact. The current contact is the
contact
+ * for the currently selected chat transport.
+ *
+ * @param contact the current contact
+ */
+ public void setCurrentContact(Contact contact);
+
+ /**
* Sets the current meta contact. Meant to be used by plugin components
that
* are interested of the current contact. The current contact could be
the
* contact currently selected in the contact list or the contact for the

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net