mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
MouseWheelEventEx: don't warn on absent getScrollingDelta method
This commit is contained in:
@@ -27,7 +27,7 @@ import java.awt.event.MouseWheelEvent;
|
||||
* an <a href="https://github.com/JetBrains/jdk8u_jdk/commit/a3cb8807b148879e9c70a74a8a16c30a28991581">implementation</a> for Mac OS X).
|
||||
*/
|
||||
class MouseWheelEventEx {
|
||||
private static final MethodInvocator ourGetScrollingDeltaMethod = new MethodInvocator(MouseWheelEvent.class, "getScrollingDelta");
|
||||
private static final MethodInvocator ourGetScrollingDeltaMethod = new MethodInvocator(false, MouseWheelEvent.class, "getScrollingDelta");
|
||||
|
||||
/**
|
||||
* Returns scrolling delta as an absolute value (if available).
|
||||
|
||||
@@ -26,6 +26,10 @@ public class MethodInvocator {
|
||||
private Method myMethod;
|
||||
|
||||
public MethodInvocator(Class<?> aClass, String method, Class<?>... parameterTypes) {
|
||||
this(true, aClass, method, parameterTypes);
|
||||
}
|
||||
|
||||
public MethodInvocator(boolean warnIfAbsent, Class<?> aClass, String method, Class<?>... parameterTypes) {
|
||||
try {
|
||||
myMethod = aClass.getDeclaredMethod(method, parameterTypes);
|
||||
|
||||
@@ -34,7 +38,9 @@ public class MethodInvocator {
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
LOG.warn("Method not found: " + aClass.getName() + "." + method);
|
||||
if (warnIfAbsent) {
|
||||
LOG.warn("Method not found: " + aClass.getName() + "." + method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user