Source Code Cross Referenced for ConsolePluginImages.java in  » IDE-Eclipse » ui » org » eclipse » ui » internal » console » 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 » ui » org.eclipse.ui.internal.console 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2005 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.ui.internal.console;
011:
012:        import java.net.MalformedURLException;
013:        import java.net.URL;
014:
015:        import org.eclipse.jface.resource.ImageDescriptor;
016:        import org.eclipse.jface.resource.ImageRegistry;
017:        import org.eclipse.swt.graphics.Image;
018:        import org.eclipse.ui.console.ConsolePlugin;
019:        import org.eclipse.ui.console.IConsoleConstants;
020:
021:        /**
022:         * The images provided by the debug plugin.
023:         */
024:        public class ConsolePluginImages {
025:
026:            /** 
027:             * The image registry containing <code>Image</code>s and the <code>ImageDescriptor</code>s.
028:             */
029:            private static ImageRegistry imageRegistry;
030:
031:            /* Declare Common paths */
032:            private static URL ICON_BASE_URL = null;
033:
034:            static {
035:                String pathSuffix = "icons/full/"; //$NON-NLS-1$
036:                ICON_BASE_URL = ConsolePlugin.getDefault().getBundle()
037:                        .getEntry(pathSuffix);
038:            }
039:
040:            // Use IPath and toOSString to build the names to ensure they have the slashes correct
041:            private final static String LOCALTOOL = "clcl16/"; //basic colors - size 16x16 //$NON-NLS-1$
042:            private final static String DLCL = "dlcl16/"; //disabled - size 16x16 //$NON-NLS-1$
043:            private final static String ELCL = "elcl16/"; //enabled - size 16x16 //$NON-NLS-1$
044:            private final static String VIEW = "cview16/"; // views //$NON-NLS-1$
045:
046:            /**
047:             * Declare all images
048:             */
049:            private static void declareImages() {
050:                // Actions
051:
052:                //local toolbars
053:                declareRegistryImage(IConsoleConstants.IMG_LCL_CLEAR, LOCALTOOL
054:                        + "clear_co.gif"); //$NON-NLS-1$
055:                declareRegistryImage(IInternalConsoleConstants.IMG_LCL_PIN,
056:                        LOCALTOOL + "pin.gif"); //$NON-NLS-1$
057:                declareRegistryImage(IInternalConsoleConstants.IMG_LCL_LOCK,
058:                        LOCALTOOL + "lock_co.gif"); //$NON-NLS-1$
059:
060:                // disabled local toolbars
061:                declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_CLEAR,
062:                        DLCL + "clear_co.gif"); //$NON-NLS-1$
063:                declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_PIN,
064:                        DLCL + "pin.gif"); //$NON-NLS-1$
065:                declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_LOCK,
066:                        DLCL + "lock_co.gif"); //$NON-NLS-1$
067:                declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_CLOSE,
068:                        DLCL + "rem_co.gif"); //$NON-NLS-1$
069:
070:                // enabled local toolbars
071:                declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_CLEAR,
072:                        ELCL + "clear_co.gif"); //$NON-NLS-1$
073:                declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_PIN,
074:                        ELCL + "pin.gif"); //$NON-NLS-1$
075:                declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_LOCK,
076:                        ELCL + "lock_co.gif"); //$NON-NLS-1$
077:                declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_CLOSE,
078:                        ELCL + "rem_co.gif"); //$NON-NLS-1$
079:                declareRegistryImage(
080:                        IInternalConsoleConstants.IMG_ELCL_NEW_CON, ELCL
081:                                + "new_con.gif"); //$NON-NLS-1$
082:
083:                // Views
084:                declareRegistryImage(IConsoleConstants.IMG_VIEW_CONSOLE, VIEW
085:                        + "console_view.gif"); //$NON-NLS-1$				
086:            }
087:
088:            /**
089:             * Declare an Image in the registry table.
090:             * @param key 	The key to use when registering the image
091:             * @param path	The path where the image can be found. This path is relative to where
092:             *				this plugin class is found (i.e. typically the packages directory)
093:             */
094:            private final static void declareRegistryImage(String key,
095:                    String path) {
096:                ImageDescriptor desc = ImageDescriptor
097:                        .getMissingImageDescriptor();
098:                try {
099:                    desc = ImageDescriptor.createFromURL(makeIconFileURL(path));
100:                } catch (MalformedURLException me) {
101:                    ConsolePlugin.log(me);
102:                }
103:                imageRegistry.put(key, desc);
104:            }
105:
106:            /**
107:             * Returns the ImageRegistry.
108:             */
109:            public static ImageRegistry getImageRegistry() {
110:                if (imageRegistry == null) {
111:                    initializeImageRegistry();
112:                }
113:                return imageRegistry;
114:            }
115:
116:            /**
117:             *	Initialize the image registry by declaring all of the required
118:             *	graphics. This involves creating JFace image descriptors describing
119:             *	how to create/find the image should it be needed.
120:             *	The image is not actually allocated until requested.
121:             *
122:             * 	Prefix conventions
123:             *		Wizard Banners			WIZBAN_
124:             *		Preference Banners		PREF_BAN_
125:             *		Property Page Banners	PROPBAN_
126:             *		Color toolbar			CTOOL_
127:             *		Enable toolbar			ETOOL_
128:             *		Disable toolbar			DTOOL_
129:             *		Local enabled toolbar	ELCL_
130:             *		Local Disable toolbar	DLCL_
131:             *		Object large			OBJL_
132:             *		Object small			OBJS_
133:             *		View 					VIEW_
134:             *		Product images			PROD_
135:             *		Misc images				MISC_
136:             *
137:             *	Where are the images?
138:             *		The images (typically gifs) are found in the same location as this plugin class.
139:             *		This may mean the same package directory as the package holding this class.
140:             *		The images are declared using this.getClass() to ensure they are looked up via
141:             *		this plugin class.
142:             *	@see org.eclipse.jface.resource.ImageRegistry
143:             */
144:            public static ImageRegistry initializeImageRegistry() {
145:                imageRegistry = new ImageRegistry(ConsolePlugin
146:                        .getStandardDisplay());
147:                declareImages();
148:                return imageRegistry;
149:            }
150:
151:            /**
152:             * Returns the <code>Image<code> identified by the given key,
153:             * or <code>null</code> if it does not exist.
154:             */
155:            public static Image getImage(String key) {
156:                return getImageRegistry().get(key);
157:            }
158:
159:            /**
160:             * Returns the <code>ImageDescriptor<code> identified by the given key,
161:             * or <code>null</code> if it does not exist.
162:             */
163:            public static ImageDescriptor getImageDescriptor(String key) {
164:                return getImageRegistry().getDescriptor(key);
165:            }
166:
167:            private static URL makeIconFileURL(String iconPath)
168:                    throws MalformedURLException {
169:                if (ICON_BASE_URL == null) {
170:                    throw new MalformedURLException();
171:                }
172:
173:                return new URL(ICON_BASE_URL, iconPath);
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.