Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 409309
Collapse All | Expand All

(-)a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/clientscripting/ClientScriptingSupport.java (-3 / +10 lines)
Lines 26-32 Link Here
26
    = "org.eclipse.rap.clientscripting.ClientListener";
26
    = "org.eclipse.rap.clientscripting.ClientListener";
27
27
28
  public static boolean isClientListener( Listener listener ) {
28
  public static boolean isClientListener( Listener listener ) {
29
    return CLIENT_LISTENER_CLASS_NAME.equals( listener.getClass().getName() );
29
    Class clazz = listener.getClass();
30
    while( clazz != null ) {
31
      if( CLIENT_LISTENER_CLASS_NAME.equals( clazz.getName() ) ) {
32
        return true;
33
      }
34
      clazz = clazz.getSuperclass();
35
    }
36
    return false;
30
  }
37
  }
31
38
32
  public static void addClientListenerTo( Widget widget, int eventType, Listener listener ) {
39
  public static void addClientListenerTo( Widget widget, int eventType, Listener listener ) {
Lines 54-61 Link Here
54
  }
61
  }
55
62
56
  private static Method findMethod( String methodName, Listener listener ) {
63
  private static Method findMethod( String methodName, Listener listener ) {
57
    Method[] declaredMethods = listener.getClass().getDeclaredMethods();
64
    Method[] methods = listener.getClass().getMethods();
58
    for( Method method : declaredMethods ) {
65
    for( Method method : methods ) {
59
      if( hasClientListenerSignature( methodName, method ) ) {
66
      if( hasClientListenerSignature( methodName, method ) ) {
60
        return method;
67
        return method;
61
      }
68
      }
(-)a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/events/EventLCAUtil_Test.java (+11 lines)
Lines 176-181 Link Here
176
  }
176
  }
177
177
178
  @Test
178
  @Test
179
  public void testIsListening_withSubclassedClientListenerOnly() {
180
    Button button = new Button( shell, SWT.PUSH );
181
    button.addListener( SWT.Selection, new TestClientListener() );
182
183
    assertFalse( EventLCAUtil.isListening( button, SWT.Selection ) );
184
  }
185
186
  @Test
179
  public void testIsListening_withClientListenerAndSWTListener() {
187
  public void testIsListening_withClientListenerAndSWTListener() {
180
    Button button = new Button( shell, SWT.PUSH );
188
    Button button = new Button( shell, SWT.PUSH );
181
    button.addListener( SWT.Selection, mock( Listener.class ) );
189
    button.addListener( SWT.Selection, mock( Listener.class ) );
Lines 184-187 Link Here
184
    assertTrue( EventLCAUtil.isListening( button, SWT.Selection ) );
192
    assertTrue( EventLCAUtil.isListening( button, SWT.Selection ) );
185
  }
193
  }
186
194
195
  private class TestClientListener extends ClientListener {
196
  }
197
187
}
198
}

Return to bug 409309