Source Code Cross Referenced for PDEPlugin.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » 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.ui 
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.ui;
011:
012:        import java.lang.reflect.InvocationTargetException;
013:        import java.net.URL;
014:        import java.util.Hashtable;
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.IStatus;
020:        import org.eclipse.core.runtime.Status;
021:        import org.eclipse.debug.core.DebugPlugin;
022:        import org.eclipse.debug.core.ILaunchConfigurationListener;
023:        import org.eclipse.jface.dialogs.ErrorDialog;
024:        import org.eclipse.jface.preference.IPreferenceStore;
025:        import org.eclipse.pde.internal.ui.launcher.LaunchConfigurationListener;
026:        import org.eclipse.pde.internal.ui.launcher.LaunchListener;
027:        import org.eclipse.pde.internal.ui.launcher.LauncherUtils;
028:        import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
029:        import org.eclipse.pde.internal.ui.util.SWTUtil;
030:        import org.eclipse.swt.widgets.Display;
031:        import org.eclipse.swt.widgets.Shell;
032:        import org.eclipse.ui.IWorkbenchPage;
033:        import org.eclipse.ui.IWorkbenchWindow;
034:        import org.eclipse.ui.editors.text.TextFileDocumentProvider;
035:        import org.eclipse.ui.forms.FormColors;
036:        import org.eclipse.ui.plugin.AbstractUIPlugin;
037:        import org.eclipse.ui.texteditor.IDocumentProvider;
038:        import org.osgi.framework.BundleContext;
039:
040:        public class PDEPlugin extends AbstractUIPlugin implements 
041:                IPDEUIConstants {
042:
043:            // Shared instance
044:            private static PDEPlugin fInstance;
045:
046:            // Launches listener
047:            private LaunchListener fLaunchListener;
048:
049:            private BundleContext fBundleContext;
050:
051:            private java.util.Hashtable fCounters;
052:
053:            // Shared colors for all forms
054:            private FormColors fFormColors;
055:            private PDELabelProvider fLabelProvider;
056:            private ILaunchConfigurationListener fLaunchConfigurationListener;
057:
058:            /**
059:             * The shared text file document provider.
060:             * @since 3.2
061:             */
062:            private IDocumentProvider fTextFileDocumentProvider;
063:
064:            private OSGiFrameworkManager fOSGiFrameworkManager;
065:
066:            public PDEPlugin() {
067:                fInstance = this ;
068:            }
069:
070:            public URL getInstallURL() {
071:                return getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
072:            }
073:
074:            public static IWorkbenchPage getActivePage() {
075:                return getDefault().internalGetActivePage();
076:            }
077:
078:            public static Shell getActiveWorkbenchShell() {
079:                IWorkbenchWindow window = getActiveWorkbenchWindow();
080:                if (window != null) {
081:                    return window.getShell();
082:                }
083:                return null;
084:            }
085:
086:            public static IWorkbenchWindow getActiveWorkbenchWindow() {
087:                return getDefault().getWorkbench().getActiveWorkbenchWindow();
088:            }
089:
090:            public static PDEPlugin getDefault() {
091:                return fInstance;
092:            }
093:
094:            public Hashtable getDefaultNameCounters() {
095:                if (fCounters == null)
096:                    fCounters = new Hashtable();
097:                return fCounters;
098:            }
099:
100:            public static String getPluginId() {
101:                return getDefault().getBundle().getSymbolicName();
102:            }
103:
104:            public static IWorkspace getWorkspace() {
105:                return ResourcesPlugin.getWorkspace();
106:            }
107:
108:            private IWorkbenchPage internalGetActivePage() {
109:                return getWorkbench().getActiveWorkbenchWindow()
110:                        .getActivePage();
111:            }
112:
113:            public static void log(IStatus status) {
114:                ResourcesPlugin.getPlugin().getLog().log(status);
115:            }
116:
117:            public static void logErrorMessage(String message) {
118:                log(new Status(IStatus.ERROR, getPluginId(), IStatus.ERROR,
119:                        message, null));
120:            }
121:
122:            public static void logException(Throwable e, final String title,
123:                    String message) {
124:                if (e instanceof  InvocationTargetException) {
125:                    e = ((InvocationTargetException) e).getTargetException();
126:                }
127:                IStatus status = null;
128:                if (e instanceof  CoreException)
129:                    status = ((CoreException) e).getStatus();
130:                else {
131:                    if (message == null)
132:                        message = e.getMessage();
133:                    if (message == null)
134:                        message = e.toString();
135:                    status = new Status(IStatus.ERROR, getPluginId(),
136:                            IStatus.OK, message, e);
137:                }
138:                ResourcesPlugin.getPlugin().getLog().log(status);
139:                Display display = SWTUtil.getStandardDisplay();
140:                final IStatus fstatus = status;
141:                display.asyncExec(new Runnable() {
142:                    public void run() {
143:                        ErrorDialog.openError(null, title, null, fstatus);
144:                    }
145:                });
146:            }
147:
148:            public static void logException(Throwable e) {
149:                logException(e, null, null);
150:            }
151:
152:            public static void log(Throwable e) {
153:                if (e instanceof  InvocationTargetException)
154:                    e = ((InvocationTargetException) e).getTargetException();
155:                IStatus status = null;
156:                if (e instanceof  CoreException)
157:                    status = ((CoreException) e).getStatus();
158:                else
159:                    status = new Status(IStatus.ERROR, getPluginId(),
160:                            IStatus.OK, e.getMessage(), e);
161:                log(status);
162:            }
163:
164:            public FormColors getFormColors(Display display) {
165:                if (fFormColors == null) {
166:                    fFormColors = new FormColors(display);
167:                    fFormColors.markShared();
168:                }
169:                return fFormColors;
170:            }
171:
172:            /* (non-Javadoc)
173:             * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
174:             */
175:            public void start(BundleContext context) throws Exception {
176:                super .start(context);
177:                this .fBundleContext = context;
178:                fLaunchConfigurationListener = new LaunchConfigurationListener();
179:                DebugPlugin.getDefault().getLaunchManager()
180:                        .addLaunchConfigurationListener(
181:                                fLaunchConfigurationListener);
182:            }
183:
184:            public BundleContext getBundleContext() {
185:                return fBundleContext;
186:            }
187:
188:            /* (non-Javadoc)
189:             * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
190:             */
191:            public void stop(BundleContext context) throws Exception {
192:                if (fLaunchListener != null)
193:                    fLaunchListener.shutdown();
194:                if (fFormColors != null) {
195:                    fFormColors.dispose();
196:                    fFormColors = null;
197:                }
198:                if (fLabelProvider != null) {
199:                    fLabelProvider.dispose();
200:                    fLabelProvider = null;
201:                }
202:                if (fLaunchConfigurationListener != null) {
203:                    DebugPlugin.getDefault().getLaunchManager()
204:                            .removeLaunchConfigurationListener(
205:                                    fLaunchConfigurationListener);
206:                    fLaunchConfigurationListener = null;
207:                }
208:                LauncherUtils.shutdown();
209:                super .stop(context);
210:            }
211:
212:            public PDELabelProvider getLabelProvider() {
213:                if (fLabelProvider == null)
214:                    fLabelProvider = new PDELabelProvider();
215:                return fLabelProvider;
216:            }
217:
218:            public LaunchListener getLaunchListener() {
219:                if (fLaunchListener == null)
220:                    fLaunchListener = new LaunchListener();
221:                return fLaunchListener;
222:            }
223:
224:            public OSGiFrameworkManager getOSGiFrameworkManager() {
225:                if (fOSGiFrameworkManager == null)
226:                    fOSGiFrameworkManager = new OSGiFrameworkManager();
227:                return fOSGiFrameworkManager;
228:            }
229:
230:            public static boolean isFullNameModeEnabled() {
231:                IPreferenceStore store = getDefault().getPreferenceStore();
232:                return store.getString(IPreferenceConstants.PROP_SHOW_OBJECTS)
233:                        .equals(IPreferenceConstants.VALUE_USE_NAMES);
234:            }
235:
236:            /**
237:             * Returns the shared text file document provider for this plug-in.
238:             * 
239:             * @return the shared text file document provider
240:             * @since 3.2
241:             */
242:            public synchronized IDocumentProvider getTextFileDocumentProvider() {
243:                if (fTextFileDocumentProvider == null) {
244:                    fTextFileDocumentProvider = new TextFileDocumentProvider() {
245:                        protected FileInfo createFileInfo(Object element)
246:                                throws CoreException {
247:                            FileInfo info = super.createFileInfo(element);
248:                            if (info != null && info.fTextFileBuffer != null)
249:                                info.fModel = info.fTextFileBuffer
250:                                        .getAnnotationModel();
251:                            setUpSynchronization(info);
252:                            return info;
253:                        }
254:                    };
255:                }
256:                return fTextFileDocumentProvider;
257:            }
258:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.