Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2010-12-28 07:07:46 -0500
committerMilos Kleint2010-12-28 07:07:46 -0500
commitcf565350118fd3f54cfa51151f99cc9a2918ebf0 (patch)
treec9a243c7cc34df8384ed867073f91f981274fe3f
parent373952ec1885a6621cd6e8a511ff2b1b3f118ecd (diff)
downloadm2e-core-cf565350118fd3f54cfa51151f99cc9a2918ebf0.tar.gz
m2e-core-cf565350118fd3f54cfa51151f99cc9a2918ebf0.tar.xz
m2e-core-cf565350118fd3f54cfa51151f99cc9a2918ebf0.zip
MNGECLIPSE-2547 different behaviour for managed artifacts additions
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/AddDependencyDialog.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/AddDependencyDialog.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/AddDependencyDialog.java
index a70dce81..074b5124 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/AddDependencyDialog.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/AddDependencyDialog.java
@@ -8,7 +8,6 @@
package org.eclipse.m2e.core.ui.dialogs;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -45,7 +44,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
@@ -140,7 +138,9 @@ public class AddDependencyDialog extends AbstractMavenDialog {
protected boolean updating;
- private MavenProject mavenProject;
+ private final MavenProject mavenProject;
+
+ private final boolean isForDependencyManagement;
/**
* The AddDependencyDialog differs slightly in behaviour depending on context. If it is being used to apply a
@@ -155,6 +155,8 @@ public class AddDependencyDialog extends AbstractMavenDialog {
super(parent, DIALOG_SETTINGS);
this.project = project;
this.mavenProject = mavenProject;
+
+ this.isForDependencyManagement = isForDependencyManagement;
setShellStyle(getShellStyle() | SWT.RESIZE);
setTitle(Messages.AddDependencyDialog_title);
@@ -354,15 +356,20 @@ public class AddDependencyDialog extends AbstractMavenDialog {
resultsViewer = new TreeViewer(resultsTree);
resultsViewer.setContentProvider(new MavenPomSelectionComponent.SearchResultContentProvider());
//TODO we want to have the artifacts marked for presence and management..
- Set<String> managed = new HashSet<String>();
+ Set<String> managed = new HashSet<String>();
+ Set<String> existing = new HashSet<String>();
if (mavenProject != null && mavenProject.getDependencyManagement() != null) {
for (org.apache.maven.model.Dependency d : mavenProject.getDependencyManagement().getDependencies()) {
managed.add(d.getGroupId() + ":" + d.getArtifactId());
managed.add(d.getGroupId() + ":" + d.getArtifactId() + ":" + d.getVersion());
}
}
+ if (isForDependencyManagement) {
+ existing = managed;
+ managed = Collections.<String>emptySet();
+ }
resultsViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(
- new MavenPomSelectionComponent.SearchResultLabelProvider(Collections.<String>emptySet(), managed,
+ new MavenPomSelectionComponent.SearchResultLabelProvider(existing, managed,
IIndex.SEARCH_ARTIFACT)));
/*

Back to the top