summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-08 05:43:16 (EDT)
committerEike Stepper2007-10-08 05:43:16 (EDT)
commit99f3c75b164889e5d89e867e8f10a5e744ac77d6 (patch)
treea5bdce55f0579fe304c81ba175743896efec8e5c
parent7ca348e4e849f13cf890e63460ac1ecfa5f8a52f (diff)
downloadcdo-99f3c75b164889e5d89e867e8f10a5e744ac77d6.zip
cdo-99f3c75b164889e5d89e867e8f10a5e744ac77d6.tar.gz
cdo-99f3c75b164889e5d89e867e8f10a5e744ac77d6.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/.options7
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java4
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java8
-rw-r--r--plugins/org.eclipse.net4j.buddies/.options11
4 files changed, 10 insertions, 20 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.server/.options b/plugins/org.eclipse.net4j.buddies.server/.options
index 5b2527c..9683194 100644
--- a/plugins/org.eclipse.net4j.buddies.server/.options
+++ b/plugins/org.eclipse.net4j.buddies.server/.options
@@ -1,8 +1 @@
org.eclipse.net4j.buddies.server/debug = true
-org.eclipse.net4j.buddies.server/debug.protocol = true
-org.eclipse.net4j.buddies.server/debug.repository = true
-org.eclipse.net4j.buddies.server/debug.session = true
-org.eclipse.net4j.buddies.server/debug.revision = true
-org.eclipse.net4j.buddies.server/debug.resource = true
-org.eclipse.net4j.buddies.server/debug.store = true
-org.eclipse.net4j.buddies.server/debug.types = true
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
index edbd100..9d365e0 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
@@ -20,6 +20,7 @@ import org.eclipse.net4j.buddies.protocol.IBuddyStateChangedEvent;
import org.eclipse.net4j.buddies.server.IBuddyAdmin;
import org.eclipse.net4j.buddies.server.IBuddySession;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
@@ -36,6 +37,8 @@ public class BuddyAdmin extends Lifecycle implements IBuddyAdmin, IListener
{
public static final BuddyAdmin INSTANCE = new BuddyAdmin();
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, BuddyAdmin.class);
+
private Map<String, IBuddyAccount> accounts = new HashMap<String, IBuddyAccount>();
private Map<String, IBuddySession> sessions = new HashMap<String, IBuddySession>();
@@ -82,6 +85,7 @@ public class BuddyAdmin extends Lifecycle implements IBuddyAdmin, IListener
BuddySession session = new BuddySession(channel, buddy);
sessions.put(userID, session);
session.addListener(this);
+ if (TRACER.isEnabled()) TRACER.trace("Opened session: " + userID);
return session;
}
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 a26bff8..261370b 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
@@ -81,7 +81,6 @@ public class BuddiesView extends ContainerView implements IListener
{
if (connecting)
{
- session.addListener(BuddiesView.this);
connectAction.setEnabled(false);
disconnectAction.setEnabled(true);
availableAction.setEnabled(true);
@@ -90,6 +89,7 @@ public class BuddiesView extends ContainerView implements IListener
awayAction.setChecked(session.getSelf().getState() == IBuddy.State.AWAY);
doNotDisturbAction.setEnabled(true);
doNotDisturbAction.setChecked(session.getSelf().getState() == IBuddy.State.DO_NOT_DISTURB);
+ session.addListener(BuddiesView.this);
}
else
{
@@ -109,15 +109,19 @@ public class BuddiesView extends ContainerView implements IListener
protected void disconnect()
{
+ connecting = false;
session.removeListener(this);
session.close();
session = null;
- connecting = false;
+
connectAction.setEnabled(true);
disconnectAction.setEnabled(false);
availableAction.setEnabled(false);
+ availableAction.setChecked(false);
awayAction.setEnabled(false);
+ awayAction.setChecked(false);
doNotDisturbAction.setEnabled(false);
+ doNotDisturbAction.setChecked(false);
}
@Override
diff --git a/plugins/org.eclipse.net4j.buddies/.options b/plugins/org.eclipse.net4j.buddies/.options
index 24abc19..0aa6942 100644
--- a/plugins/org.eclipse.net4j.buddies/.options
+++ b/plugins/org.eclipse.net4j.buddies/.options
@@ -1,12 +1 @@
org.eclipse.net4j.buddies/debug = true
-org.eclipse.net4j.buddies/debug.util = true
-org.eclipse.net4j.buddies/debug.model = true
-org.eclipse.net4j.buddies/debug.protocol = true
-org.eclipse.net4j.buddies/debug.repository = true
-org.eclipse.net4j.buddies/debug.session = true
-org.eclipse.net4j.buddies/debug.adapter = true
-org.eclipse.net4j.buddies/debug.view = true
-org.eclipse.net4j.buddies/debug.transaction = true
-org.eclipse.net4j.buddies/debug.object = true
-org.eclipse.net4j.buddies/debug.resource = true
-org.eclipse.net4j.buddies/debug.revision = true