KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > source > ILineDiffer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.text.source;
12
13 import org.eclipse.jface.text.BadLocationException;
14
15
16 /**
17  * Protocol that allows direct access to line information. Usually, implementations will also
18  * implement <code>IAnnotationModel</code>, which only allows <code>Iterator</code> based access
19  * to annotations.
20  * <p>
21  * <code>ILineDiffer</code> also allows to revert any lines to their original
22  * contents as defined by the quick diff reference used by the receiver.
23  * </p>
24  * <p>
25  * This interface may be implemented by clients.
26  * </p>
27  * <p>
28  * In order to provide backward compatibility for clients of <code>ILineDiffer</code>, extension
29  * interfaces are used to provide a means of evolution. The following extension interface
30  * exists:
31  * <ul>
32  * <li> {@link ILineDifferExtension} (since version 3.1): introducing the concept
33  * suspending and resuming an <code>ILineDiffer</code>.</li>
34  * <li> {@link ILineDifferExtension2} (since version 3.3): allowing to query the suspension state
35  * of an <code>ILineDiffer</code>.</li>
36  * </ul>
37  * </p>
38  *
39  * @since 3.0
40  */

41 public interface ILineDiffer {
42
43     /**
44      * Determines the line state for line <code>line</code> in the targeted document.
45      *
46      * @param line the line to get diff information for
47      * @return the line information object for <code>line</code> or <code>null</code> if none
48      */

49     ILineDiffInfo getLineInfo(int line);
50
51     /**
52      * Reverts a single changed line to its original state, not touching any lines that
53      * are deleted at its borders.
54      *
55      * @param line the line number of the line to be restored.
56      * @throws BadLocationException if <code>line</code> is out of bounds.
57      */

58     void revertLine(int line) throws BadLocationException;
59
60     /**
61      * Reverts a block of modified / added lines to their original state, including any deleted
62      * lines inside the block or at its borders. A block is considered to be a range of modified
63      * (e.g. changed, or added) lines.
64      *
65      * @param line any line in the block to be reverted.
66      * @throws BadLocationException if <code>line</code> is out of bounds.
67      */

68     void revertBlock(int line) throws BadLocationException;
69
70     /**
71      * Reverts a range of lines to their original state, including any deleted
72      * lines inside the block or at its borders.
73      *
74      * @param line any line in the block to be reverted.
75      * @param nLines the number of lines to be reverted, must be &gt; 0.
76      * @throws BadLocationException if <code>line</code> is out of bounds.
77      */

78     void revertSelection(int line, int nLines) throws BadLocationException;
79
80     /**
81      * Restores the deleted lines after <code>line</code>.
82      *
83      * @param line the deleted lines following this line number are restored.
84      * @return the number of restored lines.
85      * @throws BadLocationException if <code>line</code> is out of bounds.
86      */

87     int restoreAfterLine(int line) throws BadLocationException;
88 }
89
Popular Tags