Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-12-18 16:12:23 +0000
committerAlexander Kurtakov2015-12-18 16:25:13 +0000
commit6b8dc741cceb8d64fbda9b111255acad6073227e (patch)
tree6cc0f3d890e908e5cfff4768f10654822a71a605 /bundles
parent9227d728eba1d0a4ac6bdb3c2c1622885187e116 (diff)
downloadeclipse.platform.swt-6b8dc741cceb8d64fbda9b111255acad6073227e.tar.gz
eclipse.platform.swt-6b8dc741cceb8d64fbda9b111255acad6073227e.tar.xz
eclipse.platform.swt-6b8dc741cceb8d64fbda9b111255acad6073227e.zip
Bug 484699 - Use vararg reflection methods in SWT_AWT
Less code to read is always good. Change-Id: I118a0664330724cb7f9896ad7d6099ba74d8aabc Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java46
1 files changed, 16 insertions, 30 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
index 0a47aefbc5..de63e75883 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
@@ -10,34 +10,22 @@
*******************************************************************************/
package org.eclipse.swt.awt;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
+/* AWT Imports */
+import java.awt.*;
+import java.awt.Canvas;
+import java.awt.event.*;
+import java.lang.reflect.*;
/* SWT Imports */
import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.graphics.Device;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Event;
-/* AWT Imports */
-import java.awt.AWTEvent;
-import java.awt.Dimension;
-import java.awt.EventQueue;
-import java.awt.Canvas;
-import java.awt.Frame;
-import java.awt.Window;
-import java.awt.event.AWTEventListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.WindowEvent;
-
/**
* This class provides a bridge between SWT and AWT, so that it
@@ -97,11 +85,9 @@ static synchronized void initializeSwing() {
OS.gdk_error_trap_push();
try {
/* Initialize the default focus traversal policy */
- Class<?>[] emptyClass = new Class[0];
- Object[] emptyObject = new Object[0];
Class<?> clazz = Class.forName("javax.swing.UIManager");
- Method method = clazz.getMethod("getDefaults", emptyClass);
- if (method != null) method.invoke(clazz, emptyObject);
+ Method method = clazz.getMethod("getDefaults");
+ if (method != null) method.invoke(clazz);
} catch (Throwable e) {}
}
@@ -169,12 +155,12 @@ public static Frame new_Frame (final Composite parent) {
Object value = null;
Constructor<?> constructor = null;
try {
- constructor = clazz.getConstructor (new Class [] {int.class, boolean.class});
- value = constructor.newInstance (new Object [] {new Integer ((int)/*64*/handle), Boolean.TRUE});
+ constructor = clazz.getConstructor (int.class, boolean.class);
+ value = constructor.newInstance (new Integer ((int)/*64*/handle), Boolean.TRUE);
} catch (Throwable e1) {
try {
- constructor = clazz.getConstructor (new Class [] {long.class, boolean.class});
- value = constructor.newInstance (new Object [] {new Long (handle), Boolean.TRUE});
+ constructor = clazz.getConstructor (long.class, boolean.class);
+ value = constructor.newInstance (new Long (handle), Boolean.TRUE);
} catch (Throwable e2) {
SWT.error (SWT.ERROR_NOT_IMPLEMENTED, e2);
}
@@ -187,8 +173,8 @@ public static Frame new_Frame (final Composite parent) {
}
try {
/* Call registerListeners() to make XEmbed focus traversal work */
- Method method = clazz.getMethod("registerListeners", (Class[])null);
- if (method != null) method.invoke(value, (Object[])null);
+ Method method = clazz.getMethod("registerListeners");
+ if (method != null) method.invoke(value);
} catch (Throwable e) {}
final AWTEventListener awtListener = new AWTEventListener() {
public void eventDispatched(AWTEvent event) {

Back to the top