コード例 #1
0
 private void addIdMap(Shell shell) {
   IdMap idmap = new IdMap(false);
   XMLCompareAddIdMapDialog dialog =
       new XMLCompareAddIdMapDialog(
           shell, idmap, fIdMaps, fIdMapsInternal, fIdExtensionToName, false);
   if (dialog.open() == Window.OK) {
     if (!fIdMaps.containsKey(idmap.getName())) {
       fIdMaps.put(idmap.getName(), new HashMap());
       if (!idmap.getExtension().equals("")) // $NON-NLS-1$
       fIdExtensionToName.put(idmap.getExtension(), idmap.getName());
       newIdMapsTableItem(idmap, true);
     }
   }
 }
コード例 #2
0
 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);
     }
   }
 }
コード例 #3
0
 protected TableItem newIdMapsTableItem(IdMap idmap, boolean selected) {
   // find index where to insert table entry
   TableItem[] items = fIdMapsTable.getItems();
   int i = 0;
   while (i < items.length && idmap.getName().compareToIgnoreCase(items[i].getText(0)) > 0) i++;
   TableItem item = new TableItem(fIdMapsTable, SWT.NULL, i);
   String[] values =
       new String[] {
         idmap.getName(),
         (idmap.isInternal())
             ? XMLCompareMessages.XMLComparePreference_topTableColumn2internal
             : XMLCompareMessages.XMLComparePreference_topTableColumn2user,
         idmap.getExtension()
       };
   item.setText(values);
   item.setData(idmap);
   if (selected) {
     fIdMapsTable.setSelection(i);
     fIdMapsTable.setFocus();
     selectionChanged();
   }
   return item;
 }