summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-11 07:23:37 (EDT)
committerEike Stepper2007-10-11 07:23:37 (EDT)
commit4dac56083358f73743433bb51f51712ad2a8bd21 (patch)
tree012285103ec1d9874b900952a1d468d7a9af38c1
parent8632ae68b7ade127ebd6d105a6b961cf703fdbfc (diff)
downloadcdo-4dac56083358f73743433bb51f51712ad2a8bd21.zip
cdo-4dac56083358f73743433bb51f51712ad2a8bd21.tar.gz
cdo-4dac56083358f73743433bb51f51712ad2a8bd21.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOViewHistory.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java20
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java6
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SessionManager.java15
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java10
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java4
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java6
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/ContainerEvent.java2
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/SingleDeltaContainerEvent.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java8
11 files changed, 73 insertions, 19 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOViewHistory.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOViewHistory.java
index 84fbed4..e78fde0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOViewHistory.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOViewHistory.java
@@ -14,12 +14,14 @@ import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.CDOViewResourcesEvent;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.net4j.internal.util.event.Event;
import org.eclipse.net4j.internal.util.event.Notifier;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.emf.ecore.resource.Resource;
+import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Set;
@@ -100,7 +102,7 @@ public final class CDOViewHistory extends Notifier
if (changed)
{
- fireEvent(new Event(null));
+ fireEvent(new ViewHistoryEvent(null));
}
}
@@ -115,20 +117,20 @@ public final class CDOViewHistory extends Notifier
if (changed)
{
- fireEvent(new Event(entry));
+ fireEvent(new ViewHistoryEvent(entry));
}
}
/**
* @author Eike Stepper
*/
- private final class Event extends org.eclipse.net4j.internal.util.event.Event implements CDOViewHistoryEvent
+ private final class ViewHistoryEvent extends Event implements CDOViewHistoryEvent
{
private static final long serialVersionUID = 1L;
Entry addedEntry;
- public Event(Entry addedEntry)
+ public ViewHistoryEvent(Entry addedEntry)
{
super(CDOViewHistory.this);
this.addedEntry = addedEntry;
@@ -143,6 +145,12 @@ public final class CDOViewHistory extends Notifier
{
return addedEntry;
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOViewHistoryEvent[source={0}, addedEntry={1}]", getSource(), getAddedEntry());
+ }
}
/**
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index e4fb2a8..ea857c2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -419,6 +419,12 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
private StartedEvent()
{
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOTransactionStartedEvent[source={0}]", getSource());
+ }
}
/**
@@ -447,6 +453,13 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
{
return idMappings;
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOTransactionFinishedEvent[source={0}, type={1}, idMappings={2}]", getSource(),
+ getType(), idMappings == null ? 0 : idMappings.size());
+ }
}
/**
@@ -475,5 +488,12 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
{
return firstConflict;
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOTransactionConflictEvent[source={0}, conflictingObject={1}, firstConflict={2}]",
+ getSource(), getConflictingObject(), isFirstConflict());
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 74a38a8..94f3a2c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -789,7 +789,7 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
@Override
public String toString()
{
- return MessageFormat.format("CDOViewResourcesEvent[{0}, {1}, {2}]", getView(), resourcePath, kind);
+ return MessageFormat.format("CDOViewResourcesEvent[source={0}, {1}={2}]", getSource(), resourcePath, kind);
}
}
}
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 be12b96..d5f36b5 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
@@ -21,7 +21,7 @@ import org.eclipse.net4j.buddies.internal.server.protocol.BuddyRemovedNotificati
import org.eclipse.net4j.buddies.internal.server.protocol.CollaborationInitiatedNotification;
import org.eclipse.net4j.buddies.protocol.IAccount;
import org.eclipse.net4j.buddies.protocol.IBuddy;
-import org.eclipse.net4j.buddies.protocol.IBuddyStateChangedEvent;
+import org.eclipse.net4j.buddies.protocol.IBuddyStateEvent;
import org.eclipse.net4j.buddies.protocol.ICollaboration;
import org.eclipse.net4j.buddies.protocol.ISession;
import org.eclipse.net4j.buddies.server.IBuddyAdmin;
@@ -185,9 +185,9 @@ public class BuddyAdmin extends CollaborationContainer implements IBuddyAdmin, I
}
else if (event.getSource() instanceof ServerBuddy)
{
- if (event instanceof IBuddyStateChangedEvent)
+ if (event instanceof IBuddyStateEvent)
{
- IBuddyStateChangedEvent e = (IBuddyStateChangedEvent)event;
+ IBuddyStateEvent e = (IBuddyStateEvent)event;
synchronized (this)
{
for (ISession session : sessions.values())
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SessionManager.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SessionManager.java
index 01ee8b9..4c06a8b 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SessionManager.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SessionManager.java
@@ -20,6 +20,8 @@ import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import java.text.MessageFormat;
+
public class SessionManager extends Lifecycle implements ISessionManager, IListener
{
public static final SessionManager INSTANCE = new SessionManager();
@@ -50,7 +52,7 @@ public class SessionManager extends Lifecycle implements ISessionManager, IListe
{
if (this.state != state)
{
- IEvent event = new StateChangedEvent(this.state, state, session);
+ IEvent event = new SessionManagerEvent(this.state, state, session);
this.state = state;
fireEvent(event);
}
@@ -228,7 +230,7 @@ public class SessionManager extends Lifecycle implements ISessionManager, IListe
/**
* @author Eike Stepper
*/
- private final class StateChangedEvent extends Event implements ISessionManagerEvent
+ private final class SessionManagerEvent extends Event implements ISessionManagerEvent
{
private static final long serialVersionUID = 1L;
@@ -238,7 +240,7 @@ public class SessionManager extends Lifecycle implements ISessionManager, IListe
private IBuddySession session;
- public StateChangedEvent(State oldState, State newState, IBuddySession session)
+ public SessionManagerEvent(State oldState, State newState, IBuddySession session)
{
super(SessionManager.this);
this.oldState = oldState;
@@ -260,5 +262,12 @@ public class SessionManager extends Lifecycle implements ISessionManager, IListe
{
return session;
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("SessionManagerEvent[source={0}, oldState={1}, newState={2}, session={3}]",
+ getSource(), getOldState(), getNewState(), getSession());
+ }
}
} \ No newline at end of file
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 3934f4f..6e09307 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
@@ -91,6 +91,16 @@ public class CollaborationsPane extends Composite implements IListener
public void setSession(IBuddySession session)
{
this.session = session;
+ if (session != null)
+ {
+ for (ICollaboration collaboration : session.getSelf().getCollaborations())
+ {
+ collaborationAdded((IBuddyCollaboration)collaboration);
+ }
+ }
+ else
+ {
+ }
}
public void setActiveCollaboration(IBuddyCollaboration collaboration)
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java
index 2bad083..63a85c9 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java
@@ -15,7 +15,7 @@ import org.eclipse.net4j.buddies.internal.ui.actions.ConnectAction;
import org.eclipse.net4j.buddies.internal.ui.actions.DisconnectAction;
import org.eclipse.net4j.buddies.internal.ui.actions.FlashAction;
import org.eclipse.net4j.buddies.internal.ui.actions.StateAction.DropDownAction;
-import org.eclipse.net4j.buddies.protocol.IBuddyStateChangedEvent;
+import org.eclipse.net4j.buddies.protocol.IBuddyStateEvent;
import org.eclipse.net4j.buddies.ui.ISessionManager;
import org.eclipse.net4j.buddies.ui.ISessionManagerEvent;
import org.eclipse.net4j.util.container.IContainer;
@@ -67,7 +67,7 @@ public abstract class SessionManagerView extends ContainerView implements IListe
{
queryBuddiesManager();
}
- else if (event instanceof IBuddyStateChangedEvent)
+ else if (event instanceof IBuddyStateEvent)
{
if (session != null && event.getSource() == session.getSelf())
{
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 4fcef87..f16ece4 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
@@ -16,7 +16,7 @@ import org.eclipse.net4j.buddies.internal.protocol.BuddyContainer;
import org.eclipse.net4j.buddies.internal.protocol.BuddyStateNotification;
import org.eclipse.net4j.buddies.protocol.IAccount;
import org.eclipse.net4j.buddies.protocol.IBuddy;
-import org.eclipse.net4j.buddies.protocol.IBuddyStateChangedEvent;
+import org.eclipse.net4j.buddies.protocol.IBuddyStateEvent;
import org.eclipse.net4j.internal.buddies.bundle.OM;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
@@ -89,11 +89,11 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
}
else if (event.getSource() == self)
{
- if (event instanceof IBuddyStateChangedEvent)
+ if (event instanceof IBuddyStateEvent)
{
try
{
- new BuddyStateNotification(channel, self.getUserID(), ((IBuddyStateChangedEvent)event).getNewState()).send();
+ new BuddyStateNotification(channel, self.getUserID(), ((IBuddyStateEvent)event).getNewState()).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/ContainerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/ContainerEvent.java
index b5e1a96..175dc2c 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/ContainerEvent.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/ContainerEvent.java
@@ -127,6 +127,6 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E>
builder.append(delta.getElement());
}
- return MessageFormat.format("{0}[source={1}{2}]", getClass().getSimpleName(), getSource(), builder.toString());
+ return MessageFormat.format("ContainerEvent[source={0}{1}]", getSource(), builder.toString());
}
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/SingleDeltaContainerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/SingleDeltaContainerEvent.java
index f8ee7c5..abc274e 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/SingleDeltaContainerEvent.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/SingleDeltaContainerEvent.java
@@ -92,7 +92,6 @@ public class SingleDeltaContainerEvent<E> extends Event implements IContainerEve
@Override
public String toString()
{
- return MessageFormat.format("{0}[source={1}, {2}={3}]", getClass().getSimpleName(), getSource(), getDeltaElement(),
- getDeltaKind());
+ return MessageFormat.format("ContainerEvent[source={0}, {1}={2}]", getSource(), getDeltaElement(), getDeltaKind());
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
index e30da43..51e1d8c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
@@ -43,6 +43,7 @@ import org.eclipse.net4j.util.security.INegotiator;
import org.eclipse.internal.net4j.bundle.OM;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
@@ -771,5 +772,12 @@ public abstract class Connector extends Container<IChannel> implements IConnecto
{
return newState;
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("ConnectorStateEvent[source={0}, oldState={1}, newState={2}]", getSource(),
+ getOldState(), getNewState());
+ }
}
}