Skip to content

Commit

Permalink
Don't open the dialog if we can't propose anything to the user
Browse files Browse the repository at this point in the history
Currently if not a single connector can be proposed the dialog is still
opened and disturbs the user even though there is nothing much one can
do (and most probably want to do).

This first checks if there is at least one proposal before open the
dialog when importing a project.

This relates to eclipse-m2e#1012
  • Loading branch information
laeubi committed Jan 5, 2023
1 parent 0050f53 commit 29bd2d8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.ILifecycleMappingRequirement;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.IMavenDiscoveryProposal;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.LifecycleMappingDiscoveryRequest;
import org.eclipse.m2e.core.internal.project.ProjectConfigurationManager;
import org.eclipse.m2e.core.project.LocalProjectScanner;
Expand Down Expand Up @@ -88,6 +90,12 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
}
// Some errors were detected
discoverProposals(discoveryRequest, monitor);
Map<ILifecycleMappingRequirement, List<IMavenDiscoveryProposal>> proposals = discoveryRequest
.getAllProposals();
if(proposals.isEmpty()) {
//if we can't propose anything to the user there is actually no point in open the dialog.
return Status.OK_STATUS;
}
openProposalWizard(toProcess, discoveryRequest);
} finally {
this.toProcess.clear();
Expand Down

0 comments on commit 29bd2d8

Please sign in to comment.