1 11 package org.eclipse.ltk.internal.ui.refactoring.actions; 12 13 import org.eclipse.core.runtime.Assert; 14 15 import org.eclipse.ltk.internal.ui.refactoring.IRefactoringHelpContextIds; 16 import org.eclipse.ltk.internal.ui.refactoring.scripting.CreateRefactoringScriptWizard; 17 import org.eclipse.ltk.internal.ui.refactoring.scripting.ScriptingMessages; 18 19 import org.eclipse.swt.widgets.Composite; 20 21 import org.eclipse.jface.action.IAction; 22 import org.eclipse.jface.dialogs.IDialogConstants; 23 import org.eclipse.jface.viewers.ISelection; 24 import org.eclipse.jface.wizard.IWizard; 25 import org.eclipse.jface.wizard.WizardDialog; 26 27 import org.eclipse.ui.IWorkbenchWindow; 28 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 29 import org.eclipse.ui.PlatformUI; 30 31 36 public final class CreateRefactoringScriptAction implements IWorkbenchWindowActionDelegate { 37 38 39 private static final int SIZING_WIZARD_HEIGHT= 610; 40 41 42 private static final int SIZING_WIZARD_WIDTH= 500; 43 44 50 public static void showCreateScriptWizard(final IWorkbenchWindow window) { 51 Assert.isNotNull(window); 52 final IWizard wizard= new CreateRefactoringScriptWizard(); 53 final WizardDialog dialog= new WizardDialog(window.getShell(), wizard) { 54 55 protected final void createButtonsForButtonBar(final Composite parent) { 56 super.createButtonsForButtonBar(parent); 57 getButton(IDialogConstants.FINISH_ID).setText(ScriptingMessages.CreateRefactoringScriptAction_finish_button_label); 58 } 59 }; 60 dialog.create(); 61 dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT); 62 PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IRefactoringHelpContextIds.REFACTORING_CREATE_SCRIPT_PAGE); 63 dialog.open(); 64 } 65 66 67 private IWorkbenchWindow fWindow= null; 68 69 72 public void dispose() { 73 } 75 76 79 public void init(final IWorkbenchWindow window) { 80 fWindow= window; 81 } 82 83 86 public void run(final IAction action) { 87 if (fWindow != null) { 88 showCreateScriptWizard(fWindow); 89 } 90 } 91 92 95 public void selectionChanged(final IAction action, final ISelection selection) { 96 } 98 } 99 | Popular Tags |