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.ShowRefactoringHistoryWizard; 17 18 import org.eclipse.swt.widgets.Composite; 19 20 import org.eclipse.jface.action.IAction; 21 import org.eclipse.jface.dialogs.IDialogConstants; 22 import org.eclipse.jface.viewers.ISelection; 23 import org.eclipse.jface.wizard.IWizard; 24 import org.eclipse.jface.wizard.WizardDialog; 25 26 import org.eclipse.ui.IWorkbenchWindow; 27 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 28 import org.eclipse.ui.PlatformUI; 29 30 35 public final class ShowRefactoringHistoryAction implements IWorkbenchWindowActionDelegate { 36 37 38 private static final int SIZING_WIZARD_HEIGHT= 560; 39 40 41 private static final int SIZING_WIZARD_WIDTH= 480; 42 43 49 public static void showRefactoringHistoryWizard(final IWorkbenchWindow window) { 50 Assert.isNotNull(window); 51 final IWizard wizard= new ShowRefactoringHistoryWizard(); 52 final WizardDialog dialog= new WizardDialog(window.getShell(), wizard) { 53 54 protected final void createButtonsForButtonBar(final Composite parent) { 55 super.createButtonsForButtonBar(parent); 56 getButton(IDialogConstants.FINISH_ID).setText(IDialogConstants.OK_LABEL); 57 } 58 }; 59 dialog.create(); 60 dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT); 61 PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IRefactoringHelpContextIds.REFACTORING_SHOW_HISTORY_PAGE); 62 dialog.open(); 63 } 64 65 66 private IWorkbenchWindow fWindow= null; 67 68 71 public void dispose() { 72 } 74 75 78 public void init(final IWorkbenchWindow window) { 79 fWindow= window; 80 } 81 82 85 public void run(final IAction action) { 86 if (fWindow != null) { 87 showRefactoringHistoryWizard(fWindow); 88 } 89 } 90 91 94 public void selectionChanged(final IAction action, final ISelection selection) { 95 } 97 } 98 | Popular Tags |