KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > internal > core > refactoring > history > RefactoringDescriptorChange


1 /*******************************************************************************
2  * Copyright (c) 2006 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.ltk.internal.core.refactoring.history;
12
13 import org.eclipse.ltk.core.refactoring.ChangeDescriptor;
14 import org.eclipse.ltk.core.refactoring.CompositeChange;
15 import org.eclipse.ltk.core.refactoring.RefactoringChangeDescriptor;
16
17 /**
18  * Wrapper change for refactorings which returns an unknown refactoring
19  * descriptor in case the refactoring does not provide one.
20  *
21  * @since 3.2
22  */

23 public final class RefactoringDescriptorChange extends CompositeChange {
24
25     /**
26      * Creates a new refactoring descriptor change.
27      *
28      * @param name
29      * the name of the change
30      */

31     public RefactoringDescriptorChange(final String JavaDoc name) {
32         super(name);
33     }
34
35     /**
36      * {@inheritDoc}
37      */

38     public final ChangeDescriptor getDescriptor() {
39         final ChangeDescriptor descriptor= super.getDescriptor();
40         if (descriptor == null) {
41             return new RefactoringChangeDescriptor(new UnknownRefactoringDescriptor(getChildren()[0].getName()));
42         }
43         return descriptor;
44     }
45 }
46
Popular Tags