1 11 package org.eclipse.ui.internal.cheatsheets.actions; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.jface.resource.ImageDescriptor; 15 import org.eclipse.jface.window.Window; 16 import org.eclipse.ui.PlatformUI; 17 18 import org.eclipse.ui.cheatsheets.*; 19 import org.eclipse.ui.internal.cheatsheets.dialogs.CheatSheetSelectionDialog; 20 import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetElement; 21 22 30 public class CheatSheetSelectionAction extends Action { 31 32 35 public CheatSheetSelectionAction() { 36 } 37 38 42 public CheatSheetSelectionAction(String text) { 43 super(text); 44 } 45 46 51 public CheatSheetSelectionAction(String text, ImageDescriptor image) { 52 super(text, image); 53 } 54 55 58 public void run() { 59 CheatSheetSelectionDialog dialog = new CheatSheetSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); 60 61 if(dialog.open() != Window.OK || dialog.getResult().length != 1) { 62 notifyResult(false); 63 return; 64 } 65 66 notifyResult(true); 67 68 new OpenCheatSheetAction(((CheatSheetElement)dialog.getResult()[0]).getID()).run(); 69 } 70 } 71 72 | Popular Tags |