Source Code Cross Referenced for JspPluginImages.java in  » IDE-Eclipse » jdt » org » eclipse » jsp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jsp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2003 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jsp;
011:
012:        import java.net.MalformedURLException;
013:        import java.net.URL;
014:        import java.util.HashMap;
015:
016:        import org.eclipse.debug.core.DebugPlugin;
017:        import org.eclipse.jface.resource.ImageDescriptor;
018:        import org.eclipse.jface.resource.ImageRegistry;
019:        import org.eclipse.swt.graphics.Image;
020:
021:        /**
022:         * The images provided by the debug plugin.
023:         */
024:        public class JspPluginImages {
025:
026:            /** 
027:             * The image registry containing <code>Image</code>s.
028:             */
029:            private static ImageRegistry imageRegistry;
030:
031:            /**
032:             * A table of all the <code>ImageDescriptor</code>s.
033:             */
034:            private static HashMap imageDescriptors;
035:
036:            /* Declare Common paths */
037:            private static URL ICON_BASE_URL = null;
038:
039:            static {
040:                String pathSuffix = "icons/full/"; //$NON-NLS-1$
041:
042:                try {
043:                    ICON_BASE_URL = new URL(JspUIPlugin.getDefault()
044:                            .getDescriptor().getInstallURL(), pathSuffix);
045:                } catch (MalformedURLException e) {
046:                    // do nothing
047:                }
048:            }
049:
050:            // Use IPath and toOSString to build the names to ensure they have the slashes correct
051:            //private final static String CTOOL= "ctool16/"; //basic colors - size 16x16 //$NON-NLS-1$
052:            //private final static String LOCALTOOL= "clcl16/"; //basic colors - size 16x16 //$NON-NLS-1$
053:            //private final static String DLCL= "dlcl16/"; //disabled - size 16x16 //$NON-NLS-1$
054:            //private final static String ELCL= "elcl16/"; //enabled - size 16x16 //$NON-NLS-1$
055:            private final static String OBJECT = "obj16/"; //basic colors - size 16x16 //$NON-NLS-1$
056:            //private final static String WIZBAN= "wizban/"; //basic colors - size 16x16 //$NON-NLS-1$
057:            //private final static String OVR= "ovr16/"; //basic colors - size 7x8 //$NON-NLS-1$
058:            //private final static String VIEW= "cview16/"; // views //$NON-NLS-1$
059:
060:            public final static String IMG_OBJ_TOMCAT = "IMG_TOMCAT"; //$NON-NLS-1$
061:            public final static String IMG_OBJ_JSP = "IMG_OBJ_JSP"; //$NON-NLS-1$
062:
063:            /**
064:             * Declare all images
065:             */
066:            private static void declareImages() {
067:
068:                declareRegistryImage(IMG_OBJ_TOMCAT, OBJECT + "tomcat_obj.gif"); //$NON-NLS-1$
069:                declareRegistryImage(IMG_OBJ_JSP, OBJECT + "jsp_obj.gif"); //$NON-NLS-1$
070:            }
071:
072:            /**
073:             * Declare an Image in the registry table.
074:             * @param key 	The key to use when registering the image
075:             * @param path	The path where the image can be found. This path is relative to where
076:             *				this plugin class is found (i.e. typically the packages directory)
077:             */
078:            private final static void declareRegistryImage(String key,
079:                    String path) {
080:                ImageDescriptor desc = ImageDescriptor
081:                        .getMissingImageDescriptor();
082:                try {
083:                    desc = ImageDescriptor.createFromURL(makeIconFileURL(path));
084:                } catch (MalformedURLException me) {
085:                    DebugPlugin.log(me);
086:                }
087:                imageRegistry.put(key, desc);
088:                imageDescriptors.put(key, desc);
089:            }
090:
091:            /**
092:             * Returns the ImageRegistry.
093:             */
094:            public static ImageRegistry getImageRegistry() {
095:                if (imageRegistry == null) {
096:                    initializeImageRegistry();
097:                }
098:                return imageRegistry;
099:            }
100:
101:            /**
102:             *	Initialize the image registry by declaring all of the required
103:             *	graphics. This involves creating JFace image descriptors describing
104:             *	how to create/find the image should it be needed.
105:             *	The image is not actually allocated until requested.
106:             *
107:             * 	Prefix conventions
108:             *		Wizard Banners			WIZBAN_
109:             *		Preference Banners		PREF_BAN_
110:             *		Property Page Banners	PROPBAN_
111:             *		Color toolbar			CTOOL_
112:             *		Enable toolbar			ETOOL_
113:             *		Disable toolbar			DTOOL_
114:             *		Local enabled toolbar	ELCL_
115:             *		Local Disable toolbar	DLCL_
116:             *		Object large			OBJL_
117:             *		Object small			OBJS_
118:             *		View 					VIEW_
119:             *		Product images			PROD_
120:             *		Misc images				MISC_
121:             *
122:             *	Where are the images?
123:             *		The images (typically gifs) are found in the same location as this plugin class.
124:             *		This may mean the same package directory as the package holding this class.
125:             *		The images are declared using this.getClass() to ensure they are looked up via
126:             *		this plugin class.
127:             *	@see JFace's ImageRegistry
128:             */
129:            public static ImageRegistry initializeImageRegistry() {
130:                imageRegistry = new ImageRegistry(JspUIPlugin
131:                        .getStandardDisplay());
132:                imageDescriptors = new HashMap(30);
133:                declareImages();
134:                return imageRegistry;
135:            }
136:
137:            /**
138:             * Returns the <code>Image<code> identified by the given key,
139:             * or <code>null</code> if it does not exist.
140:             */
141:            public static Image getImage(String key) {
142:                return getImageRegistry().get(key);
143:            }
144:
145:            /**
146:             * Returns the <code>ImageDescriptor<code> identified by the given key,
147:             * or <code>null</code> if it does not exist.
148:             */
149:            public static ImageDescriptor getImageDescriptor(String key) {
150:                if (imageDescriptors == null) {
151:                    initializeImageRegistry();
152:                }
153:                return (ImageDescriptor) imageDescriptors.get(key);
154:            }
155:
156:            private static URL makeIconFileURL(String iconPath)
157:                    throws MalformedURLException {
158:                if (ICON_BASE_URL == null) {
159:                    throw new MalformedURLException();
160:                }
161:
162:                return new URL(ICON_BASE_URL, iconPath);
163:            }
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.