1 33 34 package edu.rice.cs.drjava.model; 35 36 import java.awt.Container ; 37 import java.awt.print.PageFormat ; 38 import java.awt.print.PrinterJob ; 39 import java.awt.print.PrinterException ; 40 import java.awt.print.Pageable ; 41 import java.awt.Font ; 42 import java.awt.Color ; 43 44 import javax.swing.ProgressMonitor ; 45 import javax.swing.event.DocumentListener ; 46 import javax.swing.event.UndoableEditListener ; 47 import javax.swing.text.AttributeSet ; 48 import javax.swing.text.BadLocationException ; 49 import javax.swing.text.Element ; 50 import javax.swing.text.Position ; 51 import javax.swing.text.Segment ; 52 import javax.swing.text.Style ; 53 54 import java.io.File ; 55 import java.io.FileFilter ; 56 import java.io.FilenameFilter ; 57 import java.io.FileNotFoundException ; 58 import java.io.FileReader ; 59 import java.io.IOException ; 60 import java.io.OutputStream ; 61 62 import java.util.ArrayList ; 63 import java.util.Arrays ; 64 import java.util.Collections ; 65 import java.util.Comparator ; 66 import java.util.HashSet ; 67 import java.util.Hashtable ; 68 import java.util.LinkedList ; 69 import java.util.List ; 70 import java.util.ListIterator ; 71 import java.util.Vector ; 72 73 import edu.rice.cs.plt.tuple.Pair; 74 import edu.rice.cs.util.ClassPathVector; 75 import edu.rice.cs.util.FileOps; 76 import edu.rice.cs.util.FileOpenSelector; 77 import edu.rice.cs.util.OperationCanceledException; 78 import edu.rice.cs.util.OrderedHashSet; 79 import edu.rice.cs.util.SRunnable; 80 import edu.rice.cs.util.StringOps; 81 import edu.rice.cs.util.UnexpectedException; 82 83 import edu.rice.cs.util.docnavigation.INavigationListener; 84 import edu.rice.cs.util.docnavigation.NodeData; 85 import edu.rice.cs.util.docnavigation.NodeDataVisitor; 86 import edu.rice.cs.util.docnavigation.AWTContainerNavigatorFactory; 87 import edu.rice.cs.util.docnavigation.IDocumentNavigator; 88 import edu.rice.cs.util.docnavigation.INavigatorItem; 89 import edu.rice.cs.util.docnavigation.INavigatorItemFilter; 90 import edu.rice.cs.util.docnavigation.JTreeSortNavigator; 91 import edu.rice.cs.util.swing.DocumentIterator; 92 import edu.rice.cs.util.swing.Utilities; 93 import edu.rice.cs.util.text.AbstractDocumentInterface; 94 import edu.rice.cs.util.text.ConsoleDocument; 95 96 import edu.rice.cs.drjava.DrJava; 97 import edu.rice.cs.drjava.config.FileOption; 98 import edu.rice.cs.drjava.config.OptionConstants; 99 import edu.rice.cs.drjava.config.OptionEvent; 100 import edu.rice.cs.drjava.config.OptionListener; 101 import edu.rice.cs.drjava.model.print.DrJavaBook; 102 103 import edu.rice.cs.drjava.model.definitions.ClassNameNotFoundException; 104 import edu.rice.cs.drjava.model.definitions.DefinitionsDocument; 105 import edu.rice.cs.drjava.model.definitions.DefinitionsEditorKit; 106 import edu.rice.cs.drjava.model.definitions.InvalidPackageException; 107 import edu.rice.cs.drjava.model.definitions.DocumentUIListener; 108 import edu.rice.cs.drjava.model.definitions.CompoundUndoManager; 109 import edu.rice.cs.drjava.model.definitions.reducedmodel.HighlightStatus; 110 import edu.rice.cs.drjava.model.definitions.reducedmodel.IndentInfo; 111 import edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedModelState; 112 import edu.rice.cs.drjava.model.debug.Breakpoint; 113 import edu.rice.cs.drjava.model.debug.Debugger; 114 import edu.rice.cs.drjava.model.repl.DefaultInteractionsModel; 115 import edu.rice.cs.drjava.model.repl.InteractionsDocument; 116 import edu.rice.cs.drjava.model.repl.InteractionsDJDocument; 117 import edu.rice.cs.drjava.model.repl.InteractionsScriptModel; 118 import edu.rice.cs.drjava.model.compiler.CompilerModel; 119 import edu.rice.cs.drjava.model.junit.JUnitModel; 120 import edu.rice.cs.drjava.project.DocFile; 121 import edu.rice.cs.drjava.project.DocumentInfoGetter; 122 import edu.rice.cs.drjava.project.MalformedProjectFileException; 123 import edu.rice.cs.drjava.project.ProjectProfile; 124 import edu.rice.cs.drjava.project.ProjectFileIR; 125 import edu.rice.cs.drjava.project.ProjectFileParser; 126 import edu.rice.cs.drjava.model.cache.DCacheAdapter; 127 import edu.rice.cs.drjava.model.cache.DDReconstructor; 128 import edu.rice.cs.drjava.model.cache.DocumentCache; 129 130 134 public class DummyGlobalModel implements GlobalModel { 135 138 139 public void addListener(GlobalModelListener listener) { 140 throw new UnsupportedOperationException ("Tried to call addListener on a Dummy"); 141 } 142 143 public void removeListener(GlobalModelListener listener) { 144 throw new UnsupportedOperationException ("Tried to call removeListener on a Dummy"); 145 } 146 147 public DefaultInteractionsModel getInteractionsModel() { 148 throw new UnsupportedOperationException ("Tried to call getInteractionsModel on a Dummy"); 149 } 150 151 public CompilerModel getCompilerModel() { 152 throw new UnsupportedOperationException ("Tried to call getCompilerModel on a Dummy"); 153 } 154 155 public JUnitModel getJUnitModel() { 156 throw new UnsupportedOperationException ("Tried to call getJUnitModel on a Dummy"); 157 } 158 159 public JavadocModel getJavadocModel() { 160 throw new UnsupportedOperationException ("Tried to call getJavadocModel on a Dummy"); 161 } 162 163 public Debugger getDebugger() { 164 throw new UnsupportedOperationException ("Tried to call getDebugger on a Dummy"); 165 } 166 167 public RegionManager<Breakpoint> getBreakpointManager() { 168 throw new UnsupportedOperationException ("Tried to call getBreakpointManager on a Dummy"); 169 } 170 171 public RegionManager<DocumentRegion> getBookmarkManager() { 172 throw new UnsupportedOperationException ("Tried to call getBookmarkManager on a Dummy"); 173 } 174 175 public List <RegionManager<MovingDocumentRegion>> getFindResultsManagers() { 176 throw new UnsupportedOperationException ("Tried to call getFindResultsManagers on a Dummy"); 177 } 178 179 public RegionManager<MovingDocumentRegion> createFindResultsManager() { 180 throw new UnsupportedOperationException ("Tried to call createFindResultsManager on a Dummy"); 181 } 182 183 public void disposeFindResultsManager(RegionManager<MovingDocumentRegion> rm) { 184 throw new UnsupportedOperationException ("Tried to call disposeFindResultsManager on a Dummy"); 185 } 186 187 public RegionManager<DocumentRegion> getBrowserHistoryManager() { 188 throw new UnsupportedOperationException ("Tried to call getBookmarkManager on a Dummy"); 189 } 190 191 public void addToBrowserHistory() { 192 throw new UnsupportedOperationException ("Tried to call getBookmarkManager on a Dummy"); 193 } 194 195 public IDocumentNavigator<OpenDefinitionsDocument> getDocumentNavigator() { 196 throw new UnsupportedOperationException ("Tried to call getDocumentNavigator on a Dummy"); 197 } 198 199 public void setDocumentNavigator(IDocumentNavigator<OpenDefinitionsDocument> newnav) { 200 throw new UnsupportedOperationException ("Tried to call setDocumentNavigator on a Dummy"); 201 } 202 203 public OpenDefinitionsDocument newFile() { 204 throw new UnsupportedOperationException ("Tried to call newFile on a Dummy"); 205 } 206 207 public OpenDefinitionsDocument newTestCase(String name, boolean makeSetUp, boolean makeTearDown) { 208 throw new UnsupportedOperationException ("Tried to call newTest on a Dummy"); 209 } 210 211 public OpenDefinitionsDocument openFile(FileOpenSelector com) throws IOException , OperationCanceledException, 212 AlreadyOpenException { 213 throw new UnsupportedOperationException ("Tried to call openFile on a Dummy"); 214 } 215 216 public OpenDefinitionsDocument[] openFiles(FileOpenSelector com) throws IOException , OperationCanceledException, 217 AlreadyOpenException { 218 throw new UnsupportedOperationException ("Tried to call openFiles on a Dummy"); 219 } 220 221 public boolean closeFile(OpenDefinitionsDocument doc) { 222 throw new UnsupportedOperationException ("Tried to call closeFile on a Dummy"); 223 } 224 225 public boolean closeFileWithoutPrompt(OpenDefinitionsDocument doc) { 226 throw new UnsupportedOperationException ("Tried to call closeFileWithoutPrompt on a Dummy"); 227 } 228 229 public boolean closeAllFiles() { 230 throw new UnsupportedOperationException ("Tried to call closeAllFiles on a Dummy"); 231 } 232 233 public void openFolder(File dir, boolean rec) throws IOException , OperationCanceledException, AlreadyOpenException { 234 throw new UnsupportedOperationException ("Tried to call openFolder on a Dummy"); 235 } 236 237 public void saveAllFiles(FileSaveSelector com) throws IOException { 238 throw new UnsupportedOperationException ("Tried to call saveAllFiles on a Dummy"); 239 } 240 241 public void createNewProject(File f) { 242 throw new UnsupportedOperationException ("Tried to call createNewProject on a Dummy"); 243 } 244 245 public void configNewProject() throws IOException { 246 throw new UnsupportedOperationException ("Tried to call configNewProject on a Dummy"); 247 } 248 249 public void saveProject(File f, Hashtable <OpenDefinitionsDocument,DocumentInfoGetter> ht) throws IOException { 250 throw new UnsupportedOperationException ("Tried to call saveProject on a Dummy"); 251 } 252 253 public void reloadProject(File f, Hashtable <OpenDefinitionsDocument,DocumentInfoGetter> ht) throws IOException { 254 throw new UnsupportedOperationException ("Tried to call reloadProject on a Dummy"); 255 } 256 257 public String fixPathForNavigator(String path) throws IOException { 258 throw new UnsupportedOperationException ("Tried to call fixPathForNavigator on a Dummy"); 259 } 260 261 public String getSourceBinTitle() { 262 throw new UnsupportedOperationException ("Tried to call getSourceBinTitle on a Dummy"); 263 } 264 265 public String getExternalBinTitle() { 266 throw new UnsupportedOperationException ("Tried to call getExternalBinTitle on a Dummy"); 267 } 268 269 public String getAuxiliaryBinTitle() { 270 throw new UnsupportedOperationException ("Tried to call getAuxiliaryBinTitle on a Dummy"); 271 } 272 273 public void addAuxiliaryFile(OpenDefinitionsDocument doc) { 274 throw new UnsupportedOperationException ("Tried to call addAuxiliaryFile on a Dummy"); 275 } 276 277 public void removeAuxiliaryFile(OpenDefinitionsDocument doc) { 278 throw new UnsupportedOperationException ("Tried to call removeAuxiliaryFile on a Dummy"); 279 } 280 281 public void openProject(File file) throws IOException , MalformedProjectFileException { 282 throw new UnsupportedOperationException ("Tried to call openProject on a Dummy"); 283 } 284 285 public void closeProject(boolean quitting) { 286 throw new UnsupportedOperationException ("Tried to call closeProject on a Dummy"); 287 } 288 289 public File getSourceFile(String fileName) { 290 throw new UnsupportedOperationException ("Tried to call getSourceFile on a Dummy"); 291 } 292 293 public File findFileInPaths(String fileName, List <File > paths) { 294 throw new UnsupportedOperationException ("Tried to call getSourceFileFromPaths on a Dummy"); 295 } 296 297 public File [] getSourceRootSet() { 298 throw new UnsupportedOperationException ("Tried to call getSourceRootSet on a Dummy"); 299 } 300 301 public String getCompletePath(int index) { 302 throw new UnsupportedOperationException ("Tried to call getDisplayFullPath on a Dummy"); 303 } 304 305 public DefinitionsEditorKit getEditorKit() { 306 throw new UnsupportedOperationException ("Tried to call getEditorKit on a Dummy"); 307 } 308 309 public DocumentIterator getDocumentIterator() { 310 throw new UnsupportedOperationException ("Tried to call getDocumentIterator on a Dummy"); 311 } 312 313 public ConsoleDocument getConsoleDocument() { 314 throw new UnsupportedOperationException ("Tried to call getConsoleDocument on a Dummy"); 315 } 316 317 public InteractionsDJDocument getSwingConsoleDocument() { 318 throw new UnsupportedOperationException ("Tried to call getSwingConsoleDocument on a Dummy"); 319 } 320 321 public void resetConsole() { 322 throw new UnsupportedOperationException ("Tried to call resetConsole on a Dummy"); 323 } 324 325 public void systemOutPrint(String s) { 326 throw new UnsupportedOperationException ("Tried to call systemOutPrint on a Dummy"); 327 } 328 329 public void systemErrPrint(String s) { 330 throw new UnsupportedOperationException ("Tried to call systemErrPrint on a Dummy"); 331 } 332 333 public void systemInEcho(String s) { 334 throw new UnsupportedOperationException ("Tried to call systemInEcho on a Dummy"); 335 } 336 337 public InteractionsDocument getInteractionsDocument() { 338 throw new UnsupportedOperationException ("Tried to call getInteractionsDocument on a Dummy"); 339 } 340 341 public InteractionsDJDocument getSwingInteractionsDocument() { 342 throw new UnsupportedOperationException ("Tried to call getSwingInteractionsDocument on a Dummy"); 343 } 344 345 public void resetInteractions(File wd) { 346 throw new UnsupportedOperationException ("Tried to call resetInteractions on a Dummy"); 347 } 348 349 public void resetInteractions(File wd, boolean forceReset) { 350 throw new UnsupportedOperationException ("Tried to call resetInteractions on a Dummy"); 351 } 352 353 public void waitForInterpreter() { 354 throw new UnsupportedOperationException ("Tried to call waitForInterpreter on a Dummy"); 355 } 356 357 public void interpretCurrentInteraction() { 358 throw new UnsupportedOperationException ("Tried to call interpretCurrentInteraction on a Dummy"); 359 } 360 361 public ClassPathVector getInteractionsClassPath() { 362 throw new UnsupportedOperationException ("Tried to call getInteractionsClasspath on a Dummy"); 363 } 364 365 public void loadHistory(FileOpenSelector selector) throws IOException { 366 throw new UnsupportedOperationException ("Tried to call loadHistory on a Dummy"); 367 } 368 369 public InteractionsScriptModel loadHistoryAsScript(FileOpenSelector s) throws IOException , OperationCanceledException 370 { 371 throw new UnsupportedOperationException ("Tried to call loadHistoryAsScript on a Dummy"); 372 } 373 374 public void clearHistory() { 375 throw new UnsupportedOperationException ("Tried to call clearHistory on a Dummy"); 376 } 377 378 public void saveHistory(FileSaveSelector selector) throws IOException { 379 throw new UnsupportedOperationException ("Tried to call saveHistory on a Dummy"); 380 } 381 382 public void saveHistory(FileSaveSelector selector, String editedVersion) throws IOException { 383 throw new UnsupportedOperationException ("Tried to call saveHistory on a Dummy"); 384 } 385 386 public String getHistoryAsStringWithSemicolons() { 387 throw new UnsupportedOperationException ("Tried to call getHistoryAsStringWithSemicolons on a Dummy"); 388 } 389 390 public String getHistoryAsString() { 391 throw new UnsupportedOperationException ("Tried to call getHistory on a Dummy"); 392 } 393 394 public void printDebugMessage(String s) { 395 throw new UnsupportedOperationException ("Tried to call printDebugMessage on a Dummy"); 396 } 397 398 public int getDebugPort() throws IOException { 399 throw new UnsupportedOperationException ("Tried to call getDebugPort on a Dummy"); 400 } 401 402 public ClassPathVector getClassPath() { 403 throw new UnsupportedOperationException ("Tried to call getClassPath on a Dummy"); 404 } 405 406 public PageFormat getPageFormat() { 407 throw new UnsupportedOperationException ("Tried to call getPageFormat on a Dummy"); 408 } 409 410 public void setPageFormat(PageFormat format) { 411 throw new UnsupportedOperationException ("Tried to call setPageFormat on a Dummy"); 412 } 413 414 public void quit() { 415 throw new UnsupportedOperationException ("Tried to call quit on a Dummy"); 416 } 417 418 public void forceQuit() { 419 throw new UnsupportedOperationException ("Tried to call forceQuit on a Dummy"); 420 } 421 422 public int getDocumentCount() { 423 throw new UnsupportedOperationException ("Tried to call getDocumentCount on a Dummy"); 424 } 425 426 public int getNumCompErrors() { 427 throw new UnsupportedOperationException ("Tried to call getNumCompErrors on a Dummy"); 428 } 429 430 public void setNumCompErrors(int num) { 431 throw new UnsupportedOperationException ("Tried to call setNumCompErrors on a Dummy"); 432 } 433 434 public OpenDefinitionsDocument getODDForDocument(AbstractDocumentInterface doc) { 435 throw new UnsupportedOperationException ("Tried to call getODDForDocument on a Dummy"); 436 } 437 438 public List <OpenDefinitionsDocument> getNonProjectDocuments() { 439 throw new UnsupportedOperationException ("Tried to call getNonProjectDocuments on a Dummy"); 440 } 441 442 public List <OpenDefinitionsDocument> getProjectDocuments() { 443 throw new UnsupportedOperationException ("Tried to call getProjectDocuments on a Dummy"); 444 } 445 446 public boolean isProjectActive() { 447 throw new UnsupportedOperationException ("Tried to call isProjectActive on a Dummy"); 448 } 449 450 454 public File getProjectFile() { 455 throw new UnsupportedOperationException ("Tried to call getProjectFile on a Dummy"); 456 } 457 458 public File [] getProjectFiles() { 459 throw new UnsupportedOperationException ("Tried to call getProjectFiles on a Dummy"); 460 } 461 462 public File getProjectRoot() { 463 throw new UnsupportedOperationException ("Tried to call getProjectRoot on a Dummy"); 464 } 465 466 public void setProjectFile(File f) { 467 throw new UnsupportedOperationException ("Tried to call setProjectFile on a Dummy"); 468 } 469 470 public void setProjectRoot(File f) { 471 throw new UnsupportedOperationException ("Tried to call setProjectRoot on a Dummy"); 472 } 473 474 public File getBuildDirectory() { 475 throw new UnsupportedOperationException ("Tried to call getBuildDirectory on a Dummy"); 476 } 477 478 public void setBuildDirectory(File f) { 479 throw new UnsupportedOperationException ("Tried to call setBuildDirectory on a Dummy"); 480 } 481 482 public File getMasterWorkingDirectory() { 483 throw new UnsupportedOperationException ("Tried to call getMasterWorkingDirectory on a Dummy"); 484 } 485 486 public File getWorkingDirectory() { 487 throw new UnsupportedOperationException ("Tried to call getWorkingDirectory on a Dummy"); 488 } 489 490 public void setWorkingDirectory(File f) { 491 throw new UnsupportedOperationException ("Tried to call setWorkingDirectory on a Dummy"); 492 } 493 494 public void setMainClass(File f) { 495 throw new UnsupportedOperationException ("Tried to call setMainClass on a Dummy"); 496 } 497 498 public File getMainClass() { 499 throw new UnsupportedOperationException ("Tried to call getMainClass on a Dummy"); 500 } 501 502 public ClassPathVector getExtraClassPath() { 503 throw new UnsupportedOperationException ("Tried to call getExtraClasspath on a Dummy"); 504 } 505 506 public void setExtraClassPath(ClassPathVector cp) { 507 throw new UnsupportedOperationException ("Tried to call setExtraClasspath on a Dummy"); 508 } 509 510 public void setCreateJarFile(File f) { 511 throw new UnsupportedOperationException ("Tried to call setCreateJarFile on a Dummy"); 512 } 513 514 public File getCreateJarFile() { 515 throw new UnsupportedOperationException ("Tried to call getCreateJarFile on a Dummy"); 516 } 517 public void setCreateJarFlags(int f) { 518 throw new UnsupportedOperationException ("Tried to call setCreateJarFlags on a Dummy"); 519 } 520 521 public int getCreateJarFlags() { 522 throw new UnsupportedOperationException ("Tried to call getCreateJarFlags on a Dummy"); 523 } 524 525 526 public boolean inProject(File f) { 527 throw new UnsupportedOperationException ("Tried to call inProject on a Dummy"); 528 } 529 530 public boolean inProjectPath(OpenDefinitionsDocument doc) { 531 throw new UnsupportedOperationException ("Tried to call inProject on a Dummy"); 532 } 533 534 public void setProjectChanged(boolean changed) { 535 throw new UnsupportedOperationException ("Tried to call setProjectChanged on a Dummy"); 536 } 537 538 public boolean isProjectChanged() { 539 throw new UnsupportedOperationException ("Tried to call isProjectChanged on a Dummy"); 540 } 541 542 public boolean hasOutOfSyncDocuments() { 543 throw new UnsupportedOperationException ("Tried to call hasOutOfSyncDocuments on a Dummy"); 544 } 545 546 public void cleanBuildDirectory(){ 547 throw new UnsupportedOperationException ("Tried to call cleanBuildDirectory on a Dummy"); 548 } 549 550 public List <File > getClassFiles() { 551 throw new UnsupportedOperationException ("Tried to call getClassFiles on a Dummy"); 552 } 553 554 public OpenDefinitionsDocument getDocumentForFile(File file) throws IOException { 555 throw new UnsupportedOperationException ("Tried to getDocumentForFile on a Dummy with file: " + file); 556 } 557 558 public boolean isAlreadyOpen(File file) { 559 throw new UnsupportedOperationException ("Tried to call isAlreadyOpen on a Dummy with file: " + file); 560 } 561 562 public List <OpenDefinitionsDocument> getOpenDefinitionsDocuments() { 563 throw new UnsupportedOperationException ("Tried to getOpenDefinitionsDocuments on a Dummy!"); 564 } 565 566 public List <OpenDefinitionsDocument> getSortedOpenDefinitionsDocuments() { 567 throw new UnsupportedOperationException ("Tried to getSortedOpenDefinitionsDocuments on a Dummy!"); 568 } 569 570 public boolean hasModifiedDocuments() { 571 throw new UnsupportedOperationException ("Tried to call hasModifiedDocuments on a Dummy!"); 572 } 573 574 public boolean hasUntitledDocuments() { 575 throw new UnsupportedOperationException ("Tried to call hasUntitliedDocuments on a Dummy!"); 576 } 577 578 } 584 | Popular Tags |