1 /*******************************************************************************
2 * Copyright (c) 2000, 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.ui.refactoring.reorg;
13 import org.eclipse.core.runtime.Assert;
15 import org.eclipse.jface.resource.ImageDescriptor;
17 import org.eclipse.ltk.core.refactoring.Refactoring;
18 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
19 import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
20 import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
22 import org.eclipse.jdt.internal.corext.refactoring.rename.RenameCompilationUnitProcessor;
23 import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor;
25 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
26 import org.eclipse.jdt.internal.ui.JavaPluginImages;
27 import org.eclipse.jdt.internal.ui.refactoring.RefactoringMessages;
30 * The type renaming wizard.
32 public class RenameTypeWizard extends RenameRefactoringWizard {
34 public RenameTypeWizard(Refactoring refactoring) {
35 this(refactoring, RefactoringMessages.RenameTypeWizard_defaultPageTitle, RefactoringMessages.RenameTypeWizardInputPage_description, JavaPluginImages.DESC_WIZBAN_REFACTOR_TYPE,
36 IJavaHelpContextIds.RENAME_TYPE_WIZARD_PAGE);
39 public RenameTypeWizard(Refactoring refactoring, String defaultPageTitle, String inputPageDescription, ImageDescriptor inputPageImageDescriptor, String pageContextHelpId) {
40 super(refactoring, defaultPageTitle, inputPageDescription, inputPageImageDescriptor, pageContextHelpId);
46 * @see RefactoringWizard#addUserInputPages
49 protected void addUserInputPages() {
50 super.addUserInputPages();
52 addPage(new RenameTypeWizardSimilarElementsPage());
56 public RenameTypeProcessor getRenameTypeProcessor() {
57 RefactoringProcessor proc= ((RenameRefactoring) getRefactoring()).getProcessor();
58 if (proc instanceof RenameTypeProcessor)
59 return (RenameTypeProcessor) proc;
60 else if (proc instanceof RenameCompilationUnitProcessor) {
61 RenameCompilationUnitProcessor rcu= (RenameCompilationUnitProcessor) proc;
62 return rcu.getRenameTypeProcessor();
64 Assert.isTrue(false); // Should never get here
68 protected boolean isRenameType() {
73 protected RenameInputWizardPage createInputPage(String message, String initialSetting) {
74 return new RenameTypeWizardInputPage(message, IJavaHelpContextIds.RENAME_TYPE_WIZARD_PAGE, true, initialSetting) {
77 protected RefactoringStatus validateTextField(String text) {
78 return validateNewName(text);