1 9 package bluej.editor.moe; 10 11 import bluej.Config; 12 import bluej.editor.Editor; 13 import bluej.editor.EditorWatcher; 14 15 import java.util.Properties ; 16 import java.util.ArrayList ; 17 import java.util.List ; 18 import java.util.Iterator ; 19 20 import java.awt.*; 22 26 27 public final class MoeEditorManager 28 extends bluej.editor.EditorManager 29 { 30 32 protected static MoeEditorManager editorManager; 34 36 private Properties resources; 37 private List editors; private Finder finder; 40 42 private boolean showLineNum; 43 private boolean showToolBar; 44 45 47 public MoeEditorManager() 48 { 49 editors = new ArrayList (4); 50 finder = new Finder(); 51 52 showToolBar = true; 53 showLineNum = false; 54 55 resources = Config.moe_user_props; 56 57 editorManager = this; } 59 60 61 75 76 public Editor openClass(String filename, 77 String docFilename, 78 String windowTitle, 79 EditorWatcher watcher, 80 boolean compiled, 81 List breakpoints, ClassLoader projectClassLoader, Rectangle bounds) 83 { 84 return openEditor (filename, docFilename, true, windowTitle, watcher, compiled, 85 breakpoints, projectClassLoader, bounds); 86 } 87 88 101 102 public Editor openText(String filename, String windowTitle, 103 Rectangle bounds) { 105 return openEditor (filename, null, false, windowTitle, null, false, null, null, bounds); 106 } 107 108 public void refreshAll() 109 { 110 Iterator e = editors.iterator(); 111 112 while(e.hasNext()) { 113 Editor ed = (Editor)e.next(); 114 115 if(ed.isShowing()) 116 ed.refresh(); 117 } 118 } 119 120 124 public void beep() 125 { 126 if(true) Toolkit.getDefaultToolkit().beep(); 128 } 129 130 135 public void discardEditor(Editor ed) 136 { 137 ed.close(); 138 editors.remove(ed); 139 } 140 141 143 147 148 Finder getFinder() 149 { 150 return finder; 151 } 152 153 155 156 158 174 175 private Editor openEditor(String filename, String docFilename, 176 boolean isCode, String windowTitle, 177 EditorWatcher watcher, boolean compiled, 178 List breakpoints, ClassLoader projectClassLoader, Rectangle bounds) 179 { 180 MoeEditor editor; 181 182 editor = new MoeEditor(windowTitle, isCode, watcher, showToolBar, 183 showLineNum, resources, projectClassLoader); 184 editors.add(editor); 185 if (watcher!=null && filename==null) return editor; 187 if (editor.showFile(filename, compiled, docFilename, bounds)) 188 return editor; 189 else { 190 editor.doClose(); return null; 192 } 193 } 194 195 } | Popular Tags |