Skip to content

Commit

Permalink
Making ordering of relevances more explicit
Browse files Browse the repository at this point in the history
Currently the suggestions are not always totally ordered (e.g. there are
some with default of 0), even though Eclipse then fall back to comparing
strings, it would be much better to have an explicit ordering.

This now:
- make creating a commented compatibility filter "more recommended"
- make removing an unused filter "more recommended"
- make configure the problem category "less recommended"
  • Loading branch information
laeubi committed Jan 25, 2025
1 parent 9ddefdb commit 67a0122
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin;
import org.eclipse.pde.api.tools.ui.internal.IApiToolsConstants;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolutionRelevance;
import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;

/**
Expand All @@ -38,7 +39,7 @@
*
* @since 1.0.0
*/
public class FilterProblemResolution extends WorkbenchMarkerResolution {
public class FilterProblemResolution extends WorkbenchMarkerResolution implements IMarkerResolutionRelevance {

protected IMarker fBackingMarker = null;
protected IJavaElement fResolvedElement = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,10 @@ public void run(IMarker[] markers, IProgressMonitor monitor) {
op.setSystem(true);
op.schedule();
}

@Override
public int getRelevanceForResolution() {
return IApiToolProposalRelevance.FILTER_PROBLEM_WITH_COMMENT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
public interface IApiToolProposalRelevance {


public static final int CONFIGURE_PROBLEM_SEVERITY = -1;
public static final int CONFIGURE_PROBLEM_SEVERITY = -10;
public static final int REMOVE_UNUSED_FILTER = 10;
public static final int FILTER_PROBLEM_WITH_COMMENT = 5;

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin;
import org.eclipse.pde.api.tools.ui.internal.IApiToolsConstants;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolutionRelevance;
import org.eclipse.ui.texteditor.MarkerUtilities;
import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;

Expand All @@ -48,7 +49,7 @@
*
* @since 1.0.0
*/
public class RemoveFilterProblemResolution extends WorkbenchMarkerResolution {
public class RemoveFilterProblemResolution extends WorkbenchMarkerResolution implements IMarkerResolutionRelevance {

/**
* The {@link IApiProblemFilter} to remove
Expand Down Expand Up @@ -166,4 +167,9 @@ public IMarker[] findOtherMarkers(IMarker[] markers) {
plural = size > 0;
return mset.toArray(new IMarker[size]);
}

@Override
public int getRelevanceForResolution() {
return IApiToolProposalRelevance.REMOVE_UNUSED_FILTER;
}
}

0 comments on commit 67a0122

Please sign in to comment.