blob: 190675866db6babe8f736160d11e0abd330201fa [file] [log] [blame]
/*******************************************************************************
* Copyright (c) Dec 28, 2012 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ant.internal.ui.editor.actions;
import org.eclipse.ant.internal.ui.editor.AntEditor;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* Default handler to open / select the enclosing declaration of the selected Ant element in the Ant editor
*
* @since 3.5.400
*/
public class OpenAntDeclarationHander extends AbstractHandler {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart part = HandlerUtil.getActiveEditor(event);
if (part instanceof AntEditor) {
((AntEditor) part).openReferenceElement();
}
return null;
}
}