blob: ed31dc89e31ba5d3818f89a3e142bbd2d15bd253 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package org.eclipse.ecf.example.collab.share;
import java.io.IOException;
import org.eclipse.ecf.core.events.ISharedObjectMessageEvent;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.sharedobject.AbstractSharedObject;
import org.eclipse.ecf.core.sharedobject.SharedObjectMsg;
import org.eclipse.ecf.core.sharedobject.SharedObjectMsgEvent;
import org.eclipse.ecf.core.util.Event;
import org.eclipse.ecf.example.collab.ui.CollabRosterView;
public class RosterSharedObject extends AbstractSharedObject {
CollabRosterView view;
public RosterSharedObject(CollabRosterView view) {
this.view = view;
}
public void sendMessageTo(ID targetID, String message) {
try {
super.sendSharedObjectMsgTo(targetID, SharedObjectMsg.createMsg(
null, "handleMessage", message));
} catch (IOException e) {
e.printStackTrace();
}
}
protected Event handleSharedObjectMsgEvent(ISharedObjectMessageEvent event) {
try {
((SharedObjectMsgEvent) event.getData()).getSharedObjectMsg()
.invoke(this);
} catch (Exception e) {
e.printStackTrace();
}
return event;
}
protected void handleMessage(String message) {
// XXX this should call the view back to display the message/do other things, etc
System.out.println("RosterSharedObject.handleMessage(" + message + ")");
}
}
|