private void editOrdered(Shell shell) { TableItem[] itemsIdMaps = fIdMapsTable.getSelection(); TableItem[] itemsOrdered = fOrderedTable.getSelection(); if (itemsOrdered.length > 0) { IdMap idmap = (IdMap) itemsIdMaps[0].getData(); ArrayList idmapAL = (ArrayList) fOrderedElements.get(idmap.getName()); Mapping mapping = (Mapping) itemsOrdered[0].getData(); String idmapALKey = mapping.getKey(); idmapAL.remove(idmapALKey); XMLCompareEditOrderedDialog dialog = new XMLCompareEditOrderedDialog(shell, mapping, null, true); if (dialog.open() == Window.OK) { idmapALKey = mapping.getKey(); idmapAL.add(idmapALKey); fOrderedTable.remove(fOrderedTable.indexOf(itemsOrdered[0])); newOrderedTableItem(mapping, true); } } }
private void addOrdered(Shell shell) { TableItem[] items = fIdMapsTable.getSelection(); if (items.length > 0) { // Set orderedSet= fOrderedElements.keySet(); // for (Iterator iter= orderedSet.iterator(); iter.hasNext(); ) { // String IdMapName= (String) iter.next(); // ArrayList ordered= (ArrayList) fOrderedElements.get(IdMapName); // for (Iterator iter2= ordered.iterator(); iter2.hasNext(); ) { // System.out.println(IdMapName + ": " + iter2.next()); //$NON-NLS-1$ // } // } IdMap idmap = (IdMap) items[0].getData(); Mapping mapping = new Mapping(); ArrayList idmapAL = (ArrayList) fOrderedElements.get(idmap.getName()); if (idmapAL == null) idmapAL = new ArrayList(); XMLCompareEditOrderedDialog dialog = new XMLCompareEditOrderedDialog(shell, mapping, idmapAL, false); if (dialog.open() == Window.OK) { String idmapALKey = mapping.getKey(); if (!idmapAL.contains(idmapALKey)) { idmapAL.add(idmapALKey); newOrderedTableItem(mapping, true); ArrayList ordered = idmap.getOrdered(); if (ordered == null) { ordered = new ArrayList(); ordered.add(mapping); idmap.setOrdered(ordered); } else { ordered.add(mapping); } if (!fOrderedElements.containsKey(idmap.getName())) fOrderedElements.put(idmap.getName(), idmapAL); } } } }