gt: 		final int type = fJavaElement.getElementType();
context: /*******************************************************************************
   * Copyright (c) 2006, 2008 IBM Corporation and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
   * which accompanies this distribution, and is available at
   * http://www.eclipse.org/legal/epl-v10.html
   *
   * Contributors:
   *     IBM Corporation - initial API and implementation
   *******************************************************************************/
  package org.eclipse.jdt.core.refactoring.descriptors;
  
  import org.eclipse.core.runtime.Assert;
  import org.eclipse.jdt.core.IField;
  import org.eclipse.jdt.core.IJavaElement;
  import org.eclipse.jdt.core.IMethod;
  import org.eclipse.jdt.core.IPackageFragment;
  import org.eclipse.jdt.core.IPackageFragmentRoot;
  import org.eclipse.jdt.core.IType;
  import org.eclipse.jdt.core.ITypeParameter;
  import org.eclipse.jdt.core.refactoring.IJavaRefactorings;
  import org.eclipse.jdt.internal.core.refactoring.descriptors.DescriptorMessages;
  import org.eclipse.jdt.internal.core.refactoring.descriptors.JavaRefactoringDescriptorUtil;
  import org.eclipse.ltk.core.refactoring.RefactoringContribution;
  import org.eclipse.ltk.core.refactoring.RefactoringCore;
  import org.eclipse.ltk.core.refactoring.RefactoringStatus;
  
  import java.util.Map;
  
  /**
   * Refactoring descriptor for the rename java element refactoring.
   * <p>
   * An instance of this refactoring descriptor may be obtained by calling
   * {@link RefactoringContribution#createDescriptor()} on a refactoring
   * contribution requested by invoking
   * {@link RefactoringCore#getRefactoringContribution(String)} with the
   * appropriate refactoring id.
   * </p>
   * <p>
   * Note: this class is not intended to be instantiated by clients.
   * </p>
   *
   * @since 1.1
   *
   * @noinstantiate This class is not intended to be instantiated by clients.
   */
  public final class RenameJavaElementDescriptor extends JavaRefactoringDescriptor {
  
  	/** The delegate attribute */
  	private static final String ATTRIBUTE_DELEGATE= "delegate"; //$NON-NLS-1$
  
  	/** The deprecate attribute */
  	private static final String ATTRIBUTE_DEPRECATE= "deprecate"; //$NON-NLS-1$
  
  	/** The hierarchical attribute */
  	private static final String ATTRIBUTE_HIERARCHICAL= "hierarchical"; //$NON-NLS-1$
  
  	/** The match strategy attribute */
  	private static final String ATTRIBUTE_MATCH_STRATEGY= "matchStrategy"; //$NON-NLS-1$
  
  	/** The parameter attribute */
  	private static final String ATTRIBUTE_PARAMETER= "parameter"; //$NON-NLS-1$
  
  	/** The patterns attribute */
  	private static final String ATTRIBUTE_PATTERNS= "patterns"; //$NON-NLS-1$
  
  	/** The qualified attribute */
  	private static final String ATTRIBUTE_QUALIFIED= "qualified"; //$NON-NLS-1$
  
  	/** The rename getter attribute */
  	private static final String ATTRIBUTE_RENAME_GETTER= "getter"; //$NON-NLS-1$
  
  	/** The rename setter attribute */
  	private static final String ATTRIBUTE_RENAME_SETTER= "setter"; //$NON-NLS-1$
  
  	/** The similar declarations attribute */
  	private static final String ATTRIBUTE_SIMILAR_DECLARATIONS= "similarDeclarations"; //$NON-NLS-1$
  
  	/** The textual matches attribute */
  	private static final String ATTRIBUTE_TEXTUAL_MATCHES= "textual"; //$NON-NLS-1$
  
  	/**
  	 * Similar declaration updating strategy which finds exact names and
  	 * embedded names as well (value: <code>2</code>).
  	 */
  	public static final int STRATEGY_EMBEDDED= 2;
  
  	/**
  	 * Similar declaration updating strategy which finds exact names only
  	 * (value: <code>1</code>).
  	 */
  	public static final int STRATEGY_EXACT= 1;
  
  	/**
  	 * Similar declaration updating strategy which finds exact names, embedded
  	 * names and name suffixes (value: <code>3</code>).
  	 */
  	public static final int STRATEGY_SUFFIX= 3;
  
  	/**
  	 * @deprecated Replaced by {@link org.eclipse.ltk.core.refactoring.resource.RenameResourceDescriptor#ID}
  	 */
  	private static final String RENAME_RESOURCE= IJavaRefactorings.RENAME_RESOURCE;
  
  
  	/** The delegate attribute */
  	private boolean fDelegate = false;
  
  	/** The deprecate attribute */
  	private boolean fDeprecate = false;
  
  	/** The hierarchical attribute */
  	private boolean fHierarchical = false;
  
  	/**
  	 * The java element attribute.
  	 * WARNING: may not exist, see comment in
  	 * {@link JavaRefactoringDescriptorUtil#handleToElement(org.eclipse.jdt.core.WorkingCopyOwner, String, String, boolean)}.
  	 */
  	private IJavaElement fJavaElement = null;
  
  	/** The match strategy */
  	private int fMatchStrategy = STRATEGY_EXACT;
  
  	/** The name attribute */
  	private String fName = null;
  
  	/** The patterns attribute */
  	private String fPatterns = null;
  
  	/** The qualified attribute */
  	private boolean fQualified = false;
  
  	/** The references attribute */
  	private boolean fReferences = false;
  
  	/** The rename getter attribute */
  	private boolean fRenameGetter = false;
  
  	/** The rename setter attribute */
  	private boolean fRenameSetter = false;
  
  	/** The similar declarations attribute */
  	private boolean fSimilarDeclarations = false;
  
  	/** The textual attribute */
  	private boolean fTextual = false;
  
  	/**
  	 * Creates a new refactoring descriptor.
  	 *
  	 * @param id
  	 *            the unique id of the rename refactoring
  	 * @see IJavaRefactorings
  	 */
  	public RenameJavaElementDescriptor(final String id) {
  		super(id);
  		Assert.isLegal(checkId(id), "Refactoring id is not a rename refactoring id"); //$NON-NLS-1$
  	}
  
  	/**
  	 * Creates a new refactoring descriptor.
  	 *
  	 * @param id
  	 *            the ID of this descriptor
  	 * @param project
  	 *            the non-empty name of the project associated with this
  	 *            refactoring, or <code>null</code> for a workspace
  	 *            refactoring
  	 * @param description
  	 *            a non-empty human-readable description of the particular
  	 *            refactoring instance
  	 * @param comment
  	 *            the human-readable comment of the particular refactoring
  	 *            instance, or <code>null</code> for no comment
  	 * @param arguments
  	 * 			  a map of arguments that will be persisted and describes
  	 * 			  all settings for this refactoring
  	 * @param flags
  	 *            the flags of the refactoring descriptor
  	 *
  	 * @throws IllegalArgumentException if the argument map contains invalid keys/values
  	 *
  	 * @since 1.2
  	 */
  	public RenameJavaElementDescriptor(String id, String project, String description, String comment, Map arguments, int flags) {
  		super(id, project, description, comment, arguments, flags);
  		Assert.isLegal(checkId(id), "Refactoring id is not a rename refactoring id"); //$NON-NLS-1$
  		fName = JavaRefactoringDescriptorUtil.getString(fArguments, ATTRIBUTE_NAME);
  		if (getID().equals(IJavaRefactorings.RENAME_TYPE_PARAMETER)) {
  			fJavaElement = JavaRefactoringDescriptorUtil.getJavaElement(fArguments, ATTRIBUTE_INPUT, getProject());
  			String parameterName = JavaRefactoringDescriptorUtil.getString(fArguments, ATTRIBUTE_PARAMETER);
  			if (fJavaElement instanceof IType) {
  				fJavaElement = ((IType)fJavaElement).getTypeParameter(parameterName);
  			}
  			if (fJavaElement instanceof IMethod) {
  				fJavaElement = ((IMethod)fJavaElement).getTypeParameter(parameterName);
  			}
  		} else
  			fJavaElement = JavaRefactoringDescriptorUtil.getJavaElement(fArguments, ATTRIBUTE_INPUT, getProject());
  