Fixes for bugs 194237 nd 194238
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java
index 5e77163..5ce06f8 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java
@@ -128,6 +128,10 @@
public static String ChatRoomView_VIEW_NAME_PREFIX;
+ public static String MultiRosterView_CHANGE_PASSWORD_EXCEPTION;
+
+ public static String MultiRosterView_CHANGE_PASSWORD_MENU;
+
public static String MultiRosterView_DISCONNECT_ACCOUNT_ACTION_TEXT;
public static String MultiRosterView_DISCONNECT_ACCOUNT_QUESTION_MESSAGE;
@@ -142,6 +146,10 @@
public static String MultiRosterView_ENTER_CHATROOM_TOOLTIP_TEXT;
+ public static String MultiRosterView_ERROR_CONTACT_REMOVE_TITLE;
+
+ public static String MultiRosterView_ERROR_CONTACT_REMOVED_MESSAGE;
+
public static String MultiRosterView_EXCEPTION_JOIN_ROOM_INVALID_ACCOUNT;
public static String MultiRosterView_EXCEPTION_JOIN_ROOM_NOT_CONNECTED;
@@ -156,6 +164,16 @@
public static String MultiRosterView_NO_IDENTIFIER_FOR_ROOM_TITLE;
+ public static String MultiRosterView_PASSWORD_CHANGE_ERROR;
+
+ public static String MultiRosterView_PASSWORD_CHANGED_DIALOG_TITLE;
+
+ public static String MultiRosterView_PASSWORD_CHANGED_MESSAGE;
+
+ public static String MultiRosterView_PASSWORD_NOT_CHANGED_MESSAGE;
+
+ public static String MultiRosterView_PASSWORD_NOT_CHANGED_TITLE;
+
public static String MultiRosterView_ROSTER_VIEW_EXT_POINT_ERROR_MESSAGE;
public static String MultiRosterView_SendIM;
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/AddContactDialog.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/AddContactDialog.java
index e052830..aff2770 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/AddContactDialog.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/AddContactDialog.java
@@ -103,7 +103,6 @@
.setText(Messages.AddContactDialog_Alias);
aliasText = new Text(parent, SWT.SINGLE);
aliasText.setLayoutData(data);
-
new Label(parent, SWT.BEGINNING)
.setText(Messages.AddContactDialog_Account);
accountsViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.BORDER);
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ChangePasswordDialog.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ChangePasswordDialog.java
index e242a6d..a717cde 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ChangePasswordDialog.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ChangePasswordDialog.java
@@ -29,9 +29,9 @@
public class ChangePasswordDialog extends Dialog {
- private Text p1;
+ private Text password1;
- private Text p2;
+ private Text password2;
private int result = Window.CANCEL;
@@ -39,10 +39,13 @@
private String pass2 = Messages.ChangePasswordDialog_1;
- Button okButton = null;
+ private Button okButton;
+
+ private String accountName;
- public ChangePasswordDialog(Shell parentShell) {
+ public ChangePasswordDialog(Shell parentShell, String accountName) {
super(parentShell);
+ this.accountName = accountName;
}
protected Control createDialogArea(Composite parent) {
@@ -56,20 +59,24 @@
gridLayout_2.numColumns = 2;
composite.setLayout(gridLayout_2);
+ Label l = new Label(composite, SWT.NONE);
+ l.setText(accountName);
+ new Label(composite,SWT.NONE);
+
final Label label_3 = new Label(composite, SWT.NONE);
label_3.setText(Messages.ChangePasswordDialog_NEW_PASSWORD_LABEL);
- p1 = new Text(composite, SWT.BORDER);
- p1.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- p1.setEchoChar('*');
+ password1 = new Text(composite, SWT.BORDER);
+ password1.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ password1.setEchoChar('*');
final Label label_2 = new Label(composite, SWT.NONE);
label_2.setText(Messages.ChangePasswordDialog_REENTER_PASSWORD_LABEL);
- p2 = new Text(composite, SWT.BORDER);
+ password2 = new Text(composite, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.FILL_HORIZONTAL);
gridData_1.widthHint = 192;
- p2.setLayoutData(gridData_1);
- p2.setEchoChar('*');
+ password2.setLayoutData(gridData_1);
+ password2.setEchoChar('*');
//
return container;
}
@@ -94,15 +101,15 @@
public void buttonPressed(int button) {
result = button;
if (button == Window.OK) {
- pass1 = p1.getText();
- pass2 = p2.getText();
+ pass1 = password1.getText();
+ pass2 = password2.getText();
if (!pass1.equals(pass2)) {
// message box that passwords do not match
MessageDialog.openError(getShell(), Messages.ChangePasswordDialog_PASSWORDS_NO_MATCH_TITLE,
Messages.ChangePasswordDialog_PASSWORDS_NO_MATCH_MESSAGE);
- p1.setText(""); //$NON-NLS-1$
- p2.setText(""); //$NON-NLS-1$
- p1.setFocus();
+ password1.setText(""); //$NON-NLS-1$
+ password2.setText(""); //$NON-NLS-1$
+ password1.setFocus();
return;
}
}
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ReceiveAuthorizeRequestDialog.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ReceiveAuthorizeRequestDialog.java
index 640ad32..3905d7b 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ReceiveAuthorizeRequestDialog.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/dialogs/ReceiveAuthorizeRequestDialog.java
@@ -35,8 +35,6 @@
public static final int REFUSE_ID = IDialogConstants.CLIENT_ID + 3;
- public static final int AUTHORIZE_AND_ADD = IDialogConstants.CLIENT_ID + 2;
-
public static final int AUTHORIZE_ID = IDialogConstants.CLIENT_ID + 1;
int buttonPressed = 0;
@@ -108,9 +106,6 @@
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, AUTHORIZE_AND_ADD, Messages.ReceiveAuthorizeRequestDialog_BUTTON_AUTHORIZE_AND_ADD,
- false);
-
createButton(parent, AUTHORIZE_ID, Messages.ReceiveAuthorizeRequestDialog_BUTTON_AUTHORIZE_ONLY, false);
createButton(parent, REFUSE_ID, Messages.ReceiveAuthorizeRequestDialog_BUTTON_REFUSE, true);
@@ -130,7 +125,6 @@
}
protected void buttonPressed(int button) {
- // System.out.println("button "+button+" pressed");
buttonPressed = button;
this.close();
}
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties
index 74f6ea1..c0900f3 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties
@@ -24,12 +24,19 @@
MultiRosterView_ShowOffline = Show &Offline Contacts
MultiRosterView_ShowEmptyGroups = Show &Empty Groups
MultiRosterView_NO_IDENTIFIER_FOR_ROOM_TITLE=Could not create identifier for room
+MultiRosterView_PASSWORD_NOT_CHANGED_MESSAGE=Error changing password
MultiRosterView_NICKNAME_MESSAGE=Nickname for {0}
MultiRosterView_EXCEPTION_USER_CANCELLED=User cancelled
+MultiRosterView_PASSWORD_CHANGED_MESSAGE=Password changed
+MultiRosterView_PASSWORD_CHANGE_ERROR=Error changing password. See Error Log for details.
MultiRosterView_EXCEPTION_JOIN_ROOM_NOT_CONNECTED=Container for account is not connected
MultiRosterView_EXCEPTION_LOG_JOIN_ROOM=joinRoom exception
+MultiRosterView_CHANGE_PASSWORD_MENU=Change Password...
MultiRosterView_ENTER_CHATROOM_ACTION_TEXT=Enter Chatroom
+MultiRosterView_ERROR_CONTACT_REMOVE_TITLE=Contact Remove Error
+MultiRosterView_PASSWORD_NOT_CHANGED_TITLE=Password not changed
MultiRosterView_DISCONNECT_QUESTION_TITLE=Disconnect
+MultiRosterView_CHANGE_PASSWORD_EXCEPTION=changePassword
MultiRosterView_ENTER_CHATROOM_TOOLTIP_TEXT=Show chat rooms for all accounts
MultiRosterView_AddContact = &Add Contact
@@ -65,8 +72,10 @@
ChangePasswordDialog_PASSWORDS_NO_MATCH_TITLE=Passwords do not match
ChangePasswordDialog_PASSWORDS_NO_MATCH_MESSAGE=Passwords do not match. Please try again
ChatRoomManagerUI_EXCEPTION_CHAT_ROOM_VIEW_INITIALIZATION=Exception in chat room view initialization for
-MultiRosterView_NO_IDENTIFIER_FOR_ROOM_MESSAGE=Could not create proper identifier for chat room {0}
+MultiRosterView_NO_IDENTIFIER_FOR_ROOM_MESSAGE=Could not create identifier for chat room {0}
MultiRosterView_DISCONNECT_ACCOUNT_ACTION_TEXT=Disconnect
+MultiRosterView_PASSWORD_CHANGED_DIALOG_TITLE=Password Changed
+MultiRosterView_ERROR_CONTACT_REMOVED_MESSAGE=Contact {0} could not be removed. Server may have refused removal.\n\nSee Error Log for details.
MultiRosterView_SHOW_CHAT_ROOMS_FOR_ACCOUNT_ACTION_TEXT=Show chat rooms
MultiRosterView_DISCONNECT_ALL_ACCOUNTS_QUESTION_MESSAGE=Disconnect all accounts?
MultiRosterView_DISCONNECT_ALL_ACCOUNTS_ACTION_TEXT=Disconnect all accounts
@@ -118,8 +127,8 @@
ChangePasswordDialog_1=
ReceiveAuthorizeRequestDialog_WOULD_LIKE_TO_ADD=\ would like to add
ReceiveAuthorizeRequestDialog_TO_BUDDY_LIST=\ to their buddy list
-ReceiveAuthorizeRequestDialog_MESSAGE=You may choose to authorize and add them to your own buddy list, authorize without adding them to your buddy list, or refuse to authorize
+ReceiveAuthorizeRequestDialog_MESSAGE=You may choose to authorize, or refuse to authorize
ReceiveAuthorizeRequestDialog_BUTTON_AUTHORIZE_AND_ADD=Authorize and Add Buddy
-ReceiveAuthorizeRequestDialog_BUTTON_AUTHORIZE_ONLY=Authorize Only
-ReceiveAuthorizeRequestDialog_BUTTON_REFUSE=Refuse
+ReceiveAuthorizeRequestDialog_BUTTON_AUTHORIZE_ONLY=Authorize
+ReceiveAuthorizeRequestDialog_BUTTON_REFUSE=Refuse to Authorize
ReceiveAuthorizeRequestDialog_AUTH_REQUEST_FROM=Authorization request from
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterAccount.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterAccount.java
index 45822fb..4b223c3 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterAccount.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterAccount.java
@@ -16,13 +16,21 @@
import org.eclipse.ecf.core.IContainerListener;
import org.eclipse.ecf.core.events.IContainerDisconnectedEvent;
import org.eclipse.ecf.core.events.IContainerEvent;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.internal.presence.ui.Activator;
+import org.eclipse.ecf.internal.presence.ui.dialogs.ReceiveAuthorizeRequestDialog;
+import org.eclipse.ecf.presence.IPresence;
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
+import org.eclipse.ecf.presence.Presence;
import org.eclipse.ecf.presence.roster.IRoster;
import org.eclipse.ecf.presence.roster.IRosterEntry;
import org.eclipse.ecf.presence.roster.IRosterItem;
import org.eclipse.ecf.presence.roster.IRosterManager;
import org.eclipse.ecf.presence.roster.IRosterListener;
+import org.eclipse.ecf.presence.roster.IRosterSubscriptionListener;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
/**
* A roster account appropriate for usage by a MultiRosterView. This class
@@ -80,6 +88,54 @@
}
};
+ IRosterSubscriptionListener subscriptionListener = new IRosterSubscriptionListener() {
+
+ public void handleSubscribeRequest(final ID fromID) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ Shell shell = MultiRosterAccount.this.multiRosterView
+ .getViewSite().getShell();
+ ReceiveAuthorizeRequestDialog authRequest = new ReceiveAuthorizeRequestDialog(
+ shell, fromID.getName(),
+ MultiRosterAccount.this.getRoster().getUser()
+ .getID().getName());
+ authRequest.setBlockOnOpen(true);
+ authRequest.open();
+ int res = authRequest.getButtonPressed();
+ if (res == ReceiveAuthorizeRequestDialog.AUTHORIZE_ID) {
+ MultiRosterAccount.this.getRosterManager()
+ .getPresenceSender().sendPresenceUpdate(
+ fromID,
+ new Presence(
+ IPresence.Type.SUBSCRIBED));
+ } else if (res == ReceiveAuthorizeRequestDialog.REFUSE_ID) {
+ // do nothing
+ } else {
+ // do nothing
+ }
+ } catch (ECFException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ });
+
+ }
+
+ public void handleSubscribed(ID fromID) {
+ }
+
+ public void handleUnsubscribed(final ID fromID) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ MultiRosterAccount.this.multiRosterView
+ .removeEntryFromTreeViewer(fromID);
+ }
+ });
+ }
+
+ };
+
public MultiRosterAccount(MultiRosterView multiRosterView,
IContainer container, IPresenceContainerAdapter adapter) {
this.multiRosterView = multiRosterView;
@@ -89,6 +145,7 @@
this.adapter = adapter;
this.container.addListener(containerListener);
getRosterManager().addRosterListener(updateListener);
+ getRosterManager().addRosterSubscriptionListener(subscriptionListener);
}
public IContainer getContainer() {
@@ -108,6 +165,8 @@
}
public void dispose() {
+ getRosterManager().removeRosterSubscriptionListener(
+ subscriptionListener);
getRosterManager().removeRosterListener(updateListener);
container.removeListener(containerListener);
}
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java
index dfeea6c..96b8b19 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java
@@ -30,7 +30,9 @@
import org.eclipse.ecf.internal.presence.ui.Activator;
import org.eclipse.ecf.internal.presence.ui.Messages;
import org.eclipse.ecf.internal.presence.ui.dialogs.AddContactDialog;
+import org.eclipse.ecf.internal.presence.ui.dialogs.ChangePasswordDialog;
import org.eclipse.ecf.internal.presence.ui.dialogs.ChatRoomSelectionDialog;
+import org.eclipse.ecf.presence.IAccountManager;
import org.eclipse.ecf.presence.IPresence;
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
import org.eclipse.ecf.presence.IPresenceListener;
@@ -44,7 +46,6 @@
import org.eclipse.ecf.presence.roster.IRosterGroup;
import org.eclipse.ecf.presence.roster.IRosterItem;
import org.eclipse.ecf.presence.roster.IRosterManager;
-import org.eclipse.ecf.presence.roster.IRosterSubscriptionListener;
import org.eclipse.ecf.presence.roster.IRosterSubscriptionSender;
import org.eclipse.ecf.presence.service.IPresenceService;
import org.eclipse.ecf.presence.ui.chatroom.ChatRoomManagerView;
@@ -152,22 +153,24 @@
private IAction setInvisibleAction;
private IAction setOfflineAction;
-
+
private IAction showOfflineAction;
-
+
private IAction showEmptyGroupsAction;
-
+
private IAction addContactAction;
private IAction openChatRoomAction;
private IAction openAccountChatRoomAction;
+ private IAction changePasswordAction;
+
private IAction disconnectAllAccountsAction;
private IAction disconnectAccountAction;
- private IRosterSubscriptionListener subscriptionListener;
+ //private IRosterSubscriptionListener subscriptionListener;
private IPresenceListener presenceListener;
@@ -234,7 +237,6 @@
treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.SINGLE
| SWT.V_SCROLL);
getSite().setSelectionProvider(treeViewer);
- subscriptionListener = new RosterSubscriptionListener();
presenceListener = new PresenceListener();
treeViewer.setContentProvider(new MultiRosterContentProvider());
treeViewer.setLabelProvider(new MultiRosterLabelProvider());
@@ -569,9 +571,6 @@
for (int i = 0; i < rosterAccounts.size(); i++) {
MultiRosterAccount account = (MultiRosterAccount) rosterAccounts
.get(i);
- account.getRosterManager()
- .removeRosterSubscriptionListener(
- subscriptionListener);
treeViewer.remove(account);
}
rosterAccounts.clear();
@@ -594,7 +593,7 @@
}
}
};
-
+
showEmptyGroupsAction = new Action(
Messages.MultiRosterView_ShowEmptyGroups, Action.AS_CHECK_BOX) {
public void run() {
@@ -605,7 +604,7 @@
}
}
};
-
+
addContactAction = new Action(Messages.MultiRosterView_AddContact,
SharedImages.getImageDescriptor(SharedImages.IMG_ADD_BUDDY)) {
public void run() {
@@ -620,12 +619,12 @@
sender.sendRosterAdd(dialog.getAccountID(), dialog
.getAlias(), null);
} catch (ECFException e) {
- e.printStackTrace();
+ Activator.getDefault().getLog().log(e.getStatus());
}
}
}
};
-
+
openChatRoomAction = new Action() {
public void run() {
selectAndJoinChatRoomForAccounts((MultiRosterAccount[]) rosterAccounts
@@ -657,6 +656,22 @@
openAccountChatRoomAction.setImageDescriptor(SharedImages
.getImageDescriptor(SharedImages.IMG_ADD_CHAT));
+ changePasswordAction = new Action() {
+ public void run() {
+ IStructuredSelection iss = (IStructuredSelection) treeViewer
+ .getSelection();
+ IRoster roster = (IRoster) iss.getFirstElement();
+ MultiRosterAccount account = findAccountForUser(roster
+ .getUser().getID());
+ if (account != null)
+ changePasswordForAccount(account);
+ }
+ };
+
+ changePasswordAction
+ .setText(Messages.MultiRosterView_CHANGE_PASSWORD_MENU);
+ changePasswordAction.setEnabled(true);
+
disconnectAllAccountsAction = new Action() {
public void run() {
if (MessageDialog
@@ -706,6 +721,39 @@
}
+ protected void changePasswordForAccount(MultiRosterAccount account) {
+ ChangePasswordDialog cpd = new ChangePasswordDialog(getViewSite()
+ .getShell(), account.getRoster().getUser().getID().getName());
+ cpd.open();
+ if (cpd.getResult() == Window.OK) {
+ IPresenceContainerAdapter pc = account
+ .getPresenceContainerAdapter();
+ IAccountManager am = pc.getAccountManager();
+ try {
+ if (am.changePassword(cpd.getNewPassword()))
+ MessageDialog
+ .openInformation(
+ getViewSite().getShell(),
+ Messages.MultiRosterView_PASSWORD_CHANGED_DIALOG_TITLE,
+ Messages.MultiRosterView_PASSWORD_CHANGED_MESSAGE);
+ else
+ MessageDialog
+ .openInformation(
+ getViewSite().getShell(),
+ Messages.MultiRosterView_PASSWORD_NOT_CHANGED_TITLE,
+ Messages.MultiRosterView_PASSWORD_NOT_CHANGED_MESSAGE);
+ } catch (ECFException e) {
+ MessageDialog.openError(getViewSite().getShell(),
+ Messages.MultiRosterView_PASSWORD_NOT_CHANGED_TITLE,
+ Messages.MultiRosterView_PASSWORD_CHANGE_ERROR);
+ Activator
+ .getDefault()
+ .getLog()
+ .log(e.getStatus());
+ }
+ }
+ }
+
protected void disconnectAccounts(MultiRosterAccount[] accounts) {
for (int i = 0; i < accounts.length; i++)
accounts[i].getContainer().disconnect();
@@ -731,7 +779,7 @@
mode));
}
} catch (ECFException e) {
- e.printStackTrace();
+ Activator.getDefault().getLog().log(e.getStatus());
}
}
@@ -762,7 +810,12 @@
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(removeAction);
} else if (element instanceof IRoster) {
+ manager.add(changePasswordAction);
+ manager.add(new Separator());
+ manager.add(addContactAction);
+ manager.add(new Separator());
manager.add(openAccountChatRoomAction);
+ manager.add(new Separator());
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(disconnectAccountAction);
} else {
@@ -808,7 +861,11 @@
entry.getUser().getID());
}
} catch (ECFException e) {
- e.printStackTrace();
+ MessageDialog.openError(getViewSite().getShell(),
+ Messages.MultiRosterView_ERROR_CONTACT_REMOVE_TITLE, NLS.bind(
+ Messages.MultiRosterView_ERROR_CONTACT_REMOVED_MESSAGE, entry.getUser()
+ .getID().getName()));
+ Activator.getDefault().getLog().log(e.getStatus()); //$NON-NLS-1$
}
}
@@ -853,7 +910,7 @@
openChatRoomAction.setEnabled(enabled);
disconnectAllAccountsAction.setEnabled(enabled);
}
-
+
private void fillLocalPullDown(IMenuManager manager) {
setStatusMenu = new MenuManager(Messages.MultiRosterView_SetStatusAs,
null);
@@ -866,7 +923,7 @@
manager.add(new Separator());
manager.add(showOfflineAction);
-
+
manager.add(showEmptyGroupsAction);
manager.add(new Separator());
@@ -891,11 +948,6 @@
treeViewer = null;
for (Iterator i = rosterAccounts.iterator(); i.hasNext();) {
MultiRosterAccount account = (MultiRosterAccount) i.next();
- account.getRosterManager().removeRosterSubscriptionListener(
- subscriptionListener);
- }
- for (Iterator i = rosterAccounts.iterator(); i.hasNext();) {
- MultiRosterAccount account = (MultiRosterAccount) i.next();
account.getRosterManager().removePresenceListener(presenceListener);
}
rosterAccounts.clear();
@@ -904,7 +956,8 @@
protected boolean addRosterAccount(MultiRosterAccount account) {
boolean result = account != null && rosterAccounts.add(account);
- if (result) setLocalPullDownEnabled(true);
+ if (result)
+ setLocalPullDownEnabled(true);
return result;
}
@@ -917,9 +970,6 @@
}
protected void removeRosterAccount(MultiRosterAccount account) {
- // Remove subscription listener
- account.getRosterManager().removeRosterSubscriptionListener(
- subscriptionListener);
// Remove presence listener
account.getRosterManager().removePresenceListener(presenceListener);
@@ -970,6 +1020,17 @@
treeViewer.remove(entry);
}
+ protected void removeEntryFromTreeViewer(ID entryID) {
+ synchronized (rosterAccounts) {
+ for (Iterator i = rosterAccounts.iterator(); i.hasNext();) {
+ MultiRosterAccount account = (MultiRosterAccount) i.next();
+ final IRosterEntry entry = find(account.getRoster()
+ .getItems(), entryID);
+ if (entry != null) treeViewer.remove(entry);
+ }
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -1007,10 +1068,8 @@
new Presence(null, null, IPresence.Mode.INVISIBLE));
}
} catch (ECFException e) {
- e.printStackTrace();
+ Activator.getDefault().getLog().log(e.getStatus());
}
- containerAdapter.getRosterManager().addRosterSubscriptionListener(
- subscriptionListener);
containerAdapter.getRosterManager().addPresenceListener(
presenceListener);
setStatusMenu.setVisible(true);
@@ -1020,35 +1079,6 @@
}
}
- private class RosterSubscriptionListener implements
- IRosterSubscriptionListener {
-
- public void handleSubscribeRequest(ID fromID) {
- }
-
- public void handleSubscribed(ID fromID) {
- }
-
- public void handleUnsubscribed(ID fromID) {
- synchronized (rosterAccounts) {
- for (Iterator i = rosterAccounts.iterator(); i.hasNext();) {
- MultiRosterAccount account = (MultiRosterAccount) i.next();
- final IRosterEntry entry = find(account.getRoster()
- .getItems(), fromID);
- if (entry != null) {
- treeViewer.getControl().getDisplay().asyncExec(
- new Runnable() {
- public void run() {
- treeViewer.remove(entry);
- }
- });
- }
- }
- }
- }
-
- }
-
private class PresenceListener implements IPresenceListener {
/*