mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-09 19:43:27 +02: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:
parent
d11328fb9c
commit
eac2f92bb4
8 changed files with 24 additions and 18 deletions
|
@ -10,10 +10,11 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.newui;
|
package org.eclipse.cdt.ui.newui;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @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) {
|
public static String getFormattedString(String key, String arg) {
|
||||||
key = toNlsFormatKey(key);
|
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) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
key = toNlsFormatKey(key);
|
key = toNlsFormatKey(key);
|
||||||
return MessageFormat.format(getString(key), args);
|
return MessageFormat.format(getString(key), (Object[])args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getString(String key) {
|
public static String getString(String key) {
|
||||||
|
|
|
@ -25,11 +25,11 @@ public class DebugCoreMessages {
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getFormattedString(String key, String arg) {
|
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) {
|
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 ) {
|
public static String getString( String key ) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class RegisterGroupDialog extends TitleAreaDialog {
|
||||||
public String getText( Object element ) {
|
public String getText( Object element ) {
|
||||||
if ( element instanceof IRegisterDescriptor ) {
|
if ( element instanceof IRegisterDescriptor ) {
|
||||||
IRegisterDescriptor rd = (IRegisterDescriptor)element;
|
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 );
|
return super.getText( element );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@ public class LaunchMessages {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFormattedString(String key, String arg) {
|
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) {
|
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) {
|
public static String getString(String key) {
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
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.CDIDebugModel;
|
||||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||||
|
@ -31,6 +30,8 @@ import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.ui.dialogs.PropertyPage;
|
import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The property page for a signal.
|
* The property page for a signal.
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +56,7 @@ public class SignalPropertyPage extends PropertyPage {
|
||||||
try {
|
try {
|
||||||
String description = getSignal().getDescription();
|
String description = getSignal().getDescription();
|
||||||
Label label = new Label( composite, SWT.WRAP );
|
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 );
|
GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER );
|
||||||
data.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
|
data.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
|
||||||
label.setLayoutData( data );
|
label.setLayoutData( data );
|
||||||
|
|
|
@ -12,11 +12,12 @@ package org.eclipse.cdt.debug.ui.sourcelookup;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
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.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Old default source locator. We keep it for migration purposes.
|
* 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 ) )
|
if ( getCSourceLocator().getProject() != null && !getCSourceLocator().getProject().equals( project ) )
|
||||||
return;
|
return;
|
||||||
if ( project == null || !project.exists() || !project.isOpen() )
|
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();
|
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
||||||
if ( psl != null )
|
if ( psl != null )
|
||||||
psl.initializeFromMemento( data );
|
psl.initializeFromMemento( data );
|
||||||
|
@ -212,7 +215,7 @@ public class OldDefaultSourceLocator implements IPersistableSourceLocator, IAdap
|
||||||
return project;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,11 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
public class LaunchUIMessages {
|
public class LaunchUIMessages {
|
||||||
|
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.gdb.internal.ui.launching.LaunchUIMessages";//$NON-NLS-1$
|
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() {}
|
private LaunchUIMessages() {}
|
||||||
|
|
||||||
public static String getFormattedString(String key, String arg) {
|
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) {
|
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) {
|
public static String getString(String key) {
|
||||||
|
|
|
@ -355,7 +355,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
||||||
protected String renderProcessLabel(String commandLine) {
|
protected String renderProcessLabel(String commandLine) {
|
||||||
String format = "{0} ({1})"; //$NON-NLS-1$
|
String format = "{0} ({1})"; //$NON-NLS-1$
|
||||||
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
|
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
|
// temporary fix for #66015
|
||||||
|
@ -366,7 +366,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
||||||
protected String renderDebuggerProcessLabel() {
|
protected String renderDebuggerProcessLabel() {
|
||||||
String format = "{0} ({1})"; //$NON-NLS-1$
|
String format = "{0} ({1})"; //$NON-NLS-1$
|
||||||
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
|
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});
|
LaunchMessages.AbstractCLaunchDelegate_Debugger_Process, timestamp});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue