Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsuen2008-11-29 03:29:38 -0500
committerrsuen2008-11-29 03:29:38 -0500
commit8fea59eb516828e9d6cc6aa5ac86213902df7e10 (patch)
treec768580d77c4cf6fa0fb4d24acc1323d5e30b210 /examples/bundles/org.eclipse.ecf.example.collab
parent062e37a3e505abbd3d5e4bbb7d605c6f2a14b9f3 (diff)
downloadorg.eclipse.ecf-8fea59eb516828e9d6cc6aa5ac86213902df7e10.tar.gz
org.eclipse.ecf-8fea59eb516828e9d6cc6aa5ac86213902df7e10.tar.xz
org.eclipse.ecf-8fea59eb516828e9d6cc6aa5ac86213902df7e10.zip
Fix bug 256956 - o.e.ecf.example.collab.share.User should be removed in favour of o.e.ecf.core.user.IUser
Diffstat (limited to 'examples/bundles/org.eclipse.ecf.example.collab')
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java81
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/User.java58
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties14
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java42
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatDropTarget.java6
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatLine.java16
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/LineChatClientView.java55
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/SharedObjectContainerUI.java29
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TeamChat.java8
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TreeDropTarget.java10
10 files changed, 135 insertions, 184 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
index 2dace72ff..8f982c1e6 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.sharedobject.ReplicaSharedObjectDescription;
+import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.example.collab.share.io.EclipseFileTransfer;
import org.eclipse.ecf.example.collab.share.io.FileTransferParams;
import org.eclipse.ecf.internal.example.collab.ClientPlugin;
@@ -90,7 +91,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
private String downloadDirectory = ""; //$NON-NLS-1$
private LineChatClientView localGUI = null;
private IResource localResource = null;
- private User localUser = null;
+ private IUser localUser = null;
private String localVersion = ""; //$NON-NLS-1$
private ID serverID = null;
private SharedObjectEventListener sharedObjectEventListener = null;
@@ -99,7 +100,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
public EclipseCollabSharedObject() {
}
- public EclipseCollabSharedObject(IResource proj, IWorkbenchWindow window, User user, String downloaddir) {
+ public EclipseCollabSharedObject(IResource proj, IWorkbenchWindow window, IUser user, String downloaddir) {
this.localResource = proj;
this.workbenchWindow = window;
this.localUser = user;
@@ -217,11 +218,11 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
return Messages.EclipseCollabSharedObject_TREE_TOP_LABEL;
}
- public User getUser() {
+ public IUser getUser() {
return localUser;
}
- public User getUserForID(final ID user) {
+ public IUser getUserForID(final ID user) {
return (localGUI != null) ? localGUI.getUser(user) : null;
}
@@ -250,12 +251,12 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void handleNotifyUserAdded(User user) {
+ public void handleNotifyUserAdded(IUser user) {
boolean add = false;
try {
final ID[] members = getContext().getGroupMemberIDs();
for (int i = 0; i < members.length; i++) {
- if (members[i].equals(user.getUserID())) {
+ if (members[i].equals(user.getID())) {
add = true;
break;
}
@@ -279,7 +280,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
sendUserUpdate(requestor);
}
- protected void handleShowPrivateTextMsg(final User remote, final String aString) {
+ protected void handleShowPrivateTextMsg(final IUser remote, final String aString) {
// Show line on local interface
Display.getDefault().asyncExec(new Runnable() {
public void run() {
@@ -316,7 +317,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
});
}
- protected void handleUserUpdate(final User ud) {
+ protected void handleUserUpdate(final IUser ud) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
try {
@@ -329,7 +330,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
});
}
- protected void handleUserMessage(final User sender, String msg) {
+ protected void handleUserMessage(final IUser sender, String msg) {
// Show line on local interface
final String message = msg;
if (sender == null)
@@ -348,7 +349,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- protected synchronized void handleStartedTyping(User user) {
+ protected synchronized void handleStartedTyping(IUser user) {
if (localGUI != null)
localGUI.startedTyping(user);
}
@@ -448,9 +449,9 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendPrivateMessageToUser(User touser, String msg) {
+ public void sendPrivateMessageToUser(IUser touser, String msg) {
try {
- forwardMsgTo(touser.getUserID(), SharedObjectMsg.createMsg(null, HANDLE_SHOW_PRIVATE_TEXT_MSG, localUser, msg));
+ forwardMsgTo(touser.getID(), SharedObjectMsg.createMsg(null, HANDLE_SHOW_PRIVATE_TEXT_MSG, localUser, msg));
} catch (final Exception e) {
log("Exception on sendShowPrivateTextMsg to remote clients", e); //$NON-NLS-1$
}
@@ -472,10 +473,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendCVSProjectUpdateRequest(User touser, String msg) {
+ public void sendCVSProjectUpdateRequest(IUser touser, String msg) {
ID receiver = null;
if (touser != null) {
- receiver = touser.getUserID();
+ receiver = touser.getID();
}
try {
final SharedObjectMsg m = SharedObjectMsg.createMsg(null, HANDLE_CVS_PROJECT_UPDATE_REQUEST_MSG, getUser(), msg);
@@ -498,10 +499,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendRingMessageToUser(User user, String msg) {
+ public void sendRingMessageToUser(IUser user, String msg) {
ID receiver = null;
if (user != null) {
- receiver = user.getUserID();
+ receiver = user.getID();
}
try {
final SharedObjectMsg m = SharedObjectMsg.createMsg(null, HANDLE_USER_MSG, this.localUser, msg);
@@ -697,10 +698,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendAddMarkerForFile(User touser, String resourceName, int offset, int length) {
+ public void sendAddMarkerForFile(IUser touser, String resourceName, int offset, int length) {
ID receiver = null;
if (touser != null) {
- receiver = touser.getUserID();
+ receiver = touser.getID();
}
try {
final SharedObjectMsg m = SharedObjectMsg.createMsg(null, HANDLE_ADD_MARKER_FOR_FILE_MSG, getUser(), resourceName, new SharedMarker(Messages.EclipseCollabSharedObject_MARKER_NAME, new Integer(offset), new Integer(length)));
@@ -713,10 +714,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendOpenAndSelectForFile(User touser, String resourceName, int offset, int length) {
+ public void sendOpenAndSelectForFile(IUser touser, String resourceName, int offset, int length) {
ID receiver = null;
if (touser != null) {
- receiver = touser.getUserID();
+ receiver = touser.getID();
}
try {
final SharedObjectMsg m = SharedObjectMsg.createMsg(null, HANDLE_OPEN_AND_SELECT_FOR_FILE_MSG, getUser(), resourceName, new SharedMarker(Messages.EclipseCollabSharedObject_MARKER_NAME, new Integer(offset), new Integer(length)));
@@ -729,10 +730,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendLaunchEditorForFile(User touser, String resourceName) {
+ public void sendLaunchEditorForFile(IUser touser, String resourceName) {
ID receiver = null;
if (touser != null) {
- receiver = touser.getUserID();
+ receiver = touser.getID();
}
try {
final SharedObjectMsg m = SharedObjectMsg.createMsg(null, HANDLE_LAUNCH_EDITOR_FOR_FILE_MSG, getUser(), resourceName);
@@ -810,12 +811,12 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
});
}
- protected void handleAddMarkerForFile(final User fromuser, final String resourceName, SharedMarker marker) {
+ protected void handleAddMarkerForFile(final IUser fromuser, final String resourceName, SharedMarker marker) {
addMarkerForFile(getLocalFileForRemote(resourceName), marker);
}
- protected void handleOpenAndSelectForFile(final User fromuser, final String resourceName, SharedMarker marker) {
- final User local = getUserForID(fromuser.getUserID());
+ protected void handleOpenAndSelectForFile(final IUser fromuser, final String resourceName, SharedMarker marker) {
+ final IUser local = getUserForID(fromuser.getID());
if (local != null) {
final Runnable runnable = createOpenEditorAndSelectForFileRunnable(resourceName, marker);
showEventInChatOutput(fromuser, resourceName, marker, runnable);
@@ -823,13 +824,13 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- protected boolean isLocalUser(User fromuser) {
- if (fromuser != null && fromuser.getUserID().equals(getUser().getUserID()))
+ protected boolean isLocalUser(IUser fromuser) {
+ if (fromuser != null && fromuser.getID().equals(getUser().getID()))
return true;
return false;
}
- protected void verifyAndOpenEditorLocally(final User fromuser, final String resourceName, final Runnable runnable) {
+ protected void verifyAndOpenEditorLocally(final IUser fromuser, final String resourceName, final Runnable runnable) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (isLocalUser(fromuser)) {
@@ -845,8 +846,8 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
});
}
- protected void handleLaunchEditorForFile(final User fromuser, final String resourceName) {
- final User local = getUserForID(fromuser.getUserID());
+ protected void handleLaunchEditorForFile(final IUser fromuser, final String resourceName) {
+ final IUser local = getUserForID(fromuser.getID());
if (local != null) {
final Runnable runnable = createOpenEditorForFileRunnable(resourceName);
showEventInChatOutput(fromuser, resourceName, null, runnable);
@@ -862,9 +863,9 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
return ClientPlugin.getDefault().getPreferenceStore().getBoolean(ClientPlugin.PREF_SHAREDEDITOR_ASK_RECEIVER);
}
- protected void showEventInChatOutput(User fromuser, String resourceName, SharedMarker marker, Runnable runnable) {
+ protected void showEventInChatOutput(IUser fromuser, String resourceName, SharedMarker marker, Runnable runnable) {
if (localGUI != null) {
- showRawLine(fromuser.getUserID(), createDisplayStringForEditorOpen(resourceName, marker), runnable);
+ showRawLine(fromuser.getID(), createDisplayStringForEditorOpen(resourceName, marker), runnable);
}
}
@@ -889,10 +890,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
return aFile;
}
- public void sendShowViewWithID(User touser, String id, String secID, Integer mode) {
+ public void sendShowViewWithID(IUser touser, String id, String secID, Integer mode) {
ID receiver = null;
if (touser != null) {
- receiver = touser.getUserID();
+ receiver = touser.getID();
}
try {
final SharedObjectMsg m = SharedObjectMsg.createMsg(null, HANDLE_SHOW_VIEW_WITH_ID_MSG, getUser(), id, secID, mode);
@@ -905,10 +906,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendShowView(User touser, String id) {
+ public void sendShowView(IUser touser, String id) {
ID receiver = null;
if (touser != null) {
- receiver = touser.getUserID();
+ receiver = touser.getID();
}
try {
final SharedObjectMsg m = SharedObjectMsg.createMsg(null, HANDLE_SHOW_VIEW_MSG, getUser(), id);
@@ -921,7 +922,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- protected void handleShowViewWithID(User fromUser, final String id, final String secID, final Integer mode) {
+ protected void handleShowViewWithID(IUser fromUser, final String id, final String secID, final Integer mode) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
@@ -933,7 +934,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
});
}
- protected void handleShowView(User fromUser, final String id) {
+ protected void handleShowView(IUser fromUser, final String id) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
@@ -964,7 +965,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
public FileReceiverUI getFileReceiverUI(EclipseFileTransfer transfer, FileTransferParams params) {
return new FileReceiverUI() {
public void receiveStart(ID from, File aFile, long length, float rate) {
- final User user = getUserForID(from);
+ final IUser user = getUserForID(from);
String nick = Messages.EclipseCollabSharedObject_UNKNOWN_USERNAME;
if (user != null) {
nick = user.getNickname();
@@ -976,7 +977,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
public void receiveDone(ID from, File aFile, Exception e) {
- final User user = getUserForID(from);
+ final IUser user = getUserForID(from);
String nick = Messages.EclipseCollabSharedObject_UNKNOWN_USERNAME;
if (user != null) {
nick = user.getNickname();
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/User.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/User.java
deleted file mode 100644
index ec52c9489..000000000
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/User.java
+++ /dev/null
@@ -1,58 +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.example.collab.share;
-
-import java.io.Serializable;
-import java.util.Vector;
-
-import org.eclipse.ecf.core.identity.ID;
-
-public class User implements Serializable {
-
- private static final long serialVersionUID = -9164887171441293342L;
- protected Vector userFields;
- protected ID userID;
- protected String nickname;
-
- public User(ID userID, String username, Vector userFields) {
- this.userID = userID;
- this.nickname = username;
- this.userFields = userFields;
- }
-
- public Vector getUserFields() {
- return userFields;
- }
-
- public ID getUserID() {
- return userID;
- }
-
- public String getNickname() {
- return nickname;
- }
-
- public void setUserFields(Vector uF) {
- this.userFields = uF;
- }
-
- public void setNickname(String name) {
- this.nickname = name;
- }
-
- public String toString() {
- if (nickname != null)
- return nickname;
- else
- return userID.getName();
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties
index 15b46e5c6..595330935 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/messages.properties
@@ -75,13 +75,13 @@ OpenSharedEditorAction_DIALOG_NOT_CONNECTED_TEXT=Project {0} not connected to an
OpenSharedEditorAction_DIALOG_NOT_CONNECTED_TITLE=Project Not Connected to Collaboration Group
SetSharedEditorSelectionAction_DIALOG_NOT_CONNECTED_TEXT=Not connected to any collaboration group. To connect, open Collaboration View
SetSharedEditorSelectionAction_DIALOG_NOT_CONNECTED_TITLE=Not Connected to Collaboration Session
-SharedObjectContainerUI_JAVA_VERSION_LABEL=Java:
-SharedObjectContainerUI_LANGUAGE_LABEL=Language:
-SharedObjectContainerUI_OS_LABEL=OS:
-SharedObjectContainerUI_OSGI_VERSION_LABEL=OSGi Version:
-SharedObjectContainerUI_PROJECT_LABEL=Project:
-SharedObjectContainerUI_TIME_LABEL=Time:
-SharedObjectContainerUI_TIME_ZONE_LABEL=Time Zone:
+SharedObjectContainerUI_JAVA_VERSION_LABEL=Java
+SharedObjectContainerUI_LANGUAGE_LABEL=Language
+SharedObjectContainerUI_OS_LABEL=OS
+SharedObjectContainerUI_OSGI_VERSION_LABEL=OSGi Version
+SharedObjectContainerUI_PROJECT_LABEL=Project
+SharedObjectContainerUI_TIME_LABEL=Time
+SharedObjectContainerUI_TIME_ZONE_LABEL=Time Zone
SharedObjectInputStream_EXCEPTION_NO_DATA=No data
SharedObjectMsg_EXCEPTION_METHOD_NOT_NULL=methodname cannot be null
SharedObjectMsg_EXCEPTION_NOT_SERIALIZABLE=Parameter {0} not Serializable
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java
index 45b61207b..ef2baf0d7 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatComposite.java
@@ -27,7 +27,7 @@ import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
-import org.eclipse.ecf.example.collab.share.User;
+import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.example.collab.share.io.FileTransferParams;
import org.eclipse.ecf.internal.example.collab.ClientPlugin;
import org.eclipse.ecf.ui.screencapture.IImageSender;
@@ -274,7 +274,7 @@ public class ChatComposite extends Composite {
return;
}
- final User user = text.getOriginator();
+ final IUser user = text.getOriginator();
final StyleRange range = new StyleRange();
range.start = textoutput.getText().length();
if (user != null) {
@@ -387,28 +387,28 @@ public class ChatComposite extends Composite {
private void fillTreeContextMenu(IMenuManager manager) {
final IStructuredSelection iss = (IStructuredSelection) tableView.getSelection();
final Object element = iss.getFirstElement();
- if (element == null || !(element instanceof User)) {
+ if (element == null || !(element instanceof IUser)) {
fillContextMenu(manager);
} else {
- fillTreeContextMenuUser(manager, (User) element);
+ fillTreeContextMenuUser(manager, (IUser) element);
}
}
- private void sendImage(final User toUser) {
+ private void sendImage(final IUser toUser) {
if (MessageDialog.openQuestion(null, MessageLoader.getString("ChatComposite.DIALOG_SCREEN_CAPTURE_TITLE"), MessageLoader.getString("ChatComposite.DIALOG_SCREEN_CAPTURE_TEXT"))) { //$NON-NLS-1$ //$NON-NLS-2$
- final Job job = new ScreenCaptureJob(getDisplay(), toUser.getUserID(), toUser.getNickname(), new IImageSender() {
+ final Job job = new ScreenCaptureJob(getDisplay(), toUser.getID(), toUser.getNickname(), new IImageSender() {
public void sendImage(ID targetID, ImageData imageData) {
- view.lch.sendImage(toUser.getUserID(), imageData);
+ view.lch.sendImage(toUser.getID(), imageData);
}
});
job.schedule(5000);
}
}
- private void fillTreeContextMenuUser(IMenuManager man, final User user) {
+ private void fillTreeContextMenuUser(IMenuManager man, final IUser user) {
boolean toUs = false;
if (this.view.userdata != null) {
- if (this.view.userdata.getUserID().equals(user.getUserID())) {
+ if (this.view.userdata.getID().equals(user.getID())) {
// this is us...so we have a special menu
toUs = true;
}
@@ -481,7 +481,7 @@ public class ChatComposite extends Composite {
// This is a menu to us
final Action sendMessageToUser = new Action() {
public void run() {
- MessageDialog.openError(null, MessageLoader.getString("ChatComposite.MESSAGE_TO_TITLE") + user.getNickname(), MessageLoader.getString("ChatComposite.MESSAGE_TO_TEXT") + user.getNickname() + "\n\tID: " + user.getUserID().getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ MessageDialog.openError(null, MessageLoader.getString("ChatComposite.MESSAGE_TO_TITLE") + user.getNickname(), MessageLoader.getString("ChatComposite.MESSAGE_TO_TEXT") + user.getNickname() + "\n\tID: " + user.getID().getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
};
sendMessageToUser.setText(MessageLoader.getString("ChatComposite.MENU_SEND_MESSAGE_TO_YOURSELF_TEXT")); //$NON-NLS-1$
@@ -689,7 +689,7 @@ public class ChatComposite extends Composite {
}
}
- protected void sendShowViewRequest(User touser) {
+ protected void sendShowViewRequest(IUser touser) {
final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final IWorkbenchPage page = ww.getActivePage();
if (page == null)
@@ -843,7 +843,7 @@ public class ChatComposite extends Composite {
section.put(SELECTION_SETTING, selectedIDs);
}
- protected void closeProjectGroup(User user) {
+ protected void closeProjectGroup(IUser user) {
if (MessageDialog.openConfirm(null, MessageLoader.getString("LineChatClientView.contextmenu.closeMessageTitle"), //$NON-NLS-1$
MessageLoader.getFormattedString("LineChatClientView.contextmenu.closeMessageMessage", this.view.name))) { //$NON-NLS-1$
this.view.lch.chatGUIDestroy();
@@ -916,12 +916,12 @@ public class ChatComposite extends Composite {
}
- protected void sendCoBrowseToUser(User user) {
+ protected void sendCoBrowseToUser(IUser user) {
String res = null;
ID userID = null;
if (user != null) {
res = getID(NLS.bind(MessageLoader.getString("ChatComposite.COBROWSE_TITLE"), user.getNickname()), MessageLoader.getString("ChatComposite.COBROWSE_URL_TEXT"), "http://"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- userID = user.getUserID();
+ userID = user.getID();
} else {
res = getID(MessageLoader.getString("ChatComposite.DIALOG_COBROWSE_TITLE"), MessageLoader.getString("ChatComposite.DIALOG_COBROWSE_TEXT"), MessageLoader.getString("ChatComposite.DIALOG_COBROWSE_HTTPPREFIX")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -974,7 +974,7 @@ public class ChatComposite extends Composite {
}
}
- protected void sendFileToUser(User user, boolean launch) {
+ protected void sendFileToUser(IUser user, boolean launch) {
final FileDialog fd = new FileDialog(Display.getDefault().getActiveShell(), SWT.OPEN);
fd.setFilterPath(System.getProperty("user.dir")); //$NON-NLS-1$
fd.setText(NLS.bind(MessageLoader.getString("ChatComposite.SELECt_FILE_TITLE"), user.getNickname())); //$NON-NLS-1$
@@ -982,7 +982,7 @@ public class ChatComposite extends Composite {
if (res != null) {
final java.io.File selected = new java.io.File(res);
final File localTarget = new File(this.view.downloaddir, selected.getName());
- sendFile(selected.getPath(), localTarget.getAbsolutePath(), null, user.getUserID(), launch);
+ sendFile(selected.getPath(), localTarget.getAbsolutePath(), null, user.getID(), launch);
}
}
@@ -994,7 +994,7 @@ public class ChatComposite extends Composite {
}
}
- protected void sendPrivateTextMsg(User data) {
+ protected void sendPrivateTextMsg(IUser data) {
if (this.view.lch != null) {
final String res = getID(MessageLoader.getString("ChatComposite.PRIVATE_MESSAGE_TITLE") + data.getNickname(), MessageLoader.getString("ChatComposite.PRIVATE_MESSAGE_TEXT"), ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (res != null)
@@ -1002,7 +1002,7 @@ public class ChatComposite extends Composite {
}
}
- protected void sendRepObjectToGroup(User user) {
+ protected void sendRepObjectToGroup(IUser user) {
final String result = getID(MessageLoader.getString("ChatComposite.SEND_REPLICATED_OBJECT_TITLE"), MessageLoader.getString("ChatComposite.SEND_REPLICATED_OBJECT_TEXT"), ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (result != null && !result.equals("")) { //$NON-NLS-1$
this.view.createObject(null, getCommand(result), getArgs(result));
@@ -1013,7 +1013,7 @@ public class ChatComposite extends Composite {
// XXX TODO
}
- protected void sendRingMessageToUser(User data) {
+ protected void sendRingMessageToUser(IUser data) {
String res = null;
if (this.view.lch != null) {
if (data != null) {
@@ -1026,14 +1026,14 @@ public class ChatComposite extends Composite {
}
}
- protected void startProgram(User ud) {
+ protected void startProgram(IUser ud) {
String res = null;
ID receiver = null;
if (ud == null) {
res = getID(MessageLoader.getString("ChatComposite.START_PROGRAM_GROUP_TITLE"), MessageLoader.getString("ChatComposite.START_PROGRAM_GROUP_TEXT"), ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
res = getID(MessageLoader.getString("ChatComposite.START_PROGRAM_TITLE") + ud.getNickname(), MessageLoader.getString("ChatComposite.START_PROGRAM_TEXT") + ud.getNickname() + ":", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- receiver = ud.getUserID();
+ receiver = ud.getID();
}
if (res != null)
this.view.runProgram(receiver, res, null);
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatDropTarget.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatDropTarget.java
index a6f7cca69..e55e5e8c9 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatDropTarget.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatDropTarget.java
@@ -14,7 +14,7 @@ package org.eclipse.ecf.internal.example.collab.ui;
import java.io.File;
import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.example.collab.share.User;
+import org.eclipse.ecf.core.user.IUser;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.DropTargetEvent;
@@ -30,7 +30,7 @@ class ChatDropTarget implements DropTargetListener {
TextTransfer textTransfer = null;
FileTransfer fileTransfer = null;
ChatComposite composite = null;
- User selectedUser = null;
+ IUser selectedUser = null;
public ChatDropTarget(LineChatClientView view, Control control,
ChatComposite comp) {
@@ -97,7 +97,7 @@ class ChatDropTarget implements DropTargetListener {
String[] files = (String[]) event.data;
for (int i = 0; i < files.length; i++) {
ID target = (selectedUser == null) ? null : selectedUser
- .getUserID();
+ .getID();
// Send file to user
File file = new File(files[i]);
if (file.exists() && !file.isDirectory() && composite != null) {
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatLine.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatLine.java
index 0e67a6105..ea7e55b5e 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatLine.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/ChatLine.java
@@ -10,13 +10,13 @@
*******************************************************************************/
package org.eclipse.ecf.internal.example.collab.ui;
-import org.eclipse.ecf.example.collab.share.User;
+import org.eclipse.ecf.core.user.IUser;
/**
* @author kgilmer
*/
public class ChatLine {
- private User originator;
+ private IUser originator;
private String text;
private String date;
private boolean isPrivate = false;
@@ -36,15 +36,15 @@ public class ChatLine {
this(text, date, null);
}
- public ChatLine(String text, User user) {
+ public ChatLine(String text, IUser user) {
this(text, null, user);
}
- public ChatLine(String text, String date, User user) {
+ public ChatLine(String text, String date, IUser user) {
this(text, date, user, null);
}
- public ChatLine(String text, User user, Runnable onClick) {
+ public ChatLine(String text, IUser user, Runnable onClick) {
this(text, null, user, onClick);
}
@@ -58,7 +58,7 @@ public class ChatLine {
* @param user
* @param onClick
*/
- public ChatLine(String text, String date, User user, Runnable onClick) {
+ public ChatLine(String text, String date, IUser user, Runnable onClick) {
this.text = text;
this.date = date;
this.originator = user;
@@ -68,7 +68,7 @@ public class ChatLine {
/**
* @return Returns the originator.
*/
- public User getOriginator() {
+ public IUser getOriginator() {
return originator;
}
@@ -76,7 +76,7 @@ public class ChatLine {
* @param originator
* The originator to set.
*/
- public void setOriginator(User originator) {
+ public void setOriginator(IUser originator) {
this.originator = originator;
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/LineChatClientView.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/LineChatClientView.java
index 946ef02d5..6633009c4 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/LineChatClientView.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/LineChatClientView.java
@@ -17,14 +17,16 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
+import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject;
import org.eclipse.ecf.example.collab.share.HelloMessageSharedObject;
import org.eclipse.ecf.example.collab.share.TreeItem;
-import org.eclipse.ecf.example.collab.share.User;
import org.eclipse.ecf.example.collab.share.url.ShowURLSharedObject;
import org.eclipse.ecf.example.collab.share.url.StartProgramSharedObject;
import org.eclipse.ecf.internal.example.collab.ClientPlugin;
@@ -68,7 +70,7 @@ public class LineChatClientView implements FileSenderUI {
Hashtable myNames = new Hashtable();
String name;
private final TeamChat teamChat;
- User userdata;
+ IUser userdata;
LineChatView view;
private final List users;
@@ -116,10 +118,10 @@ public class LineChatClientView implements FileSenderUI {
return teamChat.getTreeControl();
}
- public boolean addUser(User ud) {
+ public boolean addUser(IUser ud) {
if (ud == null)
return false;
- final ID userID = ud.getUserID();
+ final ID userID = ud.getID();
final String username = ud.getNickname();
if (myNames.containsKey(userID)) {
final String existingName = (String) myNames.get(userID);
@@ -136,7 +138,7 @@ public class LineChatClientView implements FileSenderUI {
}
}
- protected void addUserToTree(final User user) {
+ protected void addUserToTree(final IUser user) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
users.add(user);
@@ -155,14 +157,14 @@ public class LineChatClientView implements FileSenderUI {
});
}
- public boolean changeUser(User user) {
+ public boolean changeUser(IUser user) {
return changeUserInTree(user);
}
- protected boolean changeUserInTree(final User userdata) {
+ protected boolean changeUserInTree(final IUser userdata) {
for (int i = 0; i < users.size(); i++) {
- final User user = (User) users.get(i);
- if (user.getUserID().equals(userdata.getUserID())) {
+ final IUser user = (IUser) users.get(i);
+ if (user.getID().equals(userdata.getID())) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (!teamChat.isDisposed()) {
@@ -213,13 +215,13 @@ public class LineChatClientView implements FileSenderUI {
return (String) myNames.get(id);
}
- public User getUser(ID id) {
+ public IUser getUser(ID id) {
if (id == null) {
return null;
} else {
for (int i = 0; i < users.size(); i++) {
- final User user = (User) users.get(i);
- if (id.equals(user.getUserID())) {
+ final IUser user = (IUser) users.get(i);
+ if (id.equals(user.getID())) {
return user;
}
}
@@ -286,8 +288,8 @@ public class LineChatClientView implements FileSenderUI {
return;
} else {
for (int i = 0; i < users.size(); i++) {
- final User user = (User) users.get(i);
- if (user.getUserID().equals(id)) {
+ final IUser user = (IUser) users.get(i);
+ if (user.getID().equals(id)) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (!teamChat.isDisposed())
@@ -337,7 +339,7 @@ public class LineChatClientView implements FileSenderUI {
appendAndScrollToBottom(line);
}
- public void startedTyping(final User user) {
+ public void startedTyping(final IUser user) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (!teamChat.isDisposed())
@@ -355,8 +357,8 @@ public class LineChatClientView implements FileSenderUI {
return false;
} else {
for (int i = 0; i < users.size(); i++) {
- final User user = (User) users.get(i);
- if (user.getUserID().equals(id)) {
+ final IUser user = (IUser) users.get(i);
+ if (user.getID().equals(id)) {
teamChat.getTableViewer().refresh(user);
return true;
}
@@ -377,7 +379,7 @@ public class LineChatClientView implements FileSenderUI {
protected Composite createToolTipContentArea(Event event, Composite parent) {
final Widget item = teamChat.getTableViewer().getTable().getItem(new Point(event.x, event.y));
- final User user = (User) item.getData();
+ final IUser user = (IUser) item.getData();
GridLayout gl = new GridLayout();
gl.marginBottom = 0;
@@ -411,18 +413,19 @@ public class LineChatClientView implements FileSenderUI {
l.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT));
l.setLayoutData(data);
- createContentArea(parent, user.getUserFields()).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ createContentArea(parent, user.getProperties()).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
return parent;
}
- protected Control createContentArea(Composite parent, Vector fields) {
+ protected Control createContentArea(Composite parent, Map properties) {
final Text label = new Text(parent, SWT.READ_ONLY | SWT.MULTI);
label.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
final StringBuffer buffer = new StringBuffer();
synchronized (buffer) {
- for (int i = 0; i < fields.size(); i++) {
- buffer.append(fields.get(i));
+ for (Iterator it = properties.entrySet().iterator(); it.hasNext();) {
+ Entry entry = (Entry) it.next();
+ buffer.append(entry.getKey()).append(": ").append(entry.getValue()); //$NON-NLS-1$
buffer.append(Text.DELIMITER);
}
}
@@ -435,9 +438,9 @@ public class LineChatClientView implements FileSenderUI {
if (super.shouldCreateToolTip(e)) {
final Widget item = teamChat.getTableViewer().getTable().getItem(new Point(e.x, e.y));
if (item != null) {
- final User user = (User) item.getData();
- final Vector fields = user.getUserFields();
- return fields != null && !fields.isEmpty();
+ final IUser user = (IUser) item.getData();
+ final Map properties = user.getProperties();
+ return properties != null && !properties.isEmpty();
} else {
return false;
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/SharedObjectContainerUI.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/SharedObjectContainerUI.java
index aba716515..cd23007b4 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/SharedObjectContainerUI.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/SharedObjectContainerUI.java
@@ -14,7 +14,7 @@ import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
-import java.util.Vector;
+import java.util.Map;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Platform;
@@ -25,9 +25,10 @@ import org.eclipse.ecf.core.events.IContainerEvent;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.sharedobject.ISharedObjectContainer;
+import org.eclipse.ecf.core.user.IUser;
+import org.eclipse.ecf.core.user.User;
import org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject;
import org.eclipse.ecf.example.collab.share.SharedObjectEventListener;
-import org.eclipse.ecf.example.collab.share.User;
import org.eclipse.ecf.internal.example.collab.ClientEntry;
import org.eclipse.ecf.internal.example.collab.CollabClient;
import org.eclipse.ecf.internal.example.collab.Messages;
@@ -55,37 +56,37 @@ public class SharedObjectContainerUI {
return FILE_DIRECTORY;
}
- protected User getUserData(String containerType, ID clientID, String usernick, IResource project) {
- final Vector topElements = new Vector();
- topElements.add(Messages.SharedObjectContainerUI_PROJECT_LABEL + CollabClient.getNameForResource(project));
+ protected IUser getUserData(String containerType, ID clientID, String usernick, IResource project) {
+ final Map topElements = new HashMap();
+ topElements.put(Messages.SharedObjectContainerUI_PROJECT_LABEL, CollabClient.getNameForResource(project));
final SimpleDateFormat sdf = new SimpleDateFormat(JOIN_TIME_FORMAT);
- topElements.add(Messages.SharedObjectContainerUI_TIME_LABEL + sdf.format(new Date()));
+ topElements.put(Messages.SharedObjectContainerUI_TIME_LABEL, sdf.format(new Date()));
try {
- topElements.add(Messages.SharedObjectContainerUI_LANGUAGE_LABEL + System.getProperty("user.language")); //$NON-NLS-1$
+ topElements.put(Messages.SharedObjectContainerUI_LANGUAGE_LABEL, System.getProperty("user.language")); //$NON-NLS-1$
} catch (final Exception e) {
}
try {
- topElements.add(Messages.SharedObjectContainerUI_TIME_ZONE_LABEL + System.getProperty("user.timezone")); //$NON-NLS-1$
+ topElements.put(Messages.SharedObjectContainerUI_TIME_ZONE_LABEL, System.getProperty("user.timezone")); //$NON-NLS-1$
} catch (final Exception e) {
}
try {
- topElements.add(Messages.SharedObjectContainerUI_OS_LABEL + Platform.getOS());
+ topElements.put(Messages.SharedObjectContainerUI_OS_LABEL, Platform.getOS());
} catch (final Exception e) {
}
try {
- topElements.add("Username: " + System.getProperty("user.name"));
+ topElements.put("Username", System.getProperty("user.name"));
} catch (final Exception e) {
}
try {
- topElements.add("Hostname/IP: " + InetAddress.getLocalHost().toString());
+ topElements.put("Hostname/IP", InetAddress.getLocalHost().toString());
} catch (final Exception e) {
}
- return new User(clientID, usernick, topElements);
+ return new User(clientID, clientID.getName(), usernick, topElements);
}
void addObjectToClient(ISharedObjectContainer soContainer, ClientEntry client, String username, IResource proj) throws Exception {
final IResource project = (proj == null) ? CollabClient.getWorkspace() : proj;
- final User user = getUserData(client.getClass().getName(), client.getContainer().getID(), username, proj);
+ final IUser user = getUserData(client.getClass().getName(), client.getContainer().getID(), username, proj);
createAndAddSharedObject(soContainer, client, project, user, getSharedFileDirectoryForProject(project));
}
@@ -106,7 +107,7 @@ public class SharedObjectContainerUI {
});
}
- protected void createAndAddSharedObject(final ISharedObjectContainer soContainer, final ClientEntry client, final IResource proj, User user, String fileDir) throws Exception {
+ protected void createAndAddSharedObject(final ISharedObjectContainer soContainer, final ClientEntry client, final IResource proj, IUser user, String fileDir) throws Exception {
final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final EclipseCollabSharedObject sharedObject = new EclipseCollabSharedObject(proj, ww, user, fileDir);
sharedObject.setListener(new SharedObjectEventListener() {
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TeamChat.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TeamChat.java
index 9f18e702e..97dc31c7c 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TeamChat.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TeamChat.java
@@ -13,7 +13,7 @@ package org.eclipse.ecf.internal.example.collab.ui;
import java.util.List;
-import org.eclipse.ecf.example.collab.share.User;
+import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.internal.example.collab.ClientPlugin;
import org.eclipse.ecf.ui.SharedImages;
import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -137,8 +137,12 @@ class TeamChat extends Composite {
}
private class ViewLabelProvider extends LabelProvider {
+ public String getText(Object obj) {
+ return obj instanceof IUser ? ((IUser) obj).getNickname() : super.getText(obj);
+ }
+
public Image getImage(Object obj) {
- return obj instanceof User ? SharedImages
+ return obj instanceof IUser ? SharedImages
.getImage(SharedImages.IMG_USER_AVAILABLE) : null;
}
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TreeDropTarget.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TreeDropTarget.java
index 0b9abcd43..913e31682 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TreeDropTarget.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/ui/TreeDropTarget.java
@@ -11,7 +11,7 @@
package org.eclipse.ecf.internal.example.collab.ui;
-import org.eclipse.ecf.example.collab.share.User;
+import org.eclipse.ecf.core.user.IUser;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.widgets.Control;
@@ -45,8 +45,8 @@ class TreeDropTarget extends ChatDropTarget {
event.detail = DND.DROP_NONE;
return;
} else {
- if (item instanceof User) {
- selectedUser = (User) item;
+ if (item instanceof IUser) {
+ selectedUser = (IUser) item;
} else {
event.detail = DND.DROP_NONE;
return;
@@ -76,8 +76,8 @@ class TreeDropTarget extends ChatDropTarget {
if (item == null) {
event.detail = DND.DROP_NONE;
} else {
- if (item instanceof User) {
- selectedUser = (User) item;
+ if (item instanceof IUser) {
+ selectedUser = (IUser) item;
} else {
event.detail = DND.DROP_NONE;
}

Back to the top