Better fix for bugs #8151 & #11597 01/8501/2
Vincent COUVERT [Thu, 2 Aug 2012 14:45:01 +0000 (16:45 +0200)]
Change-Id: Ibe86ce1a9e51971c003f927bd49ef36492ac76bf

scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/utils/MenuBarBuilder.java
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingView.java

index bc22fe0..7a78c27 100644 (file)
@@ -309,7 +309,7 @@ public final class MenuBarBuilder {
                         } else if (attributes.item(i).getNodeName() == MACOSX) {
                             macosx = attributes.item(i).getNodeValue().equals(TRUE);
                             if (!macosx && OS.get() == OS.MAC) {
-                                GraphicController.getController().setProperty(menuId, __GO_VISIBLE__, false);
+                                GraphicController.getController().removeRelationShipAndDelete(menuId);
                                 separator = false;
                             }
                         }
index 5d3afef..c9f2441 100644 (file)
@@ -988,7 +988,9 @@ public final class SwingView implements GraphicView {
         }
         // Remove children which have been deleted
         Set<String> newChildrenSet = new HashSet<String>(Arrays.asList(newChildren));
-        for (String childId : updatedObject.getChildren()) {
+        String[] oldChildren = (String[]) updatedObject.getChildren().toArray(new String[updatedObject.getChildren().size()]);
+        for (int childIndex = 0; childIndex < oldChildren.length; childIndex++) {
+            String childId = oldChildren[childIndex];
             if (!newChildrenSet.contains(childId)) {
                 // Remove the child
                 updatedObject.removeChild(childId);