--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2000, 2012 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
+ * Felix Pahl (fpahl@web.de) - contributed fix for:
+ * o introduce parameter throws NPE if there are compiler errors
+ * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48325)
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.refactoring.code;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+
+import org.eclipse.jface.text.TextSelection;
+
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringContribution;
+import org.eclipse.ltk.core.refactoring.RefactoringCore;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
+import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+import org.eclipse.jdt.core.dom.Assignment;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.FieldAccess;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.NullLiteral;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.refactoring.IJavaRefactorings;
+import org.eclipse.jdt.core.refactoring.descriptors.ChangeMethodSignatureDescriptor;
+import org.eclipse.jdt.core.refactoring.descriptors.IntroduceParameterDescriptor;
+
+import org.eclipse.jdt.internal.corext.Corext;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.corext.dom.ASTNodes;
+import org.eclipse.jdt.internal.corext.dom.Bindings;
+import org.eclipse.jdt.internal.corext.dom.ScopeAnalyzer;
+import org.eclipse.jdt.internal.corext.refactoring.Checks;
+import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments;
+import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil;
+import org.eclipse.jdt.internal.corext.refactoring.ParameterInfo;
+import org.eclipse.jdt.internal.corext.refactoring.RefactoringAvailabilityTester;
+import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
+import org.eclipse.jdt.internal.corext.refactoring.base.RefactoringStatusCodes;
+import org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationRefactoringChange;
+import org.eclipse.jdt.internal.corext.refactoring.structure.BodyUpdater;
+import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor;
+import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
+import org.eclipse.jdt.internal.corext.refactoring.tagging.IDelegateUpdating;
+import org.eclipse.jdt.internal.corext.util.Messages;
+
+import org.eclipse.jdt.internal.ui.actions.SelectionConverter;
+import org.eclipse.jdt.internal.ui.refactoring.DelegateUIHelper;
+import org.eclipse.jdt.internal.ui.refactoring.IntroduceParameterWizard.IntroduceParameterInputPage;
+
+
+public class IntroduceParameterRefactoring extends Refactoring implements IDelegateUpdating {
+
+ public static final String ATTRIBUTE_ARGUMENT= "argument"; //$NON-NLS-1$
+
+ private static final String[] KNOWN_METHOD_NAME_PREFIXES= {"get", "is"}; //$NON-NLS-2$ //$NON-NLS-1$
+
+ public ICompilationUnit fSourceCU;
+ public int fSelectionStart;
+ public int fSelectionLength;
+
+ private IMethod fMethod;
+ private Refactoring fChangeSignatureRefactoring;
+ public ChangeSignatureProcessor fChangeSignatureProcessor;
+ public ParameterInfo fParameter;
+ public String fParameterName;
+ public JavaRefactoringArguments fArguments;
+
+ public Expression fSelectedExpression;
+ private String[] fExcludedParameterNames;
+
+ /**
+ * Creates a new introduce parameter refactoring.
+ * @param unit the compilation unit, or <code>null</code> if invoked by scripting
+ * @param selectionStart start
+ * @param selectionLength length
+ */
+ public IntroduceParameterRefactoring(ICompilationUnit unit, int selectionStart, int selectionLength) {
+ Assert.isTrue(selectionStart >= 0);
+ Assert.isTrue(selectionLength >= 0);
+ fSourceCU= unit;
+ fSelectionStart= selectionStart;
+ fSelectionLength= selectionLength;
+ }
+
+ public IntroduceParameterRefactoring(JavaRefactoringArguments arguments, RefactoringStatus status) {
+ this(null, 0, 0);
+ RefactoringStatus initializeStatus= initialize(arguments);
+ status.merge(initializeStatus);
+ }
+
+ // ------------------- IDelegateUpdating ----------------------
+
+ public boolean canEnableDelegateUpdating() {
+ return true;
+ }
+
+ public boolean getDelegateUpdating() {
+ return (fChangeSignatureProcessor != null) ? fChangeSignatureProcessor.getDelegateUpdating() : false;
+ }
+
+ public void setDelegateUpdating(boolean updating) {
+ if (fChangeSignatureProcessor != null)
+ fChangeSignatureProcessor.setDelegateUpdating(updating);
+ }
+
+ public void setDeprecateDelegates(boolean deprecate) {
+ if (fChangeSignatureProcessor != null)
+ fChangeSignatureProcessor.setDeprecateDelegates(deprecate);
+ }
+
+ public boolean getDeprecateDelegates() {
+ return (fChangeSignatureProcessor != null) ? fChangeSignatureProcessor.getDeprecateDelegates() : false;
+ }
+
+ // ------------------- /IDelegateUpdating ---------------------
+
+ @Override
+ public String getName() {
+ return RefactoringCoreMessages.IntroduceParameterRefactoring_name;
+ }
+
+ //--- checkActivation
+
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
+ try {
+ pm.beginTask("", 7); //$NON-NLS-1$
+
+ if (! fSourceCU.isStructureKnown())
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceParameterRefactoring_syntax_error);
+
+ IJavaElement enclosingElement= SelectionConverter.resolveEnclosingElement(fSourceCU, new TextSelection(fSelectionStart, fSelectionLength));
+ if (! (enclosingElement instanceof IMethod))
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_in_method);
+
+ fMethod= (IMethod) enclosingElement;
+ pm.worked(1);
+
+ RefactoringStatus result= new RefactoringStatus();
+ if (fArguments != null) {
+ // invoked by script
+ fChangeSignatureProcessor= new ChangeSignatureProcessor(fArguments, result);
+ if (!result.hasFatalError()) {
+ fChangeSignatureRefactoring= new ProcessorBasedRefactoring(fChangeSignatureProcessor);
+ fChangeSignatureRefactoring.setValidationContext(getValidationContext());
+ result.merge(fChangeSignatureProcessor.checkInitialConditions(new SubProgressMonitor(pm, 2)));
+ if (result.hasFatalError())
+ return result;
+ } else {
+ pm.worked(2);
+ return result;
+ }
+ } else {
+ // first try:
+ fChangeSignatureProcessor= RefactoringAvailabilityTester.isChangeSignatureAvailable(fMethod) ? new ChangeSignatureProcessor(fMethod) : null;
+ if (fChangeSignatureProcessor == null)
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_in_method);
+ fChangeSignatureRefactoring= new ProcessorBasedRefactoring(fChangeSignatureProcessor);
+ fChangeSignatureRefactoring.setValidationContext(getValidationContext());
+ result.merge(fChangeSignatureProcessor.checkInitialConditions(new SubProgressMonitor(pm, 1)));
+ if (result.hasFatalError()) {
+ RefactoringStatusEntry entry= result.getEntryMatchingSeverity(RefactoringStatus.FATAL);
+ if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
+ // second try:
+ IMethod method= (IMethod) entry.getData();
+ fChangeSignatureProcessor= RefactoringAvailabilityTester.isChangeSignatureAvailable(method) ? new ChangeSignatureProcessor(method) : null;
+ if (fChangeSignatureProcessor == null) {
+ String msg= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_cannot_introduce, entry.getMessage());
+ return RefactoringStatus.createFatalErrorStatus(msg);
+ }
+ fChangeSignatureRefactoring= new ProcessorBasedRefactoring(fChangeSignatureProcessor);
+ fChangeSignatureRefactoring.setValidationContext(getValidationContext());
+ result= fChangeSignatureProcessor.checkInitialConditions(new SubProgressMonitor(pm, 1));
+ if (result.hasFatalError())
+ return result;
+ } else {
+ return result;
+ }
+ } else {
+ pm.worked(1);
+ }
+ }
+
+ CompilationUnitRewrite cuRewrite= fChangeSignatureProcessor.getBaseCuRewrite();
+ if (! cuRewrite.getCu().equals(fSourceCU))
+ cuRewrite= new CompilationUnitRewrite(fSourceCU); // TODO: should try to avoid throwing away this AST
+
+ initializeSelectedExpression(cuRewrite);
+ pm.worked(1);
+
+ result.merge(checkSelection(cuRewrite, new SubProgressMonitor(pm, 3)));
+ if (result.hasFatalError())
+ return result;
+
+ cuRewrite.generated_8885148521495549108(this);
+
+ fChangeSignatureProcessor.setBodyUpdater(new BodyUpdater() {
+ @Override
+ public void updateBody(MethodDeclaration methodDeclaration, CompilationUnitRewrite rewrite, RefactoringStatus updaterResult) {
+ replaceSelectedExpression(rewrite);
+ }
+ });
+
+ return result;
+ } finally {
+ pm.done();
+ if (fChangeSignatureRefactoring != null)
+ fChangeSignatureRefactoring.setValidationContext(null);
+ }
+ }
+
+ public void addParameterInfo(CompilationUnitRewrite cuRewrite) throws JavaModelException {
+ ITypeBinding typeBinding= Bindings.normalizeForDeclarationUse(fSelectedExpression.resolveTypeBinding(), fSelectedExpression.getAST());
+ String name= fParameterName != null ? fParameterName : guessedParameterName();
+ cuRewrite.generated_1579083801405145311(this, typeBinding, name);
+ }
+
+ private void replaceSelectedExpression(CompilationUnitRewrite cuRewrite) {
+ cuRewrite.generated_6040373797681253540(this);
+ }
+
+ private void initializeSelectedExpression(CompilationUnitRewrite cuRewrite) throws JavaModelException {
+ cuRewrite.generated_5301274277122299130(this);
+ }
+
+ private RefactoringStatus checkSelection(CompilationUnitRewrite cuRewrite, IProgressMonitor pm) {
+ try {
+ if (fSelectedExpression == null){
+ String message= RefactoringCoreMessages.IntroduceParameterRefactoring_select;
+ return CodeRefactoringUtil.checkMethodSyntaxErrors(fSelectionStart, fSelectionLength, cuRewrite.getRoot(), message);
+ }
+
+ MethodDeclaration methodDeclaration= (MethodDeclaration) ASTNodes.getParent(fSelectedExpression, MethodDeclaration.class);
+ if (methodDeclaration == null || ASTNodes.getParent(fSelectedExpression, Annotation.class) != null)
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_in_method);
+ if (methodDeclaration.resolveBinding() == null)
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceParameterRefactoring_no_binding);
+ //TODO: check for rippleMethods -> find matching fragments, consider callers of all rippleMethods
+
+ RefactoringStatus result= new RefactoringStatus();
+ result.merge(checkExpression());
+ if (result.hasFatalError())
+ return result;
+
+ result.merge(checkExpressionBinding());
+ if (result.hasFatalError())
+ return result;
+
+// if (isUsedInForInitializerOrUpdater(getSelectedExpression().getAssociatedExpression()))
+// return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.getString("ExtractTempRefactoring.for_initializer_updater")); //$NON-NLS-1$
+// pm.worked(1);
+//
+// if (isReferringToLocalVariableFromFor(getSelectedExpression().getAssociatedExpression()))
+// return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.getString("ExtractTempRefactoring.refers_to_for_variable")); //$NON-NLS-1$
+// pm.worked(1);
+
+ return result;
+ } finally {
+ if (pm != null)
+ pm.done();
+ }
+ }
+
+ private RefactoringStatus checkExpression() {
+ //TODO: adjust error messages (or generalize for all refactorings on expression-selections?)
+ Expression selectedExpression= fSelectedExpression;
+
+ if (selectedExpression instanceof Name && selectedExpression.getParent() instanceof ClassInstanceCreation)
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_name_in_new);
+ //TODO: let's just take the CIC automatically (no ambiguity -> no problem -> no dialog ;-)
+
+ if (selectedExpression instanceof NullLiteral) {
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_null_literals);
+ } else if (selectedExpression instanceof ArrayInitializer) {
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_array_initializer);
+ } else if (selectedExpression instanceof Assignment) {
+ if (selectedExpression.getParent() instanceof Expression)
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_assignment);
+ else
+ return null;
+
+ } else if (selectedExpression instanceof SimpleName){
+ if ((((SimpleName)selectedExpression)).isDeclaration())
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_names_in_declarations);
+ if (selectedExpression.getParent() instanceof QualifiedName && selectedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
+ || selectedExpression.getParent() instanceof FieldAccess && selectedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_select_expression);
+ }
+
+ return null;
+ }
+
+ private RefactoringStatus checkExpressionBinding() {
+ return checkExpressionFragmentIsRValue();
+ }
+
+ // !! +/- same as in ExtractConstantRefactoring & ExtractTempRefactoring
+ private RefactoringStatus checkExpressionFragmentIsRValue() {
+ switch(Checks.checkExpressionIsRValue(fSelectedExpression)) {
+ case Checks.IS_RVALUE_GUESSED:
+ case Checks.NOT_RVALUE_MISC:
+ return RefactoringStatus.createStatus(RefactoringStatus.FATAL, RefactoringCoreMessages.IntroduceParameterRefactoring_select, null, Corext.getPluginId(), RefactoringStatusCodes.EXPRESSION_NOT_RVALUE, null);
+ case Checks.NOT_RVALUE_VOID:
+ return RefactoringStatus.createStatus(RefactoringStatus.FATAL, RefactoringCoreMessages.IntroduceParameterRefactoring_no_void, null, Corext.getPluginId(), RefactoringStatusCodes.EXPRESSION_NOT_RVALUE_VOID, null);
+ case Checks.IS_RVALUE:
+ return new RefactoringStatus();
+ default:
+ Assert.isTrue(false); return null;
+ }
+ }
+
+ public List<ParameterInfo> getParameterInfos() {
+ return fChangeSignatureProcessor.getParameterInfos();
+ }
+
+ public ParameterInfo getAddedParameterInfo() {
+ return fParameter;
+ }
+
+ public String getMethodSignaturePreview() throws JavaModelException {
+ return fChangeSignatureProcessor.getNewMethodSignature();
+ }
+
+//--- Input setting/validation
+
+ public void setParameterName(String name) {
+ Assert.isNotNull(name);
+ fParameter.setNewName(name);
+ }
+
+ /**
+ * must only be called <i>after</i> checkActivation()
+ * @return guessed parameter name
+ */
+ public String guessedParameterName() {
+ String[] proposals= guessParameterNames();
+ if (proposals.length == 0)
+ return ""; //$NON-NLS-1$
+ else
+ return proposals[0];
+ }
+
+// --- TODO: copied from ExtractTempRefactoring - should extract ------------------------------
+
+ /**
+ * Must only be called <i>after</i> checkActivation().
+ * The first proposal should be used as "best guess" (if it exists).
+ * @return proposed variable names (may be empty, but not null).
+ */
+ public String[] guessParameterNames() {
+ LinkedHashSet<String> proposals= new LinkedHashSet<String>(); //retain ordering, but prevent duplicates
+ if (fSelectedExpression instanceof MethodInvocation){
+ proposals.addAll(guessTempNamesFromMethodInvocation((MethodInvocation) fSelectedExpression, fExcludedParameterNames));
+ }
+ proposals.addAll(guessTempNamesFromExpression(fSelectedExpression, fExcludedParameterNames));
+ return proposals.toArray(new String[proposals.size()]);
+ }
+
+ private List<String> guessTempNamesFromMethodInvocation(MethodInvocation selectedMethodInvocation, String[] excludedVariableNames) {
+ String methodName= selectedMethodInvocation.getName().getIdentifier();
+ for (int i= 0; i < KNOWN_METHOD_NAME_PREFIXES.length; i++) {
+ String prefix= KNOWN_METHOD_NAME_PREFIXES[i];
+ if (! methodName.startsWith(prefix))
+ continue; //not this prefix
+ if (methodName.length() == prefix.length())
+ return Collections.emptyList(); // prefix alone -> don't take method name
+ char firstAfterPrefix= methodName.charAt(prefix.length());
+ if (! Character.isUpperCase(firstAfterPrefix))
+ continue; //not uppercase after prefix
+ //found matching prefix
+ String proposal= Character.toLowerCase(firstAfterPrefix) + methodName.substring(prefix.length() + 1);
+ methodName= proposal;
+ break;
+ }
+ String[] proposals= StubUtility.getLocalNameSuggestions(fSourceCU.getJavaProject(), methodName, 0, excludedVariableNames);
+ return Arrays.asList(proposals);
+ }
+
+ private List<String> guessTempNamesFromExpression(Expression selectedExpression, String[] excluded) {
+ ITypeBinding expressionBinding= Bindings.normalizeForDeclarationUse(
+ selectedExpression.resolveTypeBinding(),
+ selectedExpression.getAST());
+ String typeName= getQualifiedName(expressionBinding);
+ if (typeName.length() == 0)
+ typeName= expressionBinding.getName();
+ if (typeName.length() == 0)
+ return Collections.emptyList();
+ int typeParamStart= typeName.indexOf("<"); //$NON-NLS-1$
+ if (typeParamStart != -1)
+ typeName= typeName.substring(0, typeParamStart);
+ String[] proposals= StubUtility.getLocalNameSuggestions(fSourceCU.getJavaProject(), typeName, expressionBinding.getDimensions(), excluded);
+ return Arrays.asList(proposals);
+ }
+
+// ----------------------------------------------------------------------
+
+ private static String getQualifiedName(ITypeBinding typeBinding) {
+ if (typeBinding.isAnonymous())
+ return getQualifiedName(typeBinding.getSuperclass());
+ if (! typeBinding.isArray())
+ return typeBinding.getQualifiedName();
+ else
+ return typeBinding.getElementType().getQualifiedName();
+ }
+
+ public void initializeExcludedParameterNames(CompilationUnitRewrite cuRewrite) {
+ IBinding[] bindings= new ScopeAnalyzer(cuRewrite.getRoot()).getDeclarationsInScope(
+ fSelectedExpression.getStartPosition(), ScopeAnalyzer.VARIABLES);
+ fExcludedParameterNames= new String[bindings.length];
+ for (int i= 0; i < fExcludedParameterNames.length; i++) {
+ fExcludedParameterNames[i]= bindings[i].getName();
+ }
+ }
+
+ public RefactoringStatus validateInput() {
+ return fChangeSignatureProcessor.checkSignature();
+ }
+
+//--- checkInput
+
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
+ fChangeSignatureRefactoring.setValidationContext(getValidationContext());
+ try {
+ return fChangeSignatureRefactoring.checkFinalConditions(pm);
+ } finally {
+ fChangeSignatureRefactoring.setValidationContext(null);
+ }
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException {
+ fChangeSignatureRefactoring.setValidationContext(getValidationContext());
+ try {
+ Change[] changes= fChangeSignatureProcessor.getAllChanges();
+ return new DynamicValidationRefactoringChange(getRefactoringDescriptor(), RefactoringCoreMessages.IntroduceParameterRefactoring_name, changes);
+ } finally {
+ fChangeSignatureRefactoring.setValidationContext(null);
+ pm.done();
+ }
+ }
+
+ private IntroduceParameterDescriptor getRefactoringDescriptor() {
+ ChangeMethodSignatureDescriptor extended= (ChangeMethodSignatureDescriptor) fChangeSignatureProcessor.createDescriptor();
+ RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(IJavaRefactorings.CHANGE_METHOD_SIGNATURE);
+
+ Map<String, String> argumentsMap= contribution.retrieveArgumentMap(extended);
+
+ final Map<String, String> arguments= new HashMap<String, String>();
+ arguments.put(ATTRIBUTE_ARGUMENT, fParameter.getNewName());
+ arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
+ arguments.putAll(argumentsMap);
+ return fChangeSignatureProcessor.generated_8156777813229824559(this, extended, arguments);
+ }
+
+ private RefactoringStatus initialize(JavaRefactoringArguments arguments) {
+ return arguments.generated_8748163025498223751(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDelegateUpdatingTitle(boolean plural) {
+ if (plural)
+ return RefactoringCoreMessages.DelegateCreator_keep_original_changed_plural;
+ else
+ return RefactoringCoreMessages.DelegateCreator_keep_original_changed_singular;
+ }
+
+ public void generated_6066273182733123243(final IntroduceParameterInputPage introduceparameterinputpage) {
+ introduceparameterinputpage.fDeprecateDelegateCheckBox.setSelection(DelegateUIHelper.loadDeprecateDelegateSetting(this));
+ setDeprecateDelegates(introduceparameterinputpage.fDeprecateDelegateCheckBox.getSelection());
+ introduceparameterinputpage.fDeprecateDelegateCheckBox.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setDeprecateDelegates(introduceparameterinputpage.fDeprecateDelegateCheckBox.getSelection());
+ }
+ });
+ introduceparameterinputpage.fDeprecateDelegateCheckBox.setEnabled(introduceparameterinputpage.fLeaveDelegateCheckBox.getSelection());
+ }
+}