1 11 package org.eclipse.jdt.internal.ui.refactoring; 12 13 import org.eclipse.swt.widgets.Composite; 14 15 import org.eclipse.ui.PlatformUI; 16 17 import org.eclipse.ltk.ui.refactoring.RefactoringWizard; 18 19 import org.eclipse.jdt.internal.corext.refactoring.code.InlineTempRefactoring; 20 import org.eclipse.jdt.internal.corext.util.Messages; 21 22 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 23 24 public class InlineTempWizard extends RefactoringWizard { 25 26 public InlineTempWizard(InlineTempRefactoring ref) { 27 super(ref, DIALOG_BASED_USER_INTERFACE | PREVIEW_EXPAND_FIRST_NODE | NO_BACK_BUTTON_ON_STATUS_DIALOG); 28 setDefaultPageTitle(RefactoringMessages.InlineTempWizard_defaultPageTitle); 29 } 30 31 protected void addUserInputPages() { 32 addPage(new InlineTempInputPage()); 33 } 34 35 public int getMessageLineWidthInChars() { 36 return 0; 37 } 38 39 private static class InlineTempInputPage extends MessageWizardPage { 40 41 public static final String PAGE_NAME= "InlineTempInputPage"; 43 public InlineTempInputPage() { 44 super(PAGE_NAME, true, MessageWizardPage.STYLE_QUESTION); 45 } 46 47 public void createControl(Composite parent) { 48 super.createControl(parent); 49 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.INLINE_TEMP_WIZARD_PAGE); 50 } 51 52 protected String getMessageString() { 53 InlineTempRefactoring refactoring= (InlineTempRefactoring) getRefactoring(); 54 int occurrences= refactoring.getReferences().length; 55 final String identifier= refactoring.getVariableDeclaration().getName().getIdentifier(); 56 switch (occurrences) { 57 case 0: 58 return Messages.format( 59 RefactoringMessages.InlineTempInputPage_message_zero, 60 identifier); 61 62 case 1: 63 return Messages.format(RefactoringMessages.InlineTempInputPage_message_one, identifier); 64 65 default: 66 return Messages.format(RefactoringMessages.InlineTempInputPage_message_multi, new Object [] { 67 new Integer (occurrences), identifier }); 68 } 69 } 70 } 71 } 72 | Popular Tags |