001: /*BEGIN_COPYRIGHT_BLOCK
002: *
003: * Copyright (c) 2001-2007, JavaPLT group at Rice University (javaplt@rice.edu)
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are met:
008: * * Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: * * Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
014: * names of its contributors may be used to endorse or promote products
015: * derived from this software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
018: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
019: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
020: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
021: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
022: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
023: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
024: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
025: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
026: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028: *
029: * This software is Open Source Initiative approved Open Source Software.
030: * Open Source Initative Approved is a trademark of the Open Source Initiative.
031: *
032: * This file is part of DrJava. Download the current version of this project
033: * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
034: *
035: * END_COPYRIGHT_BLOCK*/
036: package edu.rice.cs.drjava.model;
037:
038: import java.util.Vector;
039: import java.util.List;
040:
041: import java.io.*;
042:
043: import java.awt.print.*;
044: import java.awt.*;
045:
046: import javax.swing.*;
047: import javax.swing.event.DocumentListener;
048: import javax.swing.event.UndoableEditListener;
049: import javax.swing.text.*;
050:
051: import edu.rice.cs.drjava.model.debug.Breakpoint;
052: import edu.rice.cs.drjava.model.definitions.*;
053: import edu.rice.cs.drjava.model.definitions.reducedmodel.*;
054: import edu.rice.cs.drjava.model.FinalizationListener;
055: import edu.rice.cs.drjava.model.definitions.ClassNameNotFoundException;
056: import edu.rice.cs.drjava.model.definitions.indent.Indenter; //import edu.rice.cs.drjava.model.definitions.DefinitionsDocument.WrappedPosition;
057:
058: import edu.rice.cs.util.OperationCanceledException;
059: import edu.rice.cs.util.docnavigation.*;
060: import edu.rice.cs.util.text.SwingDocument;
061:
062: public class DummyOpenDefDoc implements OpenDefinitionsDocument {
063:
064: public int id() {
065: throw new UnsupportedOperationException("Dummy method");
066: }
067:
068: public int compareTo(OpenDefinitionsDocument d) {
069: throw new UnsupportedOperationException("Dummy method");
070: }
071:
072: public boolean modifiedOnDisk() {
073: throw new UnsupportedOperationException("Dummy method");
074: }
075:
076: public boolean saveFile(FileSaveSelector com) throws IOException {
077: throw new UnsupportedOperationException("Dummy method");
078: }
079:
080: // public void uncommentLinesInDefinitions(int selStart, int selEnd) {
081: // throw new UnsupportedOperationException("Dummy method");
082: // }
083:
084: public boolean canAbandonFile() {
085: throw new UnsupportedOperationException("Dummy method");
086: }
087:
088: public boolean quitFile() {
089: throw new UnsupportedOperationException("Dummy method");
090: }
091:
092: public void setCurrentLocation(int location) {
093: throw new UnsupportedOperationException("Dummy method");
094: }
095:
096: protected DefinitionsDocument getDocument() {
097: throw new UnsupportedOperationException("Dummy method");
098: }
099:
100: public boolean isModifiedSinceSave() {
101: throw new UnsupportedOperationException("Dummy method");
102: }
103:
104: public int balanceForward() {
105: throw new UnsupportedOperationException("Dummy method");
106: }
107:
108: public File getFile() throws FileMovedException {
109: throw new UnsupportedOperationException("Dummy method");
110: }
111:
112: public File getRawFile() {
113: throw new UnsupportedOperationException("Dummy method");
114: }
115:
116: public File getParentDirectory() {
117: throw new UnsupportedOperationException("Dummy method");
118: }
119:
120: public boolean fileExists() {
121: throw new UnsupportedOperationException("Dummy method");
122: }
123:
124: public boolean verifyExists() {
125: throw new UnsupportedOperationException("Dummy method");
126: }
127:
128: public void cleanUpPrintJob() {
129: throw new UnsupportedOperationException("Dummy method");
130: }
131:
132: public String getFirstTopLevelClassName()
133: throws ClassNameNotFoundException {
134: throw new UnsupportedOperationException("Dummy method");
135: }
136:
137: public void startCompile() throws IOException {
138: throw new UnsupportedOperationException("Dummy method");
139: }
140:
141: public void runMain() throws IOException {
142: throw new UnsupportedOperationException("Dummy method");
143: }
144:
145: public boolean revertIfModifiedOnDisk() throws IOException {
146: throw new UnsupportedOperationException("Dummy method");
147: }
148:
149: public Pageable getPageable() throws IllegalStateException {
150: throw new UnsupportedOperationException("Dummy method");
151: }
152:
153: public int gotoLine(int line) {
154: throw new UnsupportedOperationException("Dummy method");
155: }
156:
157: public void print() throws PrinterException, BadLocationException,
158: FileMovedException {
159: throw new UnsupportedOperationException("Dummy method");
160: }
161:
162: public void removeFromDebugger() {
163: throw new UnsupportedOperationException("Dummy method");
164: }
165:
166: public RegionManager<Breakpoint> getBreakpointManager() {
167: throw new UnsupportedOperationException("Dummy method");
168: }
169:
170: public RegionManager<DocumentRegion> getBookmarkManager() {
171: throw new UnsupportedOperationException("Dummy method");
172: }
173:
174: public List<RegionManager<MovingDocumentRegion>> getFindResultsManagers() {
175: throw new UnsupportedOperationException("Dummy method");
176: }
177:
178: public void addFindResultsManager(
179: RegionManager<MovingDocumentRegion> rm) {
180: throw new UnsupportedOperationException("Dummy method");
181: }
182:
183: public void removeFindResultsManager(
184: RegionManager<MovingDocumentRegion> rm) {
185: throw new UnsupportedOperationException("Dummy method");
186: }
187:
188: public RegionManager<DocumentRegion> getBrowserHistoryManager() {
189: throw new UnsupportedOperationException("Dummy method");
190: }
191:
192: public boolean isReady() {
193: throw new UnsupportedOperationException("Dummy method");
194: }
195:
196: public boolean isUntitled() {
197: throw new UnsupportedOperationException("Dummy method");
198: }
199:
200: public boolean isSourceFile() {
201: throw new UnsupportedOperationException("Dummy method");
202: }
203:
204: public boolean isEmpty() {
205: throw new UnsupportedOperationException("Dummy method");
206: }
207:
208: public File getSourceRoot() throws InvalidPackageException {
209: throw new UnsupportedOperationException("Dummy method");
210: }
211:
212: public String getFileName() {
213: throw new UnsupportedOperationException("Dummy method");
214: }
215:
216: public String getCanonicalPath() {
217: throw new UnsupportedOperationException("Dummy method");
218: }
219:
220: public String getCompletePath() {
221: throw new UnsupportedOperationException("Dummy method");
222: }
223:
224: public String getName() {
225: return getFileName();
226: }
227:
228: public void startJUnit() throws ClassNotFoundException, IOException {
229: throw new UnsupportedOperationException("Dummy method");
230: }
231:
232: public void generateJavadoc(FileSaveSelector saver)
233: throws IOException {
234: throw new UnsupportedOperationException("Dummy method");
235: }
236:
237: public String getPackageName() {
238: throw new UnsupportedOperationException("Dummy method");
239: }
240:
241: public void setPackage(String s) {
242: throw new UnsupportedOperationException("Dummy method");
243: }
244:
245: public String getPackageNameFromDocument() {
246: throw new UnsupportedOperationException("Dummy method");
247: }
248:
249: public String getEnclosingClassName(int pos, boolean qual)
250: throws BadLocationException, ClassNameNotFoundException {
251: throw new UnsupportedOperationException("Dummy method");
252: }
253:
254: public boolean saveFileAs(FileSaveSelector com) throws IOException {
255: throw new UnsupportedOperationException("Dummy method");
256: }
257:
258: public void preparePrintJob() throws BadLocationException,
259: FileMovedException {
260: throw new UnsupportedOperationException("Dummy method");
261: }
262:
263: public int balanceBackward() {
264: throw new UnsupportedOperationException("Dummy method");
265: }
266:
267: public void revertFile() throws IOException {
268: throw new UnsupportedOperationException("Dummy method");
269: }
270:
271: public boolean checkIfClassFileInSync() {
272: throw new UnsupportedOperationException("Dummy method");
273: }
274:
275: public void documentSaved() {
276: throw new UnsupportedOperationException("Dummy method");
277: }
278:
279: public void documentModified() {
280: throw new UnsupportedOperationException("Dummy method");
281: }
282:
283: public void documentReset() {
284: throw new UnsupportedOperationException("Dummy method");
285: }
286:
287: public int getCurrentLocation() {
288: throw new UnsupportedOperationException("Dummy method");
289: }
290:
291: public INavigatorItem getIDoc() {
292: throw new UnsupportedOperationException("Dummy method");
293: }
294:
295: public void resetModification() {
296: throw new UnsupportedOperationException("Dummy method");
297: }
298:
299: public long getTimestamp() {
300: throw new UnsupportedOperationException("Dummy method");
301: }
302:
303: public void updateModifiedSinceSave() {
304: throw new UnsupportedOperationException("Dummy method");
305: }
306:
307: public void setFile(File file) {
308: throw new UnsupportedOperationException("Dummy method");
309: }
310:
311: public void close() {
312: }
313:
314: public boolean inProjectPath() {
315: return false;
316: }
317:
318: public boolean inNewProjectPath(File f) {
319: throw new UnsupportedOperationException("Dummy method");
320: }
321:
322: public boolean inProject() {
323: return false;
324: }
325:
326: public boolean isAuxiliaryFile() {
327: return false;
328: }
329:
330: public int getLineStartPos(int pos) {
331: throw new UnsupportedOperationException("Dummy method");
332: }
333:
334: public int getLineEndPos(int pos) {
335: throw new UnsupportedOperationException("Dummy method");
336: }
337:
338: //--- Non Dummy Methods ---//
339:
340: protected SwingDocument _defDoc = new SwingDocument();
341:
342: public void addDocumentListener(DocumentListener listener) {
343: _defDoc.addDocumentListener(listener);
344: }
345:
346: public void addUndoableEditListener(UndoableEditListener listener) {
347: _defDoc.addUndoableEditListener(listener);
348: }
349:
350: public Position createPosition(int offs)
351: throws BadLocationException {
352: return _defDoc.createPosition(offs);
353: }
354:
355: public Position createUnwrappedPosition(int offs)
356: throws BadLocationException {
357: return _defDoc.createUnwrappedPosition(offs);
358: }
359:
360: public Element getDefaultRootElement() {
361: return _defDoc.getDefaultRootElement();
362: }
363:
364: public Position getEndPosition() {
365: return _defDoc.getEndPosition();
366: }
367:
368: public int getLength() {
369: return _defDoc.getLength();
370: }
371:
372: public Object getProperty(Object key) {
373: return _defDoc.getProperty(key);
374: }
375:
376: public Element[] getRootElements() {
377: return _defDoc.getRootElements();
378: }
379:
380: public Position getStartPosition() {
381: return _defDoc.getStartPosition();
382: }
383:
384: public String getText(int offset, int length)
385: throws BadLocationException {
386: return _defDoc.getText(offset, length);
387: }
388:
389: public void getText(int offset, int length, Segment txt)
390: throws BadLocationException {
391: _defDoc.getText(offset, length, txt);
392: }
393:
394: public void insertString(int offset, String str, AttributeSet set)
395: throws BadLocationException {
396: _defDoc.insertString(offset, str, set);
397: }
398:
399: public void append(String str, AttributeSet set) {
400: _defDoc.append(str, set);
401: }
402:
403: public void append(String str, Style style) {
404: _defDoc.append(str, style);
405: }
406:
407: public void putProperty(Object key, Object value) {
408: _defDoc.putProperty(key, value);
409: }
410:
411: public void remove(int offs, int len) throws BadLocationException {
412: _defDoc.remove(offs, len);
413: }
414:
415: public void removeDocumentListener(DocumentListener listener) {
416: _defDoc.removeDocumentListener(listener);
417: }
418:
419: public void removeUndoableEditListener(UndoableEditListener listener) {
420: _defDoc.removeUndoableEditListener(listener);
421: }
422:
423: public void render(Runnable r) {
424: _defDoc.render(r);
425: }
426:
427: /** End implementation of Document interface. */
428:
429: /** Decorator pattern for the definitions document */
430: public CompoundUndoManager getUndoManager() {
431: throw new UnsupportedOperationException("Dummy method");
432: }
433:
434: public int commentLines(int selStart, int selEnd) {
435: throw new UnsupportedOperationException("Dummy method");
436: }
437:
438: public int uncommentLines(int selStart, int selEnd) {
439: throw new UnsupportedOperationException("Dummy method");
440: }
441:
442: public void indentLines(int selStart, int selEnd) {
443: throw new UnsupportedOperationException("Dummy method");
444: }
445:
446: public int getCurrentLine() {
447: throw new UnsupportedOperationException("Dummy method");
448: }
449:
450: public int getCurrentCol() {
451: throw new UnsupportedOperationException("Dummy method");
452: }
453:
454: public boolean getClassFileInSync() {
455: throw new UnsupportedOperationException("Dummy method");
456: }
457:
458: public void setClassFileInSync(boolean val) {
459: throw new UnsupportedOperationException("Dummy method");
460: }
461:
462: public int getIntelligentBeginLinePos(int currPos)
463: throws BadLocationException {
464: throw new UnsupportedOperationException("Dummy method");
465: }
466:
467: public int getOffset(int lineNum) {
468: throw new UnsupportedOperationException("Dummy method");
469: }
470:
471: public String getQualifiedClassName()
472: throws ClassNameNotFoundException {
473: throw new UnsupportedOperationException("Dummy method");
474: }
475:
476: public String getQualifiedClassName(int pos)
477: throws ClassNameNotFoundException {
478: throw new UnsupportedOperationException("Dummy method");
479: }
480:
481: public ReducedModelState getStateAtCurrent() {
482: throw new UnsupportedOperationException("Dummy method");
483: }
484:
485: public void resetUndoManager() {
486: throw new UnsupportedOperationException("Dummy method");
487: }
488:
489: public File getCachedClassFile() {
490: throw new UnsupportedOperationException("Dummy method");
491: }
492:
493: public void setCachedClassFile(File f) {
494: throw new UnsupportedOperationException("Dummy method");
495: }
496:
497: public DocumentListener[] getDocumentListeners() {
498: throw new UnsupportedOperationException("Dummy method");
499: }
500:
501: public UndoableEditListener[] getUndoableEditListeners() {
502: throw new UnsupportedOperationException("Dummy method");
503: }
504:
505: public void addFinalizationListener(
506: FinalizationListener<DefinitionsDocument> fl) {
507: throw new UnsupportedOperationException("Dummy method");
508: }
509:
510: public List<FinalizationListener<DefinitionsDocument>> getFinalizationListeners() {
511: throw new UnsupportedOperationException("Dummy method");
512: }
513:
514: public boolean undoManagerCanUndo() {
515: throw new UnsupportedOperationException("Dummy method");
516: }
517:
518: public boolean undoManagerCanRedo() {
519: throw new UnsupportedOperationException("Dummy method");
520: }
521:
522: //--- Styled Document Methods ---//
523:
524: public Font getFont(AttributeSet attr) {
525: throw new UnsupportedOperationException("Dummy method");
526: }
527:
528: public Color getBackground(AttributeSet attr) {
529: throw new UnsupportedOperationException("Dummy method");
530: }
531:
532: public Color getForeground(AttributeSet attr) {
533: throw new UnsupportedOperationException("Dummy method");
534: }
535:
536: public Element getCharacterElement(int pos) {
537: throw new UnsupportedOperationException("Dummy method");
538: }
539:
540: public Element getParagraphElement(int pos) {
541: throw new UnsupportedOperationException("Dummy method");
542: }
543:
544: public Style getLogicalStyle(int p) {
545: throw new UnsupportedOperationException("Dummy method");
546: }
547:
548: public void setLogicalStyle(int pos, Style s) {
549: throw new UnsupportedOperationException("Dummy method");
550: }
551:
552: public void setCharacterAttributes(int offset, int length,
553: AttributeSet s, boolean replace) {
554: throw new UnsupportedOperationException("Dummy method");
555: }
556:
557: public void setParagraphAttributes(int offset, int length,
558: AttributeSet s, boolean replace) {
559: throw new UnsupportedOperationException("Dummy method");
560: }
561:
562: public Style getStyle(String nm) {
563: throw new UnsupportedOperationException("Dummy method");
564: }
565:
566: public void removeStyle(String nm) {
567: throw new UnsupportedOperationException("Dummy method");
568: }
569:
570: public Style addStyle(String nm, Style parent) {
571: throw new UnsupportedOperationException("Dummy method");
572: }
573:
574: //---------- DJDocument Methods ----------//
575:
576: public void setTab(String tab, int pos) {
577: throw new UnsupportedOperationException("Dummy method");
578: }
579:
580: public int getWhiteSpace() {
581: throw new UnsupportedOperationException("Dummy method");
582: }
583:
584: public boolean posInParenPhrase(int pos) {
585: throw new UnsupportedOperationException("Dummy method");
586: }
587:
588: public boolean posInParenPhrase() {
589: throw new UnsupportedOperationException("Dummy method");
590: }
591:
592: public int findPrevEnclosingBrace(int pos, char opening,
593: char closing) throws BadLocationException {
594: throw new UnsupportedOperationException("Dummy method");
595: }
596:
597: public int findNextEnclosingBrace(int pos, char opening,
598: char closing) throws BadLocationException {
599: throw new UnsupportedOperationException("Dummy method");
600: }
601:
602: public int findPrevNonWSCharPos(int pos)
603: throws BadLocationException {
604: throw new UnsupportedOperationException("Dummy method");
605: }
606:
607: public int getFirstNonWSCharPos(int pos)
608: throws BadLocationException {
609: throw new UnsupportedOperationException("Dummy method");
610: }
611:
612: public int getFirstNonWSCharPos(int pos, boolean acceptComments)
613: throws BadLocationException {
614: throw new UnsupportedOperationException("Dummy method");
615: }
616:
617: public int getFirstNonWSCharPos(int pos, char[] whitespace,
618: boolean acceptComments) throws BadLocationException {
619: throw new UnsupportedOperationException("Dummy method");
620: }
621:
622: public int getLineFirstCharPos(int pos) throws BadLocationException {
623: throw new UnsupportedOperationException("Dummy method");
624: }
625:
626: public int findCharOnLine(int pos, char findChar) {
627: throw new UnsupportedOperationException("Dummy method");
628: }
629:
630: public String getIndentOfCurrStmt(int pos)
631: throws BadLocationException {
632: throw new UnsupportedOperationException("Dummy method");
633: }
634:
635: public String getIndentOfCurrStmt(int pos, char[] delims)
636: throws BadLocationException {
637: throw new UnsupportedOperationException("Dummy method");
638: }
639:
640: public String getIndentOfCurrStmt(int pos, char[] delims,
641: char[] whitespace) throws BadLocationException {
642: throw new UnsupportedOperationException("Dummy method");
643: }
644:
645: public void indentLines(int selStart, int selEnd,
646: Indenter.IndentReason reason, ProgressMonitor pm)
647: throws OperationCanceledException {
648: throw new UnsupportedOperationException("Dummy method");
649: }
650:
651: public int findPrevCharPos(int pos, char[] whitespace)
652: throws BadLocationException {
653: throw new UnsupportedOperationException("Dummy method");
654: }
655:
656: public boolean findCharInStmtBeforePos(char findChar, int position) {
657: throw new UnsupportedOperationException("Dummy method");
658: }
659:
660: public int findPrevDelimiter(int pos, char[] delims)
661: throws BadLocationException {
662: throw new UnsupportedOperationException("Dummy method");
663: }
664:
665: public int findPrevDelimiter(int pos, char[] delims,
666: boolean skipParenPhrases) throws BadLocationException {
667: throw new UnsupportedOperationException("Dummy method");
668: }
669:
670: public void resetReducedModelLocation() {
671: throw new UnsupportedOperationException("Dummy method");
672: }
673:
674: public ReducedModelState stateAtRelLocation(int dist) {
675: throw new UnsupportedOperationException("Dummy method");
676: }
677:
678: public IndentInfo getIndentInformation() {
679: throw new UnsupportedOperationException("Dummy method");
680: }
681:
682: public void move(int dist) {
683: throw new UnsupportedOperationException("Dummy method");
684: }
685:
686: public Vector<HighlightStatus> getHighlightStatus(int start, int end) {
687: throw new UnsupportedOperationException("Dummy method");
688: }
689:
690: public void setIndent(int indent) {
691: throw new UnsupportedOperationException("Dummy method");
692: }
693:
694: public int getIndent() {
695: throw new UnsupportedOperationException("Dummy method");
696: }
697:
698: public int getInitialVerticalScroll() {
699: throw new UnsupportedOperationException("Dummy method");
700: }
701:
702: public int getInitialHorizontalScroll() {
703: throw new UnsupportedOperationException("Dummy method");
704: }
705:
706: public int getInitialSelectionStart() {
707: throw new UnsupportedOperationException("Dummy method");
708: }
709:
710: public int getInitialSelectionEnd() {
711: throw new UnsupportedOperationException("Dummy method");
712: }
713:
714: public String getText() {
715: throw new UnsupportedOperationException("Dummy method");
716: }
717:
718: public void clear() {
719: throw new UnsupportedOperationException("Dummy method");
720: }
721:
722: /** Swing-style readLock(). */
723: public void acquireReadLock() {
724: throw new UnsupportedOperationException("Dummy method");
725: }
726:
727: /** Swing-style readUnLock(). */
728: public void releaseReadLock() {
729: throw new UnsupportedOperationException("Dummy method");
730: }
731:
732: /** Swing-style writeLock(). */
733: public void acquireWriteLock() {
734: throw new UnsupportedOperationException("Dummy method");
735: }
736:
737: /** Swing-style writeUnlock(). */
738: public void releaseWriteLock() {
739: throw new UnsupportedOperationException("Dummy method");
740: }
741:
742: // public int getLockState() { throw new UnsupportedOperationException("Dummy method"); }
743:
744: /** @return the number of lines in this document. */
745: public int getNumberOfLines() {
746: return 0;
747: }
748:
749: /** Translates an offset into the components text to a line number.
750: * @param offset the offset >= 0
751: * @return the line number >= 0
752: * @exception BadLocationException thrown if the offset is less than zero or greater than the document length. */
753: public int getLineOfOffset(int offset) {
754: throw new UnsupportedOperationException("Dummy method");
755: }
756:
757: /** Translates a line number into an offset.
758: * @param line number >= 0
759: * @return offset >= 0
760: */
761: public int getOffsetOfLine(int line) {
762: throw new UnsupportedOperationException("Dummy method");
763: }
764:
765: /** @return the caret position as set by the view. */
766: public int getCaretPosition() {
767: return 0;
768: }
769:
770: // public void makePositions() { /* do nothing */ }
771: }
|