KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > compare > XMLStructureMapping


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.compare;
12
13 import java.util.HashMap JavaDoc;
14
15 import org.eclipse.compare.CompareUI;
16 import org.eclipse.pde.internal.ui.PDEPluginImages;
17
18 /**
19  * This class is the plug-in runtime class for the
20  * <code>"org.eclipse.compare.xml"</code> plug-in.
21  * </p>
22  */

23 public final class XMLStructureMapping {
24     
25     public static final String JavaDoc ECLIPSE_PLUGIN = "Eclipse Plugin"; //$NON-NLS-1$
26
public static final String JavaDoc ECLIPSE_SCHEMA = "Eclipse Schema"; //$NON-NLS-1$
27
public static final String JavaDoc IMAGE_TYPE_PREFIX = "xml_"; //$NON-NLS-1$
28

29     private static HashMap JavaDoc fMappings;
30
31     static {
32         fMappings = new HashMap JavaDoc();
33         HashMap JavaDoc idmapHM = new HashMap JavaDoc();
34         idmapHM.put(getMapString("plugin"), "id"); //$NON-NLS-1$ //$NON-NLS-2$
35
idmapHM.put(getMapString("plugin>requires>import"), "plugin"); //$NON-NLS-1$ //$NON-NLS-2$
36
idmapHM.put(getMapString("plugin>runtime>library"), "name"); //$NON-NLS-1$ //$NON-NLS-2$
37
idmapHM.put(getMapString("plugin>runtime>library>export"), "name"); //$NON-NLS-1$ //$NON-NLS-2$
38
idmapHM.put(getMapString("plugin>extension-point"), "id"); //$NON-NLS-1$ //$NON-NLS-2$
39
idmapHM.put(getMapString("plugin>extension"), "point"); //$NON-NLS-1$ //$NON-NLS-2$
40
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 JavaDoc getImageKey(String JavaDoc xmlType) {
51         return IMAGE_TYPE_PREFIX + xmlType;
52     }
53     
54     private static String JavaDoc getMapString(String JavaDoc signature) {
55         return XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + signature + XMLStructureCreator.SIGN_SEPARATOR;
56     }
57     
58     public static HashMap JavaDoc getMappings() {
59         return fMappings;
60     }
61     
62 }
63
Popular Tags