KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > text > NbDocument


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.openide.text;
20
21 import java.awt.Color JavaDoc;
22 import java.awt.Component JavaDoc;
23
24 import java.beans.*;
25
26 import javax.swing.JEditorPane JavaDoc;
27 import javax.swing.JToolBar JavaDoc;
28 import javax.swing.SwingUtilities JavaDoc;
29 import javax.swing.text.*;
30
31
32 /** Dummy class holding utility methods for working with NetBeans document conventions.
33 *
34 * @author Jaroslav Tulach
35 */

36 public final class NbDocument extends Object JavaDoc {
37     /** Attribute that signals that a given character is guarded (cannot
38     * be modified). Implements {@link javax.swing.text.AttributeSet.CharacterAttribute} to signal that
39     * this attribute applies to characters, not paragraphs.
40     */

41     public static final Object JavaDoc GUARDED = new AttributeSet.CharacterAttribute() {
42         };
43
44     /** Attribute set that adds to a part of document guarded flag
45     */

46     private static final SimpleAttributeSet ATTR_ADD = new SimpleAttributeSet();
47
48     /** Attribute set to remove the guarded flag.
49     */

50     private static final SimpleAttributeSet ATTR_REMOVE = new SimpleAttributeSet();
51
52     static {
53         ATTR_ADD.addAttribute(GUARDED, Boolean.TRUE);
54         ATTR_REMOVE.addAttribute(GUARDED, Boolean.FALSE);
55     }
56
57     /** Name of style attached to documents to mark a paragraph (line)
58     * as a (debugger) breakpoint.
59     */

60     public static final String JavaDoc BREAKPOINT_STYLE_NAME = "NbBreakpointStyle"; // NOI18N
61

62     /** Name of style attached to documents to mark a paragraph (line)
63     * as erroneous.
64     */

65     public static final String JavaDoc ERROR_STYLE_NAME = "NbErrorStyle"; // NOI18N
66

67     /** Name of style attached to documents to mark a paragraph (line)
68     * as current (in a debugger).
69     */

70     public static final String JavaDoc CURRENT_STYLE_NAME = "NbCurrentStyle"; // NOI18N
71

72     /** Name of style attached to documents to unmark a paragraph (line)
73     * as anything special.
74     */

75     public static final String JavaDoc NORMAL_STYLE_NAME = "NbNormalStyle"; // NOI18N
76

77     /** @deprecated Not useful for anything. */
78     @Deprecated JavaDoc
79     public static final Colors COLORS = new Colors();
80
81     private NbDocument() {
82     }
83
84     /** Find the root element of all lines.
85     * All conforming NetBeans documents
86     * should return a valid element.
87     *
88     * @param doc styled document (expecting NetBeans document)
89     * @return the root element
90      * @exception NullPointerException If the <code>doc</code> parameter
91      * is <code>null</code>.
92     */

93     public static Element findLineRootElement(StyledDocument doc) {
94         checkDocParameter(doc);
95
96         Element e = doc.getParagraphElement(0).getParentElement();
97
98         if (e == null) {
99             // try default root (should work for text/plain)
100
e = doc.getDefaultRootElement();
101         }
102
103         return e;
104     }
105
106     /** For given document and an offset, find the line number.
107     * @param doc the document
108     * @param offset offset in the document
109     * @return the line number for that offset
110      * @exception NullPointerException If the <code>doc</code> parameter
111      * is <code>null</code>.
112     */

113     public static int findLineNumber(StyledDocument doc, int offset) {
114         /* pre-33165
115         Element paragraphsParent = findLineRootElement (doc);
116         return paragraphsParent.getElementIndex (offset);
117          */

118         return new DocumentRenderer(DocumentRenderer.FIND_LINE_NUMBER, doc, offset).renderToInt();
119     }
120
121     /** Finds column number given an offset.
122     * @param doc the document
123     * @param offset offset in the document
124     * @return column within the line of that offset (counting starts from zero)
125      * @exception NullPointerException If the <code>doc</code> parameter
126      * is <code>null</code>.
127     */

128     public static int findLineColumn(StyledDocument doc, int offset) {
129         /*
130         Element paragraphsParent = findLineRootElement (doc);
131         int indx = paragraphsParent.getElementIndex (offset);
132         return offset - paragraphsParent.getElement (indx).getStartOffset ();
133          */

134         return new DocumentRenderer(DocumentRenderer.FIND_LINE_COLUMN, doc, offset).renderToInt();
135     }
136
137     /** Finds offset of the beginning of a line.
138     * @param doc the document
139     * @param lineNumber number of the line to find the start of (zero-based)
140     * @return offset
141      * @exception NullPointerException If the <code>doc</code> parameter
142      * is <code>null</code>.
143      * @exception IndexOutOfBoundsException when incorrect
144      * <code>lineNumber</code> value is inserted
145     */

146     public static int findLineOffset(StyledDocument doc, int lineNumber) {
147         /*
148         Element paragraphsParent = findLineRootElement (doc);
149         Element line = paragraphsParent.getElement (lineNumber);
150
151         if(line == null) {
152             throw new IndexOutOfBoundsException(
153                 "Index=" + lineNumber + " is out of bounds."); // NOI18N
154         }
155
156         return line.getStartOffset ();
157          */

158         return new DocumentRenderer(DocumentRenderer.FIND_LINE_OFFSET, doc, lineNumber).renderToInt();
159     }
160
161     /** Creates position with a bias. If the bias is {@link javax.swing.text.Position.Bias#Backward}
162     * then if an insert occures at the position, the text is inserted
163     * after the position. If the bias is {@link javax.swing.text.Position.Bias#Forward <code>Forward</code>}, then the text is
164     * inserted before the position.
165     * <P>
166     * The method checks if the document implements {@link PositionBiasable},
167     * and if so, {@link PositionBiasable#createPosition <code>createPosition</code>} is called.
168     * Otherwise an attempt is made to provide a <code>Position</code> with the correct behavior.
169     *
170     * @param doc document to create position in
171     * @param offset the current offset for the position
172     * @param bias the bias to use for the position
173      * @exception NullPointerException If the <code>doc</code> parameter
174      * is <code>null</code>.
175     * @exception BadLocationException if the offset is invalid
176     */

177     public static Position createPosition(Document doc, int offset, Position.Bias bias)
178     throws BadLocationException {
179         checkDocParameter(doc);
180
181         if (doc instanceof PositionBiasable) {
182             return ((PositionBiasable) doc).createPosition(offset, bias);
183         } else {
184             if (bias == Position.Bias.Forward) {
185                 // default behaviour
186
return doc.createPosition(offset);
187             } else {
188                 // use our special position
189
return BackwardPosition.create(doc, offset);
190             }
191         }
192     }
193
194     /** Mark part of a document as guarded (immutable to the user).
195     * @param doc styled document
196     * @param offset offset to start at
197     * @param len length of text to mark as guarded
198      * @exception NullPointerException If the <code>doc</code> parameter
199      * is <code>null</code>.
200     */

201     public static void markGuarded(StyledDocument doc, int offset, int len) {
202         checkDocParameter(doc);
203         doc.setCharacterAttributes(offset, len, ATTR_ADD, false);
204     }
205
206     /** Remove guarded mark on a block of a document.
207     * @param doc styled document
208     * @param offset offset to start at
209     * @param len length of text to mark as unguarded
210      * @exception NullPointerException If the <code>doc</code> parameter
211      * is <code>null</code>.
212     */

213     public static void unmarkGuarded(StyledDocument doc, int offset, int len) {
214         checkDocParameter(doc);
215         doc.setCharacterAttributes(offset, len, ATTR_REMOVE, false);
216     }
217
218     /** Inserts a text into given offset and marks it guarded.
219     * @param doc document to insert to
220     * @param offset offset of insertion
221     * @param txt string text to insert
222      * @exception NullPointerException If the <code>doc</code> parameter
223      * is <code>null</code>.
224     */

225     public static void insertGuarded(StyledDocument doc, int offset, String JavaDoc txt)
226     throws BadLocationException {
227         checkDocParameter(doc);
228         doc.insertString(offset, txt, ATTR_ADD);
229     }
230
231     /** Attach a breakpoint to a line in the document.
232     * If the document has a defined style named {@link #BREAKPOINT_STYLE_NAME}, it is used.
233     * Otherwise, a new style is defined.
234     *
235     * @param doc the document
236     * @param offset identifies the line to set breakpoint to
237      * @exception NullPointerException If the <code>doc</code> parameter
238      * is <code>null</code>.
239     *
240     * @deprecated since 1.20. Use addAnnotation() instead
241     */

242     @Deprecated JavaDoc
243     public static void markBreakpoint(StyledDocument doc, int offset) {
244         checkDocParameter(doc);
245
246         Style bp = doc.getStyle(BREAKPOINT_STYLE_NAME);
247
248         if (bp == null) {
249             // create the style
250
bp = doc.addStyle(BREAKPOINT_STYLE_NAME, null);
251
252             if (bp == null) {
253                 return;
254             }
255
256             bp.addAttribute(StyleConstants.ColorConstants.Background, Color.red);
257             bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.white);
258         }
259
260         doc.setLogicalStyle(offset, bp);
261     }
262
263     /** Mark a line as erroneous (e.g.&nbsp;by the compiler).
264     * If the document has a defined style named {@link #ERROR_STYLE_NAME}, it is used.
265     * Otherwise, a new style is defined.
266     *
267     * @param doc the document
268     * @param offset identifies the line to mark
269      * @exception NullPointerException If the <code>doc</code> parameter
270      * is <code>null</code>.
271     *
272     * @deprecated since 1.20. Use addAnnotation() instead
273     */

