1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.jdt.internal.debug.ui.actions;
15 
16 
17 import org.eclipse.core.runtime.CoreException;
18 import org.eclipse.debug.core.model.IDebugElement;
19 import org.eclipse.jdt.debug.core.IJavaType;
20 import org.eclipse.jdt.debug.core.IJavaVariable;
21 
22 /**
23  * Opens the declared type of a variable.
24  */
25 public class OpenVariableDeclaredTypeAction extends OpenVariableTypeAction {
26 
27 	/* (non-Javadoc)
28 	 * @see org.eclipse.jdt.internal.debug.ui.actions.OpenTypeAction#getTypeToOpen(org.eclipse.debug.core.model.IDebugElement)
29 	 */
30 	@Override
getTypeToOpen(IDebugElement element)31 	protected IJavaType getTypeToOpen(IDebugElement element) throws CoreException {
32 		if (element instanceof IJavaVariable) {
33 			IJavaVariable variable = (IJavaVariable) element;
34 			return variable.getJavaType();
35 		}
36 		return null;
37 	}
38 
39 }
40