diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java index 83969cf39..158f3b3d1 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java @@ -212,14 +212,18 @@ public void loadSkin() public void setItem(Object item) { - if(filtering) - return; - - setting = true; - String newText = (item == null) ? "" : item.toString(); - - text.setText(newText); - setting = false; + if (!filtering) + { + setting = true; + try + { + text.setText((item == null) ? "" : item.toString()); + } + finally + { + setting = false; + } + } } public Object getItem() diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatOperationReasonDialog.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatOperationReasonDialog.java index 6cb22db19..b8f518ea6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatOperationReasonDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatOperationReasonDialog.java @@ -15,6 +15,7 @@ import net.java.sip.communicator.impl.gui.customcontrols.*; /** + * * @author Yana Stamcheva * @author Valentin Martinet */ @@ -22,15 +23,10 @@ public class ChatOperationReasonDialog extends MessageDialog { private static final long serialVersionUID = 3290030744711759011L; - private final JLabel reasonLabel = new JLabel( - GuiActivator.getResources() - .getI18NString("service.gui.REASON") + ":"); - - - private JPanel reasonFieldPanel = new JPanel(new BorderLayout()); - private final JTextField reasonField = new JTextField(); + private final JPanel reasonFieldPanel = new JPanel(new BorderLayout()); + /** * Creates an instance of ChatOperationReasonDialog using the * default title and message. @@ -104,7 +100,6 @@ public ChatOperationReasonDialog(String title, String message, GuiActivator.getResources().getI18NString("service.gui.OK"), showReasonLabel, disableOKIfReasonIsEmpty); - } /** @@ -130,6 +125,7 @@ public ChatOperationReasonDialog(Frame chatWindow, String title, /** * Creates an instance of ChatOperationReasonDialog by specifying * the parent window, the title and the message to show. + * * @param chatWindow the parent window * @param title the title of this dialog * @param message the message shown in this dialog @@ -145,17 +141,17 @@ public ChatOperationReasonDialog(Frame chatWindow, String title, super(chatWindow, title, message, okButtonName, false); JPanel reasonPanel = new JPanel(new BorderLayout()); - - if(showReasonLabel) - { - reasonPanel.add(reasonLabel, BorderLayout.WEST); - } - else - reasonPanel.add(new JLabel(""), BorderLayout.WEST); - + JLabel reasonLabel + = new JLabel( + showReasonLabel + ? (GuiActivator.getResources().getI18NString( + "service.gui.REASON") + + ":") + : ""); + + reasonPanel.add(reasonLabel, BorderLayout.WEST); reasonPanel.add(new JLabel(" "), BorderLayout.EAST); - reasonFieldPanel.add(reasonField, BorderLayout.NORTH); reasonFieldPanel.setOpaque(false); reasonPanel.add(reasonFieldPanel, BorderLayout.CENTER); @@ -167,29 +163,24 @@ public ChatOperationReasonDialog(Frame chatWindow, String title, if(disableOKIfReasonIsEmpty) { updateOKButtonState(); - this.reasonField.getDocument().addDocumentListener(new DocumentListener() - { - - @Override - public void removeUpdate(DocumentEvent arg0) - { - updateOKButtonState(); - } - - @Override - public void insertUpdate(DocumentEvent arg0) - { - updateOKButtonState(); - } - - @Override - public void changedUpdate(DocumentEvent arg0) - { - updateOKButtonState(); - } - - - }); + reasonField.getDocument().addDocumentListener( + new DocumentListener() + { + public void removeUpdate(DocumentEvent ev) + { + updateOKButtonState(); + } + + public void insertUpdate(DocumentEvent ev) + { + updateOKButtonState(); + } + + public void changedUpdate(DocumentEvent ev) + { + updateOKButtonState(); + } + }); } this.pack(); } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java index c24136551..cd975babb 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java @@ -5,6 +5,7 @@ */ package net.java.sip.communicator.impl.protocol.jabber; +import java.beans.*; import java.util.*; import java.util.regex.*; @@ -246,11 +247,11 @@ public void unregisterHandlerService() } /** - * Returns the protocol that this handler is responsible for or "xmpp" in - * other words. + * Returns the protocol that this handler is responsible for or + * "xmpp" in other words. * - * @return the "xmpp" string to indicate that this handler is responsible for - * handling "xmpp" uris. + * @return the "xmpp" string to indicate that this handler is + * responsible for handling "xmpp" uris. */ public String getProtocol() { @@ -327,11 +328,12 @@ public void handleUri(String uri) if(contact == null) { Object result = - JabberActivator.getUIService().getPopupDialog(). - showConfirmPopupDialog( - "Do you want to add the contact : " + contactId + " ?", - "Add contact", - PopupDialog.YES_NO_OPTION); + JabberActivator.getUIService().getPopupDialog() + .showConfirmPopupDialog( + "Do you want to add the contact : " + + contactId + " ?", + "Add contact", + PopupDialog.YES_NO_OPTION); if(result.equals(PopupDialog.YES_OPTION)) { @@ -373,7 +375,8 @@ public void handleUri(String uri) { // if we are not online we get this error // will wait for it and then will try to handle once again - if(exc.getErrorCode() == OperationFailedException.NETWORK_FAILURE + if((exc.getErrorCode() + == OperationFailedException.NETWORK_FAILURE) && !networkFailReceived) { networkFailReceived = true; @@ -388,7 +391,9 @@ public void handleUri(String uri) } catch (OperationNotSupportedException exc) { - showErrorMessage("Join to " + croom + ", not supported!", exc); + showErrorMessage( + "Join to " + croom + ", not supported!", + exc); } } else @@ -511,7 +516,7 @@ public ProtocolRegistrationThread(String uri, /** * Starts the registration process, ads this class as a registration - * listener and then tries to rehandle the uri this thread was initiaded + * listener and then tries to rehandle the uri this thread was initiated * with. */ @Override @@ -622,12 +627,15 @@ public ProtocolProviderService selectHandlingProvider(String uri) providers.add(new ProviderComboBoxEntry(provider)); } - Object result = - JabberActivator.getUIService().getPopupDialog().showInputPopupDialog( - "Please select the account that you would like \n" - + "to use to chat with " + uri, "Account Selection", - PopupDialog.OK_CANCEL_OPTION, providers.toArray(), - providers.get(0)); + Object result + = JabberActivator.getUIService().getPopupDialog() + .showInputPopupDialog( + "Please select the account that you would like \n" + + "to use to chat with " + uri, + "Account Selection", + PopupDialog.OK_CANCEL_OPTION, + providers.toArray(), + providers.get(0)); if (result == null) { @@ -665,31 +673,31 @@ public String toString() } /** - * Waiting for the provider to bcome online and then handle the uri. + * Waiting for the provider to become online and then handle the uri. */ private class ProviderStatusListener implements ProviderPresenceStatusListener { - private String uri; - private OperationSetPresence parentOpSet; + private final String uri; + private final OperationSetPresence parentOpSet; - public ProviderStatusListener(String uri, OperationSetPresence parentOpSet) + public ProviderStatusListener( + String uri, + OperationSetPresence parentOpSet) { this.uri = uri; this.parentOpSet = parentOpSet; } - public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) + public void providerStatusChanged(ProviderPresenceStatusChangeEvent ev) { - if(evt.getNewStatus().isOnline()) + if(ev.getNewStatus().isOnline()) { parentOpSet.removeProviderPresenceStatusListener(this); handleUri(uri); } } - public void providerStatusMessageChanged(java.beans.PropertyChangeEvent evt) - { - } + public void providerStatusMessageChanged(PropertyChangeEvent ev) {} } }