mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diagnostics for IDEA-143603 (unable to paste text copied from other applications)
This commit is contained in:
@@ -521,6 +521,8 @@ public class IdeEventQueue extends EventQueue {
|
||||
}
|
||||
|
||||
myEventCount++;
|
||||
|
||||
traceClipboardEvents(e);
|
||||
|
||||
if (e instanceof WindowEvent) {
|
||||
processAppActivationEvents((WindowEvent)e);
|
||||
@@ -648,6 +650,40 @@ public class IdeEventQueue extends EventQueue {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Field ourInvocationEventRunnableAccessor;
|
||||
|
||||
static {
|
||||
Field field = null;
|
||||
if (Registry.is("trace.clipboard.events") && SystemInfo.isJavaVersionAtLeast("1.8.0_60")) {
|
||||
try {
|
||||
field = InvocationEvent.class.getDeclaredField("runnable");
|
||||
field.setAccessible(true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.warn("Error creating accessor for java.awt.event.InvocationEvent.runnable field", e);
|
||||
}
|
||||
}
|
||||
ourInvocationEventRunnableAccessor = field;
|
||||
}
|
||||
|
||||
private static void traceClipboardEvents(AWTEvent e) {
|
||||
if (ourInvocationEventRunnableAccessor != null && e instanceof InvocationEvent && e.getClass().getName().equals("sun.awt.PeerEvent")) {
|
||||
try {
|
||||
Object r = ourInvocationEventRunnableAccessor.get(e);
|
||||
if (r != null) {
|
||||
String className = r.getClass().getName();
|
||||
// This check for event constructed in SunClipboard.lostOwnershipLater() (known to work with JDK 8u60)
|
||||
if (className.contains("sun.awt.datatransfer.SunClipboard") && className.contains("Lambda")) {
|
||||
LOG.info("Clipboard has been set by other application");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
LOG.warn("Error accessing java.awt.event.InvocationEvent.runnable field");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MouseEvent lastClickEvent = null;
|
||||
private long lastClickTime = 0L;
|
||||
|
||||
|
||||
@@ -653,4 +653,8 @@ ruby.remote.debugger.supports.catchpoint.removal=true
|
||||
|
||||
use.read.action.to.init.service=true
|
||||
|
||||
ide.mac.new.color.picker=false
|
||||
ide.mac.new.color.picker=false
|
||||
|
||||
trace.clipboard.events=false
|
||||
trace.clipboard.events.description=Enable detection and logging of OS notifications about external clipboard changes
|
||||
trace.clipboard.events.restartRequired=true
|
||||
Reference in New Issue
Block a user