KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > refactoring > RenameTypeArguments


1 /*******************************************************************************
2  * Copyright (c) 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.jdt.core.refactoring;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
16
17 import org.eclipse.jdt.core.IJavaElement;
18
19 /**
20  * Rename type arguments describe the data that a rename type processor
21  * provides to its rename type participants.
22  * <p>
23  * This class is not intended to be subclassed by clients.
24  * </p>
25  *
26  * @since 3.2
27  */

28 public class RenameTypeArguments extends RenameArguments {
29
30     private boolean updateSimilarDeclarations;
31     private IJavaElement[] similarDeclarations;
32     
33     /**
34      * Creates new rename type arguments.
35      *
36      * @param newName the new name of the element to be renamed
37      * @param updateReferences <code>true</code> if reference
38      * updating is requested; <code>false</code> otherwise
39      * @param updateSimilarDeclarations <code>true</code> if similar
40      * declaration updating is requested; <code>false</code> otherwise
41      * @param similarDeclarations the similar declarations that will be
42      * updated or <code>null</code> if similar declaration updating is
43      * not requested
44      */

45     public RenameTypeArguments(String JavaDoc newName, boolean updateReferences, boolean updateSimilarDeclarations,
46             IJavaElement[] similarDeclarations) {
47         super(newName, updateReferences);
48         if (updateSimilarDeclarations) {
49             Assert.isNotNull(similarDeclarations);
50         }
51         this.updateSimilarDeclarations= updateSimilarDeclarations;
52         this.similarDeclarations= similarDeclarations;
53     }
54     
55     /**
56      * Returns whether similar declaration updating is requested or not.
57      *
58      * @return returns <code>true</code> if similar declaration
59      * updating is requested; <code>false</code> otherwise
60      */

61     public boolean getUpdateSimilarDeclarations() {
62         return updateSimilarDeclarations;
63     }
64     
65     /**
66      * Returns the similar declarations that get updated. Returns
67      * <code>null</code> if similar declaration updating is not
68      * requested.
69      *
70      * @return the similar elements that get updated
71      */

72     public IJavaElement[] getSimilarDeclarations() {
73         return similarDeclarations;
74     }
75     
76     /* (non-Javadoc)
77      * @see RefactoringArguments#toString()
78      */

79     public String JavaDoc toString() {
80         return super.toString()
81                 + (updateSimilarDeclarations ? " (update derived elements)" : " (don't update derived elements)"); //$NON-NLS-1$//$NON-NLS-2$
82
}
83 }
Popular Tags