diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java b/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java index 573d987fd..404347327 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/wizard/Wizard.java @@ -68,8 +68,6 @@ public class Wizard public static final String CANCEL_BUTTON_ACTION_COMMAND = "CancelButtonActionCommand"; - private BufferedImage wizardIcon; - private JLabel wizardIconLabel; private TransparentPanel wizardIconPanel = @@ -500,17 +498,12 @@ public void windowClosing(WindowEvent e) this.close(Wizard.CANCEL_RETURN_CODE); } - static { + static { ResourceManagementService resources = GuiActivator.getResources(); BACK_TEXT = resources.getI18NString("service.gui.PREVIOUS"); NEXT_TEXT = resources.getI18NString("service.gui.NEXT"); CANCEL_TEXT = resources.getI18NString("service.gui.CANCEL"); FINISH_TEXT = resources.getI18NString("service.gui.FINISH"); - } - - public BufferedImage getWizzardIcon() - { - return wizardIcon; } public void setWizzardIcon(BufferedImage wizardIcon) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java index b5bba70bf..b2ac6342e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java @@ -286,13 +286,14 @@ else if (e.getErrorCode() */ private class BanParticipantThread extends Thread { - private ChatRoom chatRoom; + private final ChatRoom chatRoom; - private String reason; + private final String reason; BanParticipantThread(ChatRoom chatRoom, String reason) { this.chatRoom = chatRoom; + this.reason = reason; } public void run() @@ -300,8 +301,7 @@ public void run() try { chatRoom.banParticipant( - (ChatRoomMember)chatContact - .getDescriptor(), + (ChatRoomMember) chatContact.getDescriptor(), reason); } catch (OperationFailedException e) @@ -310,36 +310,26 @@ public void run() String errorTitle = GuiActivator.getResources() .getI18NString("service.gui.BAN_FAILED"); + String errorMessageKey; - if (e.getErrorCode() - == OperationFailedException.NOT_ENOUGH_PRIVILEGES) - { - new ErrorDialog(chatPanel.getChatWindow(), - errorTitle, - GuiActivator.getResources().getI18NString( - "service.gui.BAN_FAILED_NOT_ENOUGH_PERMISSIONS", - new String[]{chatContact.getName()}), - e).showDialog(); - } - else if (e.getErrorCode() - == OperationFailedException.FORBIDDEN) - { - new ErrorDialog(chatPanel.getChatWindow(), - errorTitle, - GuiActivator.getResources().getI18NString( - "service.gui.BAN_FAILED_NOT_ALLOWED", - new String[]{chatContact.getName()}), - e).showDialog(); - } - else - { - new ErrorDialog(chatPanel.getChatWindow(), - errorTitle, - GuiActivator.getResources().getI18NString( - "service.gui.BAN_FAILED_GENERAL_ERROR", - new String[]{chatContact.getName()}), - e).showDialog(); + switch (e.getErrorCode()) { + case OperationFailedException.NOT_ENOUGH_PRIVILEGES: + errorMessageKey = + "service.gui.BAN_FAILED_NOT_ENOUGH_PERMISSIONS"; + break; + case OperationFailedException.FORBIDDEN: + errorMessageKey = "service.gui.BAN_FAILED_NOT_ALLOWED"; + break; + default: + errorMessageKey = "service.gui.BAN_FAILED_GENERAL_ERROR"; + break; } + new ErrorDialog(chatPanel.getChatWindow(), + errorTitle, + GuiActivator.getResources().getI18NString( + errorMessageKey, + new String[]{chatContact.getName()}), + e).showDialog(); } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java index 9d383607b..b48d3de8e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java @@ -1018,14 +1018,14 @@ protected void done() Constants.ONLINE_STATUS); String errorMessage = null; - if(returnCode.equals(AUTHENTICATION_FAILED)) + if(AUTHENTICATION_FAILED.equals(returnCode)) { ChatRoomAuthenticationWindow authWindow = new ChatRoomAuthenticationWindow(chatRoomWrapper); authWindow.setVisible(true); } - else if(returnCode.equals(REGISTRATION_REQUIRED)) + else if(REGISTRATION_REQUIRED.equals(returnCode)) { errorMessage = GuiActivator.getResources() @@ -1033,14 +1033,14 @@ else if(returnCode.equals(REGISTRATION_REQUIRED)) "service.gui.CHAT_ROOM_REGISTRATION_REQUIRED", new String[]{chatRoomWrapper.getChatRoomName()}); } - else if(returnCode.equals(PROVIDER_NOT_REGISTERED)) + else if(PROVIDER_NOT_REGISTERED.equals(returnCode)) { errorMessage = GuiActivator.getResources() .getI18NString("service.gui.CHAT_ROOM_NOT_CONNECTED", new String[]{chatRoomWrapper.getChatRoomName()}); } - else if(returnCode.equals(SUBSCRIPTION_ALREADY_EXISTS)) + else if(SUBSCRIPTION_ALREADY_EXISTS.equals(returnCode)) { errorMessage = GuiActivator.getResources() @@ -1055,8 +1055,8 @@ else if(returnCode.equals(SUBSCRIPTION_ALREADY_EXISTS)) new String[]{chatRoomWrapper.getChatRoomName()}); } - if (!returnCode.equals(SUCCESS) - && !returnCode.equals(AUTHENTICATION_FAILED)) + if (!SUCCESS.equals(returnCode) + && !AUTHENTICATION_FAILED.equals(returnCode)) { new ErrorDialog( GuiActivator.getUIService().getMainFrame(), diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java index 5f8d46c8d..e15d6adc1 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java @@ -340,22 +340,14 @@ else if(detail.equals(ServerStoredDetails.GenderDetail.MALE)) case 0x02DA : cmd.setWorkWebPage(((StringDetail)detail).getString()); break; case 0x0258 : cmd.setNotes(((StringDetail)detail).getString()); break; case 0x01EA : - ArrayList interests = new ArrayList(); + List interests = new ArrayList(); Iterator intIter = getDetails(InterestDetail.class); while (intIter.hasNext()) { InterestDetail item = (InterestDetail) intIter.next(); interests.add(item); } - InterestDetail[] interestsArr = (InterestDetail[])interests.toArray(); - int[] interestsCategories = new int[interestsArr.length]; - String[] interestsStr = new String[interestsArr.length]; - for (int k = 0; k < interestsArr.length; k++) - { - interestsStr[k] = interestsArr[k].getInterest(); - interestsCategories[k] = getInterestCode(interestsStr[k]); - } - cmd.setInterests(interestsCategories, interestsStr); + setInterests(cmd, interests); break; case 0x0316 : int offset = ((ServerStoredDetails.TimeZoneDetail)detail). @@ -385,6 +377,20 @@ else if(detail.equals(ServerStoredDetails.GenderDetail.MALE)) infoRetreiver.detailsChanged(uin); } + private void setInterests(MetaFullInfoSetCmd cmd, List interests) + throws IOException + { + int interestCount = interests.size(); + int[] interestsCategories = new int[interestCount]; + String[] interestsStr = new String[interestCount]; + for (int k = 0; k < interestCount; k++) + { + interestsStr[k] = interests.get(k).getInterest(); + interestsCategories[k] = getInterestCode(interestsStr[k]); + } + cmd.setInterests(interestsCategories, interestsStr); + } + /** * Removes the specified detail from the list of details stored online * for this account. @@ -662,25 +668,17 @@ else if(newDetailValue.equals(ServerStoredDetails.GenderDetail.MALE)) case 0x02DA : cmd.setWorkWebPage(((StringDetail)newDetailValue).getString()); break; case 0x0258 : cmd.setNotes(((StringDetail)newDetailValue).getString()); break; case 0x01EA : - ArrayList interests = new ArrayList(); + List interests = new ArrayList(); Iterator intIter = getDetails(InterestDetail.class); while (intIter.hasNext()) { InterestDetail item = (InterestDetail) intIter.next(); if(item.equals(currentDetailValue)) - interests.add(newDetailValue); + interests.add((InterestDetail) newDetailValue); else interests.add(item); } - InterestDetail[] interestsArr = (InterestDetail[])interests.toArray(); - int[] interestsCategories = new int[interestsArr.length]; - String[] interestsStr = new String[interestsArr.length]; - for (int k = 0; k < interestsArr.length; k++) - { - interestsStr[k] = interestsArr[k].getInterest(); - interestsCategories[k] = getInterestCode(interestsStr[k]); - } - cmd.setInterests(interestsCategories, interestsStr); + setInterests(cmd, interests); break; case 0x0316 : int offset = ((ServerStoredDetails.TimeZoneDetail)newDetailValue). diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java index fa2b82419..ed0128db3 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java @@ -318,7 +318,7 @@ private void setNextButtonAccordingToUserID() || serverField.getText() == null || serverField.getText().equals("") || (!passwordNotRequired.isSelected() - && passField.equals(""))) + && passField.getText().equals(""))) { wizard.getWizardContainer().setNextFinishButtonEnabled(false); }