Skip to content

Commit

Permalink
Add support for configuring quick-fix bundles
Browse files Browse the repository at this point in the history
A qucikfix is provided by an extension point and can be part of any
bundle, so we need to have a way to configure these.
  • Loading branch information
laeubi committed Jan 24, 2025
1 parent 46edccf commit a96b3e1
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import java.io.File;
import java.util.List;
import java.util.stream.Stream;
import java.util.stream.Stream.Builder;

import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
Expand All @@ -29,6 +31,20 @@ public class QuickFixMojo extends AbstractEclipseBuildMojo<QuickFixResult> {
@Parameter(defaultValue = "${project.build.directory}/quickfix.md", property = "tycho.quickfix.report")
private File reportFileName;

/**
* Configures the quickfixes to use, as these can be provided by different
* bundles, examples are
* <ul>
* <li><code>org.eclipse.jdt.ui</code> provides resolutions for for java
* problems</li>
* <li><code>org.eclipse.pde.api.tools.ui</code> provides API tools
* resolutions</li>
* <li>...</li>
* </ul>
*/
@Parameter
private List<String> quickfixes;

@Override
protected void handleResult(QuickFixResult result) throws MojoFailureException {
if (result.isEmpty()) {
Expand All @@ -43,7 +59,12 @@ protected void handleResult(QuickFixResult result) throws MojoFailureException {

@Override
protected String[] getRequireBundles() {
return new String[] { "org.eclipse.ui.ide", "org.eclipse.jdt.ui" };
Builder<String> builder = Stream.builder();
builder.accept("org.eclipse.ui.ide");
if (quickfixes != null) {
quickfixes.forEach(builder);
}
return builder.build().toArray(String[]::new);
}

@Override
Expand Down

0 comments on commit a96b3e1

Please sign in to comment.