Skip to content

Commit c6910e9

Browse files
committed
Merge branch 'master' into graal
2 parents f2d0583 + be68016 commit c6910e9

File tree

8 files changed

+151
-119
lines changed

8 files changed

+151
-119
lines changed

visualvm/applicationviews/src/org/graalvm/visualvm/application/views/monitor/ApplicationMonitorView.java

Lines changed: 81 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ protected DataViewComponent createComponent() {
104104
dvc.addDetailsView(cpuViewSupport.getDetailsView(), DataViewComponent.TOP_LEFT);
105105

106106
final HeapViewSupport heapViewSupport = new HeapViewSupport(model);
107-
final PermGenViewSupport permGenViewSupport = new PermGenViewSupport(model);
107+
final PermGenViewSupport permGenViewSupport = model.isMemoryMonitoringSupported() ? new PermGenViewSupport(model) : null;
108108
dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(NbBundle.
109109
getMessage(ApplicationMonitorView.class, "LBL_Memory"), true), DataViewComponent.TOP_RIGHT); // NOI18N
110110
dvc.addDetailsView(heapViewSupport.getDetailsView(), DataViewComponent.TOP_RIGHT);
111-
dvc.addDetailsView(permGenViewSupport.getDetailsView(), DataViewComponent.TOP_RIGHT);
111+
if (permGenViewSupport != null) dvc.addDetailsView(permGenViewSupport.getDetailsView(), DataViewComponent.TOP_RIGHT);
112112

