Source Code Cross Referenced for PDECore.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » core » 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 » Eclipse plug in development » org.eclipse.pde.internal.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 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.pde.internal.core;
011:
012:        import java.io.IOException;
013:        import java.lang.reflect.InvocationTargetException;
014:        import java.net.URL;
015:
016:        import org.eclipse.core.resources.IWorkspace;
017:        import org.eclipse.core.resources.ResourcesPlugin;
018:        import org.eclipse.core.runtime.CoreException;
019:        import org.eclipse.core.runtime.FileLocator;
020:        import org.eclipse.core.runtime.IPath;
021:        import org.eclipse.core.runtime.IStatus;
022:        import org.eclipse.core.runtime.NullProgressMonitor;
023:        import org.eclipse.core.runtime.Path;
024:        import org.eclipse.core.runtime.Plugin;
025:        import org.eclipse.core.runtime.QualifiedName;
026:        import org.eclipse.core.runtime.Status;
027:        import org.eclipse.pde.core.plugin.IPluginModelBase;
028:        import org.eclipse.pde.internal.core.builders.CompilerFlags;
029:        import org.eclipse.pde.internal.core.builders.FeatureRebuilder;
030:        import org.eclipse.pde.internal.core.builders.PluginRebuilder;
031:        import org.eclipse.pde.internal.core.schema.SchemaRegistry;
032:        import org.eclipse.update.configurator.ConfiguratorUtils;
033:        import org.osgi.framework.BundleContext;
034:
035:        public class PDECore extends Plugin {
036:            public static final String PLUGIN_ID = "org.eclipse.pde.core"; //$NON-NLS-1$
037:
038:            public static final IPath REQUIRED_PLUGINS_CONTAINER_PATH = new Path(
039:                    PLUGIN_ID + ".requiredPlugins"); //$NON-NLS-1$
040:            public static final IPath JAVA_SEARCH_CONTAINER_PATH = new Path(
041:                    PLUGIN_ID + ".externalJavaSearch"); //$NON-NLS-1$
042:
043:            public static final String BINARY_PROJECT_VALUE = "binary"; //$NON-NLS-1$
044:            public static final String BINARY_REPOSITORY_PROVIDER = PLUGIN_ID
045:                    + "." + "BinaryRepositoryProvider"; //$NON-NLS-1$ //$NON-NLS-2$
046:
047:            public static final QualifiedName EXTERNAL_PROJECT_PROPERTY = new QualifiedName(
048:                    PLUGIN_ID, "imported"); //$NON-NLS-1$
049:            public static final QualifiedName TOUCH_PROJECT = new QualifiedName(
050:                    PLUGIN_ID, "TOUCH_PROJECT"); //$NON-NLS-1$
051:
052:            public static final QualifiedName SCHEMA_PREVIEW_FILE = new QualifiedName(
053:                    PLUGIN_ID, "SCHEMA_PREVIEW_FILE"); //$NON-NLS-1$
054:
055:            // Shared instance
056:            private static PDECore inst;
057:
058:            private static IPluginModelBase[] registryPlugins;
059:            private static PDEExtensionRegistry fExtensionRegistry = null;
060:
061:            public static PDECore getDefault() {
062:                return inst;
063:            }
064:
065:            public static IWorkspace getWorkspace() {
066:                return ResourcesPlugin.getWorkspace();
067:            }
068:
069:            public static void log(IStatus status) {
070:                if (status != null)
071:                    ResourcesPlugin.getPlugin().getLog().log(status);
072:            }
073:
074:            public static void log(Throwable e) {
075:                if (e instanceof  InvocationTargetException)
076:                    e = ((InvocationTargetException) e).getTargetException();
077:                IStatus status = null;
078:                if (e instanceof  CoreException) {
079:                    status = ((CoreException) e).getStatus();
080:                } else if (e.getMessage() != null) {
081:                    status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e
082:                            .getMessage(), e);
083:                }
084:                log(status);
085:            }
086:
087:            public static void logErrorMessage(String message) {
088:                log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR,
089:                        message, null));
090:            }
091:
092:            public static void logException(Throwable e) {
093:                logException(e, null);
094:            }
095:
096:            public static void logException(Throwable e, String message) {
097:                if (e instanceof  InvocationTargetException) {
098:                    e = ((InvocationTargetException) e).getTargetException();
099:                }
100:                IStatus status = null;
101:                if (e instanceof  CoreException)
102:                    status = ((CoreException) e).getStatus();
103:                else {
104:                    if (message == null)
105:                        message = e.getMessage();
106:                    if (message == null)
107:                        message = e.toString();
108:                    status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
109:                            message, e);
110:                }
111:                log(status);
112:            }
113:
114:            private PluginModelManager fModelManager;
115:            private FeatureModelManager fFeatureModelManager;
116:
117:            private TargetDefinitionManager fTargetProfileManager;
118:
119:            // Schema registry
120:            private SchemaRegistry fSchemaRegistry;
121:
122:            private SourceLocationManager fSourceLocationManager;
123:            private JavadocLocationManager fJavadocLocationManager;
124:            private SearchablePluginsManager fSearchablePluginsManager;
125:
126:            // Tracing options manager
127:            private TracingOptionsManager fTracingOptionsManager;
128:            private BundleContext fBundleContext;
129:            private JavaElementChangeListener fJavaElementChangeListener;
130:
131:            private FeatureRebuilder fFeatureRebuilder;
132:
133:            private PluginRebuilder fPluginRebuilder;
134:
135:            public PDECore() {
136:                inst = this ;
137:            }
138:
139:            public URL getInstallURL() {
140:                try {
141:                    return FileLocator.resolve(getDefault().getBundle()
142:                            .getEntry("/")); //$NON-NLS-1$
143:                } catch (IOException e) {
144:                    return null;
145:                }
146:            }
147:
148:            public IPluginModelBase findPluginInHost(String id) {
149:                if (registryPlugins == null) {
150:                    URL[] pluginPaths = ConfiguratorUtils
151:                            .getCurrentPlatformConfiguration().getPluginPath();
152:                    PDEState state = new PDEState(pluginPaths, false,
153:                            new NullProgressMonitor());
154:                    registryPlugins = state.getTargetModels();
155:                }
156:
157:                for (int i = 0; i < registryPlugins.length; i++) {
158:                    if (registryPlugins[i].getPluginBase().getId().equals(id))
159:                        return registryPlugins[i];
160:                }
161:                return null;
162:            }
163:
164:            public PluginModelManager getModelManager() {
165:                if (fModelManager == null) {
166:                    fModelManager = new PluginModelManager();
167:                    // when initializing plug-in models, create the extension registry so it can track relevant (ModelChange) events.
168:                    if (fExtensionRegistry == null)
169:                        getExtensionsRegistry();
170:                }
171:                return fModelManager;
172:            }
173:
174:            public TargetDefinitionManager getTargetProfileManager() {
175:                if (fTargetProfileManager == null)
176:                    fTargetProfileManager = new TargetDefinitionManager();
177:                return fTargetProfileManager;
178:            }
179:
180:            public FeatureModelManager getFeatureModelManager() {
181:                if (fFeatureModelManager == null)
182:                    fFeatureModelManager = new FeatureModelManager();
183:                return fFeatureModelManager;
184:            }
185:
186:            public JavaElementChangeListener getJavaElementChangeListener() {
187:                return fJavaElementChangeListener;
188:            }
189:
190:            public SchemaRegistry getSchemaRegistry() {
191:                if (fSchemaRegistry == null)
192:                    fSchemaRegistry = new SchemaRegistry();
193:                return fSchemaRegistry;
194:            }
195:
196:            public PDEExtensionRegistry getExtensionsRegistry() {
197:                if (fExtensionRegistry == null) {
198:                    fExtensionRegistry = new PDEExtensionRegistry();
199:                }
200:                return fExtensionRegistry;
201:            }
202:
203:            public SourceLocationManager getSourceLocationManager() {
204:                if (fSourceLocationManager == null)
205:                    fSourceLocationManager = new SourceLocationManager();
206:                return fSourceLocationManager;
207:            }
208:
209:            public JavadocLocationManager getJavadocLocationManager() {
210:                if (fJavadocLocationManager == null)
211:                    fJavadocLocationManager = new JavadocLocationManager();
212:                return fJavadocLocationManager;
213:            }
214:
215:            public TracingOptionsManager getTracingOptionsManager() {
216:                if (fTracingOptionsManager == null)
217:                    fTracingOptionsManager = new TracingOptionsManager();
218:                return fTracingOptionsManager;
219:            }
220:
221:            public SearchablePluginsManager getSearchablePluginsManager() {
222:                if (fSearchablePluginsManager == null) {
223:                    fSearchablePluginsManager = new SearchablePluginsManager();
224:                    try {
225:                        getWorkspace().addSaveParticipant(inst,
226:                                fSearchablePluginsManager);
227:                    } catch (CoreException e) {
228:                        log(e);
229:                    }
230:                }
231:                return fSearchablePluginsManager;
232:            }
233:
234:            public boolean areModelsInitialized() {
235:                return fModelManager != null && fModelManager.isInitialized();
236:            }
237:
238:            public void start(BundleContext context) throws Exception {
239:                super .start(context);
240:                fBundleContext = context;
241:                CompilerFlags.initializeDefaults();
242:                fJavaElementChangeListener = new JavaElementChangeListener();
243:                fJavaElementChangeListener.start();
244:                fPluginRebuilder = new PluginRebuilder();
245:                fPluginRebuilder.start();
246:                fFeatureRebuilder = new FeatureRebuilder();
247:                fFeatureRebuilder.start();
248:            }
249:
250:            public BundleContext getBundleContext() {
251:                return fBundleContext;
252:            }
253:
254:            public void stop(BundleContext context) throws CoreException {
255:                PDECore.getDefault().savePluginPreferences();
256:
257:                fJavaElementChangeListener.shutdown();
258:                fPluginRebuilder.stop();
259:                fFeatureRebuilder.stop();
260:
261:                if (fSchemaRegistry != null) {
262:                    fSchemaRegistry.shutdown();
263:                    fSchemaRegistry = null;
264:                }
265:                if (fTargetProfileManager != null) {
266:                    fTargetProfileManager.shutdown();
267:                    fTargetProfileManager = null;
268:                }
269:                if (fSearchablePluginsManager != null) {
270:                    getWorkspace().removeSaveParticipant(inst);
271:                    fSearchablePluginsManager.shutdown();
272:                    fSearchablePluginsManager = null;
273:                }
274:                if (fFeatureModelManager != null) {
275:                    fFeatureModelManager.shutdown();
276:                    fFeatureModelManager = null;
277:                }
278:                if (fModelManager != null) {
279:                    fModelManager.shutdown();
280:                    fModelManager = null;
281:                }
282:                if (fExtensionRegistry != null) {
283:                    fExtensionRegistry.stop();
284:                    fExtensionRegistry = null;
285:                }
286:            }
287:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.