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