274     @Deprecated JavaDoc
275     public static void markError(StyledDocument doc, int offset) {
276         checkDocParameter(doc);
277
278         Style bp = doc.getStyle(ERROR_STYLE_NAME);
279
280         if (bp == null) {
281             // create the style
282
bp = doc.addStyle(ERROR_STYLE_NAME, null);
283
284             if (bp == null) {
285                 return;
286             }
287
288             bp.addAttribute(StyleConstants.ColorConstants.Background, Color.green);
289             bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.black);
290         }
291
292         doc.setLogicalStyle(offset, bp);
293     }
294
295     /** Marks a line as current (e.g.&nbsp;for the debugger).
296     * If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
297     * Otherwise, a new style is defined.
298     *
299     * @param doc the document
300     * @param offset identifies the line to mark
301      * @exception NullPointerException If the <code>doc</code> parameter
302      * is <code>null</code>.
303     *
304     * @deprecated since 1.20. Use addAnnotation() instead
305     */

306     @Deprecated JavaDoc
307     public static void markCurrent(StyledDocument doc, int offset) {
308         checkDocParameter(doc);
309
310         Style bp = doc.getStyle(CURRENT_STYLE_NAME);
311
312         if (bp == null) {
313             // create the style
314
bp = doc.addStyle(CURRENT_STYLE_NAME, null);
315
316             if (bp == null) {
317                 return;
318             }
319
320             bp.addAttribute(StyleConstants.ColorConstants.Background, Color.blue);
321             bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.white);
322         }
323
324         doc.setLogicalStyle(offset, bp);
325     }
326
327     /**
328      * Mark a line as normal (no special attributes).
329      * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
330      * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
331      * @param doc the document
332      * @param offset identified the line to unmark
333      * @exception NullPointerException If the <code>doc</code> parameter
334      * is <code>null</code>.
335      *
336      * @deprecated since 1.20. Use addAnnotation() instead
337      */

