Skip to content

Commit 09ed9c1

Browse files
committed
Add Starters Inlay Hint in the pom file
1 parent 9011e04 commit 09ed9c1

File tree

17 files changed

+513
-50
lines changed

17 files changed

+513
-50
lines changed

eclipse-extensions/org.springframework.ide.eclipse.boot.launch/plugin.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@
221221
id="org.springframework.ide.eclipse.boot.commands.editStartersCommand"
222222
name="Edit Starters">
223223
</command>
224+
<command
225+
categoryId="org.springframework.ide.eclipse.boot.commands.category"
226+
id="org.springframework.ide.eclipse.boot.commands.editStartersCommand2"
227+
name="Edit Starters 2">
228+
</command>
224229
</extension>
225230
<extension point="org.eclipse.ui.bindings">
226231
<key

eclipse-extensions/org.springframework.ide.eclipse.boot.wizard/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16"/>
44
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
55
<classpathentry kind="src" path="src"/>
66
<classpathentry kind="output" path="target/classes"/>
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4-
org.eclipse.jdt.core.compiler.compliance=1.8
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=16
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
59
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
611
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7-
org.eclipse.jdt.core.compiler.release=disabled
8-
org.eclipse.jdt.core.compiler.source=1.8
12+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13+
org.eclipse.jdt.core.compiler.release=enabled
14+
org.eclipse.jdt.core.compiler.source=16

eclipse-extensions/org.springframework.ide.eclipse.boot.wizard/plugin.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@
142142
</and>
143143
</enabledWhen>
144144
</handler>
145+
<handler
146+
class="org.springframework.ide.eclipse.boot.wizard.AddBootStartersHandler2"
147+
commandId="org.springframework.ide.eclipse.boot.commands.editStartersCommand2">
148+
</handler>
145149
</extension>
146150

147151

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
11+
package org.springframework.ide.eclipse.boot.wizard;
12+
13+
import org.eclipse.core.commands.AbstractHandler;
14+
import org.eclipse.core.commands.ExecutionEvent;
15+
import org.eclipse.core.commands.ExecutionException;
16+
import org.eclipse.ui.IEditorInput;
17+
import org.eclipse.ui.IFileEditorInput;
18+
import org.eclipse.ui.PlatformUI;
19+
import org.eclipse.ui.handlers.HandlerUtil;
20+
import org.springframework.ide.eclipse.boot.wizard.starters.AddStartersWizard;
21+
22+
public class AddBootStartersHandler2 extends AbstractHandler {
23+
24+
@Override
25+
public Object execute(ExecutionEvent event) throws ExecutionException {
26+
try {
27+
IEditorInput input = HandlerUtil.getActiveEditorInput(event);
28+
if (input instanceof IFileEditorInput fileInput) {
29+
AddStartersWizard.openFor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), fileInput.getFile().getProject());
30+
return null;
31+
}
32+
} catch (Exception e) {
33+
throw new ExecutionException("", e);
34+
}
35+
throw new ExecutionException("Current active editor is not for pom.xml");
36+
}
37+
38+
}

eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@
8282
</enabledInputWhen>
8383
-->
8484
</contentTypeMapping>
85+
<contentTypeMapping
86+
contentType="org.springframework.boot.ide.pom.xml"
87+
id="org.eclipse.languageserver.languages.springboot">
88+
</contentTypeMapping>
8589

8690
</extension>
8791

@@ -173,6 +177,17 @@
173177
file-names="spring.factories,aot.factories"
174178
file-patterns="*.factories">
175179
</file-association>
180+
<content-type
181+
base-type="org.eclipse.core.runtime.xml"
182+
default-charset="UTF-8"
183+
id="org.springframework.boot.ide.pom.xml"
184+
name="Pom Xml"
185+
priority="normal">
186+
</content-type>
187+
<file-association
188+
content-type="org.springframework.boot.ide.pom.xml"
189+
file-names="pom.xml">
190+
</file-association>
176191
</extension>
177192

178193
<extension
@@ -261,6 +276,10 @@
261276
class="org.springframework.tooling.boot.ls.commands.RefreshModulithMetadata"
262277
commandId="org.springframework.tooling.boot.ls.modulith.metadata.refresh">
263278
</handler>
279+
<handler
280+
class="org.springframework.tooling.boot.ls.commands.AddStartersHandler"
281+
commandId="spring.initializr.addStarters">
282+
</handler>
264283
</extension>
265284
<extension
266285
point="org.eclipse.ui.commands">
@@ -292,6 +311,24 @@
292311
id="org.springframework.tooling.boot.ls.modulith.metadata.refresh"
293312
name="Refresh Modulith Metadata">
294313
</command>
314+
<command
315+
categoryId="org.eclipse.lsp4e.commandCategory"
316+
description="Adds Spring Boot Starters dependencies"
317+
id="spring.initializr.addStarters"
318+
name="Add Spring Boot Starters">
319+
<commandParameter
320+
id="org.eclipse.lsp4e.command.param"
321+
name="command"
322+
optional="true"
323+
typeId="org.eclipse.lsp4e.commandParameterType">
324+
</commandParameter>
325+
<commandParameter
326+
id="org.eclipse.lsp4e.path.param"
327+
name="path"
328+
optional="true"
329+
typeId="org.eclipse.lsp4e.pathParameterType">
330+
</commandParameter>
331+
</command>
295332
</extension>
296333

297334
<extension
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
11+
package org.springframework.tooling.boot.ls.commands;
12+
13+
import org.eclipse.core.commands.AbstractHandler;
14+
import org.eclipse.core.commands.ExecutionEvent;
15+
import org.eclipse.core.commands.ExecutionException;
16+
import org.eclipse.ui.IWorkbenchWindow;
17+
import org.eclipse.ui.handlers.HandlerUtil;
18+
import org.eclipse.ui.handlers.IHandlerService;
19+
20+
public class AddStartersHandler extends AbstractHandler {
21+
22+
@Override
23+
public Object execute(ExecutionEvent event) throws ExecutionException {
24+
try {
25+
IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
26+
final IHandlerService service = workbenchWindow.getService(IHandlerService.class);
27+
return service.executeCommand("org.springframework.ide.eclipse.boot.commands.editStartersCommand2", null);
28+
} catch (Exception e) {
29+
throw new ExecutionException("", e);
30+
}
31+
}
32+
33+
}

0 commit comments

Comments
 (0)