129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 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.text.edits.ISourceModifier;
|
|
14
|
131
|
15 import dwtx.text.edits.MultiTextEdit; // packageimport
|
|
16 import dwtx.text.edits.CopySourceEdit; // packageimport
|
|
17 import dwtx.text.edits.MoveSourceEdit; // packageimport
|
|
18 import dwtx.text.edits.CopyingRangeMarker; // packageimport
|
|
19 import dwtx.text.edits.ReplaceEdit; // packageimport
|
|
20 import dwtx.text.edits.EditDocument; // packageimport
|
|
21 import dwtx.text.edits.UndoCollector; // packageimport
|
|
22 import dwtx.text.edits.DeleteEdit; // packageimport
|
|
23 import dwtx.text.edits.MoveTargetEdit; // packageimport
|
|
24 import dwtx.text.edits.CopyTargetEdit; // packageimport
|
|
25 import dwtx.text.edits.TextEditCopier; // packageimport
|
|
26 import dwtx.text.edits.TextEditMessages; // packageimport
|
|
27 import dwtx.text.edits.TextEditProcessor; // packageimport
|
|
28 import dwtx.text.edits.MalformedTreeException; // packageimport
|
|
29 import dwtx.text.edits.TreeIterationInfo; // packageimport
|
|
30 import dwtx.text.edits.TextEditVisitor; // packageimport
|
|
31 import dwtx.text.edits.TextEditGroup; // packageimport
|
|
32 import dwtx.text.edits.TextEdit; // packageimport
|
|
33 import dwtx.text.edits.RangeMarker; // packageimport
|
|
34 import dwtx.text.edits.UndoEdit; // packageimport
|
|
35 import dwtx.text.edits.InsertEdit; // packageimport
|
|
36
|
|
37
|
129
|
38 import dwt.dwthelper.utils;
|
|
39
|
|
40 /**
|
|
41 * A source modifier can be used to modify the source of
|
|
42 * a move or copy edit before it gets inserted at the target
|
|
43 * position. This is useful if the text to be copied has to
|
|
44 * be modified before it is inserted without changing the
|
|
45 * original source.
|
|
46 *
|
|
47 * @since 3.0
|
|
48 */
|
|
49 public interface ISourceModifier {
|
|
50 /**
|
|
51 * Returns the modification to be done to the passed
|
|
52 * string in form of replace edits. The set of returned
|
|
53 * replace edits must modify disjoint text regions.
|
|
54 * Violating this requirement will result in a <code>
|
|
55 * BadLocationException</code> while executing the
|
|
56 * associated move or copy edit.
|
|
57 * <p>
|
|
58 * The caller of this method is responsible to apply
|
|
59 * the returned edits to the passed source.
|
|
60 *
|
|
61 * @param source the source to be copied or moved
|
|
62 * @return an array of <code>ReplaceEdits</code>
|
|
63 * describing the modifications.
|
|
64 */
|
|
65 public ReplaceEdit[] getModifications(String source);
|
|
66
|
|
67 /**
|
|
68 * Creates a copy of this source modifier object. The copy will
|
|
69 * be used in a different text edit object. So it should be
|
|
70 * created in a way that is doesn't conflict with other text edits
|
|
71 * referring to this source modifier.
|
|
72 *
|
|
73 * @return the copy of the source modifier
|
|
74 */
|
|
75 public ISourceModifier copy();
|
|
76 }
|