summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-26 10:51:57 +0200
committerNoel Grandin <noel@peralex.com>2014-11-27 09:27:05 +0200
commitd4daa09f94085a0fb11f4574756929418a48bf48 (patch)
tree4aa02c3f262e90b327654329b792279a7d1c07d1 /wizards
parentc0d1f38fb4de1bfa3eea0501e36e85e8dd3a0269 (diff)
java,wizards: remove unnecessary use of reflection
Change-Id: I44750fa6673c7b5e0a796b6e443028aa3a5e68fc
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java15
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java7
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java7
3 files changed, 19 insertions, 10 deletions
diff --git a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
index ca0ec1f5e6af..013fb547ca2b 100644
--- a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
+++ b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
@@ -31,8 +31,6 @@ import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.NamedValueCollection;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.ui.WizardDialog;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -89,7 +87,12 @@ public abstract class DatabaseObjectWizard extends WizardDialog
}
}
- protected static void executeWizardFromCommandLine( final String i_args[], final String i_className )
+ public interface WizardFromCommandLineStarter
+ {
+ void start(XMultiServiceFactory factory, PropertyValue[] curproperties);
+ }
+
+ protected static void executeWizardFromCommandLine( final String i_args[], WizardFromCommandLineStarter starter )
{
final String settings[] = new String[] { null, null, null };
final int IDX_PIPE_NAME = 0;
@@ -156,11 +159,7 @@ public abstract class DatabaseObjectWizard extends WizardDialog
else
curproperties[0] = Properties.createProperty( "DataSourceName", settings[ IDX_DSN ] );
- final Class wizardClass = Class.forName( i_className );
- final Constructor ctor = wizardClass.getConstructor( XMultiServiceFactory.class, PropertyValue[].class );
- final Method invokeMethod = wizardClass.getMethod( "start", new Class[0] );
- final Object wizardInstance = ctor.newInstance( serviceFactory, curproperties );
- invokeMethod.invoke( wizardInstance );
+ starter.start(serviceFactory, curproperties);
}
}
catch (java.lang.Exception jexception)
diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java
index 44dcec827aab..17e45ba65fcc 100644
--- a/wizards/com/sun/star/wizards/form/FormWizard.java
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -84,7 +84,12 @@ public class FormWizard extends DatabaseObjectWizard
public static void main(String i_args[])
{
- executeWizardFromCommandLine( i_args, FormWizard.class.getName() );
+ executeWizardFromCommandLine( i_args, new WizardFromCommandLineStarter() {
+ public void start(XMultiServiceFactory factory, PropertyValue[] curproperties) {
+ FormWizard wizard = new FormWizard(factory, curproperties);
+ wizard.start();
+ }
+ });
}
// @Override
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
index 1e068af5698f..e47ffe58d561 100644
--- a/wizards/com/sun/star/wizards/query/QueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -79,7 +79,12 @@ public class QueryWizard extends DatabaseObjectWizard
public static void main(String i_args[])
{
- executeWizardFromCommandLine( i_args, QueryWizard.class.getName() );
+ executeWizardFromCommandLine( i_args, new WizardFromCommandLineStarter() {
+ public void start(XMultiServiceFactory factory, PropertyValue[] curproperties) {
+ QueryWizard wizard = new QueryWizard(factory, curproperties);
+ wizard.start();
+ }
+ });
}
public final XFrame getFrame()