summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-16 13:39:28 (EDT)
committerEike Stepper2007-10-16 13:39:28 (EDT)
commit30f83c8bd0cc671593422b6cedd1ba20eb510a74 (patch)
tree60a3cc33811a1ccf905157cd7a36349399425b7a
parent185513a596039873f6334822ce24f0bba67e45e9 (diff)
downloadcdo-30f83c8bd0cc671593422b6cedd1ba20eb510a74.zip
cdo-30f83c8bd0cc671593422b6cedd1ba20eb510a74.tar.gz
cdo-30f83c8bd0cc671593422b6cedd1ba20eb510a74.tar.bz2
[206224] Provide chat example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206224
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java38
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java7
2 files changed, 44 insertions, 1 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
index 00f13a2..a16da52 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
@@ -168,7 +168,13 @@ public class CollaborationsPane extends Composite implements IListener
public void notifyEvent(IEvent event)
{
- if (session != null && event.getSource() == session.getSelf() && event instanceof IContainerEvent)
+ if (session == null)
+ {
+ return;
+ }
+
+ System.out.println("EVENT: " + event);
+ if (event.getSource() == session.getSelf() && event instanceof IContainerEvent)
{
IContainerEvent<ICollaboration> e = (IContainerEvent<ICollaboration>)event;
e.accept(new IContainerEventVisitor<ICollaboration>()
@@ -184,6 +190,22 @@ public class CollaborationsPane extends Composite implements IListener
}
});
}
+ // else if (event.getSource() == session && event instanceof IContainerEvent)
+ // {
+ // IContainerEvent<ICollaboration> e = (IContainerEvent<ICollaboration>)event;
+ // e.accept(new IContainerEventVisitor<ICollaboration>()
+ // {
+ // public void added(ICollaboration collaboration)
+ // {
+ // collaborationAdded((IBuddyCollaboration)collaboration);
+ // }
+ //
+ // public void removed(ICollaboration collaboration)
+ // {
+ // collaborationRemoved((IBuddyCollaboration)collaboration);
+ // }
+ // });
+ // }
else if (event instanceof IFacilityInstalledEvent)
{
IFacilityInstalledEvent e = (IFacilityInstalledEvent)event;
@@ -215,6 +237,20 @@ public class CollaborationsPane extends Composite implements IListener
protected void collaborationRemoved(IBuddyCollaboration collaboration)
{
collaboration.removeListener(this);
+ if (activeCollaboration == collaboration)
+ {
+ setActiveCollaboration(activeFacilities.isEmpty() ? null : activeFacilities.keySet().iterator().next());
+ }
+
+ activeFacilities.remove(collaboration);
+ for (IFacility facility : collaboration.getFacilities())
+ {
+ FacilityPane pane = facilityPanes.remove(facility);
+ if (pane != null)
+ {
+ pane.dispose();
+ }
+ }
}
protected void facilityInstalled(final IFacility facility, boolean fromRemote)
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
index f16ece4..0095953 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
@@ -14,9 +14,11 @@ import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.buddies.IBuddySession;
import org.eclipse.net4j.buddies.internal.protocol.BuddyContainer;
import org.eclipse.net4j.buddies.internal.protocol.BuddyStateNotification;
+import org.eclipse.net4j.buddies.internal.protocol.Collaboration;
import org.eclipse.net4j.buddies.protocol.IAccount;
import org.eclipse.net4j.buddies.protocol.IBuddy;
import org.eclipse.net4j.buddies.protocol.IBuddyStateEvent;
+import org.eclipse.net4j.buddies.protocol.ICollaboration;
import org.eclipse.net4j.internal.buddies.bundle.OM;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
@@ -114,6 +116,10 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
{
IBuddy buddy = removeBuddy(userID);
LifecycleUtil.deactivate(buddy);
+ for (ICollaboration collaboration : self.getCollaborations())
+ {
+ ((Collaboration)collaboration).removeBuddy(userID);
+ }
}
@Override
@@ -127,6 +133,7 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
protected void doDeactivate() throws Exception
{
channel.removeListener(this);
+ LifecycleUtil.deactivate(self);
super.doDeactivate();
}
}