summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-08 06:14:08 (EDT)
committerEike Stepper2007-10-08 06:14:08 (EDT)
commit96a7a13f2b2d8c78f5f3b6b083b82f610dbba0f7 (patch)
tree895db06f082380de1ed09fbe50a7ac6352694367
parent7a31caf7b336b6580fcf81cdcf2e7ffd16e7904f (diff)
downloadcdo-96a7a13f2b2d8c78f5f3b6b083b82f610dbba0f7.zip
cdo-96a7a13f2b2d8c78f5f3b6b083b82f610dbba0f7.tar.gz
cdo-96a7a13f2b2d8c78f5f3b6b083b82f610dbba0f7.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddySession.java20
2 files changed, 20 insertions, 2 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
index 65ae01c..0319248 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
@@ -269,7 +269,7 @@ public class BuddiesView extends ContainerView implements IListener
@Override
protected void safeRun() throws Exception
{
- if (session != null)
+ if (session != null && isChecked())
{
Self self = (Self)session.getSelf();
self.setState(state);
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddySession.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddySession.java
index f4dd908..938a0c4 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddySession.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddySession.java
@@ -12,8 +12,11 @@ package org.eclipse.net4j.internal.buddies;
import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.buddies.IBuddySession;
+import org.eclipse.net4j.buddies.internal.protocol.BuddyStateNotification;
import org.eclipse.net4j.buddies.protocol.IBuddy;
import org.eclipse.net4j.buddies.protocol.IBuddyAccount;
+import org.eclipse.net4j.buddies.protocol.IBuddyStateChangedEvent;
+import org.eclipse.net4j.internal.buddies.bundle.OM;
import org.eclipse.net4j.internal.util.container.SingleDeltaContainerEvent;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.container.IContainerDelta;
@@ -53,7 +56,8 @@ public class BuddySession extends Lifecycle implements IBuddySession, IListener
public void setSelf(IBuddyAccount account)
{
- this.self = new Self(this, account);
+ self = new Self(this, account);
+ self.addListener(this);
}
public Buddy addBuddy(String userID)
@@ -113,6 +117,20 @@ public class BuddySession extends Lifecycle implements IBuddySession, IListener
}
}
}
+ else if (event.getSource() == self)
+ {
+ if (event instanceof IBuddyStateChangedEvent)
+ {
+ try
+ {
+ new BuddyStateNotification(channel, self.getUserID(), ((IBuddyStateChangedEvent)event).getNewState()).send();
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ }
}
public void buddyAdded(String userID)