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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 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.activities;
011:
012:        import java.io.IOException;
013:        import java.util.ArrayList;
014:        import java.util.Collections;
015:        import java.util.List;
016:
017:        import org.eclipse.core.runtime.IConfigurationElement;
018:        import org.eclipse.core.runtime.IExtension;
019:        import org.eclipse.core.runtime.IExtensionDelta;
020:        import org.eclipse.core.runtime.IExtensionRegistry;
021:        import org.eclipse.core.runtime.IRegistryChangeEvent;
022:        import org.eclipse.core.runtime.IRegistryChangeListener;
023:        import org.eclipse.ui.internal.util.ConfigurationElementMemento;
024:
025:        final class ExtensionActivityRegistry extends AbstractActivityRegistry {
026:            private List activityRequirementBindingDefinitions;
027:
028:            private List activityDefinitions;
029:
030:            private List activityPatternBindingDefinitions;
031:
032:            private List categoryActivityBindingDefinitions;
033:
034:            private List categoryDefinitions;
035:
036:            private List defaultEnabledActivities;
037:
038:            private IExtensionRegistry extensionRegistry;
039:
040:            ExtensionActivityRegistry(IExtensionRegistry extensionRegistry) {
041:                if (extensionRegistry == null) {
042:                    throw new NullPointerException();
043:                }
044:
045:                this .extensionRegistry = extensionRegistry;
046:
047:                this .extensionRegistry
048:                        .addRegistryChangeListener(new IRegistryChangeListener() {
049:                            public void registryChanged(
050:                                    IRegistryChangeEvent registryChangeEvent) {
051:                                IExtensionDelta[] extensionDeltas = registryChangeEvent
052:                                        .getExtensionDeltas(
053:                                                Persistence.PACKAGE_PREFIX,
054:                                                Persistence.PACKAGE_BASE);
055:
056:                                if (extensionDeltas.length != 0) {
057:                                    try {
058:                                        load();
059:                                    } catch (IOException eIO) {
060:                                    }
061:                                }
062:                            }
063:                        });
064:
065:                try {
066:                    load();
067:                } catch (IOException eIO) {
068:                }
069:            }
070:
071:            private String getNamespace(
072:                    IConfigurationElement configurationElement) {
073:                String namespace = null;
074:
075:                if (configurationElement != null) {
076:                    IExtension extension = configurationElement
077:                            .getDeclaringExtension();
078:
079:                    if (extension != null) {
080:                        namespace = extension.getNamespace();
081:                    }
082:                }
083:
084:                return namespace;
085:            }
086:
087:            private void load() throws IOException {
088:                if (activityRequirementBindingDefinitions == null) {
089:                    activityRequirementBindingDefinitions = new ArrayList();
090:                } else {
091:                    activityRequirementBindingDefinitions.clear();
092:                }
093:
094:                if (activityDefinitions == null) {
095:                    activityDefinitions = new ArrayList();
096:                } else {
097:                    activityDefinitions.clear();
098:                }
099:
100:                if (activityPatternBindingDefinitions == null) {
101:                    activityPatternBindingDefinitions = new ArrayList();
102:                } else {
103:                    activityPatternBindingDefinitions.clear();
104:                }
105:
106:                if (categoryActivityBindingDefinitions == null) {
107:                    categoryActivityBindingDefinitions = new ArrayList();
108:                } else {
109:                    categoryActivityBindingDefinitions.clear();
110:                }
111:
112:                if (categoryDefinitions == null) {
113:                    categoryDefinitions = new ArrayList();
114:                } else {
115:                    categoryDefinitions.clear();
116:                }
117:
118:                if (defaultEnabledActivities == null) {
119:                    defaultEnabledActivities = new ArrayList();
120:                } else {
121:                    defaultEnabledActivities.clear();
122:                }
123:
124:                IConfigurationElement[] configurationElements = extensionRegistry
125:                        .getConfigurationElementsFor(Persistence.PACKAGE_FULL);
126:
127:                for (int i = 0; i < configurationElements.length; i++) {
128:                    IConfigurationElement configurationElement = configurationElements[i];
129:                    String name = configurationElement.getName();
130:
131:                    if (Persistence.TAG_ACTIVITY_REQUIREMENT_BINDING
132:                            .equals(name)) {
133:                        readActivityRequirementBindingDefinition(configurationElement);
134:                    } else if (Persistence.TAG_ACTIVITY.equals(name)) {
135:                        readActivityDefinition(configurationElement);
136:                    } else if (Persistence.TAG_ACTIVITY_PATTERN_BINDING
137:                            .equals(name)) {
138:                        readActivityPatternBindingDefinition(configurationElement);
139:                    } else if (Persistence.TAG_CATEGORY_ACTIVITY_BINDING
140:                            .equals(name)) {
141:                        readCategoryActivityBindingDefinition(configurationElement);
142:                    } else if (Persistence.TAG_CATEGORY.equals(name)) {
143:                        readCategoryDefinition(configurationElement);
144:                    } else if (Persistence.TAG_DEFAULT_ENABLEMENT.equals(name)) {
145:                        readDefaultEnablement(configurationElement);
146:                    }
147:                }
148:
149:                boolean activityRegistryChanged = false;
150:
151:                if (!activityRequirementBindingDefinitions
152:                        .equals(super .activityRequirementBindingDefinitions)) {
153:                    super .activityRequirementBindingDefinitions = Collections
154:                            .unmodifiableList(activityRequirementBindingDefinitions);
155:                    activityRegistryChanged = true;
156:                }
157:
158:                if (!activityDefinitions.equals(super .activityDefinitions)) {
159:                    super .activityDefinitions = Collections
160:                            .unmodifiableList(activityDefinitions);
161:                    activityRegistryChanged = true;
162:                }
163:
164:                if (!activityPatternBindingDefinitions
165:                        .equals(super .activityPatternBindingDefinitions)) {
166:                    super .activityPatternBindingDefinitions = Collections
167:                            .unmodifiableList(activityPatternBindingDefinitions);
168:                    activityRegistryChanged = true;
169:                }
170:
171:                if (!categoryActivityBindingDefinitions
172:                        .equals(super .categoryActivityBindingDefinitions)) {
173:                    super .categoryActivityBindingDefinitions = Collections
174:                            .unmodifiableList(categoryActivityBindingDefinitions);
175:                    activityRegistryChanged = true;
176:                }
177:
178:                if (!categoryDefinitions.equals(super .categoryDefinitions)) {
179:                    super .categoryDefinitions = Collections
180:                            .unmodifiableList(categoryDefinitions);
181:                    activityRegistryChanged = true;
182:                }
183:
184:                if (!defaultEnabledActivities
185:                        .equals(super .defaultEnabledActivities)) {
186:                    super .defaultEnabledActivities = Collections
187:                            .unmodifiableList(defaultEnabledActivities);
188:                    activityRegistryChanged = true;
189:                }
190:
191:                if (activityRegistryChanged) {
192:                    fireActivityRegistryChanged();
193:                }
194:            }
195:
196:            private void readDefaultEnablement(
197:                    IConfigurationElement configurationElement) {
198:                String enabledActivity = Persistence
199:                        .readDefaultEnablement(new ConfigurationElementMemento(
200:                                configurationElement));
201:
202:                if (enabledActivity != null) {
203:                    defaultEnabledActivities.add(enabledActivity);
204:                }
205:
206:            }
207:
208:            private void readActivityRequirementBindingDefinition(
209:                    IConfigurationElement configurationElement) {
210:                ActivityRequirementBindingDefinition activityRequirementBindingDefinition = Persistence
211:                        .readActivityRequirementBindingDefinition(
212:                                new ConfigurationElementMemento(
213:                                        configurationElement),
214:                                getNamespace(configurationElement));
215:
216:                if (activityRequirementBindingDefinition != null) {
217:                    activityRequirementBindingDefinitions
218:                            .add(activityRequirementBindingDefinition);
219:                }
220:            }
221:
222:            private void readActivityDefinition(
223:                    IConfigurationElement configurationElement) {
224:                ActivityDefinition activityDefinition = Persistence
225:                        .readActivityDefinition(
226:                                new ConfigurationElementMemento(
227:                                        configurationElement),
228:                                getNamespace(configurationElement));
229:
230:                if (activityDefinition != null) {
231:                    activityDefinitions.add(activityDefinition);
232:                }
233:            }
234:
235:            private void readActivityPatternBindingDefinition(
236:                    IConfigurationElement configurationElement) {
237:                ActivityPatternBindingDefinition activityPatternBindingDefinition = Persistence
238:                        .readActivityPatternBindingDefinition(
239:                                new ConfigurationElementMemento(
240:                                        configurationElement),
241:                                getNamespace(configurationElement));
242:
243:                if (activityPatternBindingDefinition != null) {
244:                    activityPatternBindingDefinitions
245:                            .add(activityPatternBindingDefinition);
246:                }
247:            }
248:
249:            private void readCategoryActivityBindingDefinition(
250:                    IConfigurationElement configurationElement) {
251:                CategoryActivityBindingDefinition categoryActivityBindingDefinition = Persistence
252:                        .readCategoryActivityBindingDefinition(
253:                                new ConfigurationElementMemento(
254:                                        configurationElement),
255:                                getNamespace(configurationElement));
256:
257:                if (categoryActivityBindingDefinition != null) {
258:                    categoryActivityBindingDefinitions
259:                            .add(categoryActivityBindingDefinition);
260:                }
261:            }
262:
263:            private void readCategoryDefinition(
264:                    IConfigurationElement configurationElement) {
265:                CategoryDefinition categoryDefinition = Persistence
266:                        .readCategoryDefinition(
267:                                new ConfigurationElementMemento(
268:                                        configurationElement),
269:                                getNamespace(configurationElement));
270:
271:                if (categoryDefinition != null) {
272:                    categoryDefinitions.add(categoryDefinition);
273:                }
274:            }
275:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.