338     @Deprecated JavaDoc
339     public static void markNormal(StyledDocument doc, int offset) {
340         checkDocParameter(doc);
341
342         Style st = doc.getStyle(NORMAL_STYLE_NAME);
343
344         if (st == null) {
345             st = doc.addStyle(NORMAL_STYLE_NAME, null);
346         }
347
348         if (st != null) {
349             doc.setLogicalStyle(offset, st);
350         }
351     }
352
353     /** Locks the document to have exclusive access to it.
354      * Documents implementing {@link Lockable} can specify exactly how to do this.
355     *
356     * @param doc document to lock
357     * @param run the action to run
358      * @exception NullPointerException If the <code>doc</code> parameter
359      * is <code>null</code>.
360     */

361     public static void runAtomic(StyledDocument doc, Runnable JavaDoc run) {
362         checkDocParameter(doc);
363
364         if (doc instanceof WriteLockable) {
365             // use the method
366
((WriteLockable) doc).runAtomic(run);
367         } else {
368             // transfer the runnable to event dispatch thread
369
synchronized (doc) {
370                 run.run();
371             }
372         }
373     }
374
375     /** Executes given runnable in "user mode" does not allowing any modifications
376     * to parts of text marked as guarded. The actions should be run as "atomic" so
377     * either happen all at once or none at all (if a guarded block should be modified).
378     *
379     * @param doc document to modify
380     * @param run runnable to run in user mode that will have exclusive access to modify the document
381      * @exception NullPointerException If the <code>doc</code> parameter
382      * is <code>null</code>.
383     * @exception BadLocationException if a modification of guarded text occured
384     * and that is why no changes to the document has been done.
385     */

