Skip to content

Commit 8c66117

Browse files
committed
Merge branch 'master' into graal
2 parents 34b584d + 027c9b7 commit 8c66117

File tree

4 files changed

+51
-20
lines changed
  • visualvm

4 files changed

+51
-20
lines changed

visualvm/heapdump/src/org/graalvm/visualvm/heapdump/HeapDump.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.graalvm.visualvm.core.snapshot.Snapshot;
3030
import org.graalvm.visualvm.core.snapshot.SnapshotsSupport;
3131
import java.io.File;
32+
import org.graalvm.visualvm.core.datasupport.Utils;
3233
import org.openide.util.NbBundle;
3334

3435
/**
@@ -39,6 +40,8 @@
3940
*/
4041
public abstract class HeapDump extends Snapshot {
4142

43+
private static final String HWCACHE_EXT = ".hwcache"; // NOI18N
44+
4245
/**
4346
* Creates new instance of HeapDump with the data stored in a file.
4447
*
@@ -65,5 +68,19 @@ public boolean supportsSaveAs() {
6568
public void saveAs() {
6669
SnapshotsSupport.getInstance().saveAs(this, NbBundle.getMessage(HeapDump.class, "LBL_Save_Heap_Dump_As")); // NOI18N
6770
}
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+
}
6885

6986
}

visualvm/libs.profiler/lib.profiler.ui/src/org/graalvm/visualvm/lib/ui/swing/ProfilerTreeTable.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
package org.graalvm.visualvm.lib.ui.swing;
4545

46+
import java.awt.AWTEvent;
4647
import java.awt.Component;
4748
import java.awt.Dimension;
4849
import java.awt.Graphics;
@@ -1567,6 +1568,37 @@ boolean isChangingModel() {
15671568
return changingModel;
15681569
}
15691570

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+
15701602
public String toString() {
15711603
return getCellRenderer().toString();
15721604
}

visualvm/libs.profiler/profiler.api/src/org/graalvm/visualvm/lib/profiler/api/JavaPlatform.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,25 +163,7 @@ public String getPlatformJDKVersion() {
163163
return null;
164164
}
165165

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);
185167
}
186168

187169
/** Gets a path to java executable for specified platform. The platform passed cannot be null.

visualvm/libs.profiler/profiler.heapwalker/src/org/graalvm/visualvm/lib/profiler/heapwalk/details/jdk/ui/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ protected void setupInstance(T instance) {}
218218

219219
final T createInstance() {
220220
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
222222
return instance;
223223
}
224224

0 commit comments

Comments
 (0)