summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-09 10:25:03 (EDT)
committerEike Stepper2007-10-09 10:25:03 (EDT)
commitbddc8121db3db1c71e78949bc39468f4a39ad951 (patch)
tree97b9daf52000f7cca016dafb5f219e4579d4477a
parent65115702db513cc9629963adace83ec94f8a6549 (diff)
downloadcdo-bddc8121db3db1c71e78949bc39468f4a39ad951.zip
cdo-bddc8121db3db1c71e78949bc39468f4a39ad951.tar.gz
cdo-bddc8121db3db1c71e78949bc39468f4a39ad951.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/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java1
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java4
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaboration.gif (renamed from plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaborations.gif)bin573 -> 573 bytes
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SharedIcons.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesItemProvider.java12
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java11
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java3
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java2
9 files changed, 36 insertions, 1 deletions
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 0387d48..325bc2f 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
@@ -90,6 +90,7 @@ public class BuddyAdmin extends CollaborationContainer implements IBuddyAdmin, I
}
ServerBuddy buddy = new ServerBuddy(account, facilityTypes);
+ LifecycleUtil.activate(buddy);
buddy.addListener(this);
ServerSession session = new ServerSession(channel, buddy);
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java
index c9d2a1f..7316f33 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java
@@ -14,7 +14,6 @@ import org.eclipse.net4j.buddies.internal.protocol.ProtocolConstants;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
-
/**
* @author Eike Stepper
*/
@@ -43,6 +42,9 @@ public class ServerProtocol extends SignalProtocol
case ProtocolConstants.SIGNAL_INSTALL_FACILITY:
return new InstallFacilityIndication();
+ case ProtocolConstants.SIGNAL_INITIATE_COLLABORATION:
+ return new InitiateCollaborationIndication();
+
case ProtocolConstants.SIGNAL_MESSAGE:
return new ServerMessageIndication();
}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaborations.gif b/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaboration.gif
index 21a902f..21a902f 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaborations.gif
+++ b/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaboration.gif
Binary files differ
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SharedIcons.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SharedIcons.java
index f09c096..0e4be13 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SharedIcons.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/SharedIcons.java
@@ -37,6 +37,8 @@ public class SharedIcons
@SuppressWarnings("unused")
private static final String WIZBAN = "wizban/";
+ public static final String OBJ_COLLABORATION = OBJ + "collaboration";
+
public static final String OBJ_BUDDY = OBJ + "buddy";
public static final String OBJ_BUDDY_LONESOME = OBJ + "buddy_lonesome";
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesItemProvider.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesItemProvider.java
index 4a088d8..b163798 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesItemProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesItemProvider.java
@@ -12,6 +12,7 @@ package org.eclipse.net4j.buddies.internal.ui.views;
import org.eclipse.net4j.buddies.internal.ui.SharedIcons;
import org.eclipse.net4j.buddies.protocol.IBuddy;
+import org.eclipse.net4j.buddies.protocol.ICollaboration;
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.ui.UIUtil;
@@ -62,6 +63,12 @@ public class BuddiesItemProvider extends ContainerItemProvider<IContainer<Object
return buddy.getUserID();
}
+ if (obj instanceof ICollaboration)
+ {
+ ICollaboration collaboration = (ICollaboration)obj;
+ return collaboration.getTitle();
+ }
+
return super.getText(obj);
}
@@ -87,6 +94,11 @@ public class BuddiesItemProvider extends ContainerItemProvider<IContainer<Object
}
}
+ if (obj instanceof ICollaboration)
+ {
+ return SharedIcons.getImage(SharedIcons.OBJ_COLLABORATION);
+ }
+
return super.getImage(obj);
}
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 7fb6f02..00d732b 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
@@ -226,6 +226,17 @@ public class BuddiesView extends ContainerView implements IListener
}
@Override
+ protected void doubleClicked(Object object)
+ {
+ if (session != null && object instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)object;
+ IBuddy self = session.getSelf();
+ self.initiate(buddy);
+ }
+ }
+
+ @Override
protected void fillLocalToolBar(IToolBarManager manager)
{
manager.add(availableAction);
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 77f277a..88f5fa9 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
@@ -20,6 +20,7 @@ import org.eclipse.net4j.internal.buddies.bundle.OM;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
@@ -53,6 +54,7 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
public void setSelf(IAccount account, Set<String> facilityTypes)
{
self = new Self(this, account, facilityTypes);
+ LifecycleUtil.activate(self);
self.addListener(this);
}
@@ -103,6 +105,7 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
public void buddyAdded(String userID)
{
ClientBuddy buddy = new ClientBuddy(this, userID);
+ LifecycleUtil.activate(buddy);
addBuddy(buddy);
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
index 5044705..b1ed367 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
@@ -16,6 +16,7 @@ import org.eclipse.net4j.buddies.protocol.IBuddy;
import org.eclipse.net4j.buddies.protocol.ICollaboration;
import org.eclipse.net4j.internal.buddies.protocol.InitiateCollaborationRequest;
import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import java.util.Set;
@@ -54,6 +55,7 @@ public class Self extends Buddy
{
long id = new InitiateCollaborationRequest(getSession().getChannel(), buddies).send(5000L);
BuddyCollaboration collaboration = new BuddyCollaboration(id, buddies);
+ LifecycleUtil.activate(collaboration);
addCollaboration(collaboration);
return collaboration;
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java
index 8bb78b8..279986b 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java
@@ -17,6 +17,7 @@ import org.eclipse.net4j.internal.buddies.BuddyCollaboration;
import org.eclipse.net4j.internal.buddies.Self;
import org.eclipse.net4j.signal.Indication;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import java.io.IOException;
import java.util.HashSet;
@@ -57,6 +58,7 @@ public class CollaborationInitiatedIndication extends Indication
}
BuddyCollaboration collaboration = new BuddyCollaboration(collaborationID, buddies);
+ LifecycleUtil.activate(collaboration);
self.addCollaboration(collaboration);
}
}