KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > rice > cs > drjava > model > DummyOpenDefDoc


1 /*BEGIN_COPYRIGHT_BLOCK
2  *
3  * This file is part of DrJava. Download the current version of this project:
4  * http://sourceforge.net/projects/drjava/ or http://www.drjava.org/
5  *
6  * DrJava Open Source License
7  *
8  * Copyright (C) 2001-2003 JavaPLT group at Rice University (javaplt@rice.edu)
9  * All rights reserved.
10  *
11  * Developed by: Java Programming Languages Team
12  * Rice University
13  * http://www.cs.rice.edu/~javaplt/
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining a
16  * copy of this software and associated documentation files (the "Software"),
17  * to deal with the Software without restriction, including without
18  * limitation the rights to use, copy, modify, merge, publish, distribute,
19  * sublicense, and/or sell copies of the Software, and to permit persons to
20  * whom the Software is furnished to do so, subject to the following
21  * conditions:
22  *
23  * - Redistributions of source code must retain the above copyright
24  * notice, this list of conditions and the following disclaimers.
25  * - Redistributions in binary form must reproduce the above copyright
26  * notice, this list of conditions and the following disclaimers in the
27  * documentation and/or other materials provided with the distribution.
28  * - Neither the names of DrJava, the JavaPLT, Rice University, nor the
29  * names of its contributors may be used to endorse or promote products
30  * derived from this Software without specific prior written permission.
31  * - Products derived from this software may not be called "DrJava" nor
32  * use the term "DrJava" as part of their names without prior written
33  * permission from the JavaPLT group. For permission, write to
34  * javaplt@rice.edu.
35  *
36  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
39  * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
40  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
41  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42  * OTHER DEALINGS WITH THE SOFTWARE.
43  *
44  END_COPYRIGHT_BLOCK*/

45
46 package edu.rice.cs.drjava.model;
47
48 import java.util.Vector JavaDoc;
49 import java.util.List JavaDoc;
50
51 import java.io.*;
52
53 import java.awt.print.*;
54 import java.awt.*;
55
56 import javax.swing.*;
57 import javax.swing.event.DocumentListener JavaDoc;
58 import javax.swing.event.UndoableEditListener JavaDoc;
59 import javax.swing.text.*;
60
61 import edu.rice.cs.drjava.model.debug.Breakpoint;
62 import edu.rice.cs.drjava.model.definitions.*;
63 import edu.rice.cs.drjava.model.definitions.reducedmodel.*;
64 import edu.rice.cs.drjava.model.FinalizationListener;
65 import edu.rice.cs.drjava.model.definitions.ClassNameNotFoundException;
66 //import edu.rice.cs.drjava.model.definitions.DefinitionsDocument.WrappedPosition;
67

