129
|
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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.source.ILineDiffer;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 import dwtx.jface.text.BadLocationException;
|
|
18
|
|
19
|
|
20 /**
|
|
21 * Protocol that allows direct access to line information. Usually, implementations will also
|
|
22 * implement <code>IAnnotationModel</code>, which only allows <code>Iterator</code> based access
|
|
23 * to annotations.
|
|
24 * <p>
|
|
25 * <code>ILineDiffer</code> also allows to revert any lines to their original
|
|
26 * contents as defined by the quick diff reference used by the receiver.
|
|
27 * </p>
|
|
28 * <p>
|
|
29 * This interface may be implemented by clients.
|
|
30 * </p>
|
|
31 * <p>
|
|
32 * In order to provide backward compatibility for clients of <code>ILineDiffer</code>, extension
|
|
33 * interfaces are used to provide a means of evolution. The following extension interface
|
|
34 * exists:
|
|
35 * <ul>
|
|
36 * <li> {@link ILineDifferExtension} (since version 3.1): introducing the concept
|
|
37 * suspending and resuming an <code>ILineDiffer</code>.</li>
|
|
38 * <li> {@link ILineDifferExtension2} (since version 3.3): allowing to query the suspension state
|
|
39 * of an <code>ILineDiffer</code>.</li>
|
|
40 * </ul>
|
|
41 * </p>
|
|
42 *
|
|
43 * @since 3.0
|
|
44 */
|
|
45 public interface ILineDiffer {
|
|
46
|
|
47 /**
|
|
48 * Determines the line state for line <code>line</code> in the targeted document.
|
|
49 *
|
|
50 * @param line the line to get diff information for
|
|
51 * @return the line information object for <code>line</code> or <code>null</code> if none
|
|
52 */
|
|
53 ILineDiffInfo getLineInfo(int line);
|
|
54
|
|
55 /**
|
|
56 * Reverts a single changed line to its original state, not touching any lines that
|
|
57 * are deleted at its borders.
|
|
58 *
|
|
59 * @param line the line number of the line to be restored.
|
|
60 * @throws BadLocationException if <code>line</code> is out of bounds.
|
|
61 */
|
|
62 void revertLine(int line) throws BadLocationException;
|
|
63
|
|
64 /**
|
|
65 * Reverts a block of modified / added lines to their original state, including any deleted
|
|
66 * lines inside the block or at its borders. A block is considered to be a range of modified
|
|
67 * (e.g. changed, or added) lines.
|
|
68 *
|
|
69 * @param line any line in the block to be reverted.
|
|
70 * @throws BadLocationException if <code>line</code> is out of bounds.
|
|
71 */
|
|
72 void revertBlock(int line) throws BadLocationException;
|
|
73
|
|
74 /**
|
|
75 * Reverts a range of lines to their original state, including any deleted
|
|
76 * lines inside the block or at its borders.
|
|
77 *
|
|
78 * @param line any line in the block to be reverted.
|
|
79 * @param nLines the number of lines to be reverted, must be > 0.
|
|
80 * @throws BadLocationException if <code>line</code> is out of bounds.
|
|
81 */
|
|
82 void revertSelection(int line, int nLines) throws BadLocationException;
|
|
83
|
|
84 /**
|
|
85 * Restores the deleted lines after <code>line</code>.
|
|
86 *
|
|
87 * @param line the deleted lines following this line number are restored.
|
|
88 * @return the number of restored lines.
|
|
89 * @throws BadLocationException if <code>line</code> is out of bounds.
|
|
90 */
|
|
91 int restoreAfterLine(int line) throws BadLocationException;
|
|
92 }
|