1 11 12 package org.eclipse.ui.internal.cheatsheets.composite.explorer; 13 14 import org.eclipse.core.runtime.IPath; 15 import org.eclipse.jface.action.Action; 16 import org.eclipse.jface.dialogs.MessageDialog; 17 import org.eclipse.jface.resource.ImageDescriptor; 18 import org.eclipse.ui.PlatformUI; 19 import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin; 20 import org.eclipse.ui.internal.cheatsheets.Messages; 21 import org.eclipse.ui.internal.cheatsheets.composite.model.CompositeCheatSheetModel; 22 import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheet; 23 24 public class RestartAllAction extends Action { 25 26 private ICompositeCheatSheet model; 27 28 public RestartAllAction(ICompositeCheatSheet model) { 29 this.model = model; 30 this.setText(Messages.RESTART_ALL_MENU); 31 IPath path = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append("restart_all.gif"); ImageDescriptor restartImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); 33 this.setImageDescriptor(restartImage); 34 } 35 36 public void run() { 37 if (confirmRestart()) { 38 ((CompositeCheatSheetModel)model).resetAllTasks(null); 39 } 40 } 41 42 public static boolean confirmRestart() { 43 return MessageDialog.openConfirm( 44 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 45 Messages.COMPOSITE_RESTART_DIALOG_TITLE, 46 Messages.COMPOSITE_RESTART_CONFIRM_MESSAGE); 47 } 48 49 } 50 | Popular Tags |