From 987ab7b7955c4f288a05f9c6f03264dabccf90e9 Mon Sep 17 00:00:00 2001 From: vbaciu Date: Thu, 28 Feb 2008 03:00:40 +0000 Subject: [189366] NLS unused messages --- .../org/eclipse/wst/wsdl/ui/internal/Messages.java | 15 +++++-- .../adapters/basic/W11MessageReference.java | 52 ++++++++++++++-------- .../adapters/basic/W11ParameterForPart.java | 36 +++++++++------ .../wst/wsdl/ui/internal/messages.properties | 4 +- 4 files changed, 69 insertions(+), 38 deletions(-) (limited to 'bundles/org.eclipse.wst.wsdl.ui') diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/Messages.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/Messages.java index a490579a5..ab165918e 100644 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/Messages.java +++ b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. + * Copyright (c) 2001, 2008 IBM Corporation 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 @@ -27,9 +27,8 @@ public class Messages { private Messages() { } - /* + /** * @deprecated: Use Messages._STRING_KEY to access strings. - * This method will be made private in the near future. */ public static String getString(String key) { try { @@ -39,10 +38,16 @@ public class Messages { } } + /** + * @deprecated: Use Messages._STRING_KEY to access strings. + */ public static String getString(String key, String arg0) { return MessageFormat.format(getString(key), new Object [] { arg0 }); } + /** + * @deprecated: Use Messages._STRING_KEY to access strings. + */ public static String getString(String key, Object[] args) { return MessageFormat.format(getString(key), args); } @@ -152,4 +157,8 @@ public class Messages { public static String _ERROR_WSI_COMPLIANCE_SOAP_PROTOCOL; public static String _WARN_WSI_COMPLIANCE_RPC_ENCODING; public static String _ERROR_WSI_COMPLIANCE_RPC_ENCODING; + public static String _UI_LABEL_UNDEFINED_ARG1; + public static String _UI_LABEL_OR_UNDEFINED_ARG2; + public static String _UI_LABEL_NO_OBJECT_SPECIFIED_ARG1; + public static String _UI_LABEL_NO_PARAMETERS_SPECIFIED; } diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11MessageReference.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11MessageReference.java index bf0873f5f..47da4d3a1 100644 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11MessageReference.java +++ b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11MessageReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. + * Copyright (c) 2001, 2008 IBM Corporation 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 @@ -17,6 +17,7 @@ import java.util.List; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.gef.commands.Command; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.graphics.Image; import org.eclipse.wst.wsdl.Fault; import org.eclipse.wst.wsdl.Input; @@ -354,7 +355,7 @@ public class W11MessageReference extends WSDLBaseAdapter implements IMessageRefe else if (parts.size() <= 0) { String[] args = new String[1]; args[0] = "part"; //$NON-NLS-1$ - addWarningDiagnosticMessage(getStringForKey("_UI_LABEL_NO_OBJECT_SPECIFIED_ARG1", args)); //$NON-NLS-1$ + addWarningDiagnosticMessage(getNoObjectSpecifiedArgsString(args)); } } @@ -423,28 +424,47 @@ public class W11MessageReference extends WSDLBaseAdapter implements IMessageRefe } } + private String getNoObjectSpecifiedArgsString(String[] args) { + String string = NLS.bind(Messages._UI_LABEL_NO_OBJECT_SPECIFIED_ARG1, args); + String customizedMessage = getProductCustomizedMessage("_UI_LABEL_NO_OBJECT_SPECIFIED_ARG1", args); //$NON-NLS-1$ + if (customizedMessage != null && !customizedMessage.equals("")) //$NON-NLS-1$ + string = customizedMessage; + return string; + } + private String getUndefinedArg1String(String arg) { String[] args = new String[1]; - args[0] = arg; - String newString = getStringForKey("_UI_LABEL_UNDEFINED_ARG1", args); //$NON-NLS-1$ - return newString; + args[0] = arg; + String string = NLS.bind(Messages._UI_LABEL_UNDEFINED_ARG1, args); + String customizedMessage = getProductCustomizedMessage("_UI_LABEL_UNDEFINED_ARG1", args); //$NON-NLS-1$ + if (customizedMessage != null && !customizedMessage.equals("")) //$NON-NLS-1$ + string = customizedMessage; + return string; } private String getNoParametersSpecifiedString() { - String string = null; String[] args = new String[0]; - string = getStringForKey("_UI_LABEL_NO_PARAMETERS_SPECIFIED", args); //$NON-NLS-1$ + String string = NLS.bind(Messages._UI_LABEL_NO_PARAMETERS_SPECIFIED, args); + String customizedMessage = getProductCustomizedMessage("_UI_LABEL_NO_PARAMETERS_SPECIFIED", args); //$NON-NLS-1$ + if (customizedMessage != null && !customizedMessage.equals("")) //$NON-NLS-1$ + string = customizedMessage; return string; } - private String getStringForKey(String key, Object[] args) { - String newString = ""; //$NON-NLS-1$ - newString = Messages.getString(key, args); + /** + * Returns a customed product-based message for the given key and arguments + * or null if none exists. + * @param key + * @param args + * @return String customized message or null if none exists + */ + private String getProductCustomizedMessage(String key, Object[] args) { + String productMessage = null; Object object = WSDLEditorPlugin.getInstance().getProductCustomizationProvider(); if (object instanceof ProductCustomizationProvider) { ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)object; - String customizedString = ""; //$NON-NLS-1$ + String customizedString = null; if (args == null) { customizedString = productCustomizationProvider.getProductString(key); } @@ -453,14 +473,10 @@ public class W11MessageReference extends WSDLBaseAdapter implements IMessageRefe } if (customizedString != null && !customizedString.equals("")) { //$NON-NLS-1$ - newString = customizedString; + productMessage = customizedString; } } - - if (newString == null) { - newString = ""; //$NON-NLS-1$ - } - - return newString; + + return productMessage; } } diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11ParameterForPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11ParameterForPart.java index d28929302..dcbae2e37 100644 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11ParameterForPart.java +++ b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11ParameterForPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. + * Copyright (c) 2001, 2008 IBM Corporation 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 @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.gef.commands.Command; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.part.MultiPageEditorPart; import org.eclipse.ui.views.contentoutline.ContentOutline; @@ -207,22 +208,33 @@ public class W11ParameterForPart extends WSDLBaseAdapter implements IParameter String[] args = new String[2]; args[0] = "element"; //$NON-NLS-1$ args[1] = "type"; //$NON-NLS-1$ - String newString = getStringForKey("_UI_LABEL_OR_UNDEFINED_ARG2", args); //$NON-NLS-1$ - ModelDiagnosticInfo info = new ModelDiagnosticInfo(newString, ModelDiagnosticInfo.ERROR_TYPE, null); + + String string = NLS.bind(Messages._UI_LABEL_OR_UNDEFINED_ARG2, args); + String customizedMessage = getProductCustomizedMessage("_UI_LABEL_OR_UNDEFINED_ARG2", args); //$NON-NLS-1$ + if (customizedMessage != null && !customizedMessage.equals("")) //$NON-NLS-1$ + string = customizedMessage; + + ModelDiagnosticInfo info = new ModelDiagnosticInfo(string, ModelDiagnosticInfo.ERROR_TYPE, null); errors.add(info); } return errors; } - private String getStringForKey(String key, Object[] args) { - String newString = ""; //$NON-NLS-1$ - newString = Messages.getString(key, args); - + /** + * Returns a customed product-based message for the given key and arguments + * or null if none exists. + * @param key + * @param args + * @return String customized message or null if none exists + */ + private String getProductCustomizedMessage(String key, Object[] args) { + String productMessage = null; + Object object = WSDLEditorPlugin.getInstance().getProductCustomizationProvider(); if (object instanceof ProductCustomizationProvider) { ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)object; - String customizedString = ""; //$NON-NLS-1$ + String customizedString = null; if (args == null) { customizedString = productCustomizationProvider.getProductString(key); } @@ -231,14 +243,10 @@ public class W11ParameterForPart extends WSDLBaseAdapter implements IParameter } if (customizedString != null && !customizedString.equals("")) { //$NON-NLS-1$ - newString = customizedString; + productMessage = customizedString; } } - if (newString == null) { - newString = ""; //$NON-NLS-1$ - } - - return newString; + return productMessage; } } diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/messages.properties b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/messages.properties index 679f314e9..afa75e280 100644 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/messages.properties +++ b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/messages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2001, 2007 IBM Corporation and others. +# Copyright (c) 2001, 2008 IBM Corporation 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 @@ -114,9 +114,7 @@ _ERROR_WSI_COMPLIANCE_RPC_ENCODING=WS-I compliance error: binding cannot be rpc _WSI_COMPLIANCE_LINK_TEXT=Modify project compliance setting _UI_LABEL_UNDEFINED_ARG1={0} undefined -_UI_LABEL_UNDEFINED_ARG2={0} undefined: ''{1}'' _UI_LABEL_OR_UNDEFINED_ARG2={0} or {1} undefined -_UI_LABEL_OR_UNDEFINED_ARG3={0} or {1} undefined: ''{2}'' _UI_LABEL_NO_OBJECT_SPECIFIED_ARG1=no {0} specified _UI_LABEL_NO_PARAMETERS_SPECIFIED=no parameters specified -- cgit v1.2.3