57
57
import org .netbeans .modules .profiler .heapwalk .OQLSupport ;
58
58
import org .openide .awt .Mnemonics ;
59
59
import org .openide .util .ImageUtilities ;
60
+ import org .openide .util .NbBundle ;
60
61
61
62
/**
62
63
*
63
64
* @author Jiri Sedlacek
64
65
*/
66
+ @ NbBundle .Messages ({
67
+ "HeapViewerOptionsPanel_CustomScript=Custom Script" ,
68
+ "HeapViewerOptionsPanel_CustomScripts=Custom OQL Scripts" ,
69
+ "HeapViewerOptionsPanel_LoadingScripts=<loading scripts>" ,
70
+ "HeapViewerOptionsPanel_NoSavedScripts=<no saved scripts>" ,
71
+ "HeapViewerOptionsPanel_DeleteScriptTooltip=Delete selected script" ,
72
+ "HeapViewerOptionsPanel_MoveScriptUpTooltip=Move selected script up" ,
73
+ "HeapViewerOptionsPanel_MoveScriptDownTooltip=Move selected script down" ,
74
+ "HeapViewerOptionsPanel_NameLabel=&Name:" ,
75
+ "HeapViewerOptionsPanel_DescriptionLabel=&Description (optional):" ,
76
+ "HeapViewerOptionsPanel_PreviewLabel=&Preview:" ,
77
+ "HeapViewerOptionsPanel_HintLabel=To add custom script, use the Save OQL Script action in Heap Viewer | OQL Console."
78
+ })
65
79
final class HeapViewerOptionsPanel extends JPanel {
66
80
67
81
private boolean loaded ;
@@ -137,11 +151,11 @@ private void refreshPreset(int index) {
137
151
138
152
internalChange = true ;
139
153
140
- nameField .setText (query == null ? "" : query .getName ());
154
+ nameField .setText (query == null ? "" : query .getName ()); // NOI18N
141
155
try { nameField .setCaretPosition (0 ); } catch (IllegalArgumentException e ) {}
142
- descrArea .setText (query == null ? "" : query .getDescription ());
156
+ descrArea .setText (query == null ? "" : query .getDescription ()); // NOI18N
143
157
try { descrArea .setCaretPosition (0 ); } catch (IllegalArgumentException e ) {}
144
- previewArea .setScript (query == null ? "" : query .getScript ());
158
+ previewArea .setScript (query == null ? "" : query .getScript ()); // NOI18N
145
159
internalChange = false ;
146
160
147
161
presetsPanel .setEnabled (index != -1 );
@@ -162,11 +176,11 @@ private void updatePreset() {
162
176
}
163
177
164
178
private String uniqueName (String name , int index ) {
165
- if (name .isEmpty ()) name = "Custom Script" ;
179
+ if (name .isEmpty ()) name = Bundle . HeapViewerOptionsPanel_CustomScript () ;
166
180
String baseName = name ;
167
181
168
182
int nameExt = 0 ;
169
- while (containsQuery (name , index )) name = baseName + " " + ++nameExt ;
183
+ while (containsQuery (name , index )) name = baseName + " " + ++nameExt ; // NOI18N
170
184
171
185
return name ;
172
186
}
@@ -185,7 +199,7 @@ private void initComponents() {
185
199
186
200
setLayout (new GridBagLayout ());
187
201
188
- SectionSeparator presetsSection = UISupport .createSectionSeparator ("Custom OQL Scripts" );
202
+ SectionSeparator presetsSection = UISupport .createSectionSeparator (Bundle . HeapViewerOptionsPanel_CustomScripts () );
189
203
c = new GridBagConstraints ();
190
204
c .gridy = 0 ;
191
205
c .gridwidth = GridBagConstraints .REMAINDER ;
@@ -215,10 +229,10 @@ public void removeSelectionInterval(int i1, int i2) {}
215
229
});
216
230
list .setSelectionMode (ListSelectionModel .SINGLE_SELECTION );
217
231
final Dimension oneDim = new Dimension (1 , 1 );
218
- final JLabel loadingScriptsLabel = new JLabel ("<loading scripts>" , JLabel .CENTER );
232
+ final JLabel loadingScriptsLabel = new JLabel (Bundle . HeapViewerOptionsPanel_LoadingScripts () , JLabel .CENTER );
219
233
loadingScriptsLabel .setEnabled (false );
220
234
loadingScriptsLabel .setSize (loadingScriptsLabel .getPreferredSize ());
221
- final JLabel noScriptsLabel = new JLabel ("<no saved scripts>" , JLabel .CENTER );
235
+ final JLabel noScriptsLabel = new JLabel (Bundle . HeapViewerOptionsPanel_NoSavedScripts () , JLabel .CENTER );
222
236
noScriptsLabel .setEnabled (false );
223
237
noScriptsLabel .setSize (noScriptsLabel .getPreferredSize ());
224
238
JScrollPane listScroll = new JScrollPane (list ) {
@@ -253,7 +267,7 @@ protected void fireActionPerformed(ActionEvent e) {
253
267
int mar = nimbusLaF ? 0 : 8 ;
254
268
margin .left = mar ;
255
269
margin .right = mar ;
256
- removeButton .setToolTipText ("Delete selected script" );
270
+ removeButton .setToolTipText (Bundle . HeapViewerOptionsPanel_DeleteScriptTooltip () );
257
271
removeButton .setMargin (margin );
258
272
upButton = new JButton () {
259
273
protected void fireActionPerformed (ActionEvent e ) {
@@ -262,7 +276,7 @@ protected void fireActionPerformed(ActionEvent e) {
262
276
};
263
277
upButton .setIcon (new ImageIcon (ImageUtilities .loadImage (
264
278
"com/sun/tools/visualvm/profiler/resources/up.png" , true ))); // NOI18N
265
- upButton .setToolTipText ("Move selected script up" ); // NOI18N
279
+ upButton .setToolTipText (Bundle . HeapViewerOptionsPanel_MoveScriptUpTooltip () ); // NOI18N
266
280
upButton .setMargin (margin );
267
281
downButton = new JButton () {
268
282
protected void fireActionPerformed (ActionEvent e ) {
@@ -271,7 +285,7 @@ protected void fireActionPerformed(ActionEvent e) {
271
285
};
272
286
downButton .setIcon (new ImageIcon (ImageUtilities .loadImage (
273
287
"com/sun/tools/visualvm/profiler/resources/down.png" , true ))); // NOI18N
274
- downButton .setToolTipText ("Move selected script down" );
288
+ downButton .setToolTipText (Bundle . HeapViewerOptionsPanel_MoveScriptDownTooltip () );
275
289
downButton .setMargin (margin );
276
290
277
291
JPanel controlsPanel = new JPanel (new GridLayout (1 , 4 , 5 , 0 )) {
@@ -306,7 +320,7 @@ public void setEnabled(boolean enabled) {
306
320
add (presetsPanel , c );
307
321
308
322
JLabel nameLabel = new JLabel ();
309
- Mnemonics .setLocalizedText (nameLabel , "&Name:" );
323
+ Mnemonics .setLocalizedText (nameLabel , Bundle . HeapViewerOptionsPanel_NameLabel () );
310
324
c = new GridBagConstraints ();
311
325
c .gridx = 0 ;
312
326
c .gridy = 0 ;
@@ -338,7 +352,7 @@ public void setBackground(Color bg) {
338
352
presetsPanel .add (nameField , c );
339
353
340
354
JLabel descrLabel = new JLabel ();
341
- Mnemonics .setLocalizedText (descrLabel , "&Description (optional):" );
355
+ Mnemonics .setLocalizedText (descrLabel , Bundle . HeapViewerOptionsPanel_DescriptionLabel () );
342
356
c = new GridBagConstraints ();
343
357
c .gridx = 0 ;
344
358
c .gridy = 1 ;
@@ -378,7 +392,7 @@ public void setEnabled(boolean b) {
378
392
presetsPanel .add (descrScroll , c );
379
393
380
394
JLabel previewLabel = new JLabel ();
381
- Mnemonics .setLocalizedText (previewLabel , "&Preview:" );
395
+ Mnemonics .setLocalizedText (previewLabel , Bundle . HeapViewerOptionsPanel_PreviewLabel () );
382
396
c = new GridBagConstraints ();
383
397
c .gridx = 0 ;
384
398
c .gridy = 3 ;
@@ -403,7 +417,7 @@ public void setEnabled(boolean b) {
403
417
presetsPanel .add (previewArea , c );
404
418
405
419
406
- JLabel hint = new JLabel ("To add custom script, use the Save OQL Script action in Heap Viewer | OQL Console." );
420
+ JLabel hint = new JLabel (Bundle . HeapViewerOptionsPanel_HintLabel () );
407
421
hint .setEnabled (false );
408
422
c = new GridBagConstraints ();
409
423
c .gridx = 0 ;
0 commit comments