Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2010-12-23 08:18:02 -0500
committerMilos Kleint2010-12-23 08:18:02 -0500
commit893f50feeb3c762001e5e8bdd2e20ac29ba42e3b (patch)
treedc322bc519fe6dc79f36015da74a28d6d7af1fc5
parent909ecc20570b118d1300a8601796fd80132c7b52 (diff)
downloadm2e-core-893f50feeb3c762001e5e8bdd2e20ac29ba42e3b.tar.gz
m2e-core-893f50feeb3c762001e5e8bdd2e20ac29ba42e3b.tar.xz
m2e-core-893f50feeb3c762001e5e8bdd2e20ac29ba42e3b.zip
MNGECLIPSE-2675 fixed enablement logic and dialog content. Only enable manage button when there is at least one dependency with version defined and only show dependencies with versions in the dialog
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java12
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java13
2 files changed, 23 insertions, 2 deletions
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
index a542a8f7..ec0fd1e4 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
@@ -943,7 +943,17 @@ public class DependenciesComposite extends Composite {
}
protected void updateManageButton() {
- manage.setEnabled(!readOnly && model.getDependencies() != null && !model.getDependencies().isEmpty());
+ boolean hasNonManaged = false;
+ //MNGECLIPSE-2675 only enable when there are unmanaged dependencies
+ if (model.getDependencies() != null) {
+ for (Dependency d : model.getDependencies()) {
+ if (d.getVersion() != null) {
+ hasNonManaged = true;
+ break;
+ }
+ }
+ }
+ manage.setEnabled(!readOnly && hasNonManaged);
}
public void setManageButtonListener(SelectionListener listener) {
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
index 1f29afcb..f6e44cde 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
@@ -9,6 +9,7 @@
package org.eclipse.m2e.editor.dialogs;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
@@ -196,7 +197,17 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
dependenciesViewer = new TableViewer(dependenciesTable);
dependenciesViewer.setLabelProvider(new ManageDependencyLabelProvider());
dependenciesViewer.setContentProvider(new ListEditorContentProvider<Dependency>());
- dependenciesViewer.setInput(model.getDependencies());
+ //MNGECLIPSE-2675 only show the dependencies not already managed (decide just by absence of the version element
+ List<Dependency> deps = model.getDependencies();
+ List<Dependency> nonManaged = new ArrayList<Dependency>();
+ if (deps != null) {
+ for (Dependency d : deps) {
+ if (d.getVersion() != null) {
+ nonManaged.add(d);
+ }
+ }
+ }
+ dependenciesViewer.setInput(nonManaged);
dependenciesViewer.addSelectionChangedListener(new DependenciesViewerSelectionListener());
pomsViewer = new TreeViewer(pomTree);

Back to the top