Mercurial > projects > dwt2
comparison org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children | ebefa5c2eab4 |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2006 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module org.eclipse.jface.internal.text.link.contentassist.ContentAssistMessages; | |
14 | |
15 | |
16 import org.eclipse.jface.internal.text.link.contentassist.IProposalListener; // packageimport | |
17 import org.eclipse.jface.internal.text.link.contentassist.LineBreakingReader; // packageimport | |
18 import org.eclipse.jface.internal.text.link.contentassist.CompletionProposalPopup2; // packageimport | |
19 import org.eclipse.jface.internal.text.link.contentassist.ContextInformationPopup2; // packageimport | |
20 import org.eclipse.jface.internal.text.link.contentassist.Helper2; // packageimport | |
21 import org.eclipse.jface.internal.text.link.contentassist.PopupCloser2; // packageimport | |
22 import org.eclipse.jface.internal.text.link.contentassist.IContentAssistListener2; // packageimport | |
23 import org.eclipse.jface.internal.text.link.contentassist.ContentAssistant2; // packageimport | |
24 import org.eclipse.jface.internal.text.link.contentassist.AdditionalInfoController2; // packageimport | |
25 | |
26 import java.lang.all; | |
27 | |
28 import java.util.ResourceBundle; | |
29 import java.util.MissingResourceException; | |
30 import java.text.MessageFormat; | |
31 | |
32 | |
33 /** | |
34 * Helper class to get NLSed messages. | |
35 * | |
36 * @since 3.0 | |
37 */ | |
38 class ContentAssistMessages { | |
39 | |
40 // private static const String RESOURCE_BUNDLE= ContentAssistMessages.classinfo.getName(); | |
41 | |
42 private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); | |
43 | |
44 static this() { | |
45 fgResourceBundle = ResourceBundle.getBundle( | |
46 getImportData!("org.eclipse.jface.internal.text.link.contentassist.ContentAssistMessages.properties")); | |
47 } | |
48 | |
49 private this() { | |
50 } | |
51 | |
52 /** | |
53 * Gets a string from the resource bundle. | |
54 * | |
55 * @param key the string used to get the bundle value, must not be null | |
56 * @return the string from the resource bundle | |
57 */ | |
58 public static String getString(String key) { | |
59 try { | |
60 return fgResourceBundle.getString(key); | |
61 } catch (MissingResourceException e) { | |
62 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ | |
63 } | |
64 } | |
65 | |
66 /** | |
67 * Gets a string from the resource bundle and formats it with the given arguments. | |
68 * | |
69 * @param key the string used to get the bundle value, must not be null | |
70 * @param args the arguments used to format the string | |
71 * @return the formatted string | |
72 */ | |
73 public static String getFormattedString(String key, Object[] args... ) { | |
74 String format= null; | |
75 try { | |
76 format= fgResourceBundle.getString(key); | |
77 } catch (MissingResourceException e) { | |
78 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ | |
79 } | |
80 return MessageFormat.format(format, args); | |
81 } | |
82 | |
83 | |
84 } |