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 addMapping(Shell shell) { TableItem[] items = fIdMapsTable.getSelection(); if (items.length > 0) { IdMap idmap = (IdMap) items[0].getData(); Mapping mapping = new Mapping(); HashMap idmapHM = (HashMap) fIdMaps.get(idmap.getName()); XMLCompareEditMappingDialog dialog = new XMLCompareEditMappingDialog(shell, mapping, idmapHM, false); if (dialog.open() == Window.OK) { String idmapHMKey = mapping.getKey(); if (idmapHM == null) idmapHM = new HashMap(); if (!idmapHM.containsKey(idmapHMKey)) { idmapHM.put(idmapHMKey, mapping.getIdAttribute()); newMappingsTableItem(mapping, true); Vector mappings = idmap.getMappings(); mappings.add(mapping); } } } }