From 483fd349d83c5d302c71e332f8d65741bfc754f0 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Mon, 6 Nov 2006 10:14:13 +0000 Subject: [PATCH] escapable remove dialog --- .../contactlist/ContactRightButtonMenu.java | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java index daf9aed3f..e991de8eb 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java @@ -357,57 +357,14 @@ else if (itemName.startsWith(moveToPrefix)) { } } else if (itemName.startsWith(removeContactPrefix)) { - Contact contact = getContactFromMetaContact( itemName.substring(removeContactPrefix.length())); if(contact != null) { - if(Constants.REMOVE_CONTACT_ASK) { - String message = "Are you sure you want to remove " - + contact.getDisplayName() - + "
from your contact list?"; - - MessageDialog dialog = new MessageDialog(this.mainFrame, - message, Messages.getString("remove")); - - int returnCode = dialog.showDialog(); - - if (returnCode == MessageDialog.OK_RETURN_CODE) { - new RemoveContactThread(contact).start(); - } - else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { - new RemoveContactThread(contact).start(); - - Constants.REMOVE_CONTACT_ASK = false; - } - } - else { - new RemoveContactThread(contact).start(); - } + new RemoveContactThread(contact).start(); } else { - if(Constants.REMOVE_CONTACT_ASK) { - String message = "Are you sure you want to remove " - + Messages.getString("allContacts") - + "
from your contact list?"; - - MessageDialog dialog = new MessageDialog(this.mainFrame, - message, Messages.getString("remove")); - - int returnCode = dialog.showDialog(); - - if (returnCode == MessageDialog.OK_RETURN_CODE) { - new RemoveAllContactsThread().start(); - } - else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { - new RemoveAllContactsThread().start(); - - Constants.REMOVE_CONTACT_ASK = false; - } - } - else { - new RemoveAllContactsThread().start(); - } + new RemoveAllContactsThread().start(); } } else if(itemName.startsWith(moveSubcontactPrefix)) { @@ -418,7 +375,7 @@ else if(itemName.startsWith(moveSubcontactPrefix)) { guiContactList.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); - this.moveDialog = new MoveSubcontactMessageDialog(mainFrame); + this.moveDialog = new MoveSubcontactMessageDialog(mainFrame, this); this.moveDialog.setVisible(true); @@ -466,7 +423,28 @@ public RemoveContactThread(Contact contact) { this.contact = contact; } public void run() { - mainFrame.getContactList().removeContact(contact); + if(Constants.REMOVE_CONTACT_ASK) { + String message = "Are you sure you want to remove " + + contact.getDisplayName() + + "
from your contact list?"; + + MessageDialog dialog = new MessageDialog(mainFrame, + message, Messages.getString("remove")); + + int returnCode = dialog.showDialog(); + + if (returnCode == MessageDialog.OK_RETURN_CODE) { + mainFrame.getContactList().removeContact(contact); + } + else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { + mainFrame.getContactList().removeContact(contact); + + Constants.REMOVE_CONTACT_ASK = false; + } + } + else { + mainFrame.getContactList().removeContact(contact); + } } } @@ -476,7 +454,29 @@ public void run() { private class RemoveAllContactsThread extends Thread { public void run() { - mainFrame.getContactList().removeMetaContact(contactItem); + if(Constants.REMOVE_CONTACT_ASK) { + String message + = "Are you sure you want to remove " + + Messages.getString("allContacts") + + "
from your contact list?"; + + MessageDialog dialog = new MessageDialog(mainFrame, + message, Messages.getString("remove")); + + int returnCode = dialog.showDialog(); + + if (returnCode == MessageDialog.OK_RETURN_CODE) { + mainFrame.getContactList().removeMetaContact(contactItem); + } + else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { + mainFrame.getContactList().removeMetaContact(contactItem); + + Constants.REMOVE_CONTACT_ASK = false; + } + } + else { + mainFrame.getContactList().removeMetaContact(contactItem); + } } }