diff options
author | Christof Marti | 2004-05-06 14:15:07 +0000 |
---|---|---|
committer | Christof Marti | 2004-05-06 14:15:07 +0000 |
commit | 770b9fc92a08afcdd6bb095f90938c59fd8826f8 (patch) | |
tree | 3449f376af6a92e7c7d138dbfe192e59549a87e9 /org.eclipse.jface.text/src/org/eclipse/jface/internal/text | |
parent | 2ea1cb1b3a324fbc2e83708679817f2311691aa0 (diff) | |
download | eclipse.platform.text-770b9fc92a08afcdd6bb095f90938c59fd8826f8.tar.gz eclipse.platform.text-770b9fc92a08afcdd6bb095f90938c59fd8826f8.tar.xz eclipse.platform.text-770b9fc92a08afcdd6bb095f90938c59fd8826f8.zip |
NLS
Diffstat (limited to 'org.eclipse.jface.text/src/org/eclipse/jface/internal/text')
7 files changed, 105 insertions, 36 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java index 068f0bf1f13..651e2f5a0d6 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/AdditionalInfoController2.java @@ -105,7 +105,7 @@ class AdditionalInfoController2 extends AbstractInformationControlManager implem synchronized (fThreadAccess) { if (fThread != null) fThread.interrupt(); - fThread= new Thread(this, JFaceTextMessages2.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$ + fThread= new Thread(this, ContentAssistMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$ fStartSignal= new Object(); synchronized (fStartSignal) { diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java new file mode 100644 index 00000000000..7dd029028b6 --- /dev/null +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/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.jface.internal.text.link.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.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.properties b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.properties new file mode 100644 index 00000000000..360a7c02e8c --- /dev/null +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.properties @@ -0,0 +1,19 @@ +############################################################################### +# 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 +############################################################################### + + +InfoPopup.info_delay_timer_name=AdditionalInfo Delay + +ContentAssistant.assist_delay_timer_name=AutoAssist Delay + +HTMLTextPresenter.ellipse= ... + +HTML2TextReader.listItemPrefix=\ - diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java index dd388393620..3944670419e 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java @@ -235,7 +235,7 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx protected void start(int showStyle) { fShowStyle= showStyle; - fThread= new Thread(this, JFaceTextMessages2.getString("ContentAssistant.assist_delay_timer_name")); //$NON-NLS-1$ + fThread= new Thread(this, ContentAssistMessages.getString("ContentAssistant.assist_delay_timer_name")); //$NON-NLS-1$ fThread.start(); } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTML2TextReader.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTML2TextReader.java index b826803580c..f026ddbe5c0 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTML2TextReader.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTML2TextReader.java @@ -171,7 +171,7 @@ class HTML2TextReader extends SubstitutionTextReader { return "\t"; //$NON-NLS-1$ if ("li".equals(html)) //$NON-NLS-1$ - return LINE_DELIM + "\t" + "-"; //$NON-NLS-1$ TODO internationalize + return LINE_DELIM + ContentAssistMessages.getString("HTML2TextReader.listItemPrefix"); //$NON-NLS-1$ //$NON-NLS-2$ if ("/b".equals(html)) { //$NON-NLS-1$ stopBold(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTMLTextPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTMLTextPresenter.java index 29ebb6455cf..b49383f09ab 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTMLTextPresenter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/HTMLTextPresenter.java @@ -148,7 +148,7 @@ class HTMLTextPresenter implements DefaultInformationControl.IInformationPresent if (line != null) { append(buffer, LINE_DELIM, lineFormatted ? presentation : null); - append(buffer, "...", presentation); // TODO get the message from somewhere + append(buffer, ContentAssistMessages.getString("HTMLTextPresenter.ellipse"), presentation); //$NON-NLS-1$ } return trim(buffer, presentation); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/JFaceTextMessages2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/JFaceTextMessages2.java deleted file mode 100644 index 9c5d4a4c273..00000000000 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/JFaceTextMessages2.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.jface.internal.text.link.contentassist; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -class JFaceTextMessages2 { - - private static final String RESOURCE_BUNDLE= "org.eclipse.jface.text.JFaceTextMessages";//$NON-NLS-1$ - - private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); - - private JFaceTextMessages2() { - } - - public static String getString(String key) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ - } - } -} |