1 11 package org.eclipse.pde.internal.ui.compare; 12 13 import java.util.HashMap ; 14 15 import org.eclipse.compare.CompareUI; 16 import org.eclipse.pde.internal.ui.PDEPluginImages; 17 18 23 public final class XMLStructureMapping { 24 25 public static final String ECLIPSE_PLUGIN = "Eclipse Plugin"; public static final String ECLIPSE_SCHEMA = "Eclipse Schema"; public static final String IMAGE_TYPE_PREFIX = "xml_"; 29 private static HashMap fMappings; 30 31 static { 32 fMappings = new HashMap (); 33 HashMap idmapHM = new HashMap (); 34 idmapHM.put(getMapString("plugin"), "id"); idmapHM.put(getMapString("plugin>requires>import"), "plugin"); idmapHM.put(getMapString("plugin>runtime>library"), "name"); idmapHM.put(getMapString("plugin>runtime>library>export"), "name"); idmapHM.put(getMapString("plugin>extension-point"), "id"); idmapHM.put(getMapString("plugin>extension"), "point"); fMappings.put(ECLIPSE_PLUGIN, idmapHM); 41 42 CompareUI.registerImageDescriptor(getImageKey(XMLStructureCreator.TYPE_ROOT), PDEPluginImages.DESC_PLUGIN_OBJ); 43 CompareUI.registerImageDescriptor(getImageKey(XMLStructureCreator.TYPE_EXTENSION), PDEPluginImages.DESC_EXTENSION_OBJ); 44 CompareUI.registerImageDescriptor(getImageKey(XMLStructureCreator.TYPE_EXTENSIONPOINT), PDEPluginImages.DESC_EXT_POINT_OBJ); 45 CompareUI.registerImageDescriptor(getImageKey(XMLStructureCreator.TYPE_ELEMENT), PDEPluginImages.DESC_XML_ELEMENT_OBJ); 46 CompareUI.registerImageDescriptor(getImageKey(XMLStructureCreator.TYPE_ATTRIBUTE), PDEPluginImages.DESC_ATT_URI_OBJ); 47 CompareUI.registerImageDescriptor(getImageKey(XMLStructureCreator.TYPE_TEXT), PDEPluginImages.DESC_XML_TEXT_NODE); 48 } 49 50 protected static String getImageKey(String xmlType) { 51 return IMAGE_TYPE_PREFIX + xmlType; 52 } 53 54 private static String getMapString(String signature) { 55 return XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + signature + XMLStructureCreator.SIGN_SEPARATOR; 56 } 57 58 public static HashMap getMappings() { 59 return fMappings; 60 } 61 62 } 63 | Popular Tags |