1 11 package org.eclipse.ant.internal.ui.antsupport; 12 13 14 import java.text.MessageFormat ; 16 import org.apache.tools.ant.BuildException; 17 import org.apache.tools.ant.Project; 18 import org.apache.tools.ant.input.DefaultInputHandler; 19 import org.apache.tools.ant.input.InputHandler; 20 21 25 class InputHandlerSetter { 26 27 protected void setInputHandler(Project project, String inputHandlerClassname) { 28 InputHandler handler = null; 29 if (inputHandlerClassname == null) { 30 handler = new DefaultInputHandler(); 31 } else { 32 try { 33 handler = (InputHandler)(Class.forName(inputHandlerClassname).newInstance()); 34 } catch (ClassCastException e) { 35 String msg = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.The_specified_input_handler_class_{0}_does_not_implement_the_org.apache.tools.ant.input.InputHandler_interface_5"), new String []{inputHandlerClassname}); throw new BuildException(msg, e); 37 } catch (Exception e) { 38 String msg = MessageFormat.format(RemoteAntMessages.getString("InternalAntRunner.Unable_to_instantiate_specified_input_handler_class_{0}___{1}_6"), new String []{inputHandlerClassname, e.getClass().getName()}); throw new BuildException(msg, e); 40 } 41 } 42 project.setInputHandler(handler); 43 } 44 } 45 | Popular Tags |