01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.cheatsheets.composite.explorer;
11:
12: import org.eclipse.core.runtime.IPath;
13: import org.eclipse.jface.action.Action;
14: import org.eclipse.jface.dialogs.MessageDialog;
15: import org.eclipse.jface.resource.ImageDescriptor;
16: import org.eclipse.ui.PlatformUI;
17: import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin;
18: import org.eclipse.ui.internal.cheatsheets.Messages;
19: import org.eclipse.ui.internal.cheatsheets.composite.model.CompositeCheatSheetModel;
20: import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheet;
21:
22: public class RestartAllAction extends Action {
23:
24: private ICompositeCheatSheet model;
25:
26: public RestartAllAction(ICompositeCheatSheet model) {
27: this .model = model;
28: this .setText(Messages.RESTART_ALL_MENU);
29: IPath path = CheatSheetPlugin.ICONS_PATH.append(
30: CheatSheetPlugin.T_ELCL).append("restart_all.gif");//$NON-NLS-1$
31: ImageDescriptor restartImage = CheatSheetPlugin
32: .createImageDescriptor(CheatSheetPlugin.getPlugin()
33: .getBundle(), path);
34: this .setImageDescriptor(restartImage);
35: }
36:
37: public void run() {
38: if (confirmRestart()) {
39: ((CompositeCheatSheetModel) model).resetAllTasks(null);
40: }
41: }
42:
43: public static boolean confirmRestart() {
44: return MessageDialog.openConfirm(PlatformUI.getWorkbench()
45: .getActiveWorkbenchWindow().getShell(),
46: Messages.COMPOSITE_RESTART_DIALOG_TITLE,
47: Messages.COMPOSITE_RESTART_CONFIRM_MESSAGE);
48: }
49:
50: }
|