Source Code Cross Referenced for MapGraphicPlugin.java in  » GIS » udig-1.1 » net » refractions » udig » mapgraphic » 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 » GIS » udig 1.1 » net.refractions.udig.mapgraphic 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.refractions.udig.mapgraphic;
002:
003:        import java.util.MissingResourceException;
004:        import java.util.ResourceBundle;
005:
006:        import org.eclipse.core.runtime.IStatus;
007:        import org.eclipse.core.runtime.Platform;
008:        import org.eclipse.core.runtime.Status;
009:        import org.eclipse.jface.resource.ImageDescriptor;
010:        import org.eclipse.ui.plugin.AbstractUIPlugin;
011:        import org.osgi.framework.BundleContext;
012:
013:        /**
014:         * The main plugin class to be used in the desktop.
015:         */
016:        public class MapGraphicPlugin extends AbstractUIPlugin {
017:            //The shared instance.
018:            private static MapGraphicPlugin plugin;
019:            //Resource bundle.
020:            private ResourceBundle resourceBundle;
021:
022:            public static final String ID = "net.refractions.udig.mapgraphic"; //$NON-NLS-1$
023:
024:            /**
025:             * The constructor.
026:             */
027:            public MapGraphicPlugin() {
028:                super ();
029:                plugin = this ;
030:            }
031:
032:            /**
033:             * This method is called upon plug-in activation
034:             */
035:            public void start(BundleContext context) throws Exception {
036:                super .start(context);
037:            }
038:
039:            /**
040:             * This method is called when the plug-in is stopped
041:             */
042:            public void stop(BundleContext context) throws Exception {
043:                plugin = null;
044:                resourceBundle = null;
045:                super .stop(context);
046:            }
047:
048:            /**
049:             * Returns the shared instance.
050:             */
051:            public static MapGraphicPlugin getDefault() {
052:                return plugin;
053:            }
054:
055:            /**
056:             * Returns the string from the plugin's resource bundle,
057:             * or 'key' if not found.
058:             */
059:            public static String getResourceString(String key) {
060:                ResourceBundle bundle = MapGraphicPlugin.getDefault()
061:                        .getResourceBundle();
062:                try {
063:                    return (bundle != null) ? bundle.getString(key) : key;
064:                } catch (MissingResourceException e) {
065:                    return key;
066:                }
067:            }
068:
069:            /**
070:             * Returns the plugin's resource bundle,
071:             */
072:            public ResourceBundle getResourceBundle() {
073:                try {
074:                    if (resourceBundle == null)
075:                        resourceBundle = ResourceBundle
076:                                .getBundle("net.refractions.udig.mapgraphic.MapgraphicPluginResources"); //$NON-NLS-1$
077:                } catch (MissingResourceException x) {
078:                    resourceBundle = null;
079:                }
080:                return resourceBundle;
081:            }
082:
083:            /**
084:             * Returns an image descriptor for the image file at the given
085:             * plug-in relative path.
086:             *
087:             * @param path the path
088:             * @return the image descriptor
089:             */
090:            public static ImageDescriptor getImageDescriptor(String path) {
091:                return AbstractUIPlugin.imageDescriptorFromPlugin(
092:                        "net.refractions.udig.mapgraphic", path); //$NON-NLS-1$
093:            }
094:
095:            /**
096:             * Processes the map graphic extension point and creates resources for
097:             * each map graphic.
098:             *
099:             */
100:            //    void loadMapGraphics() {
101:            //        //create the map graphic service
102:            //        final MapGraphicService mgService = new MapGraphicService();
103:            //        CatalogPlugin.getDefault().getLocalCatalog().add(mgService);
104:            //                                                                            
105:            //        try {
106:            //            ExtensionPointProcessor p = new ExtensionPointProcessor() {
107:            //                public void process( IExtension extension, IConfigurationElement element ) throws Exception {
108:            //                    mgService.addDecoratorResource(element);
109:            //                }
110:            //            };
111:            //            ExtensionPointUtil.process(this,MapGraphic.XPID, p);
112:            //        }
113:            //        catch(Exception e) {
114:            //            e.printStackTrace();
115:            //        }
116:            //    }
117:            /**
118:             * Logs the Throwable in the plugin's log.
119:             * <p>
120:             * This will be a user visable ERROR iff:
121:             * <ul>
122:             * <li>t is an Exception we are assuming it is human readable or if a message is provided
123:             * </ul>
124:             * </p>
125:             * @param message 
126:             * @param t 
127:             */
128:            public static void log(String message, Throwable t) {
129:                int status = t instanceof  Exception || message != null ? IStatus.ERROR
130:                        : IStatus.WARNING;
131:                getDefault().getLog().log(
132:                        new Status(status, ID, IStatus.OK, message, t));
133:            }
134:
135:            /**
136:             * Messages that only engage if getDefault().isDebugging()
137:             * <p>
138:             * It is much prefered to do this:<pre><code>
139:             * private static final String RENDERING = "net.refractions.udig.project/render/trace";
140:             * if( ProjectUIPlugin.getDefault().isDebugging() && "true".equalsIgnoreCase( RENDERING ) ){
141:             *      System.out.println( "your message here" );
142:             * }
143:             * </code></pre>
144:             * </p>
145:             * @param message 
146:             * @param e 
147:             */
148:            public static void trace(String message, Throwable e) {
149:                if (getDefault().isDebugging()) {
150:                    if (message != null)
151:                        System.out.println(message);
152:                    if (e != null)
153:                        e.printStackTrace();
154:                }
155:            }
156:
157:            /**
158:             * Performs the Platform.getDebugOption true check on the provided trace
159:             * <p>
160:             * Note: ProjectUIPlugin.getDefault().isDebugging() must also be on.
161:             * <ul>
162:             * <li>Trace.RENDER - trace rendering progress
163:             * </ul>
164:             * </p> 
165:             * @param trace currently only RENDER is defined
166:             * @return true if -debug is on for this plugin 
167:             */
168:            public static boolean isDebugging(final String trace) {
169:                return getDefault().isDebugging()
170:                        && "true".equalsIgnoreCase(Platform.getDebugOption(trace)); //$NON-NLS-1$    
171:            }
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.