11/*******************************************************************************
2- * Copyright (c) 2021, 2022 Joerg Kubitz
2+ * Copyright (c) 2021 Joerg Kubitz
33 *
44 * This program and the accompanying materials
55 * are made available under the terms of the Eclipse Public License 2.0
1313 *******************************************************************************/
1414package org .eclipse .swt .widgets ;
1515
16- import java .lang .reflect .InvocationTargetException ;
17- import java .lang .reflect .Method ;
18-
1916import org .junit .Test ;
2017
2118public class Test_org_eclipse_swt_widgets_Display {
@@ -24,28 +21,8 @@ public class Test_org_eclipse_swt_widgets_Display {
2421 public void test_isXMouseActive () {
2522 Display display = new Display ();
2623 try {
27- // boolean xMouseActive = display.isXMouseActive();
28- // System.out.println("org.eclipse.swt.widgets.Display.isXMouseActive(): " + xMouseActive);
29-
30- // Calling above method using reflection method call.
31- Method method = Class .forName (Display .class .getName ()).getDeclaredMethod ("isXMouseActive" );
32- Boolean xMouseActive = null ;
33- if (method != null && method .canAccess (display )) {
34- xMouseActive = (Boolean ) method .invoke (display , (Object []) null );
35- }
24+ boolean xMouseActive = display .isXMouseActive ();
3625 System .out .println ("org.eclipse.swt.widgets.Display.isXMouseActive(): " + xMouseActive );
37- } catch (NoSuchMethodException e ) {
38- e .printStackTrace ();
39- } catch (SecurityException e ) {
40- e .printStackTrace ();
41- } catch (IllegalAccessException e ) {
42- e .printStackTrace ();
43- } catch (IllegalArgumentException e ) {
44- e .printStackTrace ();
45- } catch (InvocationTargetException e ) {
46- e .printStackTrace ();
47- } catch (ClassNotFoundException e ) {
48- e .printStackTrace ();
4926 } finally {
5027 display .dispose ();
5128 }
0 commit comments