/******************************************************************************* * Copyright (c) 2012 BMW Car IT and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ package org.jnario.feature.ui.launching; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.pde.ui.launcher.JUnitWorkbenchLaunchShortcut; import org.eclipse.ui.IEditorPart; /** * @author Birgit Engelmann - Initial contribution and API */ public class FeatureJUnitPDELaunchShortcut extends JUnitWorkbenchLaunchShortcut { @Override public void launch(ISelection selection, String mode) { if (selection instanceof IStructuredSelection) { IStructuredSelection newSelection = FeatureLaunchShortcutUtil.replaceWithJavaElementDelegates((IStructuredSelection) selection); super.launch(newSelection, mode); } } @Override public void launch(IEditorPart editor, String mode) { IStructuredSelection selection = FeatureLaunchShortcutUtil.toSelectionWithJavaElementDelegates(editor); if (selection != null) { launch(selection, mode); } else { super.launch(editor, mode); } } }