113113
final ClassesViewSupport classesViewSupport = new ClassesViewSupport(model);
114114
dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(NbBundle.
@@ -125,7 +125,7 @@ public void run() {
125125
masterViewSupport.refresh(model);
126126
cpuViewSupport.refresh(model);
127127
heapViewSupport.refresh(model);
128-
permGenViewSupport.refresh(model);
128+
if (permGenViewSupport != null) permGenViewSupport.refresh(model);
129129
classesViewSupport.refresh(model);
130130
threadsViewSupport.refresh(model);
131131
}
@@ -291,7 +291,7 @@ private static class CpuViewSupport extends JPanel {
291291

292292
public CpuViewSupport(ApplicationMonitorModel model) {
293293
initModels(model);
294-
initComponents(model);
294+
initComponents();
295295
}
296296

297297
public DataViewComponent.DetailsView getDetailsView() {
@@ -355,23 +355,25 @@ private void initModels(ApplicationMonitorModel model) {
355355
cpuMonitoringSupported = model.isCpuMonitoringSupported();
356356
gcMonitoringSupported = model.isGcMonitoringSupported();
357357

358-
SimpleXYChartDescriptor chartDescriptor =
359-
SimpleXYChartDescriptor.percent(false, 0.1d, model.getChartCache());
358+
if (cpuMonitoringSupported || gcMonitoringSupported) {
359+
SimpleXYChartDescriptor chartDescriptor =
360+
SimpleXYChartDescriptor.percent(false, 0.1d, model.getChartCache());
361+
362+
chartDescriptor.addLineItems(CPU_USAGE, GC_USAGE);
363+
chartDescriptor.setDetailsItems(new String[] { CPU_USAGE, GC_USAGE });
360364

361-
chartDescriptor.addLineItems(CPU_USAGE, GC_USAGE);
362-
chartDescriptor.setDetailsItems(new String[] { CPU_USAGE, GC_USAGE });
365+
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
366+
model.registerCpuChartSupport(chartSupport);
363367

364-
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
365-
model.registerCpuChartSupport(chartSupport);
366-
367-
chartSupport.setZoomingEnabled(!liveModel);
368+
chartSupport.setZoomingEnabled(!liveModel);
369+
}
368370
}
369371

370-
private void initComponents(ApplicationMonitorModel model) {
372+
private void initComponents() {
371373
setLayout(new BorderLayout());
372374
setOpaque(false);
373375

374-
if (model.isCpuMonitoringSupported() || model.isGcMonitoringSupported()) {
376+
if (cpuMonitoringSupported || gcMonitoringSupported) {
375377
add(chartSupport.getChart(), BorderLayout.CENTER);
376378
chartSupport.updateDetails(new String[] { UNKNOWN, UNKNOWN });
377379
} else {
@@ -394,7 +396,7 @@ private static class HeapViewSupport extends JPanel {
394396

395397
public HeapViewSupport(ApplicationMonitorModel model) {
396398
initModels(model);
397-
initComponents(model);
399+
initComponents();
398400
}
399401

400402
public DataViewComponent.DetailsView getDetailsView() {
@@ -418,31 +420,33 @@ public void refresh(ApplicationMonitorModel model) {
418420
private void initModels(ApplicationMonitorModel model) {
419421
liveModel = model.isLive();
420422
memoryMonitoringSupported = model.isMemoryMonitoringSupported();
421-
heapName = model.getHeapName();
423+
heapName = memoryMonitoringSupported ? model.getHeapName() : NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Memory"); // NOI18N
422424

423-
String HEAP_SIZE = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Heap_size"); // NOI18N
424-
String HEAP_SIZE_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Heap_size_leg",heapName); // NOI18N
425-
String USED_HEAP = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_heap"); // NOI18N
426-
String USED_HEAP_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_heap_leg",heapName.toLowerCase()); // NOI18N
427-
String MAX_HEAP = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Max_Heap"); // NOI18N
425+
if (memoryMonitoringSupported) {
426+
String HEAP_SIZE = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Heap_size"); // NOI18N
427+
String HEAP_SIZE_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Heap_size_leg",heapName); // NOI18N
428+
String USED_HEAP = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_heap"); // NOI18N
429+
String USED_HEAP_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_heap_leg",heapName.toLowerCase()); // NOI18N
430+
String MAX_HEAP = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Max_Heap"); // NOI18N
428431

429-
SimpleXYChartDescriptor chartDescriptor =
430-
SimpleXYChartDescriptor.bytes(10 * 1024 * 1024, false, model.getChartCache());
432+
SimpleXYChartDescriptor chartDescriptor =
433+
SimpleXYChartDescriptor.bytes(10 * 1024 * 1024, false, model.getChartCache());
431434

432-
chartDescriptor.addLineFillItems(HEAP_SIZE_LEG, USED_HEAP_LEG);
433-
chartDescriptor.setDetailsItems(new String[] { HEAP_SIZE, USED_HEAP, MAX_HEAP });
435+
chartDescriptor.addLineFillItems(HEAP_SIZE_LEG, USED_HEAP_LEG);
436+
chartDescriptor.setDetailsItems(new String[] { HEAP_SIZE, USED_HEAP, MAX_HEAP });
434437

435-
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
436-
model.registerHeapChartSupport(chartSupport);
437-
438-
chartSupport.setZoomingEnabled(!liveModel);
438+
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
439+
model.registerHeapChartSupport(chartSupport);
440+
441+
chartSupport.setZoomingEnabled(!liveModel);
442+
}
439443
}
440444

441-
private void initComponents(ApplicationMonitorModel model) {
445+
private void initComponents() {
442446
setLayout(new BorderLayout());
443447
setOpaque(false);
444448

445-
if (model.isMemoryMonitoringSupported()) {
449+
if (memoryMonitoringSupported) {
446450
add(chartSupport.getChart(), BorderLayout.CENTER);
447451
chartSupport.updateDetails(new String[] { UNKNOWN, UNKNOWN, UNKNOWN });
448452
} else {
@@ -466,7 +470,7 @@ private static class PermGenViewSupport extends JPanel {
466470

467471
public PermGenViewSupport(ApplicationMonitorModel model) {
468472
initModels(model);
469-
initComponents(model);
473+
initComponents();
470474
}
471475

472476
public DataViewComponent.DetailsView getDetailsView() {
@@ -492,29 +496,31 @@ private void initModels(ApplicationMonitorModel model) {
492496
memoryMonitoringSupported = model.isMemoryMonitoringSupported();
493497
permgenName = model.getPermgenName();
494498

495-
String PERM_SIZE = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_PermGen_size"); // NOI18N
496-
String PERM_SIZE_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_PermGen_size_leg", permgenName); // NOI18N
497-
String USED_PERM = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_PermGen"); // NOI18N
498-
String USED_PERM_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_PermGen_leg", permgenName); // NOI18N
499-
String MAX_PERM = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Max_PermGen_size"); // NOI18N
499+
if (memoryMonitoringSupported) {
500+
String PERM_SIZE = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_PermGen_size"); // NOI18N
501+
String PERM_SIZE_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_PermGen_size_leg", permgenName); // NOI18N
502+
String USED_PERM = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_PermGen"); // NOI18N
503+
String USED_PERM_LEG = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Used_PermGen_leg", permgenName); // NOI18N
504+
String MAX_PERM = NbBundle.getMessage(ApplicationMonitorView.class, "LBL_Max_PermGen_size"); // NOI18N
500505

501-
SimpleXYChartDescriptor chartDescriptor =
502-
SimpleXYChartDescriptor.bytes(10 * 1024 * 1024, false, model.getChartCache());
506+
SimpleXYChartDescriptor chartDescriptor =
507+
SimpleXYChartDescriptor.bytes(10 * 1024 * 1024, false, model.getChartCache());
503508

504-
chartDescriptor.addLineFillItems(PERM_SIZE_LEG, USED_PERM_LEG);
505-
chartDescriptor.setDetailsItems(new String[] { PERM_SIZE, USED_PERM, MAX_PERM });
509+
chartDescriptor.addLineFillItems(PERM_SIZE_LEG, USED_PERM_LEG);
510+
chartDescriptor.setDetailsItems(new String[] { PERM_SIZE, USED_PERM, MAX_PERM });
506511

507-
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
508-
model.registerPermGenChartSupport(chartSupport);
509-
510-
chartSupport.setZoomingEnabled(!liveModel);
512+
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
513+
model.registerPermGenChartSupport(chartSupport);
514+
515+
chartSupport.setZoomingEnabled(!liveModel);
516+
}
511517
}
512518

513-
private void initComponents(ApplicationMonitorModel model) {
519+
private void initComponents() {
514520
setLayout(new BorderLayout());
515521
setOpaque(false);
516522

517-
if (model.isMemoryMonitoringSupported()) {
523+
if (memoryMonitoringSupported) {
518524
add(chartSupport.getChart(), BorderLayout.CENTER);
519525
chartSupport.updateDetails(new String[] { UNKNOWN, UNKNOWN, UNKNOWN });
520526
} else {
@@ -544,7 +550,7 @@ private static class ClassesViewSupport extends JPanel {
544550

545551
public ClassesViewSupport(ApplicationMonitorModel model) {
546552
initModels(model);
547-
initComponents(model);
553+
initComponents();
548554
}
549555

550556
public DataViewComponent.DetailsView getDetailsView() {
@@ -571,24 +577,26 @@ private void initModels(ApplicationMonitorModel model) {
571577
liveModel = model.isLive();
572578
classMonitoringSupported = model.isClassMonitoringSupported();
573579

574-
SimpleXYChartDescriptor chartDescriptor =
575-
SimpleXYChartDescriptor.decimal(100, false, model.getChartCache());
580+
if (classMonitoringSupported) {
581+
SimpleXYChartDescriptor chartDescriptor =
582+
SimpleXYChartDescriptor.decimal(100, false, model.getChartCache());
576583

577-
chartDescriptor.addLineItems(TOTAL_LOADED_LEG, SHARED_LOADED_LEG);
578-
chartDescriptor.setDetailsItems(new String[] { TOTAL_LOADED, SHARED_LOADED,
579-
TOTAL_UNLOADED, SHARED_UNLOADED });
584+
chartDescriptor.addLineItems(TOTAL_LOADED_LEG, SHARED_LOADED_LEG);
585+
chartDescriptor.setDetailsItems(new String[] { TOTAL_LOADED, SHARED_LOADED,
586+
TOTAL_UNLOADED, SHARED_UNLOADED });
580587

581-
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
582-
model.registerClassesChartSupport(chartSupport);
583-
584-
chartSupport.setZoomingEnabled(!liveModel);
588+
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
589+
model.registerClassesChartSupport(chartSupport);
590+
591+
chartSupport.setZoomingEnabled(!liveModel);
592+
}
585593
}
586594

587-
private void initComponents(ApplicationMonitorModel model) {
595+
private void initComponents() {
588596
setLayout(new BorderLayout());
589597
setOpaque(false);
590598

591-
if (model.isClassMonitoringSupported()) {
599+
if (classMonitoringSupported) {
592600
add(chartSupport.getChart(), BorderLayout.CENTER);
593601
chartSupport.updateDetails(new String[] { UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN });
594602
} else {
@@ -618,7 +626,7 @@ private static class ThreadsViewSupport extends JPanel {
618626

619627
public ThreadsViewSupport(ApplicationMonitorModel model) {
620628
initModels(model);
621-
initComponents(model);
629+
initComponents();
622630
}
623631

624632
public DataViewComponent.DetailsView getDetailsView() {
@@ -645,24 +653,26 @@ private void initModels(ApplicationMonitorModel model) {
645653
liveModel = model.isLive();
646654
threadsMonitoringSupported = model.isThreadsMonitoringSupported();
647655

648-
SimpleXYChartDescriptor chartDescriptor =
649-
SimpleXYChartDescriptor.decimal(3, false, model.getChartCache());
656+
if (threadsMonitoringSupported) {
657+
SimpleXYChartDescriptor chartDescriptor =
658+
SimpleXYChartDescriptor.decimal(3, false, model.getChartCache());
650659

651-
chartDescriptor.addLineItems(LIVE_LEG, DAEMON_LEG);
652-
chartDescriptor.setDetailsItems(new String[] { LIVE, DAEMON,
653-
PEAK, STARTED });
660+
chartDescriptor.addLineItems(LIVE_LEG, DAEMON_LEG);
661+
chartDescriptor.setDetailsItems(new String[] { LIVE, DAEMON,
662+
PEAK, STARTED });
654663

655-
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
656-
model.registerThreadsChartSupport(chartSupport);
657-
658-
chartSupport.setZoomingEnabled(!liveModel);
664+
chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
665+
model.registerThreadsChartSupport(chartSupport);
666+
667+
chartSupport.setZoomingEnabled(!liveModel);
668+
}
659669
}
660670

661-
private void initComponents(ApplicationMonitorModel model) {
671+
private void initComponents() {
662672
setLayout(new BorderLayout());
663673
setOpaque(false);
664674

665-
if (model.isThreadsMonitoringSupported()) {
675+
if (threadsMonitoringSupported) {
666676
add(chartSupport.getChart(), BorderLayout.CENTER);
667677
chartSupport.updateDetails(new String[] { UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN });
668678
} else {

visualvm/appui/src/org/graalvm/visualvm/modules/appui/actions/VisualVMActionsSupportProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
package org.graalvm.visualvm.modules.appui.actions;
2626

27+
import java.awt.Toolkit;
2728
import java.awt.event.InputEvent;
2829
import java.awt.event.KeyEvent;
2930
import javax.swing.Action;
@@ -47,9 +48,9 @@ public KeyStroke registerAction(String actionKey, Action action, ActionMap actio
4748
KeyStroke ks = null;
4849

4950
if (FilterUtils.FILTER_ACTION_KEY.equals(actionKey)) {
50-
ks = KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_MASK);
51+
ks = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
5152
} else if (SearchUtils.FIND_ACTION_KEY.equals(actionKey)) {
52-
ks = KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK);
53+
ks = KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
5354
} else if (SearchUtils.FIND_NEXT_ACTION_KEY.equals(actionKey)) {
5455
ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0);
5556
} else if (SearchUtils.FIND_PREV_ACTION_KEY.equals(actionKey)) {

visualvm/heapviewer/src/org/graalvm/visualvm/heapviewer/java/impl/JavaFieldsPlugin.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ public void run() {
207207
return nodes == null || nodes.length == 0 ? new HeapViewerNode[] { new TextNode(filtered ? Bundle.JavaFieldsPlugin_NoFieldsFiltered() : Bundle.JavaFieldsPlugin_NoFields()) } : nodes;
208208
}
209209

210+
SwingUtilities.invokeLater(new Runnable() {
211+
public void run() {
212+
if (!CCONF_INSTANCE.equals(objectsView.getCurrentColumnConfiguration()))
213+
objectsView.configureColumns(CCONF_INSTANCE);
214+
}
215+
});
216+
210217
return new HeapViewerNode[] { new TextNode(Bundle.JavaFieldsPlugin_NoSelection()) };
211218
}
212219
@Override

0 commit comments

Comments
 (0)