Mercurial > projects > dwt-addons
annotate dwtx/jface/text/source/JFaceTextMessages.d @ 159:7926b636c282
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 01:57:58 +0200 |
parents | 25f1f92fa3df |
children | c6d7b1ea700b |
rev | line source |
---|---|
129 | 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 | |
131 | 14 |
151 | 15 module dwtx.jface.text.source.JFaceTextMessages; |
16 | |
131 | 17 import dwtx.jface.text.source.ISharedTextColors; // packageimport |
18 import dwtx.jface.text.source.ILineRange; // packageimport | |
19 import dwtx.jface.text.source.IAnnotationPresentation; // packageimport | |
20 import dwtx.jface.text.source.IVerticalRulerInfoExtension; // packageimport | |
21 import dwtx.jface.text.source.ICharacterPairMatcher; // packageimport | |
22 import dwtx.jface.text.source.TextInvocationContext; // packageimport | |
23 import dwtx.jface.text.source.LineChangeHover; // packageimport | |
24 import dwtx.jface.text.source.IChangeRulerColumn; // packageimport | |
25 import dwtx.jface.text.source.IAnnotationMap; // packageimport | |
26 import dwtx.jface.text.source.IAnnotationModelListenerExtension; // packageimport | |
27 import dwtx.jface.text.source.ISourceViewerExtension2; // packageimport | |
28 import dwtx.jface.text.source.IAnnotationHover; // packageimport | |
29 import dwtx.jface.text.source.ContentAssistantFacade; // packageimport | |
30 import dwtx.jface.text.source.IAnnotationAccess; // packageimport | |
31 import dwtx.jface.text.source.IVerticalRulerExtension; // packageimport | |
32 import dwtx.jface.text.source.IVerticalRulerColumn; // packageimport | |
33 import dwtx.jface.text.source.LineNumberRulerColumn; // packageimport | |
34 import dwtx.jface.text.source.MatchingCharacterPainter; // packageimport | |
35 import dwtx.jface.text.source.IAnnotationModelExtension; // packageimport | |
36 import dwtx.jface.text.source.ILineDifferExtension; // packageimport | |
37 import dwtx.jface.text.source.DefaultCharacterPairMatcher; // packageimport | |
38 import dwtx.jface.text.source.LineNumberChangeRulerColumn; // packageimport | |
39 import dwtx.jface.text.source.IAnnotationAccessExtension; // packageimport | |
40 import dwtx.jface.text.source.ISourceViewer; // packageimport | |
41 import dwtx.jface.text.source.AnnotationModel; // packageimport | |
42 import dwtx.jface.text.source.ILineDifferExtension2; // packageimport | |
43 import dwtx.jface.text.source.IAnnotationModelListener; // packageimport | |
44 import dwtx.jface.text.source.IVerticalRuler; // packageimport | |
45 import dwtx.jface.text.source.DefaultAnnotationHover; // packageimport | |
46 import dwtx.jface.text.source.SourceViewer; // packageimport | |
47 import dwtx.jface.text.source.SourceViewerConfiguration; // packageimport | |
48 import dwtx.jface.text.source.AnnotationBarHoverManager; // packageimport | |
49 import dwtx.jface.text.source.CompositeRuler; // packageimport | |
50 import dwtx.jface.text.source.ImageUtilities; // packageimport | |
51 import dwtx.jface.text.source.VisualAnnotationModel; // packageimport | |
52 import dwtx.jface.text.source.IAnnotationModel; // packageimport | |
53 import dwtx.jface.text.source.ISourceViewerExtension3; // packageimport | |
54 import dwtx.jface.text.source.ILineDiffInfo; // packageimport | |
55 import dwtx.jface.text.source.VerticalRulerEvent; // packageimport | |
56 import dwtx.jface.text.source.ChangeRulerColumn; // packageimport | |
57 import dwtx.jface.text.source.ILineDiffer; // packageimport | |
58 import dwtx.jface.text.source.AnnotationModelEvent; // packageimport | |
59 import dwtx.jface.text.source.AnnotationColumn; // packageimport | |
60 import dwtx.jface.text.source.AnnotationRulerColumn; // packageimport | |
61 import dwtx.jface.text.source.IAnnotationHoverExtension; // packageimport | |
62 import dwtx.jface.text.source.AbstractRulerColumn; // packageimport | |
63 import dwtx.jface.text.source.ISourceViewerExtension; // packageimport | |
64 import dwtx.jface.text.source.AnnotationMap; // packageimport | |
65 import dwtx.jface.text.source.IVerticalRulerInfo; // packageimport | |
66 import dwtx.jface.text.source.IAnnotationModelExtension2; // packageimport | |
67 import dwtx.jface.text.source.LineRange; // packageimport | |
68 import dwtx.jface.text.source.IAnnotationAccessExtension2; // packageimport | |
69 import dwtx.jface.text.source.VerticalRuler; // packageimport | |
70 import dwtx.jface.text.source.IOverviewRuler; // packageimport | |
71 import dwtx.jface.text.source.Annotation; // packageimport | |
72 import dwtx.jface.text.source.IVerticalRulerListener; // packageimport | |
73 import dwtx.jface.text.source.ISourceViewerExtension4; // packageimport | |
74 import dwtx.jface.text.source.AnnotationPainter; // packageimport | |
75 import dwtx.jface.text.source.IAnnotationHoverExtension2; // packageimport | |
76 import dwtx.jface.text.source.OverviewRuler; // packageimport | |
77 import dwtx.jface.text.source.OverviewRulerHoverManager; // packageimport | |
78 | |
129 | 79 import dwt.dwthelper.utils; |
80 | |
155
8442b6b2da2d
Fix import for ResourceBundle
Frank Benoit <benoit@tionex.de>
parents:
154
diff
changeset
|
81 import dwt.dwthelper.ResourceBundle; |
158 | 82 import dwtx.dwtxhelper.MessageFormat; |
129 | 83 |
84 /** | |
85 * Accessor for the <code>JFaceTextMessages.properties</code> file in | |
86 * package <code>dwtx.jface.text</code>. | |
87 * @since 2.0 | |
88 */ | |
89 class JFaceTextMessages { | |
90 | |
91 /** The resource bundle name. */ | |
159 | 92 // private static const String RESOURCE_BUNDLE= "dwtx.jface.text.JFaceTextMessages";//$NON-NLS-1$ |
129 | 93 |
94 /** The resource bundle. */ | |
159 | 95 private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); |
96 | |
97 static this() { | |
98 fgResourceBundle = ResourceBundle.getBundle( | |
99 getImportData!("dwtx.jface.text.JFaceTextMessages.properties")); | |
100 } | |
129 | 101 |
102 /** | |
103 * Prohibits the creation of accessor objects. | |
104 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
105 private this() { |
129 | 106 } |
107 | |
108 /** | |
109 * Returns the string found in the resource bundle under the given key or a place holder string. | |
110 * | |
111 * @param key the look up key | |
112 * @return the value found under the given key | |
113 */ | |
114 public static String getString(String key) { | |
115 try { | |
116 return fgResourceBundle.getString(key); | |
117 } catch (MissingResourceException e) { | |
159 | 118 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ |
129 | 119 } |
120 } | |
121 | |
122 /** | |
123 * Gets a string from the resource bundle and formats it with the argument | |
124 * | |
125 * @param key the string used to get the bundle value, must not be null | |
126 * @param args arguments used when formatting the string | |
127 * @return the formatted string | |
128 * @since 3.0 | |
129 */ | |
159 | 130 public static String getFormattedString(String key, Object[] args...) { |
129 | 131 String format= null; |
132 try { | |
133 format= fgResourceBundle.getString(key); | |
134 } catch (MissingResourceException e) { | |
159 | 135 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ |
129 | 136 } |
137 return MessageFormat.format(format, args); | |
138 } | |
139 } |