From 37d7f8c33478c0dca2ccc3d1f4c9c3a354d1dcaa Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 26 Nov 2009 15:23:52 +0000
Subject: [PATCH] Fix a problem with the generation of the equivalent command-line.

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java
index 46129b9..32870ca 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java
@@ -875,9 +875,32 @@
 
       if (!indexTypes.equals(indexToModify.getTypes()))
       {
+        // To add
+        Set<IndexType> toAdd = new TreeSet<IndexType>();
         for (IndexType newType : indexTypes)
         {
-          args.add("--set");
+          if (!indexToModify.getTypes().contains(newType))
+          {
+            toAdd.add(newType);
+          }
+        }
+        // To delete
+        Set<IndexType> toDelete = new TreeSet<IndexType>();
+        for (IndexType oldType : indexToModify.getTypes())
+        {
+          if (!indexTypes.contains(oldType))
+          {
+            toDelete.add(oldType);
+          }
+        }
+        for (IndexType newType : toAdd)
+        {
+          args.add("--add");
+          args.add("index-type:"+newType.toString());
+        }
+        for (IndexType newType : toDelete)
+        {
+          args.add("--remove");
           args.add("index-type:"+newType.toString());
         }
       }

--
Gitblit v1.10.0