private void editMapping(Shell shell) { TableItem[] itemsIdMaps = fIdMapsTable.getSelection(); TableItem[] itemsMappings = fMappingsTable.getSelection(); if (itemsMappings.length > 0) { IdMap idmap = (IdMap) itemsIdMaps[0].getData(); HashMap idmapHM = (HashMap) fIdMaps.get(idmap.getName()); Mapping mapping = (Mapping) itemsMappings[0].getData(); String idmapHMKey = mapping.getKey(); idmapHM.remove(idmapHMKey); XMLCompareEditMappingDialog dialog = new XMLCompareEditMappingDialog(shell, mapping, null, true); if (dialog.open() == Window.OK) { idmapHMKey = mapping.getKey(); idmapHM.put(idmapHMKey, mapping.getIdAttribute()); fMappingsTable.remove(fMappingsTable.indexOf(itemsMappings[0])); newMappingsTableItem(mapping, true); } } }
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 renameIdMap(Shell shell) { TableItem[] itemsIdMaps = fIdMapsTable.getSelection(); if (itemsIdMaps.length > 0) { IdMap idmap = (IdMap) itemsIdMaps[0].getData(); String old_name = idmap.getName(); String old_extension = idmap.getExtension(); HashMap idmapHS = (HashMap) fIdMaps.get(old_name); XMLCompareAddIdMapDialog dialog = new XMLCompareAddIdMapDialog( shell, idmap, fIdMaps, fIdMapsInternal, fIdExtensionToName, true); if (dialog.open() == Window.OK) { fIdMaps.remove(old_name); fIdExtensionToName.remove(old_extension); fIdMaps.put(idmap.getName(), idmapHS); if (!idmap.getExtension().equals("")) // $NON-NLS-1$ fIdExtensionToName.put(idmap.getExtension(), idmap.getName()); fIdMapsTable.remove(fIdMapsTable.indexOf(itemsIdMaps[0])); newIdMapsTableItem(idmap, true); } } }