Source Code Cross Referenced for PDEManager.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) 2005, 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.net.URL;
013:        import java.util.ArrayList;
014:
015:        import org.eclipse.core.resources.IProject;
016:        import org.eclipse.osgi.service.resolver.BundleDescription;
017:        import org.eclipse.osgi.service.resolver.HostSpecification;
018:        import org.eclipse.pde.core.plugin.IFragmentModel;
019:        import org.eclipse.pde.core.plugin.IPluginModel;
020:        import org.eclipse.pde.core.plugin.IPluginModelBase;
021:        import org.eclipse.pde.core.plugin.PluginRegistry;
022:        import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase;
023:        import org.eclipse.pde.internal.core.plugin.ExternalPluginModelBase;
024:
025:        public class PDEManager {
026:
027:            public static IFragmentModel[] findFragmentsFor(
028:                    IPluginModelBase model) {
029:                ArrayList result = new ArrayList();
030:                BundleDescription desc = getBundleDescription(model);
031:                if (desc != null) {
032:                    BundleDescription[] fragments = desc.getFragments();
033:                    for (int i = 0; i < fragments.length; i++) {
034:                        IPluginModelBase candidate = PluginRegistry
035:                                .findModel(fragments[i]);
036:                        if (candidate instanceof  IFragmentModel) {
037:                            result.add(candidate);
038:                        }
039:                    }
040:                }
041:                return (IFragmentModel[]) result
042:                        .toArray(new IFragmentModel[result.size()]);
043:            }
044:
045:            public static IPluginModel findHostFor(IFragmentModel fragment) {
046:                BundleDescription desc = getBundleDescription(fragment);
047:                if (desc != null) {
048:                    HostSpecification spec = desc.getHost();
049:                    if (spec != null) {
050:                        IPluginModelBase host = PluginRegistry.findModel(spec
051:                                .getName());
052:                        if (host instanceof  IPluginModel)
053:                            return (IPluginModel) host;
054:                    }
055:                }
056:                return null;
057:            }
058:
059:            private static BundleDescription getBundleDescription(
060:                    IPluginModelBase model) {
061:                BundleDescription desc = model.getBundleDescription();
062:
063:                if (desc == null && model.getUnderlyingResource() != null) {
064:                    // the model may be an editor model. 
065:                    // editor models don't carry a bundle description
066:                    // get the core model counterpart.
067:                    IProject project = model.getUnderlyingResource()
068:                            .getProject();
069:                    IPluginModelBase coreModel = PluginRegistry
070:                            .findModel(project);
071:                    if (coreModel != null)
072:                        desc = coreModel.getBundleDescription();
073:                }
074:                return desc;
075:            }
076:
077:            public static URL[] getNLLookupLocations(IPluginModelBase model) {
078:                ArrayList urls = new ArrayList();
079:                addNLLocation(model, urls);
080:                if (model instanceof  IPluginModel) {
081:                    IFragmentModel[] fragments = findFragmentsFor(model);
082:                    for (int i = 0; i < fragments.length; i++) {
083:                        addNLLocation(fragments[i], urls);
084:                    }
085:                } else if (model instanceof  IFragmentModel) {
086:                    IPluginModel host = findHostFor((IFragmentModel) model);
087:                    if (host != null)
088:                        addNLLocation(host, urls);
089:                }
090:                return (URL[]) urls.toArray(new URL[urls.size()]);
091:            }
092:
093:            private static void addNLLocation(IPluginModelBase model,
094:                    ArrayList urls) {
095:                URL location = model.getNLLookupLocation();
096:                if (location != null)
097:                    urls.add(location);
098:            }
099:
100:            public static String getBundleLocalization(IPluginModelBase model) {
101:                if (model instanceof  IBundlePluginModelBase
102:                        && model.getUnderlyingResource() != null)
103:                    return ((IBundlePluginModelBase) model)
104:                            .getBundleLocalization();
105:
106:                if (model instanceof  ExternalPluginModelBase)
107:                    return ((ExternalPluginModelBase) model).getLocalization();
108:
109:                return "plugin"; //$NON-NLS-1$
110:            }
111:
112:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.