]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/jdt-before/core refactoring/org/eclipse/jdt/internal/corext/refactoring/changes/DynamicValidationRefactoringChange.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / core refactoring / org / eclipse / jdt / internal / corext / refactoring / changes / DynamicValidationRefactoringChange.java
CommitLineData
1b2798f6
EK
1/*******************************************************************************
2 * Copyright (c) 2006, 2011 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 *******************************************************************************/
11package org.eclipse.jdt.internal.corext.refactoring.changes;
12
13import org.eclipse.core.runtime.Assert;
14
15import org.eclipse.ltk.core.refactoring.Change;
16import org.eclipse.ltk.core.refactoring.ChangeDescriptor;
17import org.eclipse.ltk.core.refactoring.RefactoringChangeDescriptor;
18import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
19
20import org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor;
21
22import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
23
24/**
25 * Dynamic validation state change with support for refactoring descriptors.
26 *
27 * @since 3.2
28 */
29public final class DynamicValidationRefactoringChange extends DynamicValidationStateChange {
30
31 /** The refactoring descriptor */
32 private final RefactoringDescriptor fDescriptor;
33
34 /**
35 * Creates a new dynamic validation refactoring change.
36 *
37 * @param descriptor
38 * the refactoring descriptor
39 * @param name
40 * the name of the change
41 */
42 public DynamicValidationRefactoringChange(final JavaRefactoringDescriptor descriptor, final String name) {
43 super(name);
44 Assert.isNotNull(descriptor);
45 fDescriptor= descriptor;
46 }
47
48 /**
49 * Creates a new dynamic validation refactoring change.
50 *
51 * @param descriptor
52 * the refactoring descriptor
53 * @param name
54 * the name of the change
55 * @param changes
56 * the changes
57 */
58 public DynamicValidationRefactoringChange(final JavaRefactoringDescriptor descriptor, final String name, final Change[] changes) {
59 super(name, changes);
60 Assert.isNotNull(descriptor);
61 Assert.isTrue(!descriptor.validateDescriptor().hasFatalError(), RefactoringCoreMessages.DynamicValidationRefactoringChange_fatal_error);
62 fDescriptor= descriptor;
63 }
64
65 /**
66 * {@inheritDoc}
67 */
68 @Override
69 public ChangeDescriptor getDescriptor() {
70 return new RefactoringChangeDescriptor(fDescriptor);
71 }
72}