386     public static void runAtomicAsUser(StyledDocument doc, Runnable JavaDoc run)
387     throws BadLocationException {
388         checkDocParameter(doc);
389
390         if (doc instanceof WriteLockable) {
391             // use the method
392
((WriteLockable) doc).runAtomicAsUser(run);
393         } else {
394             // transfer the runnable to event dispatch thread
395
synchronized (doc) {
396                 run.run();
397             }
398         }
399     }
400
401     /** Helper method for checking document parameter validity.
402      * @exception NullPointerException If the <code>doc</code> parameter
403      * is <code>null</code>. */

404     private static void checkDocParameter(Document doc) {
405         if (doc == null) {
406             throw new NullPointerException JavaDoc("Invalid doc parameter. Document may not be null!"); // NOI18N
407
}
408     }
409
410     /** Find a way to print a given document.
411      * If the document implements the correct interface(s) then the document is returned,
412      * else a default {@link java.awt.print.Printable} is used as a wrapper. In this last case it is useful
413      * to implement {@link NbDocument.Printable} to describe how to print in terms of
414      * attributed characters, rather than specifying the complete page layout from scratch.
415      *
416      * @param doc the document to find printing support for
417      * @return an object that is instance of eith {@link java.awt.print.Printable} or {@link java.awt.print.Pageable}
418      */

419     public static Object JavaDoc findPageable(StyledDocument doc) {
420         if (doc instanceof java.awt.print.Pageable JavaDoc) {
421             return doc;
422         } else if (doc instanceof java.awt.print.Printable JavaDoc) {
423             return doc;
424         } else {
425             return new DefaultPrintable(doc);
426         }
427     }
428
429     /** Add annotation to the document. For annotation of whole line
430      * the length parameter can be ignored (specify value -1).
431      * @param doc the document which will be annotated
432      * @param startPos position which represent begining
433      * of the annotated text
434      * @param length length of the annotated text. If -1 is specified
435      * the whole line will be annotated
436      * @param annotation annotation which is attached to this text
437      * @since 1.20
438      */

439     public static void addAnnotation(
440         final StyledDocument doc, final Position startPos, final int length, final Annotation annotation
441     ) {
442         if (!(doc instanceof Annotatable)) {
443             return;
444         }
445
446         if (SwingUtilities.isEventDispatchThread()) {
447             ((Annotatable) doc).addAnnotation(startPos, length, annotation);
448         } else {
449             SwingUtilities.invokeLater(
450                 new Runnable JavaDoc() {
451                     public void run() {
452                         ((Annotatable) doc).addAnnotation(startPos, length, annotation);
453                     }
454                 }
455             );
456         }
457     }
458
459     /** Removal of added annotation.
460      * @param doc the annotated document
461      * @param annotation annotation which is going to be removed
462      * @since 1.20
463      */

