1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 ******************************************************************************/ 11 package org.eclipse.jdt.internal.ui.commands; 12 13 import org.eclipse.core.commands.AbstractHandler; 14 import org.eclipse.core.commands.ExecutionEvent; 15 import org.eclipse.core.commands.ExecutionException; 16 17 import org.eclipse.jdt.core.IJavaElement; 18 19 import org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart; 20 21 /** 22 * A command handler to show a java element in the package view. 23 * 24 * @since 3.2 25 */ 26 public class ShowElementInPackageViewHandler extends AbstractHandler { 27 28 private static final String PARAM_ID_ELEMENT_REF= "elementRef"; //$NON-NLS-1$ 29 30 public Object execute(ExecutionEvent event) throws ExecutionException { 31 32 IJavaElement javaElement= (IJavaElement) event.getObjectParameterForExecution(PARAM_ID_ELEMENT_REF); 33 34 PackageExplorerPart view= PackageExplorerPart.openInActivePerspective(); 35 view.tryToReveal(javaElement); 36 37 return null; 38 } 39 40 } 41