blob: 68f9978df7305bb92efcbcad44049b183371bb6e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.text.edits.TextEditGroup;
public class ASTModification {
public enum ModificationKind {
REPLACE,
INSERT_BEFORE,
APPEND_CHILD
}
private final ModificationKind fKind;
private final IASTNode fTargetNode;
private final IASTNode fNewNode;
private final TextEditGroup fTextEditGroup;
public ASTModification(ModificationKind kind, IASTNode targetNode, IASTNode newNode, TextEditGroup group) {
fKind= kind;
fTargetNode= targetNode;
fNewNode= newNode;
fTextEditGroup= group;
}
/**
* @return the kind of the modification
*/
public ModificationKind getKind() {
return fKind;
}
/**
* Return the target node of this modification.
*/
public IASTNode getTargetNode() {
return fTargetNode;
}
/**
* Return the new node of this modification, or <code>null</code>
*/
public IASTNode getNewNode() {
return fNewNode;
}
/**
* Returns the edit group to collect the text edits of this modification.
* @return the edit group or <code>null</code>.
*/
public TextEditGroup getAssociatedEditGroup() {
return fTextEditGroup;
}
}
|