464     public static void removeAnnotation(final StyledDocument doc, final Annotation annotation) {
465         if (!(doc instanceof Annotatable)) {
466             return;
467         }
468
469         if (SwingUtilities.isEventDispatchThread()) {
470             ((Annotatable) doc).removeAnnotation(annotation);
471         } else {
472             SwingUtilities.invokeLater(
473                 new Runnable JavaDoc() {
474                     public void run() {
475                         ((Annotatable) doc).removeAnnotation(annotation);
476                     }
477                 }
478             );
479         }
480     }
481
482     /** Specialized version of document that knows how to lock the document
483     * for complex modifications.
484     */

485     public interface WriteLockable extends Document {
486         /** Executes given runnable in lock mode of the document.
487         * In this mode, all redrawing is stopped and the caller has exclusive
488         * access to all modifications to the document.
489         * <P>
490         * By definition there should be only one locker at a time. Sample implementation, if you are extending {@link AbstractDocument}:
491         *
492         * <p><code>
493         * writeLock();<br>
494         * try {<br>
495         * &nbsp;&nbsp;r.run();<br>
496         * } finally {<br>
497         * &nbsp;&nbsp;writeUnlock();<br>
498         * }
499         * </code>
500         *
501         * @param r runnable to run while locked
502         *
503         * @see NbDocument#runAtomic
504         */

505         public void runAtomic(Runnable JavaDoc r);
506
507         /** Executes given runnable in "user mode" does not allowing any modifications
508         * to parts of text marked as guarded. The actions should be run as "atomic" so
509         * either happen all at once or none at all (if a guarded block should be modified).
510         *
511         * @param r runnable to run in user mode that will have exclusive access to modify the document
512         * @exception BadLocationException if a modification of guarded text occured
513         * and that is why no changes to the document has been done.
514         */

515         public void runAtomicAsUser(Runnable JavaDoc r) throws BadLocationException;
516     }
517
518     /** Document which may support styled text printing.
519     * Any document that wishes to support special formatting while printing
520     * can implement this interface and provide a <code>AttributedCharacterIterator</code>
521     * specifying colors, fonts, etc.
522     */

523     public interface Printable extends Document {
524         /** Get an attributed character iterator for the document, so that it may be printed.
525          * <p>For a convenient way to do this, you may use {@link AttributedCharacters#iterator a simple implementation}
526          * of an
527          * attributed character list.
528         * @return list of <code>AttributedCharacterIterator</code>s to be used for printing
529         *
530         * @see NbDocument#findPageable */

531         public java.text.AttributedCharacterIterator JavaDoc[] createPrintIterators();
532     }
533
534     /** Enhanced version of document that provides better support for
535     * holding and working with biased positions. It adds one new method
536     * {@link #createPosition} that creates
537     * a position that moves either to the left or to the right when an insertion
538     * is performed at it.
539     * <P>
540     * If a document implements this interface, the new method is
541     * used in {@link NbDocument#createPosition}.
542     * If not, special support for the position is created.
543     */

544     public interface PositionBiasable extends Document {
545         /** Creates position with a bias. If the bias is {@link javax.swing.text.Position.Bias#Backward}
546         * then if an insert occures at the position, the text is inserted
547         * after the position. If the bias is {@link javax.swing.text.Position.Bias#Forward <code>Forward</code>}, then the text is
548         * inserted before the position.
549         *
550         * @param offset the offset for the position
551         * @param bias the bias to use for the position
552         * @exception BadLocationException if the offset is invalid
553         *
554         * @see NbDocument#createPosition
555         */

556         public Position createPosition(int offset, Position.Bias bias)
557         throws BadLocationException;
558     }
559
560     /** Enabled documents to add special UI components to their Editor pane.
561     * If this interface is implemented by the Editor document, it can be used
562     * to add other components (such as toolbars) to the pane.
563     */

564     public interface CustomEditor extends Document {
565         /** Create a whole editor component over the given <code>JEditorPane</code>.
566          * The implementation should generally add some kind of scrolling
567          * support to the given <code>JEditorPane</code> (typically with scrollbars),
568          * possibly some other components
569          * according to the desired layout,
570          * and return the resulting container.
571          * @param j editor pane over which the resulting component
572          * will be built
573          * @return component encapsulating the pane and all other
574          * custom UI components
575          */

576         public Component JavaDoc createEditor(JEditorPane JavaDoc j);
577     }
578
579     /**
580      * Enabled documents to add special UI toolbar components to their Editor pane.
581      */

