1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Fixed warnings: do not call MessageFormat#format(...) with String[].

Change-Id: I3da681e323cfeb0c1c07a669183e6d1d18ca6ff6
Signed-off-by: Jesper Eskilson <jesper.eskilson@iar.com>
This commit is contained in:
Jesper Eskilson 2016-03-13 20:32:43 +01:00 committed by Gerrit Code Review @ Eclipse.org
parent d11328fb9c
commit eac2f92bb4
8 changed files with 24 additions and 18 deletions

View file

@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import com.ibm.icu.text.MessageFormat;
/**
* @since 2.0
* @noextend This class is not intended to be subclassed by clients.
@ -40,12 +41,12 @@ public class UIMessages {
}
public static String getFormattedString(String key, String arg) {
key = toNlsFormatKey(key);
return MessageFormat.format(getString(key), new String[] { arg });
return MessageFormat.format(getString(key), new Object[] { arg });
}
public static String getFormattedString(String key, String[] args) {
key = toNlsFormatKey(key);
return MessageFormat.format(getString(key), args);
return MessageFormat.format(getString(key), (Object[])args);
}
public static String getString(String key) {

View file

@ -25,11 +25,11 @@ public class DebugCoreMessages {
}
static String getFormattedString(String key, String arg) {
return MessageFormat.format(getString(key), new String[]{arg});
return MessageFormat.format(getString(key), new Object[]{arg});
}
static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getString(key), args);
return MessageFormat.format(getString(key), (Object[])args);
}
public static String getString( String key ) {

View file

@ -58,7 +58,7 @@ public class RegisterGroupDialog extends TitleAreaDialog {
public String getText( Object element ) {
if ( element instanceof IRegisterDescriptor ) {
IRegisterDescriptor rd = (IRegisterDescriptor)element;
return MessageFormat.format( "{0} - {1}", new String[] { rd.getName(), rd.getGroupName() } ); //$NON-NLS-1$
return MessageFormat.format( "{0} - {1}", new Object[] { rd.getName(), rd.getGroupName() } ); //$NON-NLS-1$
}
return super.getText( element );
}

View file

@ -23,11 +23,11 @@ public class LaunchMessages {
}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getString(key), new String[] { arg });
return MessageFormat.format(getString(key), new Object[] { arg });
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getString(key), args);
return MessageFormat.format(getString(key), (Object[])args);
}
public static String getString(String key) {

View file

@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.propertypages;
import com.ibm.icu.text.MessageFormat;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.ICSignal;
@ -30,6 +29,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.dialogs.PropertyPage;
import com.ibm.icu.text.MessageFormat;
/**
* The property page for a signal.
@ -55,7 +56,7 @@ public class SignalPropertyPage extends PropertyPage {
try {
String description = getSignal().getDescription();
Label label = new Label( composite, SWT.WRAP );
label.setText( MessageFormat.format( PropertyPageMessages.getString( "SignalPropertyPage.0" ), new String[] { description } ) ); //$NON-NLS-1$
label.setText( MessageFormat.format( PropertyPageMessages.getString( "SignalPropertyPage.0" ), new Object[] { description } ) ); //$NON-NLS-1$
GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER );
data.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
label.setLayoutData( data );

View file

@ -12,11 +12,12 @@ package org.eclipse.cdt.debug.ui.sourcelookup;
import java.io.IOException;
import java.io.StringReader;
import com.ibm.icu.text.MessageFormat;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
@ -37,6 +38,8 @@ import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.ibm.icu.text.MessageFormat;
/**
* Old default source locator. We keep it for migration purposes.
*/
@ -124,7 +127,7 @@ public class OldDefaultSourceLocator implements IPersistableSourceLocator, IAdap
if ( getCSourceLocator().getProject() != null && !getCSourceLocator().getProject().equals( project ) )
return;
if ( project == null || !project.exists() || !project.isOpen() )
abort( MessageFormat.format( SourceLookupMessages.getString( "OldDefaultSourceLocator.4" ), new String[]{ projectName } ), null ); //$NON-NLS-1$
abort( MessageFormat.format( SourceLookupMessages.getString( "OldDefaultSourceLocator.4" ), new Object[]{ projectName } ), null ); //$NON-NLS-1$
IPersistableSourceLocator psl = getPersistableSourceLocator();
if ( psl != null )
psl.initializeFromMemento( data );
@ -212,7 +215,7 @@ public class OldDefaultSourceLocator implements IPersistableSourceLocator, IAdap
return project;
}
}
abort( MessageFormat.format( SourceLookupMessages.getString( "OldDefaultSourceLocator.9" ), new String[]{ projectName } ), null ); //$NON-NLS-1$
abort( MessageFormat.format( SourceLookupMessages.getString( "OldDefaultSourceLocator.9" ), new Object[]{ projectName } ), null ); //$NON-NLS-1$
return null;
}
}

View file

@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import com.ibm.icu.text.MessageFormat;
public class LaunchUIMessages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.gdb.internal.ui.launching.LaunchUIMessages";//$NON-NLS-1$
@ -31,11 +32,11 @@ public class LaunchUIMessages {
private LaunchUIMessages() {}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getString(key), new String[]{arg});
return MessageFormat.format(getString(key), new Object[]{arg});
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getString(key), args);
return MessageFormat.format(getString(key), (Object[])args);
}
public static String getString(String key) {

View file

@ -355,7 +355,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
protected String renderProcessLabel(String commandLine) {
String format = "{0} ({1})"; //$NON-NLS-1$
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
return MessageFormat.format(format, new String[]{commandLine, timestamp});
return MessageFormat.format(format, new Object[]{commandLine, timestamp});
}
// temporary fix for #66015
@ -366,7 +366,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
protected String renderDebuggerProcessLabel() {
String format = "{0} ({1})"; //$NON-NLS-1$
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
return MessageFormat.format(format, new String[]{
return MessageFormat.format(format, new Object[]{
LaunchMessages.AbstractCLaunchDelegate_Debugger_Process, timestamp});
}