1 19 20 package org.apache.tools.ant.module.bridge; 21 22 import java.io.File ; 23 import java.io.InputStream ; 24 import java.util.Enumeration ; 25 import java.util.List ; 26 import java.util.Map ; 27 import org.apache.tools.ant.module.AntModule; 28 import org.netbeans.api.progress.ProgressHandle; 29 import org.openide.ErrorManager; 30 import org.openide.util.NbBundle; 31 import org.openide.util.Enumerations; 32 import org.openide.windows.OutputWriter; 33 34 38 final class DummyBridgeImpl implements BridgeInterface, IntrospectionHelperProxy { 39 40 private final Throwable problem; 41 42 public DummyBridgeImpl(Throwable problem) { 43 this.problem = problem; 44 AntModule.err.notify(ErrorManager.INFORMATIONAL, problem); 45 } 46 47 public String getAntVersion() { 48 return NbBundle.getMessage(DummyBridgeImpl.class, "ERR_ant_not_loadable", problem); 49 } 50 51 public boolean isAnt16() { 52 return false; 53 } 54 55 public IntrospectionHelperProxy getIntrospectionHelper(Class clazz) { 56 return this; 57 } 58 59 public Class getAttributeType(String name) { 60 throw new IllegalStateException (); 61 } 62 63 public Enumeration <String > getAttributes() { 64 return Enumerations.empty(); 65 } 66 67 public Class getElementType(String name) { 68 throw new IllegalStateException (); 69 } 70 71 public Enumeration <String > getNestedElements() { 72 return Enumerations.empty(); 73 } 74 75 public boolean supportsCharacters() { 76 return false; 77 } 78 79 public boolean toBoolean(String val) { 80 return Boolean.valueOf(val).booleanValue(); 81 } 82 83 public String [] getEnumeratedValues(Class c) { 84 return null; 85 } 86 87 public boolean run(File buildFile, List <String > targets, InputStream in, OutputWriter out, OutputWriter err, Map <String ,String > properties, int verbosity, String displayName, Runnable interestingOutputCallback, ProgressHandle handle) { 88 err.println(NbBundle.getMessage(DummyBridgeImpl.class, "ERR_cannot_run_target")); 89 problem.printStackTrace(err); 90 return false; 91 } 92 93 public void stop(Thread process) { 94 } 96 97 } 98 | Popular Tags |