582     public interface CustomToolbar extends Document {
583         /**
584          * Implementation shall return a toolbar for the document. Preferably non-floatable.
585          */

586         public JToolBar JavaDoc createToolbar(JEditorPane JavaDoc j);
587     }
588
589     /** Enhanced version of document which is capable of
590      * attaching/detaching of annotations. It is guaranteed that
591      * annotations are added/removed to document only in AWT thread.
592      * @since 1.20
593      */

594     public interface Annotatable extends Document {
595         /** Add annotation to the document. For annotation of whole line
596          * the length parameter can be ignored (specify value -1).
597          * @param startPos position which represent begining
598          * of the annotated text
599          * @param length length of the annotated text. If -1 is specified
600          * the whole line will be annotated
601          * @param annotation annotation which is attached to this text */

602         public void addAnnotation(Position startPos, int length, Annotation annotation);
603
604         /** Removal of added annotation.
605          * @param annotation annotation which is going to be removed */

606         public void removeAnnotation(Annotation annotation);
607     }
608
609     /** @deprecated Not useful for anything. */
610     @Deprecated JavaDoc
611     public static final class Colors extends org.openide.options.SystemOption {
612         public static final String JavaDoc PROP_BREAKPOINT = BREAKPOINT_STYLE_NAME;
613         public static final String JavaDoc PROP_ERROR = ERROR_STYLE_NAME;
614         public static final String JavaDoc PROP_CURRENT = CURRENT_STYLE_NAME;
615         static final long serialVersionUID = -9152250591365746193L;
616
617         public void setBreakpoint(Color JavaDoc c) {
618         }
619
620         public Color JavaDoc getBreakpoint() {
621             return new Color JavaDoc(127, 127, 255);
622         }
623
624         public void setError(Color JavaDoc c) {
625         }
626
627         public Color JavaDoc getError() {
628             return Color.red;
629         }
630
631         public void setCurrent(Color JavaDoc c) {
632         }
633
634         public Color JavaDoc getCurrent() {
635             return Color.magenta;
636         }
637
638         public String JavaDoc displayName() {
639             return "COLORS"; // NOI18N
640
}
641     }
642
643     private static final class DocumentRenderer implements Runnable JavaDoc {
644         private static final int FIND_LINE_NUMBER = 0;
645         private static final int FIND_LINE_COLUMN = 1;
646         private static final int FIND_LINE_OFFSET = 2;
647         private StyledDocument doc;
648         private int opCode;
649         private int argInt;
650         private int retInt;
651
652         DocumentRenderer(int opCode, StyledDocument doc, int argInt) {
653             this.opCode = opCode;
654             this.doc = doc;
655             this.argInt = argInt;
656         }
657
658         int renderToInt() {
659             doc.render(this);
660
661             return retInt;
662         }
663
664         public void run() {
665             switch (opCode) {
666             case FIND_LINE_NUMBER: {
667                 Element paragraphsParent = findLineRootElement(doc);
668                 retInt = paragraphsParent.getElementIndex(argInt); // argInt is offset
669

670                 break;
671             }
672
673             case FIND_LINE_COLUMN: {
674                 Element paragraphsParent = findLineRootElement(doc);
675                 int indx = paragraphsParent.getElementIndex(argInt); // argInt is offset
676
retInt = argInt - paragraphsParent.getElement(indx).getStartOffset();
677
678                 break;
679             }
680
681             case FIND_LINE_OFFSET: {
682                 Element paragraphsParent = findLineRootElement(doc);
683                 Element line = paragraphsParent.getElement(argInt); // argInt is lineNumber
684

685                 if (line == null) {
686                     throw new IndexOutOfBoundsException JavaDoc("Index=" + argInt + " is out of bounds."); // NOI18N
687
}
688
689                 retInt = line.getStartOffset();
690
691                 break;
692             }
693
694             default:
695                 throw new IllegalStateException JavaDoc();
696             }
697         }
698     }
699 }
700
Popular Tags