Kaydet (Commit) d4daa09f authored tarafından Noel Grandin's avatar Noel Grandin

java,wizards: remove unnecessary use of reflection

Change-Id: I44750fa6673c7b5e0a796b6e443028aa3a5e68fc
üst c0d1f38f
......@@ -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)
......
......@@ -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
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment