Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions org.eclipse.m2e.launching/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
description="%m2.shortcut.description.generate-sources"
categoryId="org.eclipse.debug.ui.category.run"/>
</extension>

<extension point="org.eclipse.ui.handlers">
<handler commandId="org.eclipse.m2e.core.pomFileAction.run"
class="org.eclipse.m2e.actions.ExecutePomAction"/>
</extension>

<extension point="org.eclipse.ui.bindings">
<key sequence="M3+M2+X M"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
Expand Down Expand Up @@ -56,6 +58,7 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.handlers.HandlerUtil;

import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.IMavenExecutableLocation;
Expand All @@ -74,7 +77,8 @@
* @author Dmitri Maximovich
* @author Eugene Kuleshov
*/
public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension, ILaunchShortcut2 {
public class ExecutePomAction extends AbstractHandler
implements ILaunchShortcut, IExecutableExtension, ILaunchShortcut2 {
private static final Logger log = LoggerFactory.getLogger(ExecutePomAction.class);

private boolean showDialog = false;
Expand All @@ -89,6 +93,12 @@ public void setInitializationData(IConfigurationElement config, String propertyN
}
}

public Object execute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
launch(findPomXmlBasedir(selection), ILaunchManager.RUN_MODE);
return null;
}

public void launch(IEditorPart editor, String mode) {
IEditorInput editorInput = editor.getEditorInput();
if(editorInput instanceof IFileEditorInput fileInput) {
Expand Down
Loading