01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.text.edits;
11:
12: /**
13: * A source modifier can be used to modify the source of
14: * a move or copy edit before it gets inserted at the target
15: * position. This is useful if the text to be copied has to
16: * be modified before it is inserted without changing the
17: * original source.
18: *
19: * @since 3.0
20: */
21: public interface ISourceModifier {
22: /**
23: * Returns the modification to be done to the passed
24: * string in form of replace edits. The set of returned
25: * replace edits must modify disjoint text regions.
26: * Violating this requirement will result in a <code>
27: * BadLocationException</code> while executing the
28: * associated move or copy edit.
29: * <p>
30: * The caller of this method is responsible to apply
31: * the returned edits to the passed source.
32: *
33: * @param source the source to be copied or moved
34: * @return an array of <code>ReplaceEdits</code>
35: * describing the modifications.
36: */
37: public ReplaceEdit[] getModifications(String source);
38:
39: /**
40: * Creates a copy of this source modifier object. The copy will
41: * be used in a different text edit object. So it should be
42: * created in a way that is doesn't conflict with other text edits
43: * referring to this source modifier.
44: *
45: * @return the copy of the source modifier
46: */
47: public ISourceModifier copy();
48: }
|