68 import edu.rice.cs.util.OperationCanceledException;
69 import edu.rice.cs.util.docnavigation.*;
70 import edu.rice.cs.util.text.SwingDocument;
71
72 public class DummyOpenDefDoc implements OpenDefinitionsDocument {
73   
74    public int id() {
75     throw new UnsupportedOperationException JavaDoc("Dummy method");
76   }
77    
78    public int compareTo(OpenDefinitionsDocument d) {
79     throw new UnsupportedOperationException JavaDoc("Dummy method");
80   }
81    
82   public boolean modifiedOnDisk() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
83   
84   public boolean saveFile(FileSaveSelector com) throws IOException {
85     throw new UnsupportedOperationException JavaDoc("Dummy method");
86   }
87   
88 // public void uncommentLinesInDefinitions(int selStart, int selEnd) {
89
// throw new UnsupportedOperationException("Dummy method");
90
// }
91

92   public boolean canAbandonFile() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
93   
94   public boolean quitFile() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
95   
96   public void setCurrentLocation(int location) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
97   
98   protected DefinitionsDocument getDocument() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
99   
100   public boolean isModifiedSinceSave() {
101     throw new UnsupportedOperationException JavaDoc("Dummy method");
102   }
103   
104   public int balanceForward() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
105   
106   public File getFile() throws FileMovedException { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
107   
108   public File getRawFile() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
109   
110   public File getParentDirectory() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
111   
112   public boolean fileExists() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
113   
114   public boolean verifyExists() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
115   
116   public void cleanUpPrintJob() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
117   
118   public String JavaDoc getFirstTopLevelClassName() throws ClassNameNotFoundException {
119     throw new UnsupportedOperationException JavaDoc("Dummy method");
120   }
121   
122   public void startCompile() throws IOException { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
123   
124   public void runMain() throws IOException { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
125   
126   public boolean revertIfModifiedOnDisk() throws IOException {
127     throw new UnsupportedOperationException JavaDoc("Dummy method");
128   }
129   
130   public Pageable getPageable() throws IllegalStateException JavaDoc {
131     throw new UnsupportedOperationException JavaDoc("Dummy method");
132   }
133
134   public int gotoLine(int line) {
135     throw new UnsupportedOperationException JavaDoc("Dummy method");
136   }
137  
138   public void print() throws PrinterException, BadLocationException, FileMovedException {
139     throw new UnsupportedOperationException JavaDoc("Dummy method");
140   }
141   public void removeFromDebugger() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
142
143   public RegionManager<Breakpoint> getBreakpointManager() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
144
145   public RegionManager<DocumentRegion> getBookmarkManager() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
146
147   public List JavaDoc<RegionManager<MovingDocumentRegion>> getFindResultsManagers() {
148     throw new UnsupportedOperationException JavaDoc("Dummy method");
149   }
150
151   public void addFindResultsManager(RegionManager<MovingDocumentRegion> rm) {
152     throw new UnsupportedOperationException JavaDoc("Dummy method");
153   }
154     
155   public void removeFindResultsManager(RegionManager<MovingDocumentRegion> rm) {
156     throw new UnsupportedOperationException JavaDoc("Dummy method");
157   }
158   
159   public RegionManager<DocumentRegion> getBrowserHistoryManager() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
160
161   public boolean isUntitled() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
162   
163   public boolean isSourceFile() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
164   
165   public File getSourceRoot() throws InvalidPackageException {
166     throw new UnsupportedOperationException JavaDoc("Dummy method");
167   }
168   
169   public String JavaDoc getFileName() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
170   public String JavaDoc getCanonicalPath() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
171   public String JavaDoc getCompletePath() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
172   public String JavaDoc getName() { return getFileName(); }
173  
174   public void startJUnit() throws ClassNotFoundException JavaDoc, IOException {
175     throw new UnsupportedOperationException JavaDoc("Dummy method");
176   }
177   
178   public void generateJavadoc(FileSaveSelector saver) throws IOException {
179     throw new UnsupportedOperationException JavaDoc("Dummy method");
180   }
181   
182   public String JavaDoc getPackageName() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
183   public void setPackage(String JavaDoc s) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
184   public String JavaDoc getPackageNameFromDocument() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
185   
186   public String JavaDoc getEnclosingClassName(int pos, boolean qual) throws BadLocationException, ClassNameNotFoundException {
187     throw new UnsupportedOperationException JavaDoc("Dummy method");
188   }
189
190   public boolean saveFileAs(FileSaveSelector com) throws IOException {
191     throw new UnsupportedOperationException JavaDoc("Dummy method");
192   }
193   
194   public void preparePrintJob() throws BadLocationException, FileMovedException {
195     throw new UnsupportedOperationException JavaDoc("Dummy method");
196   }
197   
198   public int balanceBackward() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
199   public void revertFile() throws IOException { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
200   public boolean checkIfClassFileInSync() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
201   public void documentSaved() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
202   public void documentModified() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
203   public void documentReset() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
204   public int getCurrentLocation() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
205   public INavigatorItem getIDoc() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
206   public void resetModification() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
207   public long getTimestamp() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
208   public void updateModifiedSinceSave() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
209   public void setFile(File file) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
210   public void close() { }
211   public boolean inProjectPath() { return false; }
212   public boolean inNewProjectPath(File f) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
213   public boolean inProject() { return false; }
214   public boolean isAuxiliaryFile() { return false; }
215   public int getLineStartPos(int pos) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
216   public int getLineEndPos(int pos) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
217   
218   //--- Non Dummy Methods ---//
219

220   protected SwingDocument _defDoc = new SwingDocument();
221   public void addDocumentListener(DocumentListener JavaDoc listener) { _defDoc.addDocumentListener(listener); }
222   
223   public void addUndoableEditListener(UndoableEditListener JavaDoc listener) {
224     _defDoc.addUndoableEditListener(listener);
225   }
226   
227   public Position createPosition(int offs) throws BadLocationException {
228     return _defDoc.createPosition(offs);
229   }
230   
231   public Position createUnwrappedPosition(int offs) throws BadLocationException {
232     return _defDoc.createUnwrappedPosition(offs);
233   }
234   
235   public Element getDefaultRootElement() { return _defDoc.getDefaultRootElement(); }
236   public Position getEndPosition() { return _defDoc.getEndPosition(); }
237   public int getLength() { return _defDoc.getLength(); }
238   public Object JavaDoc getProperty(Object JavaDoc key) { return _defDoc.getProperty(key); }
239   public Element[] getRootElements() { return _defDoc.getRootElements(); }
240   public Position getStartPosition() { return _defDoc.getStartPosition(); }
241   
242   public String JavaDoc getText(int offset, int length) throws BadLocationException {
243     return _defDoc.getText(offset, length);
244   }
245   
246   public void getText(int offset, int length, Segment txt) throws BadLocationException {
247     _defDoc.getText(offset, length, txt);
248   }
249   
250   public void insertString(int offset, String JavaDoc str, AttributeSet set) throws BadLocationException {
251     _defDoc.insertString(offset, str, set);
252   }
253   
254   public void append(String JavaDoc str, AttributeSet set) { _defDoc.append(str, set); }
255   public void append(String JavaDoc str, Style style) { _defDoc.append(str, style); }
256   public void putProperty(Object JavaDoc key, Object JavaDoc value) { _defDoc.putProperty(key, value); }
257   public void remove(int offs, int len) throws BadLocationException { _defDoc.remove(offs, len); }
258   public void removeDocumentListener(DocumentListener JavaDoc listener) { _defDoc.removeDocumentListener(listener); }
259   
260   public void removeUndoableEditListener(UndoableEditListener JavaDoc listener) {
261     _defDoc.removeUndoableEditListener(listener);
262   }
263   
264   public void render(Runnable JavaDoc r) { _defDoc.render(r); }
265   
266   /** End implementation of Document interface. */
267   
268   /** Decorator pattern for the definitions document */
269   public CompoundUndoManager getUndoManager() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
270   public int commentLines(int selStart, int selEnd) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
271   public int uncommentLines(int selStart, int selEnd) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
272   public void indentLines(int selStart, int selEnd) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
273   public int getCurrentLine() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
274   public int getCurrentCol() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
275   public boolean getClassFileInSync() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
276  
277   public int getIntelligentBeginLinePos(int currPos) throws BadLocationException {
278     throw new UnsupportedOperationException JavaDoc("Dummy method");
279   }
280   
281   public int getOffset(int lineNum) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
282   
283   public String JavaDoc getQualifiedClassName() throws ClassNameNotFoundException {
284     throw new UnsupportedOperationException JavaDoc("Dummy method");
285   }
286   
287   public String JavaDoc getQualifiedClassName(int pos) throws ClassNameNotFoundException {
288     throw new UnsupportedOperationException JavaDoc("Dummy method");
289   }
290   
291   public ReducedModelState getStateAtCurrent() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
292   public void resetUndoManager() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
293   public File getCachedClassFile() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
294   public void setCachedClassFile(File f) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
295   
296   public DocumentListener JavaDoc[] getDocumentListeners() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
297   public UndoableEditListener JavaDoc[] getUndoableEditListeners() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
298   
299   public void addFinalizationListener(FinalizationListener<DefinitionsDocument> fl) {
300     throw new UnsupportedOperationException JavaDoc("Dummy method");
301   }
302   
303   public List JavaDoc<FinalizationListener<DefinitionsDocument>> getFinalizationListeners() {
304     throw new UnsupportedOperationException JavaDoc("Dummy method");
305   }
306   
307   public boolean undoManagerCanUndo() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
308   public boolean undoManagerCanRedo() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
309   
310   //--- Styled Document Methods ---//
311

312   public Font getFont(AttributeSet attr) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
313   public Color getBackground(AttributeSet attr) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
314   public Color getForeground(AttributeSet attr) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
315   public Element getCharacterElement(int pos) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
316   public Element getParagraphElement(int pos) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
317   public Style getLogicalStyle(int p) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
318   public void setLogicalStyle(int pos, Style s) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
319   
320   public void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace) {
321     throw new UnsupportedOperationException JavaDoc("Dummy method");
322   }
323   
324   public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) {
325     throw new UnsupportedOperationException JavaDoc("Dummy method");
326   }
327   
328   public Style getStyle(String JavaDoc nm) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
329   public void removeStyle(String JavaDoc nm) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
330   public Style addStyle(String JavaDoc nm, Style parent) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
331   
332   //---------- DJDocument Methods ----------//
333

334   public void setTab(String JavaDoc tab, int pos) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
335   public int getWhiteSpace() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
336   public boolean posInParenPhrase(int pos) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
337   public boolean posInParenPhrase() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
338   
339   public int findPrevEnclosingBrace(int pos, char opening, char closing) throws BadLocationException {
340     throw new UnsupportedOperationException JavaDoc("Dummy method");
341   }
342   
343   public int findNextEnclosingBrace(int pos, char opening, char closing) throws BadLocationException {
344     throw new UnsupportedOperationException JavaDoc("Dummy method");
345   }
346   
347   public int findPrevNonWSCharPos(int pos) throws BadLocationException {
348     throw new UnsupportedOperationException JavaDoc("Dummy method");
349   }
350   
351   public int getFirstNonWSCharPos(int pos) throws BadLocationException {
352     throw new UnsupportedOperationException JavaDoc("Dummy method");
353   }
354   
355   public int getFirstNonWSCharPos(int pos, boolean acceptComments) throws BadLocationException {
356     throw new UnsupportedOperationException JavaDoc("Dummy method");
357   }
358   
359   public int getFirstNonWSCharPos (int pos, char[] whitespace, boolean acceptComments) throws BadLocationException {
360     throw new UnsupportedOperationException JavaDoc("Dummy method");
361   }
362   
363   public int getLineFirstCharPos(int pos) throws BadLocationException {
364     throw new UnsupportedOperationException JavaDoc("Dummy method");
365   }
366   
367   public int findCharOnLine(int pos, char findChar) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
368   
369   public String JavaDoc getIndentOfCurrStmt(int pos) throws BadLocationException {
370     throw new UnsupportedOperationException JavaDoc("Dummy method");
371   }
372   
373   public String JavaDoc getIndentOfCurrStmt(int pos, char[] delims) throws BadLocationException {
374     throw new UnsupportedOperationException JavaDoc("Dummy method");
375   }
376   
377   public String JavaDoc getIndentOfCurrStmt(int pos, char[] delims, char[] whitespace) throws BadLocationException {
378     throw new UnsupportedOperationException JavaDoc("Dummy method");
379   }
380   
381   public void indentLines(int selStart, int selEnd, int reason, ProgressMonitor pm) throws OperationCanceledException {
382     throw new UnsupportedOperationException JavaDoc("Dummy method");
383   }
384   
385   public int findPrevCharPos(int pos, char[] whitespace) throws BadLocationException {
386     throw new UnsupportedOperationException JavaDoc("Dummy method");
387   }
388   
389   public boolean findCharInStmtBeforePos(char findChar, int position) {
390     throw new UnsupportedOperationException JavaDoc("Dummy method");
391   }
392   
393   public int findPrevDelimiter(int pos, char[] delims) throws BadLocationException {
394     throw new UnsupportedOperationException JavaDoc("Dummy method");
395   }
396   
397   public int findPrevDelimiter(int pos, char[] delims, boolean skipParenPhrases) throws BadLocationException {
398     throw new UnsupportedOperationException JavaDoc("Dummy method");
399   }
400   
401   public void resetReducedModelLocation() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
402   public ReducedModelState stateAtRelLocation(int dist) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
403   public IndentInfo getIndentInformation() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
404   public void move(int dist) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
405
406   public Vector JavaDoc<HighlightStatus> getHighlightStatus(int start, int end) {
407     throw new UnsupportedOperationException JavaDoc("Dummy method");
408   }
409   
410   public void setIndent(int indent) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
411   public int getIndent() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
412   public int getInitialVerticalScroll() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
413   public int getInitialHorizontalScroll() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
414   public int getInitialSelectionStart() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
415   public int getInitialSelectionEnd() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
416   public String JavaDoc getText() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
417   public void clear() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
418  
419   /** Swing-style readLock(). */
420   public void acquireReadLock() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
421   
422   /** Swing-style readUnLock(). */
423   public void releaseReadLock() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
424
425   /** Swing-style writeLock(). */
426   public void acquireWriteLock() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
427   
428   /** Swing-style writeUnlock(). */
429   public void releaseWriteLock() { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
430   
431 // public int getLockState() { throw new UnsupportedOperationException("Dummy method"); }
432

433   /** @return the number of lines in this document. */
434   public int getNumberOfLines() { return 0; }
435   
436   /** Translates an offset into the components text to a line number.
437    * @param offset the offset >= 0
438    * @return the line number >= 0
439    * @exception BadLocationException thrown if the offset is less than zero or greater than the document length. */

440   public int getLineOfOffset(int offset) { throw new UnsupportedOperationException JavaDoc("Dummy method"); }
441  
442   /** @return the caret position as set by the view. */
443   public int getCaretPosition() { return 0; }
444   
445 // public void makePositions() { /* do nothing */ }
446
}
447
Popular Tags