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


001:        package net.refractions.udig.style.sld.editor;
002:
003:        import java.io.InputStream;
004:        import java.io.OutputStream;
005:        import java.util.Collections;
006:        import java.util.HashMap;
007:        import java.util.Map;
008:
009:        import org.eclipse.core.runtime.CoreException;
010:        import org.eclipse.core.runtime.IConfigurationElement;
011:        import org.eclipse.core.runtime.IExtension;
012:        import org.eclipse.core.runtime.IExtensionPoint;
013:        import org.eclipse.core.runtime.IRegistryChangeEvent;
014:        import org.eclipse.core.runtime.IRegistryChangeListener;
015:        import org.eclipse.core.runtime.IStatus;
016:        import org.eclipse.core.runtime.Platform;
017:        import org.eclipse.core.runtime.preferences.IEclipsePreferences;
018:        import org.eclipse.core.runtime.preferences.IExportedPreferences;
019:        import org.eclipse.core.runtime.preferences.IPreferenceFilter;
020:        import org.eclipse.core.runtime.preferences.IPreferencesService;
021:        import org.eclipse.core.runtime.preferences.IScope;
022:        import org.eclipse.core.runtime.preferences.IScopeContext;
023:        import org.osgi.service.prefs.Preferences;
024:
025:        /**
026:         * TODO Purpose of
027:         * <p>
028:         * Yes, I know we aren't supposed to implement IPreferencesService, but this isn't a regular
029:         * circumstance; since we want to have the same functionality as the preference dialog without being
030:         * the preference dialog, this seems appropriate.
031:         * </p>
032:         * 
033:         * @author chorner
034:         * @since 1.1
035:         */
036:        public class SLDPreferencesService implements  IPreferencesService,
037:                IRegistryChangeListener {
038:
039:            private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
040:            private static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
041:            private static final String ELEMENT_SCOPE = "scope"; //$NON-NLS-1$
042:
043:            private static SLDPreferencesService instance;
044:            static final SLDRootPreferences root = new SLDRootPreferences();
045:            private static final Map<String, Object> scopeRegistry = Collections
046:                    .synchronizedMap(new HashMap<String, Object>());
047:
048:            public SLDPreferencesService() {
049:                super ();
050:                initializeScopes();
051:            }
052:
053:            public String get(String key, String defaultValue,
054:                    Preferences[] nodes) {
055:                return null;
056:            }
057:
058:            public boolean getBoolean(String qualifier, String key,
059:                    boolean defaultValue, IScopeContext[] contexts) {
060:                return false;
061:            }
062:
063:            public byte[] getByteArray(String qualifier, String key,
064:                    byte[] defaultValue, IScopeContext[] contexts) {
065:                return null;
066:            }
067:
068:            public double getDouble(String qualifier, String key,
069:                    double defaultValue, IScopeContext[] contexts) {
070:                return 0;
071:            }
072:
073:            public float getFloat(String qualifier, String key,
074:                    float defaultValue, IScopeContext[] contexts) {
075:                return 0;
076:            }
077:
078:            public int getInt(String qualifier, String key, int defaultValue,
079:                    IScopeContext[] contexts) {
080:                return 0;
081:            }
082:
083:            public long getLong(String qualifier, String key,
084:                    long defaultValue, IScopeContext[] contexts) {
085:                return 0;
086:            }
087:
088:            public String getString(String qualifier, String key,
089:                    String defaultValue, IScopeContext[] contexts) {
090:                return null;
091:            }
092:
093:            public IEclipsePreferences getRootNode() {
094:                return null;
095:            }
096:
097:            public IStatus exportPreferences(IEclipsePreferences node,
098:                    OutputStream output, String[] excludesList)
099:                    throws CoreException {
100:                return null;
101:            }
102:
103:            public IStatus importPreferences(InputStream input)
104:                    throws CoreException {
105:                return null;
106:            }
107:
108:            public IStatus applyPreferences(IExportedPreferences preferences)
109:                    throws CoreException {
110:                return null;
111:            }
112:
113:            public IExportedPreferences readPreferences(InputStream input)
114:                    throws CoreException {
115:                return null;
116:            }
117:
118:            public String[] getDefaultLookupOrder(String qualifier, String key) {
119:                return null;
120:            }
121:
122:            public String[] getLookupOrder(String qualifier, String key) {
123:                return null;
124:            }
125:
126:            public void setDefaultLookupOrder(String qualifier, String key,
127:                    String[] order) {
128:            }
129:
130:            public void exportPreferences(IEclipsePreferences node,
131:                    IPreferenceFilter[] filters, OutputStream output)
132:                    throws CoreException {
133:            }
134:
135:            public IPreferenceFilter[] matches(IEclipsePreferences node,
136:                    IPreferenceFilter[] filters) throws CoreException {
137:                return null;
138:            }
139:
140:            public void applyPreferences(IEclipsePreferences node,
141:                    IPreferenceFilter[] filters) throws CoreException {
142:            }
143:
144:            /**
145:             * See who is plugged into the extension point.
146:             */
147:            private void initializeScopes() {
148:                IExtensionPoint point = Platform.getExtensionRegistry()
149:                        .getExtensionPoint(StyleEditor.ID);
150:                if (point == null)
151:                    return;
152:                IExtension[] extensions = point.getExtensions();
153:                for (int i = 0; i < extensions.length; i++) {
154:                    IConfigurationElement[] elements = extensions[i]
155:                            .getConfigurationElements();
156:                    for (int j = 0; j < elements.length; j++)
157:                        if (ELEMENT_SCOPE.equalsIgnoreCase(elements[j]
158:                                .getName()))
159:                            scopeAdded(elements[j]);
160:                }
161:                Platform.getExtensionRegistry().addRegistryChangeListener(this ,
162:                        StyleEditor.ID);
163:            }
164:
165:            /*
166:             * Abstracted into a separate method to prepare for dynamic awareness.
167:             */
168:            static void scopeAdded(IConfigurationElement element) {
169:                String key = element.getAttribute(ATTRIBUTE_NAME);
170:                if (key == null) {
171:                    //            String message = NLS.bind(Messages.preferences_missingScopeAttribute, element.getDeclaringExtension().getUniqueIdentifier());
172:                    //            log(createStatusWarning(message, null));
173:                    return;
174:                }
175:                scopeRegistry.put(key, element);
176:                root.addChild(key, null);
177:            }
178:
179:            public void registryChanged(IRegistryChangeEvent event) {
180:            }
181:
182:            protected IEclipsePreferences createNode(String name) {
183:                IScope scope = null;
184:                Object value = scopeRegistry.get(name);
185:                if (value instanceof  IConfigurationElement) {
186:                    try {
187:                        scope = (IScope) ((IConfigurationElement) value)
188:                                .createExecutableExtension(ATTRIBUTE_CLASS);
189:                        scopeRegistry.put(name, scope);
190:                    } catch (ClassCastException e) {
191:                        //                log(createStatusError(Messages.preferences_classCastScope, e));
192:                        return new SLDPreferences(root, name);
193:                    } catch (CoreException e) {
194:                        log(e.getStatus());
195:                        return new SLDPreferences(root, name);
196:                    }
197:                } else
198:                    scope = (IScope) value;
199:                return scope.create(root, name);
200:            }
201:
202:            /*
203:             * Return the instance.
204:             */
205:            public static SLDPreferencesService getDefault() {
206:                if (instance == null)
207:                    instance = new SLDPreferencesService();
208:                return instance;
209:            }
210:
211:            static void log(IStatus status) {
212:                //InternalPlatform.getDefault().log(status);
213:            }
214:
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.