File tree Expand file tree Collapse file tree 4 files changed +51
-20
lines changed
heapdump/src/org/graalvm/visualvm/heapdump
lib.profiler.ui/src/org/graalvm/visualvm/lib/ui/swing
profiler.api/src/org/graalvm/visualvm/lib/profiler/api
profiler.heapwalker/src/org/graalvm/visualvm/lib/profiler/heapwalk/details/jdk/ui Expand file tree Collapse file tree 4 files changed +51
-20
lines changed Original file line number Diff line number Diff line change 29
29
import org .graalvm .visualvm .core .snapshot .Snapshot ;
30
30
import org .graalvm .visualvm .core .snapshot .SnapshotsSupport ;
31
31
import java .io .File ;
32
+ import org .graalvm .visualvm .core .datasupport .Utils ;
32
33
import org .openide .util .NbBundle ;
33
34
34
35
/**
39
40
*/
40
41
public abstract class HeapDump extends Snapshot {
41
42
43
+ private static final String HWCACHE_EXT = ".hwcache" ; // NOI18N
44
+
42
45
/**
43
46
* Creates new instance of HeapDump with the data stored in a file.
44
47
*
@@ -65,5 +68,19 @@ public boolean supportsSaveAs() {
65
68
public void saveAs () {
66
69
SnapshotsSupport .getInstance ().saveAs (this , NbBundle .getMessage (HeapDump .class , "LBL_Save_Heap_Dump_As" )); // NOI18N
67
70
}
71
+
72
+ protected void remove () {
73
+ final File f = getFile ();
74
+
75
+ // #GH-111: delete the corresponding .hwcache directory
76
+ if (f != null ) Utils .FILE_QUEUE .post (new Runnable () {
77
+ public void run () {
78
+ File ff = new File (f .getParent (), f .getName () + HWCACHE_EXT );
79
+ if (ff .isDirectory ()) Utils .delete (ff , true );
80
+ }
81
+ });
82
+
83
+ super .remove ();
84
+ }
68
85
69
86
}
Original file line number Diff line number Diff line change 43
43
44
44
package org .graalvm .visualvm .lib .ui .swing ;
45
45
46
+ import java .awt .AWTEvent ;
46
47
import java .awt .Component ;
47
48
import java .awt .Dimension ;
48
49
import java .awt .Graphics ;
@@ -1567,6 +1568,37 @@ boolean isChangingModel() {
1567
1568
return changingModel ;
1568
1569
}
1569
1570
1571
+
1572
+ // --- Handle supported/unsupported AWT Events for the JTree -----------
1573
+
1574
+ protected void processEvent (AWTEvent e ) {
1575
+ if (e instanceof KeyEvent ) {
1576
+ if (supportsKeyEvent ((KeyEvent )e )) super .processEvent (e );
1577
+ } else if (e instanceof MouseEvent ) {
1578
+ if (supportsMouseEvent ((MouseEvent )e )) super .processEvent (e );
1579
+ }
1580
+ }
1581
+
1582
+ private boolean supportsKeyEvent (KeyEvent e ) {
1583
+ switch (e .getKeyCode ()) {
1584
+ // Bugfix #GH-109
1585
+ // Handled by the table
1586
+ case KeyEvent .VK_PAGE_UP :
1587
+ case KeyEvent .VK_PAGE_DOWN :
1588
+ return false ;
1589
+
1590
+ default :
1591
+ return true ;
1592
+ }
1593
+ }
1594
+
1595
+ private boolean supportsMouseEvent (MouseEvent e ) {
1596
+ return true ;
1597
+ }
1598
+
1599
+ // ---------------------------------------------------------------------
1600
+
1601
+
1570
1602
public String toString () {
1571
1603
return getCellRenderer ().toString ();
1572
1604
}
Original file line number Diff line number Diff line change @@ -163,25 +163,7 @@ public String getPlatformJDKVersion() {
163
163
return null ;
164
164
}
165
165
166
- if (ver .startsWith ("1.5" )) {
167
- return CommonConstants .JDK_15_STRING ; // NOI18N
168
- } else if (ver .startsWith ("1.6" )) {
169
- return CommonConstants .JDK_16_STRING ; // NOI18N
170
- } else if (ver .startsWith ("1.7" )) {
171
- return CommonConstants .JDK_17_STRING ; // NOI18N
172
- } else if (ver .startsWith ("1.8" )) {
173
- return CommonConstants .JDK_18_STRING ; // NOI18N
174
- } else if (ver .startsWith ("1.9" )) {
175
- return CommonConstants .JDK_19_STRING ; // NOI18N
176
- } else if (ver .equals ("9" ) || ver .startsWith ("9." )) {
177
- return CommonConstants .JDK_19_STRING ; // NOI18N
178
- } else if (ver .equals ("10" ) || ver .startsWith ("10." )) {
179
- return CommonConstants .JDK_100_STRING ; // NOI18N
180
- } else if (ver .equals ("11" ) || ver .startsWith ("11." )) {
181
- return CommonConstants .JDK_110_STRING ; // NOI18N
182
- } else {
183
- return null ;
184
- }
166
+ return Platform .getJDKVersionString (ver );
185
167
}
186
168
187
169
/** Gets a path to java executable for specified platform. The platform passed cannot be null.
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ protected void setupInstance(T instance) {}
218
218
219
219
final T createInstance () {
220
220
T instance = createInstanceImpl ();
221
- if (instance != null ) setupInstance (instance );
221
+ if (instance != null ) try { setupInstance (instance ); } catch ( Throwable t ) {} // #GH-110: setting up the instance may fail at any time
222
222
return instance ;
223
223
}
224
224
You can’t perform that action at this time.
0 commit comments