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.ReplaceEdit; // packageimport
|
|
16
|
129
|
17 import dwt.dwthelper.utils;
|
|
18
|
|
19 /**
|
|
20 * A source modifier can be used to modify the source of
|
|
21 * a move or copy edit before it gets inserted at the target
|
|
22 * position. This is useful if the text to be copied has to
|
|
23 * be modified before it is inserted without changing the
|
|
24 * original source.
|
|
25 *
|
|
26 * @since 3.0
|
|
27 */
|
|
28 public interface ISourceModifier {
|
|
29 /**
|
|
30 * Returns the modification to be done to the passed
|
|
31 * string in form of replace edits. The set of returned
|
|
32 * replace edits must modify disjoint text regions.
|
|
33 * Violating this requirement will result in a <code>
|
|
34 * BadLocationException</code> while executing the
|
|
35 * associated move or copy edit.
|
|
36 * <p>
|
|
37 * The caller of this method is responsible to apply
|
|
38 * the returned edits to the passed source.
|
|
39 *
|
|
40 * @param source the source to be copied or moved
|
|
41 * @return an array of <code>ReplaceEdits</code>
|
|
42 * describing the modifications.
|
|
43 */
|
|
44 public ReplaceEdit[] getModifications(String source);
|
|
45
|
|
46 /**
|
|
47 * Creates a copy of this source modifier object. The copy will
|
|
48 * be used in a different text edit object. So it should be
|
|
49 * created in a way that is doesn't conflict with other text edits
|
|
50 * referring to this source modifier.
|
|
51 *
|
|
52 * @return the copy of the source modifier
|
|
53 */
|
|
54 public ISourceModifier copy();
|
|
55 }
|