1 /*******************************************************************************2 * Copyright (c) 2006, 2007 IBM Corporation and others.3 * All rights reserved. This program and the accompanying materials4 * are made available under the terms of the Eclipse Public License v1.05 * which accompanies this distribution, and is available at6 * http://www.eclipse.org/legal/epl-v10.html7 *8 * Contributors:9 * IBM Corporation - initial API and implementation10 *******************************************************************************/11 package org.eclipse.ui.internal.cheatsheets.handlers;12 13 import org.eclipse.core.commands.AbstractHandler;14 import org.eclipse.core.commands.ExecutionEvent;15 import org.eclipse.core.commands.ExecutionException;16 import org.eclipse.ui.cheatsheets.OpenCheatSheetAction;17 import org.eclipse.ui.internal.cheatsheets.actions.CheatSheetCategoryBasedSelectionAction;18 19 /**20 * Opens the cheatsheet identified by the parameter, or if no parameter is given21 * opens the dialog that allows the user to choose a cheatsheet.22 * 23 * @since 3.224 */25 public class OpenCheatSheetHandler extends AbstractHandler {26 27 private static final String PARAM_ID_CHEAT_SHEET_ID = "cheatSheetId"; //$NON-NLS-1$28 29 public Object execute(ExecutionEvent event) throws ExecutionException {30 31 String cheatSheetId = event.getParameter(PARAM_ID_CHEAT_SHEET_ID);32 33 if (cheatSheetId == null) {34 CheatSheetCategoryBasedSelectionAction action = new CheatSheetCategoryBasedSelectionAction();35 action.run();36 } else {37 OpenCheatSheetAction action = new OpenCheatSheetAction(cheatSheetId);38 action.run();39 }40 41 return null;42 }43 44 }45