diff options
| author | slewis | 2005-03-28 07:11:19 +0000 |
|---|---|---|
| committer | slewis | 2005-03-28 07:11:19 +0000 |
| commit | f7d8cbca8fb7358436ae8f532b252386db226d4a (patch) | |
| tree | 4c9579c3d3c44cd76df0867655a4037331fb1fe8 | |
| parent | d36e6d3cc493b5c3a6813b1f4426397d2bf648d6 (diff) | |
| download | org.eclipse.ecf-f7d8cbca8fb7358436ae8f532b252386db226d4a.tar.gz org.eclipse.ecf-f7d8cbca8fb7358436ae8f532b252386db226d4a.tar.xz org.eclipse.ecf-f7d8cbca8fb7358436ae8f532b252386db226d4a.zip | |
Moved a number of interfaces to the org.eclipse.ecf.presence plugin. Changed references to interfaces previously defined in org.eclipse.ecf.ui to org.eclipse.ecf.presence.
12 files changed, 36 insertions, 696 deletions
diff --git a/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF index 8cc7c4078..80f9d0a29 100644 --- a/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF +++ b/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF @@ -9,10 +9,13 @@ Bundle-Localization: plugin Require-Bundle: org.eclipse.ecf, org.eclipse.jface.text, org.eclipse.ui;reprovide=true, - org.eclipse.core.runtime + org.eclipse.core.runtime, + org.eclipse.ecf.presence Eclipse-AutoStart: true Provide-Package: org.eclipse.ecf.ui.presence, org.eclipse.ecf.ui, org.eclipse.ecf.ui.messaging, org.eclipse.ecf.ui.views +Export-Package: org.eclipse.ecf.ui.views +DynamicImport-Package: org.eclipse.ecf.presence, org.eclipse.ecf.presence.impl diff --git a/framework/bundles/org.eclipse.ecf.ui/plugin.xml b/framework/bundles/org.eclipse.ecf.ui/plugin.xml index a59715d15..29e181b2e 100644 --- a/framework/bundles/org.eclipse.ecf.ui/plugin.xml +++ b/framework/bundles/org.eclipse.ecf.ui/plugin.xml @@ -7,4 +7,13 @@ name="ECF" id="org.eclipse.ecf.ui.viewcategory"/> </extension> + <extension + point="org.eclipse.ui.views"> + <view + icon="icons/person.gif" + class="org.eclipse.ecf.ui.views.RosterView" + category="org.eclipse.ecf.ui.viewcategory" + name="ECF Buddy List" + id="org.eclipse.ecf.ui.view.rosterview"/> + </extension> </plugin> diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/messaging/IMessageViewer.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/messaging/IMessageViewer.java deleted file mode 100644 index 23ea7f656..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/messaging/IMessageViewer.java +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.messaging; - -import org.eclipse.ecf.core.identity.ID; - -public interface IMessageViewer { - - public void showMessage(ID fromID, ID toID, Type type, String subject, String message); - - public static class Type { - - private static final String NORMAL_NAME = "normal"; - private static final String CHAT_NAME = "chat"; - private static final String GROUP_CHAT_NAME = "group_chat"; - private static final String HEADLINE_NAME = "headline"; - private static final String ERROR_NAME = "error"; - - private final transient String name; - // Protected constructor so that only subclasses are allowed to create instances - protected Type(String name) { - this.name = name; - } - public static Type fromString(String itemType) { - if (itemType == null) return null; - if (itemType.equals(NORMAL_NAME)) { - return NORMAL; - } else if (itemType.equals(CHAT_NAME)) { - return CHAT; - } else if (itemType.equals(GROUP_CHAT_NAME)) { - return GROUP_CHAT; - } else if (itemType.equals(HEADLINE_NAME)) { - return HEADLINE; - } else if (itemType.equals(ERROR_NAME)) { - return ERROR; - } else return null; - } - - public static final Type NORMAL = new Type(NORMAL_NAME); - public static final Type CHAT = new Type(CHAT_NAME); - public static final Type GROUP_CHAT = new Type(GROUP_CHAT_NAME); - public static final Type HEADLINE = new Type(HEADLINE_NAME); - public static final Type ERROR = new Type(ERROR_NAME); - - public String toString() { return name; } - // This is to make sure that subclasses don't screw up these methods - public final boolean equals(Object that) { - return super.equals(that); - } - public final int hashCode() { - return super.hashCode(); - } - } - - -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java deleted file mode 100644 index 862e6e6f1..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IPresence.java +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.presence; - -import java.io.ObjectStreamException; -import java.io.Serializable; -import java.util.Map; -import org.eclipse.core.runtime.IAdaptable; - -public interface IPresence extends IAdaptable, Serializable { - - public Mode getMode(); - public int getPriority(); - public Map getProperties(); - public String getStatus(); - public Type getType(); - - /** - * A type-safe enum class to represent the presence type information - * - */ - public static class Type implements Serializable { - - private static final String AVAILABLE_NAME = "available"; - private static final String ERROR_NAME = "error"; - private static final String SUBSCRIBE_NAME = "subscribe"; - private static final String SUBSCRIBED_NAME = "subscribed"; - private static final String UNAVAILABLE_NAME = "unavailable"; - private static final String UNSUBSCRIBE_NAME = "unsubscribe"; - private static final String UNSUBSCRIBED_NAME = "unsubscribed"; - private static final String UNKWOWN_NAME = "unknown"; - - private final transient String name; - // Protected constructor so that only subclasses are allowed to create instances - protected Type(String name) { - this.name = name; - } - public static Type fromString(String presenceType) { - if (presenceType == null) return null; - if (presenceType.equals(AVAILABLE_NAME)) { - return AVAILABLE; - } else if (presenceType.equals(ERROR_NAME)) { - return ERROR; - } else if (presenceType.equals(SUBSCRIBE_NAME)) { - return SUBSCRIBE; - } else if (presenceType.equals(SUBSCRIBED_NAME)) { - return SUBSCRIBED; - } else if (presenceType.equals(UNAVAILABLE_NAME)) { - return UNAVAILABLE; - } else if (presenceType.equals(UNSUBSCRIBE_NAME)) { - return UNSUBSCRIBE; - } else if (presenceType.equals(UNSUBSCRIBED_NAME)) { - return UNSUBSCRIBED; - } else if (presenceType.equals(UNKWOWN_NAME)) { - return UNKNOWN; - } else return null; - } - - public static final Type AVAILABLE = new Type(AVAILABLE_NAME); - public static final Type ERROR = new Type(ERROR_NAME); - public static final Type SUBSCRIBE = new Type(SUBSCRIBE_NAME); - public static final Type SUBSCRIBED = new Type(SUBSCRIBED_NAME); - public static final Type UNAVAILABLE = new Type(UNAVAILABLE_NAME); - public static final Type UNSUBSCRIBE = new Type(UNSUBSCRIBE_NAME); - public static final Type UNSUBSCRIBED = new Type(UNSUBSCRIBED_NAME); - public static final Type UNKNOWN = new Type(UNKWOWN_NAME); - - public String toString() { return name; } - // This is to make sure that subclasses don't screw up these methods - public final boolean equals(Object that) { - return super.equals(that); - } - public final int hashCode() { - return super.hashCode(); - } - // For serialization - private static int nextOrdinal = 0; - private final int ordinal = nextOrdinal++; - private static final Type [] VALUES = { AVAILABLE, ERROR, SUBSCRIBE, SUBSCRIBED, UNAVAILABLE, UNSUBSCRIBE, UNSUBSCRIBED, UNKNOWN }; - Object readResolve() throws ObjectStreamException { - return VALUES[ordinal]; - } - } - - /** - * A type-safe enum class to represent the presence mode information - * - */ - public static class Mode implements Serializable { - - private static final String AVAILABLE_NAME = "available"; - private static final String AWAY_NAME = "away"; - private static final String CHAT_NAME = "chat"; - private static final String DND_NAME = "do not disturb"; - private static final String EXTENDED_AWAY_NAME = "extended away"; - private static final String INVISIBLE_NAME = "unsubscribed"; - - private final transient String name; - // Protected constructor so that only subclasses are allowed to create instances - protected Mode(String name) { - this.name = name; - } - public static Mode fromString(String presenceMode) { - if (presenceMode == null) return null; - if (presenceMode.equals(AVAILABLE_NAME)) { - return AVAILABLE; - } else if (presenceMode.equals(AWAY_NAME)) { - return AWAY; - } else if (presenceMode.equals(CHAT_NAME)) { - return CHAT; - } else if (presenceMode.equals(DND_NAME)) { - return DND; - } else if (presenceMode.equals(EXTENDED_AWAY_NAME)) { - return EXTENDED_AWAY; - } else if (presenceMode.equals(INVISIBLE_NAME)) { - return INVISIBLE; - } else return null; - } - - public static final Mode AVAILABLE = new Mode(AVAILABLE_NAME); - public static final Mode AWAY = new Mode(AWAY_NAME); - public static final Mode CHAT = new Mode(CHAT_NAME); - public static final Mode DND = new Mode(DND_NAME); - public static final Mode EXTENDED_AWAY = new Mode(EXTENDED_AWAY_NAME); - public static final Mode INVISIBLE = new Mode(INVISIBLE_NAME); - - public String toString() { return name; } - // This is to make sure that subclasses don't screw up these methods - public final boolean equals(Object that) { - return super.equals(that); - } - public final int hashCode() { - return super.hashCode(); - } - // For serialization - private static int nextOrdinal = 0; - private final int ordinal = nextOrdinal++; - private static final Mode [] VALUES = { AVAILABLE, AWAY, CHAT, DND, EXTENDED_AWAY, INVISIBLE }; - Object readResolve() throws ObjectStreamException { - return VALUES[ordinal]; - } - } - -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterEntry.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterEntry.java deleted file mode 100644 index a076cde87..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterEntry.java +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.presence; - -import java.util.Iterator; -import org.eclipse.ecf.core.identity.ID; - -public interface IRosterEntry { - - public void add(IRosterGroup group); - public void remove(IRosterGroup group); - public Iterator getGroups(); - public String getName(); - public ID getUserID(); - public void setName(String name); - public InterestType getInterestType(); - public IPresence getPresenceState(); - public void setPresenceState(IPresence presence); - - public static class InterestType { - - private static final String BOTH_NAME = "both"; - private static final String FROM_NAME = "from"; - private static final String NONE_NAME = "none"; - private static final String REMOVE_NAME = "remove"; - private static final String TO_NAME = "to"; - - private final transient String name; - // Protected constructor so that only subclasses are allowed to create instances - protected InterestType(String name) { - this.name = name; - } - public static InterestType fromString(String itemType) { - if (itemType == null) return null; - if (itemType.equals(BOTH_NAME)) { - return BOTH; - } else if (itemType.equals(FROM_NAME)) { - return FROM; - } else if (itemType.equals(NONE_NAME)) { - return NONE; - } else if (itemType.equals(REMOVE_NAME)) { - return REMOVE; - } else if (itemType.equals(TO_NAME)) { - return TO; - } else return null; - } - - public static final InterestType BOTH = new InterestType(BOTH_NAME); - public static final InterestType FROM = new InterestType(FROM_NAME); - public static final InterestType NONE = new InterestType(NONE_NAME); - public static final InterestType REMOVE = new InterestType(REMOVE_NAME); - public static final InterestType TO = new InterestType(TO_NAME); - - public String toString() { return name; } - // This is to make sure that subclasses don't screw up these methods - public final boolean equals(Object that) { - return super.equals(that); - } - public final int hashCode() { - return super.hashCode(); - } - } - -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterGroup.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterGroup.java deleted file mode 100644 index 9e3a62e9f..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterGroup.java +++ /dev/null @@ -1,25 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.presence; - -import java.util.Iterator; -import java.util.Map; - -public interface IRosterGroup { - public IRosterEntry add(IRosterEntry entry); - public void addAll(Map existing); - public IRosterEntry contains(IRosterEntry entry); - public Iterator getRosterEntries(); - public int size(); - public String getName(); - public IRosterEntry removeEntry(IRosterEntry entry); -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterViewer.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterViewer.java deleted file mode 100644 index da07d2f15..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/IRosterViewer.java +++ /dev/null @@ -1,20 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.presence; - -import org.eclipse.ecf.core.identity.ID; - -public interface IRosterViewer { - - public void receiveRosterEntry(IRosterEntry entry); - public void receivePresence(ID userID, IPresence presence); -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/Presence.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/Presence.java deleted file mode 100644 index e733989b8..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/Presence.java +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.presence; - -import java.util.Map; -import java.util.Properties; - -public class Presence implements IPresence { - - protected Type type; - protected Mode mode; - protected int priority; - protected String status; - protected Map properties; - - public Presence() { - this(Type.AVAILABLE); - } - public Presence(Type type) { - this(type,"",Mode.AVAILABLE); - } - public Presence(Type type, int priority, String status, Mode mode, Map props) { - this.type = type; - this.priority = priority; - this.status = status; - this.mode = mode; - this.properties = props; - } - public Presence(Type type, int priority, String status, Mode mode) { - this(type,priority,status,mode,new Properties()); - } - public Presence(Type type, String status, Mode mode) { - this(type,-1,status,mode); - } - public Mode getMode() { - return mode; - } - public int getPriority() { - return priority; - } - public Map getProperties() { - return properties; - } - public String getStatus() { - return status; - } - public Type getType() { - return type; - } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - return null; - } - - public String toString() { - StringBuffer sb = new StringBuffer("Presence["); - sb.append("type=").append(type).append(";"); - sb.append("mode=").append(mode).append(";"); - sb.append("priority=").append(priority).append(";"); - sb.append("status=").append(status).append(";"); - sb.append("props=").append(properties).append(";"); - sb.append("]"); - return sb.toString(); - } -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/RosterEntry.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/RosterEntry.java deleted file mode 100644 index ca44b8fe1..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/RosterEntry.java +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.presence; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import org.eclipse.ecf.core.identity.ID; - -public class RosterEntry implements IRosterEntry { - - protected ID userID; - protected String name; - protected IPresence presenceState; - protected InterestType interestType; - protected List groups; - - public RosterEntry(ID userID, String name, IPresence presenceState, InterestType interestType, Collection grps) { - this.userID = userID; - this.name = name; - this.presenceState = presenceState; - this.interestType = interestType; - this.groups = new ArrayList(); - if (grps != null) this.groups.addAll(groups); - } - - public RosterEntry(ID userID, String name) { - this(userID,name,null,InterestType.BOTH,null); - } - - public RosterEntry(ID userID, String name, IPresence presenceState) { - this(userID,name,presenceState,InterestType.BOTH,null); - } - public RosterEntry(ID userID, String name, InterestType interestType) { - this(userID,name,null,interestType,null); - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#getGroups() - */ - public Iterator getGroups() { - return groups.iterator(); - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#getName() - */ - public String getName() { - return name; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#getUserID() - */ - public ID getUserID() { - return userID; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#setName(java.lang.String) - */ - public void setName(String name) { - this.name = name; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#getInterestType() - */ - public InterestType getInterestType() { - return interestType; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#getPresenceState() - */ - public IPresence getPresenceState() { - return presenceState; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#setPresenceState(org.eclipse.ecf.ui.presence.IPresence) - */ - public void setPresenceState(IPresence presence) { - this.presenceState = presence; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#addGroup(org.eclipse.ecf.ui.presence.IRosterGroup) - */ - public void add(IRosterGroup group) { - groups.add(group); - } - - public void addAll(Collection grps) { - groups.addAll(grps); - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterEntry#remvoe(org.eclipse.ecf.ui.presence.IRosterGroup) - */ - public void remove(IRosterGroup group) { - groups.remove(group); - } - - public String toString() { - StringBuffer sb = new StringBuffer("RosterEntry["); - sb.append("userID=").append(userID).append(";"); - sb.append("name=").append(name).append(";"); - sb.append("presence=").append(presenceState).append(";"); - sb.append("interest=").append(interestType).append(";"); - sb.append("groups=").append(groups).append(";"); - sb.append("]"); - return sb.toString(); - } - -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/RosterGroup.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/RosterGroup.java deleted file mode 100644 index e65166be9..000000000 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/presence/RosterGroup.java +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -* Copyright (c) 2004 Composent, Inc. and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* Composent, Inc. - initial API and implementation -*****************************************************************************/ - -package org.eclipse.ecf.ui.presence; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import org.eclipse.ecf.core.identity.ID; - -public class RosterGroup implements IRosterGroup { - - protected Map entries; - protected String name; - - public RosterGroup(String name, Map existing) { - super(); - this.name = name; - entries = new HashMap(); - if (existing != null) addAll(existing); - } - - public RosterGroup(String name) { - this(name,null); - } - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterGroup#add(org.eclipse.ecf.core.identity.ID, org.eclipse.ecf.ui.presence.IRosterEntry) - */ - public IRosterEntry add(IRosterEntry entry) { - if (entry != null) { - synchronized (entries) { - IRosterEntry res = (IRosterEntry) entries.put(entry.getUserID(),entry); - entry.add(this); - return res; - } - } else return null; - } - public void addAll(Map existing) { - synchronized (entries) { - for(Iterator i=existing.entrySet().iterator(); i.hasNext(); ) { - IRosterEntry entry = (IRosterEntry) i.next(); - add(entry); - } - } - } - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterGroup#contains(org.eclipse.ecf.core.identity.ID) - */ - public IRosterEntry contains(IRosterEntry entry) { - if (entry == null) return null; - synchronized (entries) { - ID uID = entry.getUserID(); - boolean has = entries.containsKey(uID); - if (has) { - return (IRosterEntry) entries.get(uID); - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterGroup#getRosterEntries() - */ - public Iterator getRosterEntries() { - return entries.values().iterator(); - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterGroup#size() - */ - public int size() { - return entries.size(); - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterGroup#getName() - */ - public String getName() { - return this.name; - } - - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.presence.IRosterGroup#removeEntry(org.eclipse.ecf.ui.presence.IRosterEntry) - */ - public IRosterEntry removeEntry(IRosterEntry entry) { - synchronized (entries) { - boolean hasEntry = entries.containsValue(entry); - IRosterEntry res = (IRosterEntry) entries.remove(entry.getUserID()); - return res; - } - } - - public String toString() { - StringBuffer sb = new StringBuffer("RosterGroup["); - sb.append("name=").append(name).append(";"); - sb.append("entries=").append(entries).append(";"); - sb.append("]"); - return sb.toString(); - } - - -} diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/ChatWindow.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/ChatWindow.java index 777f90cee..6c55e69ff 100644 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/ChatWindow.java +++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/ChatWindow.java @@ -14,8 +14,8 @@ package org.eclipse.ecf.ui.views; import org.eclipse.core.runtime.Path; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.user.IUser; +import org.eclipse.ecf.presence.IMessageListener; import org.eclipse.ecf.ui.UiPlugin; -import org.eclipse.ecf.ui.messaging.IMessageViewer; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.window.ApplicationWindow; import org.eclipse.swt.SWT; @@ -38,7 +38,7 @@ import org.eclipse.ui.part.ViewPart; * @author pnehrer * */ -public class ChatWindow extends ApplicationWindow implements IMessageViewer { +public class ChatWindow extends ApplicationWindow implements IMessageListener { protected static final String ICONS_PERSON_GIF = "icons/person.gif"; private static final long FLASH_INTERVAL = 600; @@ -337,10 +337,7 @@ public class ChatWindow extends ApplicationWindow implements IMessageViewer { } } - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.messaging.IMessageViewer#showMessage(org.eclipse.ecf.core.identity.ID, org.eclipse.ecf.core.identity.ID, org.eclipse.ecf.ui.messaging.IMessageViewer.Type, java.lang.String, java.lang.String) - */ - public void showMessage(final ID fromID, ID toID, Type type, String subject, final String message) { + public void handleMessage(final ID fromID, ID toID, Type type, String subject, final String message) { Display.getDefault().syncExec(new Runnable() { public void run() { if (!disposed && chat != null) { diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/RosterView.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/RosterView.java index df5bf28cd..aaaace73a 100644 --- a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/RosterView.java +++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/views/RosterView.java @@ -22,14 +22,14 @@ import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.identity.IDFactory; import org.eclipse.ecf.core.user.IUser; import org.eclipse.ecf.core.user.User; +import org.eclipse.ecf.presence.IMessageListener; +import org.eclipse.ecf.presence.IPresence; +import org.eclipse.ecf.presence.IPresenceListener; +import org.eclipse.ecf.presence.IRosterEntry; +import org.eclipse.ecf.presence.IRosterGroup; +import org.eclipse.ecf.presence.impl.RosterEntry; import org.eclipse.ecf.ui.UiPlugin; import org.eclipse.ecf.ui.UiPluginConstants; -import org.eclipse.ecf.ui.messaging.IMessageViewer; -import org.eclipse.ecf.ui.presence.IPresence; -import org.eclipse.ecf.ui.presence.IRosterEntry; -import org.eclipse.ecf.ui.presence.IRosterGroup; -import org.eclipse.ecf.ui.presence.IRosterViewer; -import org.eclipse.ecf.ui.presence.RosterEntry; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -60,12 +60,8 @@ import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.ViewPart; -/** - * WARNING: IN PROGRESS - * - */ public class RosterView extends ViewPart implements IConfigViewer, - IRosterViewer, IMessageViewer { + IPresenceListener, IMessageListener { protected static final int TREE_EXPANSION_LEVELS = 1; private TreeViewer viewer; private Action chatAction; @@ -522,12 +518,7 @@ public class RosterView extends ViewPart implements IConfigViewer, viewer.getControl().setFocus(); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.ui.presence.IRosterViewer#receiveRosterEntry(org.eclipse.ecf.ui.presence.IRosterEntry) - */ - public void receiveRosterEntry(IRosterEntry entry) { + public void handleRosterEntry(IRosterEntry entry) { if (entry == null) return; ViewContentProvider vcp = (ViewContentProvider) viewer @@ -538,15 +529,9 @@ public class RosterView extends ViewPart implements IConfigViewer, } } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.ui.presence.IPresenceViewer#receivePresence(org.eclipse.ecf.core.identity.ID, - * org.eclipse.ecf.ui.presence.IPresence) - */ - public void receivePresence(ID userID, IPresence presence) { + public void handlePresence(ID userID, IPresence presence) { IRosterEntry entry = new RosterEntry(userID, null, presence); - receiveRosterEntry(entry); + handleRosterEntry(entry); refreshView(); } @@ -585,9 +570,9 @@ public class RosterView extends ViewPart implements IConfigViewer, }; } else if (clazz.equals(IConfigViewer.class)) { return this; - } else if (clazz.equals(IRosterViewer.class)) { + } else if (clazz.equals(IPresenceListener.class)) { return this; - } else if (clazz.equals(IMessageViewer.class)) { + } else if (clazz.equals(IMessageListener.class)) { return this; } else return null; @@ -604,20 +589,12 @@ public class RosterView extends ViewPart implements IConfigViewer, return sdf.format(new Date()); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.ui.messaging.IMessageViewer#showMessage(org.eclipse.ecf.core.identity.ID, - * org.eclipse.ecf.core.identity.ID, - * org.eclipse.ecf.ui.messaging.IMessageViewer.Type, java.lang.String, - * java.lang.String) - */ - public void showMessage(ID fromID, ID toID, Type type, String subject, + public void handleMessage(ID fromID, ID toID, Type type, String subject, String message) { ChatWindow window = openChatWindowForTarget(fromID); // finally, show message if (window != null) { - window.showMessage(fromID, toID, type, subject, message); + window.handleMessage(fromID, toID, type, subject, message); window.setStatus("last message received at "+(new SimpleDateFormat("hh:mm:ss").format(new Date()))); } } @@ -633,9 +610,6 @@ public class RosterView extends ViewPart implements IConfigViewer, } } - /* (non-Javadoc) - * @see org.eclipse.ecf.ui.views.IConfigViewer#memberDeparted(org.eclipse.ecf.core.identity.ID) - */ public void memberDeparted(ID member) { if (groupID != null) { if (groupID.equals(member)) { @@ -643,7 +617,12 @@ public class RosterView extends ViewPart implements IConfigViewer, } } } - + public void handleContainerJoined(ID containerID) { + // XXX + } + public void handleContainerDeparted(ID containerID) { + handleGroupManagerDeparted(); + } protected void disposeAllChatWindows(String status) { synchronized (chatThreads) { for(Iterator i=chatThreads.values().iterator(); i.hasNext(); ) { |
