summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Johnson2014-03-26 19:51:02 (EDT)
committerDaniel Johnson2014-03-26 19:51:02 (EDT)
commit1ca616de4d90198090bf1dffe0f4cd63db4e9abc (patch)
tree250efad64db0b4a9ed6fe2ad54469fa332cc5bb8
parentc181856b7f00d8a62fdba00ca095507de7c8ddad (diff)
downloadorg.eclipse.tigerstripe-1ca616de4d90198090bf1dffe0f4cd63db4e9abc.zip
org.eclipse.tigerstripe-1ca616de4d90198090bf1dffe0f4cd63db4e9abc.tar.gz
org.eclipse.tigerstripe-1ca616de4d90198090bf1dffe0f4cd63db4e9abc.tar.bz2
Fix add dependencies to not add duplicates when multiple models are selected and add transative checkbox is selected.HEADmaster
-rw-r--r--plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/dependencies/ReferencedProjectsSection.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/dependencies/ReferencedProjectsSection.java b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/dependencies/ReferencedProjectsSection.java
index a02b496..813acd1 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/dependencies/ReferencedProjectsSection.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/dependencies/ReferencedProjectsSection.java
@@ -603,12 +603,21 @@ public class ReferencedProjectsSection extends TigerstripeDescriptorSectionPart
}
if (ref != null) {
try {
- getTSProject().addModelReference(ref);
+ boolean exists = false;
+ for (ModelReference existingRef : getTSProject().getModelReferences()) {
+ if (existingRef.getToModelId().equals(ref.getToModelId())) {
+ exists = true;
+ break;
+ }
+ }
+ if (!exists) {
+ getTSProject().addModelReference(ref);
+ }
viewer.refresh(true);
viewer.setChecked(ref, true); // NM: Check newly added dependency
markPageModified();
if (dialog.isIncludeTransitiveDependencies()){
- addMissingTransitiveDependencies(new ModelReference[] { ref });
+ addMissingTransitiveDependencies(new ModelReference[] { ref });
}
} catch (TigerstripeException e) {
EclipsePlugin.log(e);