1 19 20 package org.netbeans.modules.java.source.engine; 21 22 import java.io.BufferedWriter ; 23 import java.io.File ; 24 import java.io.FileNotFoundException ; 25 import java.io.FileWriter ; 26 import java.io.IOException ; 27 import java.io.PrintWriter ; 28 import javax.swing.text.BadLocationException ; 29 import javax.tools.JavaFileManager; 30 import javax.tools.JavaFileObject; 31 import org.netbeans.api.java.source.query.ResultTableModel; 32 import org.netbeans.modules.java.source.engine.PropertySheetInfo; 33 import org.openide.filesystems.FileUtil; 34 35 38 public class DefaultApplicationContext implements ApplicationContext { 39 private BuildProgress nullProgress = new DefaultBuildProgress(); 40 private QueryProgress nullQueryProgress = new DefaultQueryProgress(); 41 42 public BuildProgress getBuildProgress() { 43 return nullProgress; 44 } 45 46 public QueryProgress getQueryProgress() { 47 return nullQueryProgress; 48 } 49 50 public boolean setProperties(Object command, String title) { 51 PropertySheetInfo.find(command.getClass()).loadValues(command); 52 return true; 53 } 54 55 public void setResult(Object result, String title) { 56 System.out.println(result.toString()); 57 } 58 59 public void setStatusMessage(String message) { 60 System.out.println(message); 61 } 62 63 public void setErrorMessage(String message, String title) { 64 setStatusMessage(title + ": " + message); 65 } 66 67 public PrintWriter getOutputWriter(String title) { 68 return new PrintWriter (System.out, true); 69 } 70 71 public Class getCommandClass(String className) { 72 try { 73 return Class.forName(className, true, getClass().getClassLoader()); 74 } catch (ClassNotFoundException e) { 75 return null; 76 } 77 } 78 79 public SourceRewriter getSourceRewriter(JavaFileObject sourcefile) throws IOException { 80 return new FileSourceRewriter(sourcefile); 81 } 82 } 83 | Popular Tags |