Skip to content

Commit 091f04f

Browse files
Omega1001laeubi
authored andcommitted
Restore maven build shortcut without adding a toolbar button
1 parent 27eae6a commit 091f04f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

org.eclipse.m2e.launching/plugin.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
description="%m2.shortcut.description.generate-sources"
3535
categoryId="org.eclipse.debug.ui.category.run"/>
3636
</extension>
37+
38+
<extension point="org.eclipse.ui.handlers">
39+
<handler commandId="org.eclipse.m2e.core.pomFileAction.run"
40+
class="org.eclipse.m2e.actions.ExecutePomAction"/>
41+
</extension>
3742

3843
<extension point="org.eclipse.ui.bindings">
3944
<key sequence="M3+M2+X M"

org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import org.slf4j.Logger;
2020
import org.slf4j.LoggerFactory;
2121

22+
import org.eclipse.core.commands.AbstractHandler;
23+
import org.eclipse.core.commands.ExecutionEvent;
2224
import org.eclipse.core.resources.IContainer;
2325
import org.eclipse.core.resources.IFile;
2426
import org.eclipse.core.resources.IFolder;
@@ -56,6 +58,7 @@
5658
import org.eclipse.ui.IFileEditorInput;
5759
import org.eclipse.ui.PlatformUI;
5860
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
61+
import org.eclipse.ui.handlers.HandlerUtil;
5962

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

8084
private boolean showDialog = false;
@@ -89,6 +93,12 @@ public void setInitializationData(IConfigurationElement config, String propertyN
8993
}
9094
}
9195

96+
public Object execute(ExecutionEvent event) {
97+
ISelection selection = HandlerUtil.getCurrentSelection(event);
98+
launch(findPomXmlBasedir(selection), ILaunchManager.RUN_MODE);
99+
return null;
100+
}
101+
92102
public void launch(IEditorPart editor, String mode) {
93103
IEditorInput editorInput = editor.getEditorInput();
94104
if(editorInput instanceof IFileEditorInput fileInput) {

0 commit comments

Comments
 (0)