summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-10 06:24:27 (EDT)
committerEike Stepper2007-10-10 06:24:27 (EDT)
commita32ffcf2988454ab9668fe8e8fae7a13ecc01a97 (patch)
tree2495ce8e68f39456d8b8e7e8376c1e9cc5d24cc6
parent2d5f81a3fc0db86fd5c1fa81f63bc180cc7e8832 (diff)
downloadcdo-a32ffcf2988454ab9668fe8e8fae7a13ecc01a97.zip
cdo-a32ffcf2988454ab9668fe8e8fae7a13ecc01a97.tar.gz
cdo-a32ffcf2988454ab9668fe8e8fae7a13ecc01a97.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.java21
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java21
2 files changed, 38 insertions, 4 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 48d81a8..744c1ee 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
@@ -66,7 +66,7 @@ public class BuddiesView extends ContainerView implements IListener
{
if (event instanceof IBuddiesManagerStateChangedEvent)
{
- session = IBuddiesManager.INSTANCE.getSession();
+ queryBuddiesManager();
updateState();
}
else if (event instanceof IBuddyStateChangedEvent)
@@ -82,7 +82,7 @@ public class BuddiesView extends ContainerView implements IListener
protected Control createUI(Composite parent)
{
Control control = super.createUI(parent);
- session = IBuddiesManager.INSTANCE.getSession();
+ queryBuddiesManager();
IBuddiesManager.INSTANCE.addListener(this);
INSTANCE = this;
updateState();
@@ -132,6 +132,23 @@ public class BuddiesView extends ContainerView implements IListener
super.fillLocalPullDown(manager);
}
+ protected void queryBuddiesManager()
+ {
+ IBuddySession oldSession = session;
+ session = IBuddiesManager.INSTANCE.getSession();
+ if (oldSession != null && oldSession != session)
+ {
+ oldSession.removeListener(this);
+ oldSession.getSelf().removeListener(this);
+ }
+
+ if (session != null && session != oldSession)
+ {
+ session.addListener(this);
+ session.getSelf().addListener(this);
+ }
+ }
+
protected void updateState()
{
updateState(availableAction, IBuddy.State.AVAILABLE);
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
index 4cd76ab..520713f 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
@@ -63,7 +63,7 @@ public class CollaborationsView extends ContainerView implements IListener
{
if (event instanceof IBuddiesManagerStateChangedEvent)
{
- session = IBuddiesManager.INSTANCE.getSession();
+ queryBuddiesManager();
updateState();
}
else if (event instanceof IBuddyStateChangedEvent)
@@ -121,7 +121,7 @@ public class CollaborationsView extends ContainerView implements IListener
rightControlData.bottom = new FormAttachment(100, 0);
rightControl.setLayoutData(rightControlData);
- session = IBuddiesManager.INSTANCE.getSession();
+ queryBuddiesManager();
IBuddiesManager.INSTANCE.addListener(this);
INSTANCE = this;
updateState();
@@ -152,6 +152,23 @@ public class CollaborationsView extends ContainerView implements IListener
super.fillLocalPullDown(manager);
}
+ protected void queryBuddiesManager()
+ {
+ IBuddySession oldSession = session;
+ session = IBuddiesManager.INSTANCE.getSession();
+ if (oldSession != null && oldSession != session)
+ {
+ oldSession.removeListener(this);
+ oldSession.getSelf().removeListener(this);
+ }
+
+ if (session != null && session != oldSession)
+ {
+ session.addListener(this);
+ session.getSelf().addListener(this);
+ }
+ }
+
protected void updateState()
{
}