Skip to content

Commit f6500f4

Browse files
committed
I18N for HeapViewer, part 3 - finished
1 parent 267fe47 commit f6500f4

10 files changed

+87
-49
lines changed

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/BreadCrumbsNavigator.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,20 @@
5050
import com.sun.tools.visualvm.heapviewer.model.RootNode;
5151
import com.sun.tools.visualvm.heapviewer.swing.LinkButton;
5252
import org.openide.util.ImageUtilities;
53+
import org.openide.util.NbBundle;
5354

5455
/**
5556
*
5657
* @author JiriSedlacek
5758
*/
59+
@NbBundle.Messages({
60+
"BreadCrumbsNavigator_Pin=Pin",
61+
"BreadCrumbsNavigator_ResetPin=Reset Pin",
62+
"BreadCrumbsNavigator_Class=class",
63+
"BreadCrumbsNavigator_SelectNode=Select {0}",
64+
"BreadCrumbsNavigator_ResetPinSelectNode=Reset Pin and Select {0}",
65+
"BreadCrumbsNavigator_ResetView=Reset View"
66+
})
5867
abstract class BreadCrumbsNavigator {
5968

6069
private static final Icon ICON_SEPARATOR = ImageUtilities.image2Icon(ImageUtilities.loadImage(BreadCrumbsNavigator.class.getPackage().getName().replace('.', '/') + "/separator.png", true));
@@ -114,7 +123,7 @@ protected void fireActionPerformed(ActionEvent e) {
114123
}
115124
};
116125
pb.setSelected(node.equals(pinnedNode));
117-
pb.setToolTipText(pb.isSelected() ? "Reset Pin" : "Pin");
126+
pb.setToolTipText(pb.isSelected() ? Bundle.BreadCrumbsNavigator_ResetPin() : Bundle.BreadCrumbsNavigator_Pin());
118127
if (pb.isSelected()) visitedPinnedNode = pinnedNode;
119128
component.add(pb, 0);
120129
component.add(Box.createHorizontalStrut(3), 0);
@@ -128,7 +137,7 @@ protected void clicked() {
128137
}
129138
protected void middleClicked(MouseEvent e) {
130139
HeapViewerNodeAction.Actions nodeActions = getNodeActions(nodeF);
131-
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers());
140+
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers()); // NOI18N
132141
nodeActions.performMiddleButtonAction(ae);
133142
}
134143
protected void populatePopup(JPopupMenu popup) {
@@ -138,7 +147,7 @@ protected void populatePopup(JPopupMenu popup) {
138147
};
139148
boolean beforePinnedNode = visitedPinnedNode != null && visitedPinnedNode != node;
140149
if (beforePinnedNode) lb.setForeground(UIUtils.getDisabledLineColor());
141-
lb.setToolTipText(beforePinnedNode ? "Reset Pin and Select " + renderer.toString() : "Select " + renderer.toString());
150+
lb.setToolTipText(beforePinnedNode ? Bundle.BreadCrumbsNavigator_ResetPinSelectNode(renderer.toString()) : Bundle.BreadCrumbsNavigator_SelectNode(renderer.toString()));
142151
lb.addMouseListener(new MouseAdapter() {
143152
public void mouseClicked(MouseEvent e) {
144153
if (SwingUtilities.isMiddleMouseButton(e)) openNode(nodeF);
@@ -157,7 +166,7 @@ public void mouseClicked(MouseEvent e) {
157166
protected void clicked() { nodeClicked(null); }
158167
};
159168
if (visitedPinnedNode != null) lb.setForeground(UIUtils.getDisabledLineColor());
160-
lb.setToolTipText("Reset View");
169+
lb.setToolTipText(Bundle.BreadCrumbsNavigator_ResetView());
161170
component.add(lb, 0);
162171

163172
component.add(Box.createHorizontalStrut(4), 0);
@@ -176,7 +185,7 @@ private static JComponent createSeparator() {
176185

177186

178187
private void init() {
179-
final int refHeight = new LinkButton("XXX", Icons.getIcon(LanguageIcons.CLASS)).getPreferredSize().height + 3;
188+
final int refHeight = new LinkButton("XXX", Icons.getIcon(LanguageIcons.CLASS)).getPreferredSize().height + 3; // NOI18N
180189
component = new JPanel(null) {
181190
public Dimension getPreferredSize() {
182191
Dimension dim = super.getPreferredSize();
@@ -190,7 +199,7 @@ public Dimension getMinimumSize() {
190199
}
191200
};
192201
component.setLayout(new BoxLayout(component, BoxLayout.LINE_AXIS));
193-
component.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager.getColor("Separator.foreground")));
202+
component.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager.getColor("Separator.foreground"))); // NOI18N
194203
}
195204

196205

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/HTMLView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ private void invokeDefaultAction(URL url, InputEvent e) {
220220
if (node == null) return;
221221

222222
HeapViewerNodeAction.Actions nodeActions = HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions);
223-
ActionEvent ae = e == null ? new ActionEvent(htmlComponent, ActionEvent.ACTION_PERFORMED, "link"):
224-
new ActionEvent(e.getSource(), e.getID(), "link", e.getWhen(), e.getModifiers());
223+
ActionEvent ae = e == null ? new ActionEvent(htmlComponent, ActionEvent.ACTION_PERFORMED, "link"): // NO18N
224+
new ActionEvent(e.getSource(), e.getID(), "link", e.getWhen(), e.getModifiers()); // NO18N
225225
nodeActions.performDefaultAction(ae);
226226
}
227227

@@ -230,7 +230,7 @@ private void invokeMiddleButtonAction(URL url, InputEvent e) {
230230
if (node == null) return;
231231

232232
HeapViewerNodeAction.Actions nodeActions = HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions);
233-
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers());
233+
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers()); // NO18N
234234
nodeActions.performMiddleButtonAction(ae);
235235
}
236236

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/HeapDumpInfoAction.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
"HeapDumpInfoAction_JvmItemString=<b>JVM: </b>{0} ({1}, {2})",
9090
"HeapDumpInfoAction_ShowSysPropsLinkString=Show System Properties",
9191
"HeapDumpInfoAction_ThreadsString=Threads at the heap dump:",
92-
"HeapDumpInfoAction_ShowThreadsLinkString=Show Threads"
92+
"HeapDumpInfoAction_ShowThreadsLinkString=Show Threads",
93+
"HeapDumpInfoAction_ComputingInfo=computing heap dump information..."
9394
})
9495
class HeapDumpInfoAction extends AbstractAction {
9596
//~ Instance fields ----------------------------------------------------------------------------------------------------------
@@ -135,8 +136,8 @@ protected String doInBackground() throws Exception {
135136
Heap heap = heapViewer.getFragments().get(0).getHeap();
136137
Properties sysprops = heap.getSystemProperties();
137138

138-
return computeInfo(heapViewer) + "<br><br>" +
139-
computeEnvironment(heap, sysprops) + "<br><br>" +
139+
return computeInfo(heapViewer) + "<br><br>" + // NO18N
140+
computeEnvironment(heap, sysprops) + "<br><br>" + // NO18N
140141
computeSystemProperties(sysprops);
141142
}
142143
protected void done() {
@@ -158,16 +159,16 @@ protected void done() {
158159
} catch (ExecutionException ex) {
159160
Exceptions.printStackTrace(ex);
160161
} catch (TimeoutException ex) {
161-
text.setText(SUMMARY_SECTION_PREFIX + LINE_PREFIX + "computing heap dump information...");
162+
text.setText(SUMMARY_SECTION_PREFIX + LINE_PREFIX + Bundle.HeapDumpInfoAction_ComputingInfo());
162163
text.setCaretPosition(0);
163164
}
164165
}
165166

166167
private static final String LINE_PREFIX = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; // NOI18N
167-
private static final String SUMMARY_SECTION_PREFIX = "<b><img border='0' align='bottom' src='nbresloc:/" +
168+
private static final String SUMMARY_SECTION_PREFIX = "<b><img border='0' align='bottom' src='nbresloc:/" + // NO18N
168169
Icons.getResource(GeneralIcons.INFO) +
169-
"'>&nbsp;&nbsp;" + Bundle.HeapDumpInfoAction_SummaryString() +
170-
"</b><br><hr>";
170+
"'>&nbsp;&nbsp;" + Bundle.HeapDumpInfoAction_SummaryString() + // NO18N
171+
"</b><br><hr>"; // NO18N
171172

172173
private static String computeInfo(HeapViewer heapViewer) {
173174
File file = heapViewer.getFile();

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/HeapViewerComponent.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
* @author Jiri Sedlacek
6868
*/
6969
@NbBundle.Messages({
70-
"HeapViewerComponent_LoadingProgress=Opening heap dump..."
70+
"HeapViewerComponent_LoadingProgress=Opening heap dump...",
71+
"HeapViewerComponent_Scope=Scope:",
72+
"HeapViewerComponent_View=View:"
7173
})
7274
public final class HeapViewerComponent extends JPanel {
7375

@@ -291,7 +293,7 @@ public String getName() {
291293

292294
public String getDescription() {
293295
return contexts.length == 1 ? selectedFeature.getName() :
294-
(selectedContext.getFragment().getName() + ": " +
296+
(selectedContext.getFragment().getName() + ": " + // NOI18N
295297
selectedFeature.getName());
296298
}
297299

@@ -432,7 +434,7 @@ protected void fireActionPerformed(ActionEvent e) {
432434
final ViewsUpdater updater = new ViewsUpdater();
433435

434436
if (scopes) {
435-
JLabel scopeL = new JLabel("Scope:", JLabel.LEADING);
437+
JLabel scopeL = new JLabel(Bundle.HeapViewerComponent_Scope(), JLabel.LEADING);
436438
scopeL.setFont(popup.getFont().deriveFont(Font.BOLD));
437439
c = new GridBagConstraints();
438440
c.gridx = 0;
@@ -464,7 +466,7 @@ protected void fireItemStateChanged(ItemEvent event) {
464466
popup.add(mi, c);
465467
}
466468

467-
JLabel viewL = new JLabel("View:", JLabel.LEADING);
469+
JLabel viewL = new JLabel(Bundle.HeapViewerComponent_View(), JLabel.LEADING);
468470
viewL.setFont(popup.getFont().deriveFont(Font.BOLD));
469471
c = new GridBagConstraints();
470472
c.gridx = 0;

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/HeapViewerNumberRenderer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public void setValue(Object value, int row) {
7070
private static ProfilerRenderer createNumberRenderer(Format customFormat, final DataType dataType) {
7171
NumberRenderer numberRenderer = new NumberRenderer(customFormat) {
7272
protected String getValueString(Object value, int row, Format format) {
73-
if (Objects.equals(value, dataType.getNoValue())) return "-";
74-
if (Objects.equals(value, dataType.getUnsupportedValue())) return "";
75-
if (Objects.equals(value, dataType.getNotAvailableValue())) return "n/a";
73+
if (Objects.equals(value, dataType.getNoValue())) return "-"; // NOI18N
74+
if (Objects.equals(value, dataType.getUnsupportedValue())) return ""; // NOI18N
75+
if (Objects.equals(value, dataType.getNotAvailableValue())) return "n/a"; // NOI18N
7676
return super.getValueString(value, row, format);
7777
}
7878
};

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/NodeObjectsView.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@
4545
import com.sun.tools.visualvm.heapviewer.model.Progress;
4646
import com.sun.tools.visualvm.heapviewer.model.RootNode;
4747
import javax.swing.SwingUtilities;
48+
import org.openide.util.NbBundle;
4849
import org.openide.util.RequestProcessor;
4950

5051
/**
5152
*
5253
* @author Jiri Sedlacek
5354
*/
55+
@NbBundle.Messages({
56+
"NodeObjectsView_Details=Details:",
57+
"NodeObjectsView_NewTab=Open in New Tab"
58+
})
5459
public class NodeObjectsView extends HeapView {
5560

5661
private final HeapViewerNode viewNode;
@@ -133,7 +138,7 @@ private void initUI() {
133138
toolbar.addSeparator();
134139
toolbar.addSpace(5);
135140

136-
toolbar.add(new GrayLabel("Details:"));
141+
toolbar.add(new GrayLabel(Bundle.NodeObjectsView_Details()));
137142
toolbar.addSpace(2);
138143

139144
toolbar.add(objectsView.getToolbar());
@@ -212,7 +217,7 @@ public void run() {
212217
public static abstract class DefaultOpenAction extends OpenAction {
213218

214219
public DefaultOpenAction(HeapViewerNode node, HeapContext context, HeapViewerActions actions) {
215-
super("Open in New Tab", 0, node, context, actions);
220+
super(Bundle.NodeObjectsView_NewTab(), 0, node, context, actions);
216221
}
217222

218223
public boolean isDefault() {

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/PluggableTreeTableView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
*/
5959
public class PluggableTreeTableView extends TreeTableView {
6060

61-
private static final Color SEPARATOR_COLOR = UIManager.getColor("Separator.foreground");
61+
private static final Color SEPARATOR_COLOR = UIManager.getColor("Separator.foreground"); // NOI18N
6262

6363
private final List<HeapViewPlugin> plugins;
6464
// private Collection<? extends HeapViewPlugin.Provider> pluginProviders;

visualvm/heapviewer/src/com/sun/tools/visualvm/heapviewer/ui/TreeTableView.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,19 @@
7070
import com.sun.tools.visualvm.heapviewer.model.Progress;
7171
import com.sun.tools.visualvm.heapviewer.model.RootNode;
7272
import org.openide.util.Lookup;
73+
import org.openide.util.NbBundle;
7374

7475
/**
7576
*
7677
* @author Jiri Sedlacek
7778
*/
79+
@NbBundle.Messages({
80+
"TreeTableView_FilteredFlag={0} (filtered)",
81+
"TreeTableView_Filter=Filter",
82+
"TreeTableView_Pin=Pin",
83+
"TreeTableView_ResetPin=Reset Pin",
84+
"TreeTableView_SortToGet=sort to get"
85+
})
7886
public class TreeTableView {
7987

8088
private final String viewID;
@@ -114,7 +122,7 @@ public TreeTableView(String viewID, HeapContext context, HeapViewerActions actio
114122
public TreeTableView(String viewID, HeapContext context, HeapViewerActions actions, boolean useBreadCrumbs, boolean pluggableColumns, TreeTableViewColumn... columns) {
115123
assert(!SwingUtilities.isEventDispatchThread());
116124

117-
if (columns == null || columns.length == 0) throw new IllegalArgumentException("View must have at least one column defined");
125+
if (columns == null || columns.length == 0) throw new IllegalArgumentException("View must have at least one column defined"); // NOI18N
118126

119127
this.viewID = viewID;
120128
this.context = context;
@@ -242,7 +250,7 @@ protected void nodeSelected(HeapViewerNode node, boolean adjusting) {
242250
hasSelection = node != null;
243251
if (navigator != null) {
244252
String _viewName = viewName;
245-
if (_viewName != null && filter != null) _viewName += " (filtered)";
253+
if (_viewName != null && filter != null) _viewName = Bundle.TreeTableView_FilteredFlag(_viewName);
246254
navigator.setNode(node, currentRoot == root ? null : currentRoot, getRoot(), _viewName);
247255
}
248256
}
@@ -446,7 +454,7 @@ public void mouseClicked(MouseEvent e) {
446454
HeapViewerNodeAction.Actions nodeActions = navigator == null ?
447455
HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions) :
448456
HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions, new PinAction(node), new ResetPinAction());
449-
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers());
457+
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers()); // NOI18N
450458
nodeActions.performMiddleButtonAction(ae);
451459
}
452460
}
@@ -494,7 +502,7 @@ public boolean requestFocusInWindow() {
494502
protected void populatePopupLast(HeapViewerNode node, JPopupMenu popup) {
495503
if (filterComponent.getComponentCount() > 0) {
496504
popup.addSeparator();
497-
popup.add(new JMenuItem("Filter") {
505+
popup.add(new JMenuItem(Bundle.TreeTableView_Filter()) {
498506
protected void fireActionPerformed(ActionEvent e) { activateFilter(); }
499507
});
500508
}
@@ -564,7 +572,7 @@ private class PinAction extends HeapViewerNodeAction {
564572
private final HeapViewerNode node;
565573

566574
PinAction(HeapViewerNode node) {
567-
super("Pin", 110);
575+
super(Bundle.TreeTableView_Pin(), 110);
568576
this.node = node;
569577
setEnabled(node != currentRoot && !node.isLeaf());
570578
}
@@ -584,7 +592,7 @@ public void actionPerformed(ActionEvent e) {
584592
private class ResetPinAction extends HeapViewerNodeAction {
585593

586594
ResetPinAction() {
587-
super("Reset Pin", 111);
595+
super(Bundle.TreeTableView_ResetPin(), 111);
588596
setEnabled(root != currentRoot);
589597
}
590598

@@ -644,7 +652,7 @@ public Class getColumnClass(int column) {
644652
public String getColumnName(int column) {
645653
String columnName = columns.get(column).getHeaderValue().toString();
646654
return dataTypeListeners[column] == null ? columnName :
647-
"<html><nobr>" + columnName + " <small style='color: gray;'>(sort to get)</small></nobr></html>";
655+
"<html><nobr>" + columnName + " <small style='color: gray;'>(" + Bundle.TreeTableView_SortToGet() + ")</small></nobr></html>";
648656
}
649657

650658
public Object getValueAt(TreeNode node, int column) {

0 commit comments

Comments
 (0)