mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-18 04:34:25 +00:00
using new constructor mechanism #36
This commit is contained in:
parent
9151c49983
commit
253ad08520
@ -19,6 +19,7 @@
|
||||
*/
|
||||
package com.webcodepro.applecommander.ui;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@ -95,7 +96,8 @@ public class AppleCommander {
|
||||
try {
|
||||
swtAppleCommander = Class.forName(
|
||||
"com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$
|
||||
Object object = swtAppleCommander.newInstance();
|
||||
Constructor<?> constructor = swtAppleCommander.getConstructor();
|
||||
Object object = constructor.newInstance();
|
||||
Method launchMethod = swtAppleCommander.
|
||||
getMethod("launch", (Class[]) null); //$NON-NLS-1$
|
||||
launchMethod.invoke(object, (Object[]) null);
|
||||
@ -149,7 +151,8 @@ public class AppleCommander {
|
||||
try {
|
||||
swingAppleCommander = Class.forName(
|
||||
"com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$
|
||||
Object object = swingAppleCommander.newInstance();
|
||||
Constructor<?> constructor = swingAppleCommander.getConstructor();
|
||||
Object object = constructor.newInstance();
|
||||
Method launchMethod = swingAppleCommander.
|
||||
getMethod("launch", (Class[]) null); //$NON-NLS-1$
|
||||
launchMethod.invoke(object, (Object[]) null);
|
||||
|
@ -26,6 +26,8 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -1602,13 +1604,22 @@ public class DiskExplorerTab {
|
||||
FileViewerWindow window = null;
|
||||
FileFilter fileFilter = null;
|
||||
try {
|
||||
fileFilter = fileFilterClass.newInstance();
|
||||
Constructor<? extends FileFilter> constructor = fileFilterClass.getConstructor();
|
||||
fileFilter = constructor.newInstance();
|
||||
} catch (NullPointerException ex) {
|
||||
// This is expected
|
||||
} catch (InstantiationException e) {
|
||||
SwtUtil.showSystemErrorDialog(shell, e);
|
||||
} catch (IllegalAccessException e) {
|
||||
SwtUtil.showSystemErrorDialog(shell, e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
SwtUtil.showSystemErrorDialog(shell, e);
|
||||
} catch (SecurityException e) {
|
||||
SwtUtil.showSystemErrorDialog(shell, e);
|
||||
} catch (IllegalArgumentException e) {
|
||||
SwtUtil.showSystemErrorDialog(shell, e);
|
||||
} catch (InvocationTargetException e) {
|
||||
SwtUtil.showSystemErrorDialog(shell, e);
|
||||
}
|
||||
if (fileFilter != null) {
|
||||
window = new FileViewerWindow(shell, fileEntry, imageManager, fileFilter);
|
||||
|
Loading…
x
Reference in New Issue
Block a user