diff options
5 files changed, 100 insertions, 5 deletions
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersMessages.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersMessages.java index 37006f88e65..3adae7d34b0 100644 --- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersMessages.java +++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersMessages.java @@ -21,7 +21,7 @@ import java.util.ResourceBundle; * * @since 3.0 */ -public class FileBuffersMessages { +class FileBuffersMessages { private static final String RESOURCE_BUNDLE= FileBuffersMessages.class.getName(); diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java index 2043f552e8f..45a7ca50d9b 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java @@ -11,7 +11,6 @@ package org.eclipse.ui.contentassist; -import java.text.MessageFormat; import java.util.List; import java.util.Map; @@ -183,11 +182,11 @@ public class ContentAssistHandler { ICommand command= commandManager.getCommand(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); List bindings= command.getKeySequenceBindings(); if (bindings.size() == 0) { - return "Content Assist Available"; + return ContentAssistMessages.getString("ContentAssistHandler.contentAssistAvailable"); //$NON-NLS-1$ } else { IKeySequenceBinding ksb= (IKeySequenceBinding) bindings.get(0); Object[] args= { ksb.getKeySequence().format() }; - return MessageFormat.format("Content Assist Available ({0})", args); + return ContentAssistMessages.getFormattedString("ContentAssistHandler.contentAssistAvailableWithKeyBinding", args); //$NON-NLS-1$ } } }; diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistMessages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistMessages.java new file mode 100644 index 00000000000..b992262a284 --- /dev/null +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistMessages.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ui.contentassist; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + + +/** + * Helper class to get NLSed messages. + * + * @since 3.0 + */ +class ContentAssistMessages { + + private static final String RESOURCE_BUNDLE= ContentAssistMessages.class.getName(); + + private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); + + private ContentAssistMessages() { + } + + /** + * Gets a string from the resource bundle. + * + * @param key the string used to get the bundle value, must not be null + * @return the string from the resource bundle + */ + public static String getString(String key) { + try { + return fgResourceBundle.getString(key); + } catch (MissingResourceException e) { + return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ + } + } + + /** + * Gets a string from the resource bundle and formats it with the given arguments. + * + * @param key the string used to get the bundle value, must not be null + * @param args the arguments used to format the string + * @return the formatted string + */ + public static String getFormattedString(String key, Object[] args) { + String format= null; + try { + format= fgResourceBundle.getString(key); + } catch (MissingResourceException e) { + return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ + } + return MessageFormat.format(format, args); + } + + /** + * Gets a string from the resource bundle and formats it with the given argument. + * + * @param key the string used to get the bundle value, must not be null + * @param arg the argument used to format the string + * @return the formatted string + */ + public static String getFormattedString(String key, Object arg) { + String format= null; + try { + format= fgResourceBundle.getString(key); + } catch (MissingResourceException e) { + return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ + } + if (arg == null) + arg= ""; //$NON-NLS-1$ + return MessageFormat.format(format, new Object[] { arg }); + } +} diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistMessages.properties b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistMessages.properties new file mode 100644 index 00000000000..4e4f8b1f6c3 --- /dev/null +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistMessages.properties @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2000, 2004 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Common Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/cpl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + + +ContentAssistHandler.contentAssistAvailable= Content Assist Available +ContentAssistHandler.contentAssistAvailableWithKeyBinding= Content Assist Available ({0}) diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java index c3eba1dc61d..bfbc6b6c0dd 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java @@ -13,7 +13,7 @@ package org.eclipse.ui.internal.texteditor; import java.util.MissingResourceException; import java.util.ResourceBundle; -public class EditorMessages { +class EditorMessages { private static final String RESOURCE_BUNDLE= EditorMessages.class.getName(); private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); |