KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > text > edits > ISourceModifier


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  *******************************************************************************/

11 package org.eclipse.text.edits;
12
13 /**
14  * A source modifier can be used to modify the source of
15  * a move or copy edit before it gets inserted at the target
16  * position. This is useful if the text to be copied has to
17  * be modified before it is inserted without changing the
18  * original source.
19  *
20  * @since 3.0
21  */

22 public interface ISourceModifier {
23     /**
24      * Returns the modification to be done to the passed
25      * string in form of replace edits. The set of returned
26      * replace edits must modify disjoint text regions.
27      * Violating this requirement will result in a <code>
28      * BadLocationException</code> while executing the
29      * associated move or copy edit.
30      * <p>
31      * The caller of this method is responsible to apply
32      * the returned edits to the passed source.
33      *
34      * @param source the source to be copied or moved
35      * @return an array of <code>ReplaceEdits</code>
36      * describing the modifications.
37      */

38     public ReplaceEdit[] getModifications(String JavaDoc source);
39
40     /**
41      * Creates a copy of this source modifier object. The copy will
42      * be used in a different text edit object. So it should be
43      * created in a way that is doesn't conflict with other text edits
44      * referring to this source modifier.
45      *
46      * @return the copy of the source modifier
47      */

48     public ISourceModifier copy();
49 }
50
Popular Tags